Skip to content

Getting Started

Cirill edited this page Apr 27, 2016 · 34 revisions

Using the Demo Application

The demo application contains an end-to-end representative example of using IBM MobileEdge for connecting to a device (TI Sensor Tag) and the detection of fall events. It is strongly recommended that you try this app and go over its source code before you start developing your app.

To access the source code simply open Workspace.xcworkspace in Xcode, then navigate to the DemoApp target and update the Bundle Identifier as needed.

bundleidentifier-01

Add the framework to the 'Embedded Binaries' section of your application target. Select your application target, under the 'Embedded Binaries' section. Click the '+' button and select the IBMMobileEdge.frameworkiOS file.

Build an app (DemoApp scheme) and test it on a physical iPhone device (iPhone simulator is not supported).

MobileEdge Controller

MobileEdgeController class exposes the main APIs for controlling the SDK operations:

  • Connect/disconnect to a device
  • Read the sensor's data
  • Handle the interpretation of the data

To start using the MobileEdgeController API, simply create an instance of it, for example:

let controller = MobileEdgeController()

API Overview

The MobileEdgeController manages the connection flow to a device for you. The main use of the connection is a single function named connect. This function receives a device-based class (called Connector) that is responsible for the connection to a specific device.

Example: Connecting to different types of devices

controller.connect(SensorTag()) //Start a connection to a Sensor Tag device
//Or
controller.connect(MicrosoftBand()) //Start a connection to a Microsoft Band device
//Or 
controller.connect(Gemsense()) //Start a connection to a Gemsense device

Reading sensor data

To read the sensor's data from your device you should use the sensors variable of the
MobileEdgeController. It will allow you to register notifications about data changes in a similar way for all the devices.

Interpretation of the data

Usually after your successful connection to a device, you want to get notifications when the interpretation of the sensor's data changes (like heart rate increased dramatically, temperature dropped below some point etc..). IBM MobileEdge allows you to create and register custom logic classes (calledInterpretations) that notify you about a variety of recognized data changes.

For more information about the API of the controller see the following sections.