Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2023-09-15 14:45:56 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8ef7b359433624a1d11e548d4e4629b351a82389
8ef7b359
1 parent
2c5e72ea
telematics registerSensor fix
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
12 deletions
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/TelematicsViewController.swift
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
8ef7b35
...
...
@@ -7,7 +7,7 @@
<key>
Pods-SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
8ef7b35
...
...
@@ -7,7 +7,7 @@
<key>
SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
8ef7b35
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/TelematicsViewController.swift
View file @
8ef7b35
...
...
@@ -14,6 +14,8 @@ import CoreMotion
// MARK: Constants and Properties
private
var
mIsTripStarted
=
false
private
var
hasLocationPermissions
=
false
private
var
isFirstLoad
=
true
private
var
mAccelerationTimestamps
=
[[
String
:
Any
]]()
private
var
locationManager
:
CLLocationManager
!
private
var
motionManager
:
CMMotionManager
!
...
...
@@ -68,6 +70,8 @@ import CoreMotion
accelerationLimitTextField
.
delegate
=
self
sampleTimeTextField
.
delegate
=
self
hasLocationPermissions
=
authorizationStatusIsGranted
(
status
:
CLLocationManager
.
authorizationStatus
())
orientationCountLabel
.
text
=
"0"
touchCountLabel
.
text
=
"0"
recordsSavedLabel
.
text
=
"0"
...
...
@@ -99,7 +103,7 @@ import CoreMotion
public
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
super
.
viewWillDisappear
(
animated
)
if
(
self
.
mIsTripStarted
==
true
)
{
self
.
stopTrip
()
}
...
...
@@ -234,7 +238,7 @@ import CoreMotion
}
private
func
processAccelerometerData
(
_
accelerationData
:
CMAccelerometerData
)
{
// print("=== accelerationData: ",accelerationData)
//
print("=== accelerationData: ",accelerationData)
// sensorDataLabel.text = "\(accelerationData.acceleration.x), \(accelerationData.acceleration.y), \(accelerationData.acceleration.z)"
...
...
@@ -260,7 +264,7 @@ import CoreMotion
// TODO: CHECK mayby this is correct
// accelerationLabel.text = String(format: "%.1f m/s^2", acceleration)
// print("=== acceleration: ",acceleration)
//
print("=== acceleration: ",acceleration)
// If acceleration is below the stop threshold, assume we are in a stop
// if acceleration < STOP_THRESHOLD {
...
...
@@ -270,7 +274,7 @@ import CoreMotion
velocity
=
acceleration
*
time
// }
// print("=== velocity: ",velocity)
//
print("=== velocity: ",velocity)
// Convert velocity to km/h
mAcceleration
=
velocity
// Convert to km/h
...
...
@@ -400,7 +404,7 @@ import CoreMotion
self
?
.
mAccelerationTimestamps
.
append
(
jsonObject
)
// print("=== self?.mAccelerationTimestamps: ", self?.mAccelerationTimestamps)
//
print("=== self?.mAccelerationTimestamps: ", self?.mAccelerationTimestamps)
}
}
timerTel
!.
resume
()
...
...
@@ -449,9 +453,14 @@ import CoreMotion
}
func
onAuthorizationStatusIsGranted
()
{
// print("=== onAuthorizationStatusIsGranted === ")
//
print("=== onAuthorizationStatusIsGranted === ")
locationManager
.
startUpdatingLocation
();
registerSensor
()
// registerSensor()
if
(
!
isFirstLoad
||
(
isFirstLoad
&&
!
hasLocationPermissions
))
{
registerSensor
()
}
hasLocationPermissions
=
true
isFirstLoad
=
false
}
func
onAuthorizationStatusIsDenied
()
{
...
...
@@ -459,7 +468,7 @@ import CoreMotion
}
public
func
locationManager
(
_
manager
:
CLLocationManager
,
didChangeAuthorization
status
:
CLAuthorizationStatus
)
{
// print("=== locationManager didChangeAuthorization: ",status)
//
print("=== locationManager didChangeAuthorization: ",status)
if
(
authorizationStatusIsDenied
(
status
:
status
))
{
onAuthorizationStatusIsDenied
();
...
...
@@ -471,8 +480,8 @@ import CoreMotion
public
func
locationManager
(
_
manager
:
CLLocationManager
,
didUpdateLocations
locations
:
[
CLLocation
])
{
if
let
location
=
locations
.
last
{
// print("=== locationManager didUpdateLocations latitude: ",location.coordinate.latitude)
// print("=== locationManager didUpdateLocations longitude: ",location.coordinate.longitude)
//
print("=== locationManager didUpdateLocations latitude: ",location.coordinate.latitude)
//
print("=== locationManager didUpdateLocations longitude: ",location.coordinate.longitude)
if
mLatitude
!=
0
&&
mLongitude
!=
0
{
mSpeed
=
calculateSpeed
(
lat1
:
mLatitude
,
lon1
:
mLongitude
,
lat2
:
location
.
coordinate
.
latitude
,
lon2
:
location
.
coordinate
.
longitude
,
timeDifferenceInSeconds
:
LOCATION_UPDATE_INTERVAL
/
1000
)
...
...
Please
register
or
login
to post a comment