Swift
Register for licence key
To use our SDK a license key is required which is generated after a short registration and your acceptance of the license terms.
--> Register to get the license key
Our beta-sdk is actually completely free for non commercial usage/testing. See details in the license terms.
Please contact us for commercial use. info@evomo.de
How to install
There are currently two different versions of the SDK.
- Basic - smartphone sensor api only
- Movesense - smartphone sensors + Movesense api
- ClassificationOnly - Feed external sensor data and classify it
CocoaPods
The Evomo MoitionAI SDK consist of a precompiled Cocoa Touch framework bundled in a XCFramework.
- Install the CocoaPods-Beta
Important: The CocoaPods version 1.9.1. or newer is required, because of the new XCFramework-Bundle.
# Install the newest cocoapods versionsudo gem install cocoapods
- Add the evomo private specs repo
# Evomo private specs repo sourcesource 'https://bitbucket.org/evomo/evomopodsrelease.git'# Standard cocoapods specs sourcesource 'https://github.com/CocoaPods/Specs.git'
- Add the pod to your podfile with following line:
# Basic is defaultpod "EvomoMotionAI/Basic"# or# Movesensepod "EvomoMotionAI/Movesense"# or# ClassificationOnlypod "EvomoMotionAI/ClassificationOnly"
- Install: Navigate to the project folder and run pod install on the console.
- Update: Upgrade the evomo cocoa pod if needed with the shell command pod update in your Xcode project folder. Then go into the xCode workspace andclean the project build folder with: Product > Clean Build Folder
Apple app store requirements (Movesense)
For a successful approval of your app in the Apple app store, the following description entries must be made:
NSBluetoothAlwaysUsageDescription : "We use Bluetooth to communicate with extern motion sensors to make motion detection possible." (This is a example)NSBluetoothPeripheralUsageDescription : "This app requires Bluetooth to connect to an external motion sensor." (This is a example)
This messages inform the user that this app will use Bluetooth to connect with the external Movesense sensor. Details
API - Overview
Initialize and configure
import EvomoMotionAI// Init the ClassificationControlLayerlet controlLayer = ClassificationControlLayer.shared// Declare licenseID string once (You will receive the license key from Evomo after agreeing to the license conditions.)ClassificationControlLayer.shared.setLicense(licenseID: licenseID)// Define sensor deviceslet devices = [Device(deviceID: "",deviceType: .iPhone,devicePosition: .leftUpperArm,deviceOrientation: .buttonDown)]// Subscribe to the classified movementscontrolLayer.movementHandler = { movement in// Do something with the classified movements in time}// Handle heart rate changesClassificationControlLayer.shared.heartRateSubHandler = { hr in// Do something with the heart rate}// Handle device eventsClassificationControlLayer.shared.deviceEventHandler = { deviceEvent inlet (device, event) = deviceEventswitch event {case let .dataStraming(state):// Will be triggered on data streaming state change (Bool)// dataStraming = true if sensor data received in the last 0.2 secondsprint("\(state ? "data streaming" : "data stream lost")")case let .connected(connected):// Will be triggered if the device successfully connect or disconnectprint("\(connected ? "connected" : "disconnected")")case let .energyPercent(energyPercent):// Implemented for movesense devices (Apple devices dont return a energy level)// The energy level will always emit on after connecting to the device.print("Energy \(Int(energyPercent * 100)) %"case let .softwareVersion(version):// not implemented now// Will return the software version of the device after connectingprint("OS/FW - \(version)")}}
Start and stop
// Start movement classificationClassificationControlLayer.shared.start(devices: devices,isConnected: {print("--- All devices connected ---")}, isStarted:{print("--- All devices started ---")}, isFailed: { error inprint("Start classification failed: \(error)")})wait(10)// Stop movement classification_ = ClassificationControlLayer.shared.stop()