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 {
      xbee.getResponse().getZBRxResponse(rxResponse);
      // 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 $$$).

Bluetooth

So with the tree, I started thinking it might be good to have a deployment that doesn’t depend on XBee.  It’s a pain to have the XBee radio attached to the phone and it would be nice to hand over control to someone else’s phone.  I’ve known about the Bluetooth to XBee converters and actually ordered a couple last year but didn’t have a reason to check it out until now.  Unfortunately I have an old undocumented version I got from EBay.  A little testing and serial magic and I have it configured and communicating with the laptop.  Next is some testing with the XBee APIs to see if this is indeed drop in replaceable.  Also, need to see if we can use the iPhone app on non-jailbroken phones using the BLE4 standard.  But that will require a better part.

IMG_3010