Bluetooth Dropin

Getting the XBee API communication to work through Bluetooth was pretty straightforward.  Main issue was that the Bluetooth is straight through communication which means that the receiver sees the TX Request message instead of the expected RX Response from the network.  In the code where we check for RX_RESPONSE I added a check for TX_REQUEST.  Paylods are unchanged and easily extracted from the object.  Added that check on both sides and success!

void processRXResponse() {
   uint8_t* data;
   uint8_t dataLength;
   int apiId = xbee.getResponse().getApiId();
   if (apiId == ZB_TX_REQUEST) {
      // Probably a transparent interface, e.g. Bluetooth
      int TxRequestFrameHeaderLength = 13;
      data = xbee.getResponse().getFrameData() + TxRequestFrameHeaderLength;
      dataLength = xbee.getResponse().getFrameDataLength() - TxRequestFrameHeaderLength;
   } else {
      // TODO: Check data length for potential errors
      data = rxResponse.getData();
      dataLength = rxResponse.getDataLength();

This was working on the laptop no problem.  However when I went to use the iPhone…  So it looks like the HC-05 Bluetooth chip is not compatible with the iDevices.  Boooo.  Need to upgrade (e.g $$$).

Leave a Reply

Your email address will not be published. Required fields are marked *