![](/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:
- 15:182b95c25cf2
- Parent:
- 14:25e836a5a7bf
- Child:
- 16:ab2d9341997a
--- a/main.cpp Thu Aug 11 02:38:44 2016 +0000 +++ b/main.cpp Thu Aug 11 03:43:51 2016 +0000 @@ -423,11 +423,7 @@ BasicPacket packet(payload); // verify crc - if (!packet.verify()) - { - printf("Oops, catch a invalid packet\r\n"); - return; - } + // skip this for now // process the packet based on different feature id BasicPacket::L3Fid_t fid = (BasicPacket::L3Fid_t) packet.getFid(); @@ -447,6 +443,27 @@ { DataBlockPacket dataBlockPacket(payload); + uint8_t sensor_type = dataBlockPacket.getSourceType(); + switch(sensor_type) + { + case 0x0: // temperature sensor + { + uint8_t sensor_data = dataBlockPacket.getData(0); + + char serial_resp[32]; + memset(serial_resp, 0x0, sizeof(serial_resp)); + sprintf(serial_resp, "<f00300%02x%02xff>", src_addr, sensor_data); + printf("expected: %s\r\n", serial_resp); + break; + } + case 0x1: // temperature sensor + { + break; + } + default: + break; + } + // do something break; } @@ -467,6 +484,7 @@ // register callback functions for SIP SIP.registerCommand(0x00, toggleChecksum); + SIP.registerCommand(0x02, NULL); // send message is not available for the base station SIP.registerCommand(0x02, configureRadio); SIP.registerCommand(0x03, radioUpdateSettings); SIP.registerCommand(0x04, querySensors);