Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: config/ConfigurationSynchronization.cpp
- Revision:
- 69:237c01eb36c2
- Parent:
- 68:0dc778a16d0d
- Child:
- 76:b07effe83fb8
--- a/config/ConfigurationSynchronization.cpp Sat Dec 06 19:47:23 2014 +0000 +++ b/config/ConfigurationSynchronization.cpp Sat Dec 13 16:07:07 2014 +0000 @@ -22,8 +22,8 @@ return false; // Update Configuration - // Usage: 130,<DEVICE/ID>,<CONFIG/STRING> - if (!_tpl.add("10,130,PUT,/inventory/managedObjects/%%,application/vnd.com.nsn.cumulocity.managedObject+json,application/vnd.com.nsn.cumulocity.managedObject+json,%%,UNSIGNED STRING,\"{\"\"c8y_Configuration\"\":{\"\"config\"\":\"\"%%\"\"}}\"\r\n")) + // Usage: 130,<DEVICE/ID>,<CONFIG/STRING>,<RESPONSIBILITY> + if (!_tpl.add("10,130,PUT,/inventory/managedObjects/%%,application/vnd.com.nsn.cumulocity.managedObject+json,application/vnd.com.nsn.cumulocity.managedObject+json,%%,UNSIGNED STRING NUMBER,\"{\"\"c8y_Configuration\"\":{\"\"config\"\":\"\"%%\"\"},\"\"c8y_RequiredAvailability\"\":{ \"\"responseInterval\"\":%%}}\"\r\n")) return false; _init = true; @@ -32,7 +32,7 @@ bool ConfigurationSynchronization::integrate() { - if (!loadConfiguration()) { + if ((!loadConfiguration()) || (!_configurationProperties.validateProperties())) { if ((!_configurationProperties.resetConfiguration()) || (!updateDeviceObject()) || (!saveConfiguration())) return false; } else { @@ -60,6 +60,11 @@ if (!_deviceConfiguration.read(cfg)) return false; + if (!_configurationProperties.validateProperties()) { + loadConfiguration(); + return false; + } + _changed = true; return true; } @@ -77,7 +82,8 @@ IntegerValue msgId(130); IntegerValue deviceId(_deviceId); CharValue config(buf); - if ((!record.add(msgId)) || (!record.add(deviceId)) || (!record.add(config))) + IntegerValue responsibility(_configurationProperties.readInterval()); + if ((!record.add(msgId)) || (!record.add(deviceId)) || (!record.add(config)) || (!record.add(responsibility))) return false; if (_client.send(record) != SMARTREST_SUCCESS) {