[−][src]Function app::app_network::send_sensor_data
pub fn send_sensor_data(val: &SensorValue) -> MynewtResult<()>
Compose a CoAP JSON message with the Sensor Key (field name) and Value in val
and send to the CoAP server. The message will be enqueued for transmission by the CoAP / OIC
Background Task so this function will return without waiting for the message to be transmitted.
Return Ok()
if successful, SYS_EAGAIN
if network is not ready yet.
For the CoAP server hosted at thethings.io, the CoAP payload should be encoded in JSON like this:
{"values":[
{"key":"device", "value":"0102030405060708090a0b0c0d0e0f10"},
{"key":"t", "value":1715}
]}