Decoding String sent by Bluz to a Gateway Photon


#1

Hello,

I have a Bluz DK that is sending a String to the Gateway using the following code:

 tMessage = (String(unitNum) + " , veh: " +      String(num));
 byte bMessage[tMessage.length()];
 tMessage.getBytes(bMessage, tMessage.length()+1);   //make sure length +1
 BLE.sendData(bMessage, tMessage.length()+1);

I know the String is being sent.

How do I read the string on the Gateway Photon side. I would appreciate any example code as my knowledge of C is minimal.

Thanks.


#2

You can see the code for both the bluz and gateway sides in the local communication tutorial in the docs: http://docs.bluz.io/tutorials/local_communication/

The main function you want to pay attention to is handle_custom_data, as this is the callback that is fired when the data is received by the gateway


#3

Thank you @eric. I found it.