Hi all,
So Trying to create a iOS application to pick up telemetry packets that are flagged as in motion and then update a DB. I’m also just learning swift and don’t have a real good grasp on the langue just yet. The SDK ReadMe that heyPitor updated on GitHub, explains how to pull the temp from the packet. I’m confused as to
- how to enable the Telemetry packets first off?
- how to setup the rest of the code to pick up on the motion flag?
I’m using my AppDelegate because the app is doing nothing but seeing the motion flag then updating firebase so I don’t need anything up on screen
class AppDelegate: UIResponder, UIApplicationDelegate, ESTDeviceManagerDelegate {
override init() {
FIRApp.configure()
FIRDatabase.database().persistenceEnabled = true
}
var window: UIWindow?
lazy var database = FIRDatabase.database()
let deviceManager = ESTDeviceManager()
// Copied code from ReadMe except I don't need the print() statement
let movementNotification = ESTTelemetryNotificationMotion { (motion) in motion.motionState}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//again same as ReadMe code
deviceManager.register(forTelemetryNotification: movementNotification)
//updates the Firebase DB
database.reference().childByAutoId().setValue(movementNotification)
return true
}
I don’t think I have the code setup correctly at all, if anyone could help me with this that be greatly appreciated. I was able to do this exact idea with the Nearables but I don’t understand the code for the Telemetry Packets.
Thanks,
DaveM