SafeDetect
/
LoRaWAN_XDOT
basic loraWAN sending, some settings done-- no keys or any of that though
Diff: main.cpp
- Revision:
- 60:6b488cb72780
- Parent:
- 56:39847849d219
diff -r 23cc35ed9008 -r 6b488cb72780 main.cpp --- a/main.cpp Thu Nov 28 09:01:59 2019 +0000 +++ b/main.cpp Tue Dec 03 09:21:15 2019 +0000 @@ -30,7 +30,7 @@ // Max payload size can be LORAMAC_PHY_MAXPAYLOAD. // This example only communicates with much shorter messages (<30 bytes). // If longer messages are used, these buffers must be changed accordingly. -uint8_t tx_buffer[30]; +uint8_t tx_buffer[50]; uint8_t rx_buffer[30]; /* @@ -145,11 +145,14 @@ return 0; } -/** +/* * Sends a message to the Network Server */ static void send_message() { + /* 30 byte message + can be 50 bytes, max + */ uint16_t packet_len; int16_t retcode; int32_t sensor_value; @@ -163,11 +166,16 @@ printf("\r\n No sensor found \r\n"); return; } + + uint16_t* sensor_readings = (uint16_t* ) malloc(25*sizeof(uint16_t)); + int i = 0; + for(i; i < 25; i++) { + sensor_readings[i] = 1234; + } + // tx_buffer = (uint8_t* )sensor_readings; +// packet_len = 50; - packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %d", - sensor_value); - - retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len, + retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, (uint8_t* )sensor_readings, 50, MSG_UNCONFIRMED_FLAG); if (retcode < 0) {