Manos Chorianopoulos

TelematicsMainViewController fixes

......@@ -123,9 +123,9 @@ import CoreMotion
}
DispatchQueue.main.async {
if (mIsTripStarted == true) {
if (self.mIsTripStarted == true) {
// Stop trip
stopTrip()
self.stopTrip()
} else {
// Start trip
......@@ -139,16 +139,16 @@ import CoreMotion
// sampleTimeTextField.isEnabled = false
// Start location and sensor updates
requestLocationUpdates()
self.requestLocationUpdates()
// registerSensor()
mIsTripStarted = true
self.mIsTripStarted = true
// orientationCountLabel.text = "0"
// touchCountLabel.text = "0"
tripButton.setTitle("Stop Trip", for: .normal)
mStartTimestamp = String(Int(Date().timeIntervalSince1970 * 1000)) // time in milliseconds since January 1, 1970
initializeOrientation()
startTimer()
self.tripButton.setTitle("Stop Trip", for: .normal)
self.mStartTimestamp = String(Int(Date().timeIntervalSince1970 * 1000)) // time in milliseconds since January 1, 1970
self.initializeOrientation()
self.startTimer()
}
}
}
......@@ -303,24 +303,24 @@ import CoreMotion
private func requestLocationUpdates() {
DispatchQueue.global().async {
if CLLocationManager.locationServicesEnabled() {
locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
// locationManager.requestLocation()
if (!locationServicesIsEnabled()) {
onLocationServicesIsDisabled();
if (!self.locationServicesIsEnabled()) {
self.onLocationServicesIsDisabled();
}
else if (authorizationStatusIsDenied(status: CLLocationManager.authorizationStatus())) {
onAuthorizationStatusIsDenied();
else if (self.authorizationStatusIsDenied(status: CLLocationManager.authorizationStatus())) {
self.onAuthorizationStatusIsDenied();
}
else if (authorizationStatusNeedRequest(status: CLLocationManager.authorizationStatus())) {
onAuthorizationStatusNeedRequest();
else if (self.authorizationStatusNeedRequest(status: CLLocationManager.authorizationStatus())) {
self.onAuthorizationStatusNeedRequest();
}
else if (authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())) {
onAuthorizationStatusIsGranted();
else if (self.authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())) {
self.onAuthorizationStatusIsGranted();
}
} else {
self.onLocationServicesIsDisabled();
}
} else {
self.onLocationServicesIsDisabled();
}
}
......