[][src]Module app::app_network

[]

Transmit sensor data to a CoAP server like thethings.io. The CoAP payload will be encoded as JSON. The sensor data will be transmitted over NB-IoT. Note that we are using a patched version of apps/my_sensor_app/src/vsscanf.c that fixes response parsing bugs. The patched file must be present in that location. This is the Rust version of https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/rust-nbiot/apps/my_sensor_app/OLDsrc/network.c

Functions

aggregate_sensor_data
send_sensor_data

Compose a CoAP JSON message with the Sensor Key (field name), Value and Geolocation (optional) 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 shall be encoded in JSON like this: