This project provides the source code and example code that XGPS150/XGPS160/DashPro exchanges data with iPhone device via Bluetooth connection.
import XGPSSDKSwift
var xgpsManager: XGPSManager = XGPSManager()
/* this protocol is declared within SDK
public protocol XGPSDelegate: AnyObject {
func didUpdate(connected: Bool) -> Void
func didUpdateGpsInfo(modelNumber:String, isCharging:Bool, betteryLevel:Float) -> Void
func didUpdateSettings() -> Void
func didUpdatePositionData(fixType: Int, latitude:Double, longitude: Double, altitude: Float,
speedAndCourseIsValid:Bool, speed: Float, heading: Float,
utcTime: String, waas: Bool, dgps: Bool) -> Void
func didUpdateSatelliteData(systemId: GnssSystemId, usedArray : NSArray,
systemInfo : NSDictionary,
averageSNR : Int) -> Void
}
*/
class ViewController: UIViewController, XGPSDelegate {
func didUpdate(connected: Bool) {
// Called when connection information changes.
}
func didUpdateGpsInfo(modelNumber: String, isCharging: Bool, betteryLevel: Float) {
// Called when the status of a device's battery, etc. changes.
}
func didUpdateSettings() {
// Called when reflection to the device is complete after setting up the setting command.
}
func didUpdatePositionData(fixType: Int, latitude: Double, longitude: Double, altitude: Float, speedAndCourseIsValid: Bool, speed: Float, heading: Float, utcTime: String, waas: Bool, dgps: Bool) {
// GPS location information is received.
}
func didUpdateSatelliteData(systemId: XGPSSDKSwift.GnssSystemId, usedArray: NSArray, systemInfo: NSDictionary, averageSNR: Int) {
// Satellite information is received.
}
}
func logListData() -> NSMutableArray
func logBulkDic() -> NSMutableArray
func loggingEnabled() -> Bool
func logOverWriteEnabled() -> Bool
func logInterval() -> Int32
func commandGetSettings()
func commandLogAccessMode()
func commandStreamEnable()
func commandStreamDisable()
func commandGetLogList(delegate: TripLogDelegate)
func commandGetFreeSpace()
func commandLogDelete(logData: LogData)
func commandGetLogBulk(logData: LogData, delegate: TripLogDelegate)
func commandSetAlwaysRecord(isOn: Bool)
func commandSetOverwriteOld(isOn: Bool)
This section describes the internal structure of the data in 'didUpdateSatelliteData' that sends satellite information values.
This is GNSS system id.
enum GnssSystemId: Int {
case gps = 1
case glonass = 2
case galileo = 3
case beidou = 4
case qzss = 5
case navic = 6
case unknown = 7
}
This value is the 'String' array of satellites ID that used in solution.
ex) usedArray : "01","08","10","27"
systemInfo
├── NSDictionary
│ ├── key : Signal ID
│ │
│ └── value : NSDictionary
│ ├── key : Satellite ID : NSNumber
│ │
│ └── value : NSArray
│ ├── azimuth : NSNumber
│ ├── elevation : NSNumber
│ ├── SNR : NSNumber
│ └── inUse : NSNumber
└── NSDictionary
├── key : Signal ID
│
└── value : NSDictionary
├── key : Satellite ID : NSNumber
│
└── value : NSArray
├── azimuth : NSNumber
├── elevation : NSNumber
├── SNR : NSNumber
└── inUse : NSNumber
This is only for XGPS160
let xgpsManager = AppDelegate.getDelegate().xGpsManager
if xgpsManager.isConnected() {
xgpsManager.commandGetLogList(delegate: self)
}
add logListComplete() delegate function
xgpsManager.commandLogDelete(logData: logData)
see the 'TripsViewController.swift
xgpsManager.commandLoggingUpdateRate(UInt8(settingValue))
see the SettingsViewController.swift