Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
|
This project was about creating a mini controller for my home automation system. The Rapid-IoT prototyping kit looked like it would contain many of the things I would need to build it. It contains a number of sensors and switches. It contains a couple of ways to have wireless communications.
The JourneyInitially I wanted to use a bluetooth communication to be able to have the device wirelessly connect to my home automation hub. Thread or ZigBee were not an option because I'm not setup for those.
Attempt #1:
I was going to connect using bluetooth to a raspberry pi . Issue, my pi was being used in another project and I couldn't disassemble it, and my home automation hub was built for raspberry pi 2 which doesn't have bluetooth, not sure how much work it would of been to upgrade to the 3.
Attempt #2
Connect the Rapid-IoT prototype kit using bluetooth though an old cell phone. This seemed like a real viable solution, as the NXP Studio will allow you to create the code for the kit, also create the app for android plus integrate some cloud connectivity. I worked on this solution for quite some time, and while I had some success, I was not able to get it to send data over to my home automation hub. The idea was to use Amazon web services DynamoDB to be the connection point. The data from the sensor would go over to the old cell phone using bluetooth, then the apps that was create would send data to DynamoDB using the cloud functionality that was supported using NXP Studio. This ultimately failed because I couldn't get the android app to connect to AWS DynamoDB.
Attempt #3
Connect the Rapid-IoT prototype kit using a USB cable. Because I burned up so much time trying to get the attempt #2 working, I needed to come up with some way to connect to the home automation hub. As much as I don't like to hard wire it, it was a feasible way to do it. So this was what I went with.
So how can I get data from the kit using USB cable? Apparently there is a Debug building block in NXP Studio. This building block is similar to using the serial monitor in an Arduino. Using this Debug building block to connect to my home automation hub over an USB cable allowed me to simplify my build. Also to save time I started off with one of the example projects. I used the Rapid IoT Weather Station because it would use a couple of sensor ( 5 sensors ) to simulate what I needed.
Rapid-IoT App:The Rapid IoT Weather Station app contains all the code for the prototyping kit, android app and cloud integration. I decided to keep all three parts of the app as I figured it would be nice to be able to use the phone to see the data if I was close enough. As for modification, I had to find a way to take the 5 sensor's readings and format them to send over to Node Red running on my pi2. I create a struct in the header section of the code containing a variable for each sensor.
In the app there are function block for each of the sensors, I had to modify the code in each of the 5 sensor function blocks to update the structure with the new reading
I then added a function building block to the app and wired the 5 sensor's output to it. When any of the sensors updates its reading, it will update the structure variable. The function will then take the values in the structure to create a JSON document. I then wire the output of the function to the Debug building block where the output of the function will be sent to.
With this all done, how can I test it? Well first you have to upload the new code to the prototyping kit. Since your connected to your pc to do this, once your app is finished uploading and the kit has restarted, you can open your favorite terminal app. I use putty. My kit was connected on com3, so I created a session in putty to connect to com3 with a baud rate of 112500.
Once started, it receives data from the kit in the JSON format I created.
Node Red:
Now that I have the kit producing a JSON doc and sending it over serial port. Its time to integrate it to my home automation hub which uses node red. The first issue is my test above was done on a windows pc. and my node red runs on a raspberry pi 2, which is linux.
First thing, get serial data from the kit using command line. To do this, we have to find out what the equivalent serial port is in linux to com3 on windows. On my pi, it was /dev/ttyACM0. The command line test is to run cat < /dev/ttyACM0 , and voila, the JSON data is printed to the screen.
Now, its time to get it working in node red, my node red already has a serial in node, so I didnt have to add it. but the instructions on added nodes can be found using a simple google search. Once your logged in, I created a new flow and added the serial in node, configured it to connect to /dev/ttypACM0 and wired it to a debug node. Deploy it and after a few seconds you should see messages printed in the debug window.
Once we see that these messages are coming in, we can do what ever we want with them, For simplicity I created a simple dashboard to display the real time data from the 5 sensors. Well this failed, I kept getting an error saying the JSON doc was not formatted properly. After a day or two scratching my head, I took the debug message (which is in JSON format ) and put it though a JSON validator. What did it find? the JSON doc was valid. But once I looked at that data, I notice there was a "\u0000" at the start of the doc. I created a function in node red and used javascript to remove it, that still didnt work. Ultimately I needed to take the JSON message and put it though a javascript function JSON.parse(). This function fixed the issue.
Given more time and with the current knowledge I have on this kit now, I think I would make the following changes.
- Make a BlueTooth hub to Ethernet. I got thinking after I finished that I probably have a board sitting around that has both BlueTooth and WiFi. So I think it creating a mini hub would of made it easier to interface everything together.
- In the Rapit IoT app I modified, I had connected each of the sensors functions to my function block. I got thinking that this isn't necessary. I could of just added another interval block to trigger my function to send the data.
This prototyping kit is awesome. I has a lot of functionality built in. I wish I was setup with Thread or ZigBee, I think it would of may the project go a lot smoother. I feel like BlueTooth wouldn't really be practical because of the range.
I have to say the the NXP Studio is pretty good. It really makes it easy to build projects with this kit. I think though it does need a few enhancements like the ability to debug the phone app and cloud integrations. Documentation on the cloud items is definitely needing some updates and samples.
Thanks
Dana.
{
"name": "Rapid IoT Weather Station",
"createVersion": "2017-08-12",
"description": "Demonstrates reading of weather related sensors such as temperature, humidity, pressure, ambient light, and air quality. Demonstrates basic BLE Characteristic writing and reading as well as cloud storage.",
"lastModified": "2018-02-13T00:39:19.386Z",
"created": "2018-02-13T00:39:19.386Z",
"meta": {
"projectTypeName": "NXP Rapid IoT",
"projectTypeId": "NxpRpk"
},
"planes": {
"NXP Rapid IoT": {
"type": "mcuxpresso",
"compilerVersion": "latest",
"variants": [
"NxpRpk"
],
"meta": {},
"elements": [
{
"name": "AirQualityCharacteristic",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(AirQualityCharacteristic, instance),\n\t\t&ATMO_VARIABLE(AirQualityCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(AirQualityCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(AirQualityCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(AirQualityCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(AirQualityCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(AirQualityCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(AirQualityCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(AirQualityCharacteristic, writeDataType), ATMO_PROPERTY(AirQualityCharacteristic, readDataType), ATMO_PROPERTY(AirQualityCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(AirQualityCharacteristic, instance),\n\t\t&ATMO_VARIABLE(AirQualityCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(AirQualityCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(AirQualityCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(AirQualityCharacteristic, instance),\n\t\tATMO_VARIABLE(AirQualityCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(AirQualityCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(AirQualityCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(AirQualityCharacteristic, instance),\n\t\tATMO_VARIABLE(AirQualityCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(AirQualityCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
"bleCharacteristicUuid": "1493dd8e-8c3e-4e75-a4ff-6f0cd50005f9",
"read": true,
"write": true,
"notify": true,
"readDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"writeDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"notifyDataType": "ATMO_DATATYPE_UNSIGNED_INT"
},
"meta": {
"editorX": 282.50006103515625,
"editorY": 473,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": true,
"subscibed": true,
"unsubscribed": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "TemperatureCharacteristic",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(TemperatureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(TemperatureCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(TemperatureCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(TemperatureCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(TemperatureCharacteristic, writeDataType), ATMO_PROPERTY(TemperatureCharacteristic, readDataType), ATMO_PROPERTY(TemperatureCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(TemperatureCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(TemperatureCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(TemperatureCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(TemperatureCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
"bleCharacteristicUuid": "1493dd8e-8c3e-4e76-a4ff-6f0cd50005f9",
"read": true,
"write": true,
"notify": true,
"readDataType": "ATMO_DATATYPE_FLOAT",
"writeDataType": "ATMO_DATATYPE_FLOAT",
"notifyDataType": "ATMO_DATATYPE_FLOAT"
},
"meta": {
"editorX": 607.5000610351562,
"editorY": 6,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": true,
"subscibed": true,
"unsubscribed": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "HumidityCharacteristic",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(HumidityCharacteristic, instance),\n\t\t&ATMO_VARIABLE(HumidityCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(HumidityCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(HumidityCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(HumidityCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(HumidityCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(HumidityCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(HumidityCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(HumidityCharacteristic, writeDataType), ATMO_PROPERTY(HumidityCharacteristic, readDataType), ATMO_PROPERTY(HumidityCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(HumidityCharacteristic, instance),\n\t\t&ATMO_VARIABLE(HumidityCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(HumidityCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(HumidityCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(HumidityCharacteristic, instance),\n\t\tATMO_VARIABLE(HumidityCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(HumidityCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(HumidityCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(HumidityCharacteristic, instance),\n\t\tATMO_VARIABLE(HumidityCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(HumidityCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
"bleCharacteristicUuid": "1493dd8e-8c3e-4e77-a4ff-6f0cd50005f9",
"read": true,
"write": true,
"notify": true,
"readDataType": "ATMO_DATATYPE_FLOAT",
"writeDataType": "ATMO_DATATYPE_FLOAT",
"notifyDataType": "ATMO_DATATYPE_FLOAT"
},
"meta": {
"editorX": 308.50006103515625,
"editorY": 90,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": true,
"subscibed": true,
"unsubscribed": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "PressureCharacteristic",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(PressureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(PressureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(PressureCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(PressureCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(PressureCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(PressureCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(PressureCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(PressureCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(PressureCharacteristic, writeDataType), ATMO_PROPERTY(PressureCharacteristic, readDataType), ATMO_PROPERTY(PressureCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(PressureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(PressureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(PressureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(PressureCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(PressureCharacteristic, instance),\n\t\tATMO_VARIABLE(PressureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(PressureCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(PressureCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(PressureCharacteristic, instance),\n\t\tATMO_VARIABLE(PressureCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(PressureCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
"bleCharacteristicUuid": "1493dd8e-8c3e-4e78-a4ff-6f0cd50005f9",
"read": true,
"write": true,
"notify": true,
"readDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"writeDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"notifyDataType": "ATMO_DATATYPE_UNSIGNED_INT"
},
"meta": {
"editorX": 483.50006103515625,
"editorY": 316,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": true,
"subscibed": true,
"unsubscribed": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "AmbientLightCharacteristic",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(AmbientLightCharacteristic, instance),\n\t\t&ATMO_VARIABLE(AmbientLightCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(AmbientLightCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(AmbientLightCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(AmbientLightCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(AmbientLightCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(AmbientLightCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(AmbientLightCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(AmbientLightCharacteristic, writeDataType), ATMO_PROPERTY(AmbientLightCharacteristic, readDataType), ATMO_PROPERTY(AmbientLightCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(AmbientLightCharacteristic, instance),\n\t\t&ATMO_VARIABLE(AmbientLightCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(AmbientLightCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(AmbientLightCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(AmbientLightCharacteristic, instance),\n\t\tATMO_VARIABLE(AmbientLightCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(AmbientLightCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(AmbientLightCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(AmbientLightCharacteristic, instance),\n\t\tATMO_VARIABLE(AmbientLightCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(AmbientLightCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
"bleCharacteristicUuid": "1493dd8e-8c3e-4e79-a4ff-6f0cd50005f9",
"read": true,
"write": true,
"notify": true,
"readDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"writeDataType": "ATMO_DATATYPE_UNSIGNED_INT",
"notifyDataType": "ATMO_DATATYPE_UNSIGNED_INT"
},
"meta": {
"editorX": 303.50006103515625,
"editorY": 351,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": true,
"subscibed": true,
"unsubscribed": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "SX9500Touch",
"type": "EmbeddedSX9500",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\tATMO_SX9500_Config_t config;\n\tconfig.address = ATMO_PROPERTY(SX9500Touch, i2cAddress);\n\tconfig.i2cDriverInstance = ATMO_PROPERTY(SX9500Touch, i2cInstance);\n\tconfig.gpioDriverInstance = ATMO_PROPERTY(SX9500Touch, gpioInstance);\n\tconfig.interruptEnabled = ATMO_PROPERTY(SX9500Touch, interruptEnabled);\n\tconfig.interruptPin = ATMO_PROPERTY(SX9500Touch, interruptGpio);\n\tATMO_SX9500_Init(&config);\n\tATMO_SX9500_RegisterTouchedAbilityHandle(SX9500_Touched_Up, ATMO_ABILITY(SX9500Touch, pressUp));\n\tATMO_SX9500_RegisterTouchedAbilityHandle(SX9500_Touched_Down, ATMO_ABILITY(SX9500Touch, pressDown));\n\tATMO_SX9500_RegisterTouchedAbilityHandle(SX9500_Touched_Left, ATMO_ABILITY(SX9500Touch, pressLeft));\n\tATMO_SX9500_RegisterTouchedAbilityHandle(SX9500_Touched_Right, ATMO_ABILITY(SX9500Touch, pressRight));\n\treturn ATMO_Status_Success;",
"getTouchData": "",
"pressUp": "SX9500_TouchState_t touchState;\nATMO_GetBinary(in, &touchState, sizeof(touchState));\nATMO_CreateValueBinary(out, &touchState, sizeof(touchState));\nreturn ATMO_Status_Success;",
"pressDown": "SX9500_TouchState_t touchState;\nATMO_GetBinary(in, &touchState, sizeof(touchState));\nATMO_CreateValueBinary(out, &touchState, sizeof(touchState));\nreturn ATMO_Status_Success;",
"pressLeft": "SX9500_TouchState_t touchState;\nATMO_GetBinary(in, &touchState, sizeof(touchState));\nATMO_CreateValueBinary(out, &touchState, sizeof(touchState));\nreturn ATMO_Status_Success;",
"pressRight": "SX9500_TouchState_t touchState;\nATMO_GetBinary(in, &touchState, sizeof(touchState));\nATMO_CreateValueBinary(out, &touchState, sizeof(touchState));\nreturn ATMO_Status_Success;"
},
"variables": {},
"embeddedPropertyConversions": {},
"codeUserChanged": {
"setup": false,
"getTouchData": false,
"pressUp": false,
"pressDown": false,
"pressLeft": false,
"pressRight": false
},
"i2cInstance": "ATMO_DRIVERINSTANCE_I2C_I2C2",
"gpioInstance": "ATMO_DRIVERINSTANCE_GPIO_GPIO1",
"interruptEnabled": true,
"interruptGpio": "PTA9",
"i2cAddress": "0x28"
},
"meta": {
"editorX": 1079.33349609375,
"editorY": 33,
"lastTrigger": "rightPressed"
},
"triggers": {
"triggered": [],
"touchDataRead": [],
"upPressed": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "EmbeddedPageController",
"targetAbility": "navigateUp"
}
],
"downPressed": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "EmbeddedPageController",
"targetAbility": "navigateDown"
}
],
"leftPressed": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "EmbeddedPageController",
"targetAbility": "navigateLeft"
}
],
"rightPressed": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "EmbeddedPageController",
"targetAbility": "navigateRight"
}
]
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"getTouchData": false,
"pressUp": false,
"pressDown": false,
"pressLeft": false,
"pressRight": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "getTouchData",
"triggers": [
"touchDataRead"
]
},
{
"name": "pressUp",
"triggers": [
"upPressed",
"touchDataRead"
]
},
{
"name": "pressDown",
"triggers": [
"downPressed",
"touchDataRead"
]
},
{
"name": "pressLeft",
"triggers": [
"leftPressed",
"touchDataRead"
]
},
{
"name": "pressRight",
"triggers": [
"rightPressed",
"touchDataRead"
]
}
]
},
{
"name": "Temperature_P",
"type": "EmbeddedIconLabelDisplay",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"rpk"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"displayPage": "\n\tATMO_UI_Page_DisplayPageByCoord(ATMO_PROPERTY(Temperature_P, x), ATMO_PROPERTY(Temperature_P, y), false);\n\treturn ATMO_Status_Success;\n\t",
"onDisplayed": "\n\treturn ATMO_Status_Success;\n ",
"topRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"bottomRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"topLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"bottomLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"setup": "\n ATMO_UI_PAGE_Config_t config;\n\tconfig.hidden = ATMO_PROPERTY(Temperature_P, pageHidden);\n\tconfig.textColor = ATMO_PROPERTY(Temperature_P, textColor);\n config.activeButtons = ATMO_UI_Page_GetButtonMask(ATMO_PROPERTY(Temperature_P, topRightButtonEnabled),\n ATMO_PROPERTY(Temperature_P,bottomRightButtonEnabled), ATMO_PROPERTY(Temperature_P, topLeftButtonEnabled), ATMO_PROPERTY(Temperature_P, bottomLeftButtonEnabled));\n\tconfig.x = ATMO_PROPERTY(Temperature_P, x);\n config.x = ATMO_PROPERTY(Temperature_P, x);\n config.y = ATMO_PROPERTY(Temperature_P, y);\n\tstrncpy(config.topLeftButtonLabel, ATMO_PROPERTY(Temperature_P, topLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.topRightButtonLabel, ATMO_PROPERTY(Temperature_P, topRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomLeftButtonLabel, ATMO_PROPERTY(Temperature_P, bottomLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomRightButtonLabel, ATMO_PROPERTY(Temperature_P, bottomRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n config.spanX = ATMO_PROPERTY(Temperature_P, spanX);\n\tconfig.spanY = ATMO_PROPERTY(Temperature_P, spanY);\n config.title = ATMO_PROPERTY(Temperature_P, pageTitle);\n config.titleHidden = ATMO_PROPERTY(Temperature_P, titleHidden);\n\tATMO_UI_SINGLEICONTEXT_Init(&config);\n\tATMO_VARIABLE(Temperature_P, pageHandle) = config.templateInstance;\n ATMO_UI_SINGLEICONTEXT_SetMainText(config.templateInstance, ATMO_PROPERTY(Temperature_P, label));\n ATMO_UI_SINGLEICONTEXT_SetIcon(config.templateInstance, ATMO_PROPERTY(Temperature_P, icon));\n ATMO_UI_SINGLEICONTEXT_RegisterOnDisplayedAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), ATMO_ABILITY(Temperature_P, onDisplayed));\n ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 1, ATMO_ABILITY(Temperature_P, topRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 2, ATMO_ABILITY(Temperature_P, bottomRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 3, ATMO_ABILITY(Temperature_P, topLeftButtonPressed));\n ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 4, ATMO_ABILITY(Temperature_P, bottomLeftButtonPressed));\n ATMO_UI_SINGLEICONTEXT_RegisterOnLeaveAbilityHandle(config.templateInstance, ATMO_ABILITY(Temperature_P, onLeave));\n\treturn ATMO_Status_Success;\n ",
"onLeave": "\n\treturn ATMO_Status_Success;\n\t",
"setLabel": "\n char label[32];\n if(ATMO_GetString(in, label, 32) == ATMO_Status_Success)\n {\n ATMO_UI_SINGLEICONTEXT_SetMainText(ATMO_VARIABLE(Temperature_P,pageHandle), label);\n }\n else\n {\n return ATMO_Status_Fail;\n }\n\n return ATMO_Status_Success;\n "
},
"variables": {
"pageHandle": {
"type": "ATMO_DriverInstanceHandle_t"
}
},
"embeddedPropertyConversions": {
"pageTitle": "string",
"topRightButtonLabel": "string",
"bottomRightButtonLabel": "string",
"topLeftButtonLabel": "string",
"bottomLeftButtonLabel": "string",
"label": "string"
},
"codeUserChanged": {
"onDisplayed": false,
"topRightButtonPressed": false,
"bottomRightButtonPressed": false,
"topLeftButtonPressed": false,
"bottomLeftButtonPressed": false,
"setup": false,
"onLeave": false,
"setLabel": false
},
"textColor": "GUI_BLACK",
"pageTitle": "Temperature",
"titleHidden": false,
"pageHidden": false,
"topRightButtonLabel": "",
"topRightButtonEnabled": false,
"bottomRightButtonLabel": "",
"bottomRightButtonEnabled": false,
"topLeftButtonLabel": "",
"topLeftButtonEnabled": false,
"bottomLeftButtonLabel": "",
"bottomLeftButtonEnabled": false,
"x": 0,
"y": 0,
"spanX": 1,
"spanY": 1,
"icon": "icon_applications_thermostat",
"label": "N/A"
},
"meta": {
"editorX": 663.33349609375,
"editorY": 137,
"lastTrigger": "onDisplayed"
},
"triggers": {
"triggered": [],
"onDisplayed": [],
"topRightButtonPressed": [],
"bottomRightButtonPressed": [],
"topLeftButtonPressed": [],
"bottomLeftButtonPressed": [],
"onLeave": []
},
"interruptAbilities": {
"trigger": false,
"displayPage": false,
"onDisplayed": false,
"topRightButtonPressed": false,
"bottomRightButtonPressed": false,
"topLeftButtonPressed": false,
"bottomLeftButtonPressed": false,
"setup": false,
"onLeave": false,
"setLabel": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "displayPage",
"triggers": []
},
{
"name": "onDisplayed",
"triggers": [
"onDisplayed"
]
},
{
"name": "topRightButtonPressed",
"triggers": [
"topRightButtonPressed"
]
},
{
"name": "bottomRightButtonPressed",
"triggers": [
"bottomRightButtonPressed"
]
},
{
"name": "topLeftButtonPressed",
"triggers": [
"topLeftButtonPressed"
]
},
{
"name": "bottomLeftButtonPressed",
"triggers": [
"bottomLeftButtonPressed"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "onLeave",
"triggers": [
"onLeave"
]
},
{
"name": "setLabel",
"triggers": []
}
]
},
{
"name": "EmbeddedPageController",
"type": "EmbeddedPageController",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"rpk"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_UI_PAGE_CONTROLLER_Config_t config;\n\tconfig.enableUpDownNavLabels = ATMO_PROPERTY(EmbeddedPageController, upDownNavigationLabelsEnabled);\n\tconfig.enableLeftRightNavLabels = ATMO_PROPERTY(EmbeddedPageController, leftRightNavigationLabelsEnabled);\n\tATMO_UI_Page_SetConfiguration(&config);\n return ATMO_Status_Success;\n\t",
"displayRootPage": "\n\t\n\tATMO_UI_Page_DisplayRootPage();\n\treturn ATMO_Status_Success;\n\t",
"navigateUp": "\n\tATMO_UI_Page_ProcessNavButton(ATMO_UI_PAGE_NAV_UP);\n\treturn ATMO_Status_Success;\n\t",
"navigateDown": "\n\tATMO_UI_Page_ProcessNavButton(ATMO_UI_PAGE_NAV_DOWN);\n\treturn ATMO_Status_Success;\n\t",
"navigateLeft": "\n\tATMO_UI_Page_ProcessNavButton(ATMO_UI_PAGE_NAV_LEFT);\n\treturn ATMO_Status_Success;\n\t",
"navigateRight": "\n\tATMO_UI_Page_ProcessNavButton(ATMO_UI_PAGE_NAV_RIGHT);\n\treturn ATMO_Status_Success;\n\t",
"processTopRightButton": "\n\tATMO_UI_Page_ProcessUserButton(1);\n\treturn ATMO_Status_Success;\n\t",
"processBottomRightButton": "\n\tATMO_UI_Page_ProcessUserButton(2);\n\treturn ATMO_Status_Success;\n\t",
"processTopLeftButton": "\n\tATMO_UI_Page_ProcessUserButton(3);\n\treturn ATMO_Status_Success;\n\t",
"processBottomLeftButton": "\n\tATMO_UI_Page_ProcessUserButton(4);\n\treturn ATMO_Status_Success;\n\t"
},
"variables": {},
"embeddedPropertyConversions": {},
"codeUserChanged": {
"setup": false,
"displayRootPage": false,
"navigateUp": false,
"navigateDown": false,
"navigateLeft": false,
"navigateRight": false,
"processTopRightButton": false,
"processBottomRightButton": false,
"processTopLeftButton": false,
"processBottomLeftButton": false
},
"upDownNavigationLabelsEnabled": true,
"leftRightNavigationLabelsEnabled": true
},
"meta": {
"editorX": 1222.33349609375,
"editorY": 29,
"lastTrigger": "triggered"
},
"triggers": {
"triggered": [],
"navigateUp": [],
"navigateDown": [],
"navigateLeft": [],
"navigateRight": [],
"processTopRightButton": [],
"processBottomRightButton": [],
"processTopLeftButton": [],
"processBottomLeftButton": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"displayRootPage": false,
"navigateUp": false,
"navigateDown": false,
"navigateLeft": false,
"navigateRight": false,
"processTopRightButton": false,
"processBottomRightButton": false,
"processTopLeftButton": false,
"processBottomLeftButton": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "displayRootPage",
"triggers": []
},
{
"name": "navigateUp",
"triggers": [
"navigateUp"
]
},
{
"name": "navigateDown",
"triggers": [
"navigateDown"
]
},
{
"name": "navigateLeft",
"triggers": [
"navigateLeft"
]
},
{
"name": "navigateRight",
"triggers": [
"navigateRight"
]
},
{
"name": "processTopRightButton",
"triggers": [
"processTopRightButton"
]
},
{
"name": "processBottomRightButton",
"triggers": [
"processBottomRightButton"
]
},
{
"name": "processTopLeftButton",
"triggers": [
"processTopLeftButton"
]
},
{
"name": "processBottomLeftButton",
"triggers": [
"processBottomLeftButton"
]
}
]
},
{
"name": "Humidity_Pag",
"type": "EmbeddedIconLabelDisplay",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"rpk"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"displayPage": "\n\tATMO_UI_Page_DisplayPageByCoord(ATMO_PROPERTY(Humidity_Pag, x), ATMO_PROPERTY(Humidity_Pag, y), false);\n\treturn ATMO_Status_Success;\n\t",
"onDisplayed": "\n\treturn ATMO_Status_Success;\n ",
"topRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"bottomRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"topLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"bottomLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
"setup": "\n ATMO_UI_PAGE_Config_t config;\n\tconfig.hidden = ATMO_PROPERTY(Humidity_Pag, pageHidden);\n\tconfig.textColor = ATMO_PROPERTY(Humidity_Pag, textColor);\n config.activeButtons = ATMO_UI_Page_GetButtonMask(ATMO_PROPERTY(Humidity_Pag, topRightButtonEnabled),\n ATMO_PROPERTY(Humidity_Pag,bottomRightButtonEnabled), ATMO_PROPERTY(Humidity_Pag, topLeftButtonEnabled), ATMO_PROPERTY(Humidity_Pag, bottomLeftButtonEnabled));\n\tconfig.x = ATMO_PROPERTY(Humidity_Pag, x);\n config.x = ATMO_PROPERTY(Humidity_Pag, x);\n config.y = ATMO_PROPERTY(Humidity_Pag, y);\n\tstrncpy(config.topLeftButtonLabel, ATMO_PROPERTY(Humidity_Pag, topLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.topRightButtonLabel, ATMO_PROPERTY(Humidity_Pag, topRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomLeftButtonLabel, ATMO_PROPERTY(Humidity_Pag, bottomLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomRightButtonLabel, ATMO_PROPERTY(Humidity_Pag, bottomRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n config.spanX = ATMO_PROPERTY(Humidity_Pag, spanX);\n\tconfig.spanY = ATMO_PROPERTY(Humidity_Pag, spanY);\n config.title = ATMO_PROPERTY(Humidity_Pag, pageTitle);\n config.titleHidden = ATMO_PROPERTY(Humidity_Pag, titleHidden);\n\tATMO_UI_SINGLEICONTEXT_Init(&config);\n\tATMO_VARIABLE(Humidity_Pag, pageHandle) = config.templateInstance;\n ATMO_UI_SINGLEICONTEXT_SetMainText(config.templateInstance, ATMO_PROPERTY(Humidity_Pag, label));\n ATMO_UI_SINGLEICONTEXT_SetIcon(config.templateInstance, ATMO_PROPERTY(Humidity_Pag, icon));\n ATMO_UI_SINGLEICONTEXT_RegisterOnDisplayedAbilityHandle(ATMO_VARIABLE(Humidity_Pag,pageHandle), ATMO_ABILITY(Humidity_Pag, onDisplayed));\n ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Humidity_Pag,pageHandle), 1, ATMO_ABILITY(Humidity_Pag, topRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Humidity_Pag,pageHandle), 2, ATMO_ABILITY(Humidity_Pag, bottomRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Humidity_Pag,pageHandle), 3, ATMO_ABILITY(Humidity_Pag, topLeftButtonPressed));\n ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Humidity_Pag,pageHandle), 4, ATMO_ABILITY(Humidity_Pag, bottomLeftButtonPressed));\n ATMO_UI_SINGLEICONTEXT_RegisterOnLeaveAbilityHandle(config.templateInstance, ATMO_ABILITY(Humidity_Pag, onLeave));\n\treturn ATMO_Status_Success;\n ",
"onLeave": "\n\treturn ATMO_Status_Success;\n\t",
"setLabel": "\n char label[32];\n if(ATMO_GetString(in, label, 32) == ATMO_Status_Success)\n {\n ATMO_UI_SINGLEICONTEXT_SetMainText(ATMO_VARIABLE(Humidity_Pag,pageHandle), label);\n }\n else\n {\n return ATMO_Status_Fail;\n }\n\n return ATMO_Status_Success;\n "
},
"variables": {
"pageHandle": {
"type": "ATMO_DriverInstanceHandle_t"
}
},
"embeddedPropertyConversions": {
"pageTitle": "string",
"topRightButtonLabel": "string",
"bottomRightButtonLabel": "string",
"topLeftButtonLabel": "string",
"bottomLeftButtonLabel": "string",
"label": "string"
},
"codeUserChanged": {
"onDisplayed": false,
...
This file has been truncated, please download it to see its full contents.
struct Sensors
{
float temperature;
float humidity;
int pressure;
int light;
int airquality;
} stSensorValues ;
ATMO_Status_t data2struct_trigger(ATMO_Value_t *in, ATMO_Value_t *out) {
char str[200];
sprintf(str, "{\"temperature\":\"%.1f\",\"humidity\":\"%.1f\",\"pressure\":\"%d\",\"light\":\"%d\",\"airquality\":\"%d\"}", stSensorValues.temperature,stSensorValues.humidity,stSensorValues.pressure,stSensorValues.light,stSensorValues.airquality);
ATMO_CreateValueString(out, str);
return ATMO_Status_Success;
}
[
{
"id": "ea5c8b1c.b1e198",
"type": "serial in",
"z": "df6cd362.35517",
"name": "Rapid_IoT_Data",
"serial": "77f4d891.d1e2d8",
"x": 120,
"y": 60,
"wires": [
[
"803114ee.202878",
"7a5bc090.653cd"
]
]
},
{
"id": "ffe63b12.2f2b78",
"type": "ui_gauge",
"z": "df6cd362.35517",
"name": "Temperature",
"group": "8c6578fb.c89ee8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Temperature",
"label": "c",
"format": "{{temperature}}",
"min": 0,
"max": "50",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 750,
"y": 60,
"wires": []
},
{
"id": "803114ee.202878",
"type": "debug",
"z": "df6cd362.35517",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 510,
"y": 60,
"wires": []
},
{
"id": "7a5bc090.653cd",
"type": "function",
"z": "df6cd362.35517",
"name": "remove bad json",
"func": "var payload = msg.payload;\n\npayload = payload.replace('\\u0000', '');\n\nif (payload.length > 5){\n msg.payload = payload;\n msg = JSON.parse(msg.payload);\n return [msg,null];\n}else\n return [null,msg];",
"outputs": 2,
"noerr": 0,
"x": 390,
"y": 200,
"wires": [
[
"ffe63b12.2f2b78",
"10186ade.9631e5",
"53fe0f23.db676",
"85a1ba97.dcdab8",
"f1d22356.e31b8"
],
[
"71c1aab2.7eeb54"
]
]
},
{
"id": "71c1aab2.7eeb54",
"type": "debug",
"z": "df6cd362.35517",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 490,
"y": 300,
"wires": []
},
{
"id": "10186ade.9631e5",
"type": "ui_gauge",
"z": "df6cd362.35517",
"name": "pressure",
"group": "f870ec7e.ead88",
"order": 3,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Pressure",
"label": "hPa",
"format": "{{pressure}}",
"min": 0,
"max": "2000",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 740,
"y": 180,
"wires": []
},
{
"id": "53fe0f23.db676",
"type": "ui_gauge",
"z": "df6cd362.35517",
"name": "air_quality",
"group": "f870ec7e.ead88",
"order": 4,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Air Quality",
"label": "ppb",
"format": "{{airquality}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 750,
"y": 240,
"wires": []
},
{
"id": "85a1ba97.dcdab8",
"type": "ui_gauge",
"z": "df6cd362.35517",
"name": "humidity",
"group": "8c6578fb.c89ee8",
"order": 6,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Humidity",
"label": "rh",
"format": "{{humidity}}",
"min": 0,
"max": "100",
"colors": [
"#ff0000",
"#ff8040",
"#00ff00"
],
"seg1": "",
"seg2": "",
"x": 740,
"y": 120,
"wires": []
},
{
"id": "f1d22356.e31b8",
"type": "ui_gauge",
"z": "df6cd362.35517",
"name": "light",
"group": "9f3b7827.fc0188",
"order": 6,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Light",
"label": "units",
"format": "{{light}}",
"min": 0,
"max": 10,
"colors": [
"#000000",
"#808080",
"#ffffff"
],
"seg1": "",
"seg2": "",
"x": 730,
"y": 300,
"wires": []
},
{
"id": "77f4d891.d1e2d8",
"type": "serial-port",
"z": "",
"serialport": "/dev/ttyACM1",
"serialbaud": "115200",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": true,
"responsetimeout": "10000"
},
{
"id": "8c6578fb.c89ee8",
"type": "ui_group",
"z": "",
"name": "Group 1",
"tab": "18ca30b6.f31c0f",
"order": 1,
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "f870ec7e.ead88",
"type": "ui_group",
"z": "",
"name": "Group 2",
"tab": "18ca30b6.f31c0f",
"order": 2,
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "9f3b7827.fc0188",
"type": "ui_group",
"z": "",
"name": "Group 3",
"tab": "18ca30b6.f31c0f",
"order": 3,
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "18ca30b6.f31c0f",
"type": "ui_tab",
"z": "",
"name": "Rapid IOT Real Time Data",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
Comments