![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Wireless interface using LoRa technology
Dependencies: AlohaTransceiver RingBuffer SX1276Lib SerialInterfaceProtocol mbed L3PDU
Diff: main.cpp
- Revision:
- 11:9590f3c9d915
- Parent:
- 9:e13e02aa4a2f
- Child:
- 12:2ead6bfd9f2a
--- a/main.cpp Fri Aug 05 03:08:19 2016 +0000 +++ b/main.cpp Fri Aug 05 11:18:49 2016 +0000 @@ -382,6 +382,17 @@ return 0; } +int userQuery(uint8_t *payload, uint8_t payload_length, uint8_t *response, uint8_t *response_length) +{ + // send query data to client + // make some dummy response + response[0] = 1; // temperature sensor + sprintf((char *)response + 1, "22.4"); + *response_length = 5; + + return 0; +} + void AlohaDataEcho(AlohaFrame *frame) { // get rssi and snr @@ -438,6 +449,7 @@ SIP.registerCommand(0x01, sendMessage); SIP.registerCommand(0x02, configureRadio); SIP.registerCommand(0x03, radioUpdateSettings); + SIP.registerCommand(0x04, userQuery); // register callback functions for aloha transceiver aloha.registerType(AlohaFrame::Aloha_Data, AlohaDataEcho);