Add a widget to scan and connect to your BLE devices from a Mendix application.
Widget built for TI CC2650 SensorTag.
Requires PhoneGap plugin cordova-plugin-ble-central in your hybrid mobile Mendix application configuration.
Follow instructions at https://docs.mendix.com/howto/mobile/ to deploy your hybrid mobile application.
Thanks to Don Coleman (https://github.com/don) for the code and tutorials available at https://github.com/don/phonegap-ble-workshop
Watch the demo at https://youtu.be/eLvtzRvMy40
- Install the widget in your project
- Include the ScanBLE widget in a context wrapper (i.e. Data Grid, List view) on a page. Include the ConnectBLE widget in the context for the 'Scanned Device Types' entity.
- Create entities to store device types, scanned devices and device data.
-
Entity: AllowedDeviceTypes
- Attributes: deviceType , String
- Purpose: Provide a comma separated list of device type ids to limit the devices to be scanned.
- Attributes: deviceType , String
-
Entity: ScannedDevices
- Attributes:
- deviceID, String
- deviceName, String
- deviceType, String
- deviceMfgData, String , unlimited
- Attributes:
-
Entity: DeviceData
- Attributes:
- deviceID, String
- deviceType, String
- characteristicUUID, String
- characteristicName, String
- dataValue, String
- dataUnits, String
- Attributes:
-
Configure the widget's settings: ScanBLE
- On the Input tab, Configure:
- 'BLE Device Types' : set to the deviceType field of the enclosing AllowedDeviceTypes
- 'Scan Time (seconds)': set to an integer value
- On the Output tab, Configure:
- 'Object to Create' : set to 'ScannedDevices' entity
- Map entity fields
- On the Button tab, Configure:
- 'Button Label'
- 'Button Class' : optional
ConnectBLE
-
On the Input tab, Configure:
- 'BLE Device ID' : set to the deviceID field of the enclosing ScannedDevices entity
-
On the Device Data tab, Configure:
- 'Object to Create' : set to 'DeviceData' entity
- Map entity fields
- On the Input tab, Configure:
Only scans TI CC2650 sensors.
See AppStoreWidgetBoilerplate for an example