Changed passing way of the logger
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 22s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 22s
This commit is contained in:
68
vehicle.go
68
vehicle.go
@ -203,7 +203,7 @@ func (v *Vehicle) Lock() {
|
||||
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ func (v *Vehicle) Unlock() {
|
||||
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
// ERROR
|
||||
// {"httpCode":500,"errorCode":"error","errorMessage":"org.springframework.web.HttpMediaTypeNotSupportedException - Content type 'application/x-www-form-urlencoded' not supported"}
|
||||
@ -277,7 +277,7 @@ func (v *Vehicle) EngineStart() {
|
||||
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ func (v *Vehicle) EngineStop() {
|
||||
pollingURL := MOBILE_API_VERSION + apiURLs["API_REMOTE_SVC_STATUS"]
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("Active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("Active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ func (v *Vehicle) LightsStart() {
|
||||
}
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ func (v *Vehicle) LightsStop() {
|
||||
}
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ func (v *Vehicle) HornStart() {
|
||||
}
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ func (v *Vehicle) HornStop() {
|
||||
}
|
||||
v.client.execute(reqURL, POST, params, pollingURL, true)
|
||||
} else {
|
||||
v.client.log.Error("Active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("Active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,9 +526,9 @@ func (v *Vehicle) GetClimateQuickPresets() {
|
||||
|
||||
respParsed, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetClimateQuickPresets", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetClimateQuickPresets", "error", err.Error())
|
||||
}
|
||||
v.client.log.Debug("CLIMATE SETTINGS OUTPUT", "body", respParsed)
|
||||
v.client.logger.Debug("CLIMATE SETTINGS OUTPUT", "body", respParsed)
|
||||
|
||||
// ONLY FOR THAT REQUEST BECAUSE OF API SENDS BACK ESCAPING DATA IN DATA FIELD
|
||||
data, ok := respParsed.Path("data").Data().(string)
|
||||
@ -543,9 +543,9 @@ func (v *Vehicle) GetClimateQuickPresets() {
|
||||
// TODO: Work with errorCode
|
||||
panic(data)
|
||||
}
|
||||
v.client.log.Debug("PRESETS", "output", data)
|
||||
v.client.logger.Debug("PRESETS", "output", data)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,12 +558,12 @@ func (v *Vehicle) GetClimatePresets() {
|
||||
|
||||
respParsed, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||
}
|
||||
|
||||
// ONLY FOR THAT REQUEST BECAUSE OF API SENDS BACK ESCAPED DATA IN DATA FIELD
|
||||
for _, child := range respParsed.S("data").Children() {
|
||||
// log.Debugf("key: %v, value: %v\n", key, child.Data().(string))
|
||||
// logger.Debugf("key: %v, value: %v\n", key, child.Data().(string))
|
||||
var climateProfile ClimateProfile
|
||||
json.Unmarshal([]byte(child.Data().(string)), &climateProfile)
|
||||
|
||||
@ -576,7 +576,7 @@ func (v *Vehicle) GetClimatePresets() {
|
||||
v.Updated = time.Now()
|
||||
}
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,13 +589,13 @@ func (v *Vehicle) GetClimateUserPresets() {
|
||||
|
||||
respParsed, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetClimateUserPresets", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetClimateUserPresets", "error", err.Error())
|
||||
}
|
||||
v.client.log.Debug("CLIMATE USER SETTINGS OUTPUT", "body", respParsed)
|
||||
v.client.logger.Debug("CLIMATE USER SETTINGS OUTPUT", "body", respParsed)
|
||||
|
||||
// ONLY FOR THAT REQUEST BECAUSE OF API SENDS BACK ESCAPED DATA IN DATA FIELD
|
||||
for _, child := range respParsed.S("data").Children() {
|
||||
// log.Debugf("key: %v, value: %v\n", key, child.Data().(string))
|
||||
// logger.Debugf("key: %v, value: %v\n", key, child.Data().(string))
|
||||
var climateProfile ClimateProfile
|
||||
json.Unmarshal([]byte(child.Data().(string)), &climateProfile)
|
||||
|
||||
@ -620,9 +620,9 @@ func (v *Vehicle) GetClimateUserPresets() {
|
||||
// // TODO: Work with errorCode
|
||||
// panic(data)
|
||||
// }
|
||||
// log.Debugf("PRESETS: %+v\n", data)
|
||||
// logger.Debugf("PRESETS: %+v\n", data)
|
||||
} else {
|
||||
v.client.log.Error("active STARLINK Security Plus subscription required")
|
||||
v.client.logger.Error("active STARLINK Security Plus subscription required")
|
||||
}
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
||||
if v.client.isResponseSuccessfull(resp) {
|
||||
respParsed, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetVehicleStatus", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetVehicleStatus", "error", err.Error())
|
||||
}
|
||||
|
||||
vSta := VehicleStatus{}
|
||||
@ -667,7 +667,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
||||
}
|
||||
if strings.HasPrefix(key, "door") && strings.HasSuffix(key, "Position") {
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
}
|
||||
@ -684,7 +684,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
||||
}
|
||||
if strings.HasPrefix(key, "door") && strings.HasSuffix(key, "Status") {
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
}
|
||||
@ -701,7 +701,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
||||
}
|
||||
if strings.HasPrefix(key, "window") && strings.HasSuffix(key, "Status") {
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
}
|
||||
@ -717,7 +717,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
||||
v.Windows = append(v.Windows, &window)
|
||||
}
|
||||
if strings.HasPrefix(key, "tire") && !strings.HasSuffix(key, "Psi") {
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data())
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data())
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
@ -785,7 +785,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
if v.client.isResponseSuccessfull(resp) {
|
||||
respParsed, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetVehicleCondition", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetVehicleCondition", "error", err.Error())
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`[A-Z][^A-Z]*`)
|
||||
@ -798,7 +798,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
}
|
||||
if strings.HasPrefix(key, "door") && strings.HasSuffix(key, "Position") {
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
}
|
||||
@ -814,7 +814,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
}
|
||||
if strings.HasPrefix(key, "window") && strings.HasSuffix(key, "Status") {
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data(), "number", len(submatchall))
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
}
|
||||
@ -828,7 +828,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
v.Windows = append(v.Windows, &window)
|
||||
}
|
||||
if strings.HasPrefix(key, "tire") && !strings.HasSuffix(key, "Unit") {
|
||||
v.client.log.Debug("VEHICLE COND", "key", key, "data", child.Data())
|
||||
v.client.logger.Debug("VEHICLE COND", "key", key, "data", child.Data())
|
||||
submatchall := re.FindAllString(key, -1)
|
||||
for _, element := range submatchall {
|
||||
fmt.Println(element)
|
||||
@ -846,7 +846,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
// continue
|
||||
// }
|
||||
// if strings.HasPrefix(elem.Key, "door") {
|
||||
// log.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// logger.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// }
|
||||
// }
|
||||
// for _, elem := range vCon.VehicleStatus {
|
||||
@ -854,7 +854,7 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
// continue
|
||||
// }
|
||||
// if strings.HasPrefix(elem.Key, "window") {
|
||||
// log.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// logger.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// }
|
||||
// }
|
||||
// for _, elem := range vCon.VehicleStatus {
|
||||
@ -862,10 +862,10 @@ func (v *Vehicle) GetVehicleCondition() {
|
||||
// continue
|
||||
// }
|
||||
// if strings.HasPrefix(elem.Key, "tire") {
|
||||
// log.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// logger.Debugf("VEHICLE COND: %v > %v\n", elem.Key, elem.Value)
|
||||
// }
|
||||
// }
|
||||
// log.Debugf("VEHICLE COND REQUEST: %+v", vCon)
|
||||
// logger.Debugf("VEHICLE COND REQUEST: %+v", vCon)
|
||||
}
|
||||
|
||||
// VEHICLE_STATE_TYPE >> IGNITION_OFF
|
||||
@ -895,7 +895,7 @@ func (v *Vehicle) GetVehicleHealth() {
|
||||
if v.client.isResponseSuccessfull(resp) {
|
||||
_, err := gabs.ParseJSON(resp)
|
||||
if err != nil {
|
||||
v.client.log.Error("error which parsing json", "request", "GetVehicleHealth", "error", err.Error())
|
||||
v.client.logger.Error("error which parsing json", "request", "GetVehicleHealth", "error", err.Error())
|
||||
}
|
||||
// TODO:
|
||||
}
|
||||
|
Reference in New Issue
Block a user