BLE ADV Gateway, converts advertisement to proper JSON serial output
Dependencies: BLE_API mbed mbedtls nRF51822
Diff: main.cpp
- Revision:
- 14:0486f885b1b1
- Parent:
- 13:e136665cf993
--- a/main.cpp Sun Aug 27 05:48:02 2017 +0000 +++ b/main.cpp Mon Nov 05 04:44:01 2018 +0000 @@ -43,7 +43,7 @@ mbedtls_aes_context aes; unsigned char iv[16] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x1, 0x2}; //16-byte aes key - +//Serial device(p9, p11); //nRF51822 uart: TX=p9. RX=p11 Serial device(p9, p11); //nRF51822 uart: TX=p9. RX=p11 DigitalIn pinHandShake(p0); //handshake uart to prevent output before bridge MCU is ready. Flow control. @@ -415,7 +415,7 @@ // 4. Xmit Counter 0-255, incremented by Beacon with each new unique ADV event. // "tmr":xxxx, //--------------------------------------- - device.printf("\"xmit_cnt\":%d,", Received_Xmit_Cnt); + device.printf("\"xcnt\":%d,", Received_Xmit_Cnt); //--------------------------------------- // 5. rest of sensor payload as json @@ -430,7 +430,7 @@ device.printf("}"); device.printf("\r\n"); //gateway looking for cariage return to indicate end - wait_ms(60); //needed to give gateway time to assert flow control handshake pin + wait_ms(140); //needed to give gateway time to assert flow control handshake pin while (pinHandShake.read() == 1) //normally pulled down, so loop when gateway processing; { //uart flow control