Titanium Modules FAQ

Bluetooth Modules

These questions have been compiled over time supporting the Logical Labs Bluetooth Modules for Titanium developers.

Q: Can I determine distance between devices using the RSSI value?
A: While distance can be estimated from RSSI, the value itself is a measurement of the power as signal strength. There are other factors that affect how distance can be calculated from this value such as antenna placement, your test environment, obstacles affecting line of sight, etc. You should research this really to understand the relationship between RSSI and distance and how significant it is that your estimation of distance may be inaccurate. There are some web sites and papers out there that discuss it.

Q: (BLE) How do I scan for any peripheral service vs. a known service UUID?
A: Most of the demos in the example app included with the modules are setup to scan for a pre-defined service UUID, so scanning is started like this BluetoothLE.startScan({UUIDs: [CUSTOM_SERVICE_UUID]}) however if you omit the argument for the UUIDs all together, like this BluetoothLE.startScan(), it will scan for and connect to any peripheral and discovers its services and characteristics.

Q: Does the Bluetooth Module support XYZ profile?
A: All of the Logical Labs Bluetooth Modules are written to expose all of the necessary components that a Titanium developer needs to build and use a profile in their app. The modules themselves don’t attempt to create or directly support specific profiles.

Q: How do I write a HEX value vs an ASCII value for a characteristic?
A: HEX and ASCII are just two different representations of the same value. 0x32 is equivalent to the ASCII character “2” which is equivalent to a decimal byte value of 50. You can write 0x32 or 50 into the buffer for a characteristic like so:

var buffer = Ti.createBuffer({length: 1}); // a Ti.Buffer is an array of bytes
buffer[0] = 50; // decimal byte, equivalent to ASCII “2” and the same as HEX 0x32
buffer[0] = 0x32; // HEX, equivalent to ASCII “2” and the same as decimal byte 50
connectedPeripheral.writeValueForCharacteristic({
  data: buffer,
  characteristic: writeChar, // defined elsewhere
  type: BluetoothLE.CHARACTERISTIC_TYPE_WRITE_WITH_RESPONSE
});

Q: Does iOS support RFCOMM / SPP / BT Classic or not? I’ve heard that it does not.
A: RFCOMM or SPP (serial port profile) refers to a streaming connection that emulates a physical serial connection over BT Classic. The answer can be “YES” but with a big “IF” attached to it. The device you are connecting to over BT Classic must be an MFi certified device. An MFi certified device is one that has been approved by Apple’s MFi program. So if you are the manufacturer of the device that is on the other end and you enroll in the MFi program and get your device certified or if you are using an already MFi certified device, then iOS does support it and Logical Labs’ External Accessories Module would support communicating with it from Titanium.