What do you need to send data with an iOS device to the IoT Services?
- You have enabled the SAP HANA Cloud Platform, IoT Services (see: Try out the SAP HANA Cloud Platform Internet of Things (IoT) services).
- You own an Apple iPhone or Apple iPad (> iOS 9.x) to send data.
Optional:
- You own a Texas Instruments Sensor Tag Bluetooth Smart (CC2650).
- You own a ublox Sensor (OLP 425).
How to Send Data with the IoT Sensor App by itelligence AG?
Create a device model via IoT Services Cockpit
- Open the Internet of Things services Cockpit.
- Choose the Device Types tile.
- Create a new Device Type by clicking ( + ).
- Enter a name, e.g.: "iOSDevice", "TI CC2650" or "OLP 425" (depending on your available hardware).
- Copy the displayed Device Type ID and Device Registration Token to your Clipboard.
- Go back to the Internet of Things services Cockpit.
- Choose the Message Types tile.
- Create a new Message Type by clicking ( + ).
- Enter a name, e.g. "iOS Data".
- Select the Device Type that was previously created (here: "iOS Device").
- Change the Data Type for timestamp to long.
- Enter the following fields depending on the device you are targeting (all fields are optional):
- iOS Device: timestamp (long) / accX (double) / accY (double) / accZ (double) / altitude (double) / locLat (double) / locLong (double) / pressure (double)
- TI Sensor Tag: timestamp (long) / accX (double) / accY (double) / accZ (double) / rotX (double) / rotY (double) / pressure (double)
- ublox OLP: timestamp (long) / sensorTemp (double) / sensorGyroX (double) / sensorGyroY (double) / sensorGyroZ (double)
- Copy the displayed Message Type IDto your Clipboard.
You can now start sending data with a client using the created Device Type and Message Type.
Download and configure IoT Sensor App
- Install on your mobile device: IoTSensor on the App Store (iOS only)
- Configure the app with by calling the following custom URL on your device:
- iot-create://&/accountName&/[Account ID]&/name&/[Connection Name]&/dataCenter&/[Data Center]&/deviceName&/[Device Name]&/deviceTypeID&/[Device Type ID]&/deviceReg&/[Device Registration Token]&/messageTypeID&/[Message Type ID]
- Parameters:
- [Account ID] => your account ID, e.g., "p1234567trail"
- [Data Center] => your account data center, e.g., "hanatrial" / "hana" / "hana.us1" / "hana.us2" / "hana.ap1"
- [Connection Name] => any name for a connection, e.g., "myConnection"
- [Device Name] => any name for the device, e.g., "iPhone Michael" / "Sensor Tag 1"
- [Device Type ID] => the Device Type ID you copied previously to your clipboard
- [Device Registration Token] => the Device Registration Token you copied previously to your clipboard
- [Message Type ID] => the Message Type ID you copied previously to your clipboard
- Sample: iot-create://&/accountName&/p000000trial&/name&/myTrialConnection&/dataCenter&/hanatrial&/deviceName&/iPhoneMichael&/deviceTypeID&/f807b43597e44cf1fc4b&/deviceReg&/ce89c5cfe7fdb25b381eff51136b97&/messageTypeID&/9208dd4b8cc54bc1fb1b
- Once the custom URL is launched the app starts and account will be configured.
- Press on Registration.
- The "Device" gets registered and is ready to send Data. Press OK.
- The "Connection" is now coloured red.
Select Device and Send Data
- Press on Sensor.
- Select a device (vor BLE device connection press refresh).
- The device is not connect. Go back by pressing Select Source.
- Press Back. (Sensor and Connection are coloured red.)
- Press Record Button.
- Data is sent according to sending interval (values that are not defined in the message type are ignored.)
Where do I see my Incoming Data?
IoT Message Management Cockpit
You can see your incoming data immediately via the MMS Cockpit.
- Open the Internet of Things services Cockpit.
- Choose the Send and view messages, or perform other actions tile. (The MMS Cockpit opens.)
- Choose the Display stored messages tile. (All tables of incoming data are listed.)
- Select the table that is named after the Message Type ID that you created previously ("T_IOT_<MESSAGE TYPE ID>").
- Press refresh to update the table. The latest values are on top.
OData Consumption
The Message Management Service exposes the tables via OData as well (Documentation: SAP HANA Cloud Platform Internet of Things (IoT) Services).
- Open any browser.
- Copy the targeted table name to your clipboard. (see previous step)
- Enter the URL as follows:
- https://iotmms[Account ID].[Data Center].ondemand.com/com.sap.iotservices.mms/v1/api/http/app.svc/[Table Name]?$format=json
- Example: https://iotmmsp00000trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/app.svc/T_IOT_0E23399B70FC2633A03A?$format=json
- Remove the parameter "?$format=json" in case you want to consume the OData API in application, e.g., HTML5 Applications.
You can now start to consume the data in other applications.
How to write your own iOS App?
- The SAP IoT Starter Kit includes an iOS Sample how to write your own client: iot-starterkit/src/hardware/iOS at master · SAP/iot-starterkit · GitHub
Additional Material?
- Try out the SAP HANA Cloud Platform Internet of Things (IoT) services
- SAP IoT Starter Kit (code snippets how to use the SAP HANA Cloud Platform, IoT Services)
- SAP HANA Cloud Platform Internet of Things (IoT) Services (official documentation)
Questions and Feedback?
We highly appreciate your questions or feedback. Please add your comments below.