diff --git a/vehicle.go b/vehicle.go index 991da5d..0bbd169 100644 --- a/vehicle.go +++ b/vehicle.go @@ -226,6 +226,7 @@ func (v *Vehicle) Lock() (chan string, error) { "forceKeyInCar": "false"} reqUrl := MOBILE_API_VERSION + urlToGen(apiURLs["API_LOCK"], v.getAPIGen()) pollingUrl := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"] + ch := make(chan string) go func() { defer close(ch) @@ -250,6 +251,7 @@ func (v *Vehicle) Unlock() (chan string, error) { "unlockDoorType": "ALL_DOORS_CMD"} // FRONT_LEFT_DOOR_CMD | ALL_DOORS_CMD reqUrl := MOBILE_API_VERSION + urlToGen(apiURLs["API_UNLOCK"], v.getAPIGen()) pollingUrl := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"] + ch := make(chan string) go func() { defer close(ch) @@ -287,6 +289,7 @@ func (v *Vehicle) EngineStart() (chan string, error) { } reqUrl := MOBILE_API_VERSION + apiURLs["API_G2_REMOTE_ENGINE_START"] pollingUrl := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"] + ch := make(chan string) go func() { defer close(ch) @@ -337,11 +340,13 @@ func (v *Vehicle) LightsStart() (chan string, error) { if v.getAPIGen() == FEATURE_G1_TELEMATICS { pollingUrl = MOBILE_API_VERSION + apiURLs["API_G1_HORN_LIGHTS_STATUS"] } + ch := make(chan string) go func() { defer close(ch) v.executeServiceRequest(params, reqUrl, pollingUrl, ch, 1) }() + return ch, nil } @@ -362,6 +367,7 @@ func (v *Vehicle) LightsStop() (chan string, error) { if v.getAPIGen() == FEATURE_G1_TELEMATICS { pollingUrl = MOBILE_API_VERSION + apiURLs["API_G1_HORN_LIGHTS_STATUS"] } + ch := make(chan string) go func() { defer close(ch) @@ -388,6 +394,7 @@ func (v *Vehicle) HornStart() (chan string, error) { if v.getAPIGen() == FEATURE_G1_TELEMATICS { pollingUrl = MOBILE_API_VERSION + apiURLs["API_G1_HORN_LIGHTS_STATUS"] } + ch := make(chan string) go func() { defer close(ch) @@ -414,6 +421,7 @@ func (v *Vehicle) HornStop() (chan string, error) { if v.getAPIGen() == FEATURE_G1_TELEMATICS { pollingUrl = MOBILE_API_VERSION + apiURLs["API_G1_HORN_LIGHTS_STATUS"] } + ch := make(chan string) go func() { defer close(ch) @@ -442,9 +450,8 @@ func (v *Vehicle) ChargeOn() (chan string, error) { v.executeServiceRequest(params, reqUrl, pollingUrl, ch, 1) }() return ch, nil - } else { - return nil, errors.New("not an EV car") } + return nil, errors.New("not an EV car") } // GetLocation