Hi,
I'm trying to get a Connect Datafield working with BLE. All the connections are happening fine, and I can write data. However, when I perform a read the data is returning as null due to a BluetoothLowEnergy.Status of 13. I'm trying to connect to an iOS app acting as a 3rd party peripheral, and can successfully write data to the app. When a read request is performed I've tried sending a byte array containing a single integer value, a 16 byte array where 15 are 0's, and a 20 byte array where 19 are 0's. I'm able to connect to my fake peripheral and successfully read this using 3rd party apps such as blueFruit and LightBlue, so I'm not sure the setup is incorrect on the iOS side but could be wrong. My setup for the DataField is as follows:
// Profile definitions private const _ProfileDef = { :uuid => SERVICE_ID, :characteristics => [ { :uuid => DATA_CHARACTERISTIC_ID, :descriptors => [BluetoothLowEnergy.cccdUuid()] }, { :uuid => WRITE_CHARACTERISTIC_ID } ] };
var service = device.getService(SERVICE_ID); var readCharacteristic = service.getCharacteristic(DATA_CHARACTERISTIC_ID); readCharacteristic.requestRead();
function onCharacteristicRead(char, status, value) { readInProgress = false; System.println("Read value: "+value); System.println("Status: "+status); System.println("Char: "+char); if (value != null && value.size() > 0) { System.println("Read value 0: " + value[0]); } }
Checking the logs I get the following output:
Read value: null Status: 13 Char: Obj: 163
Am I missing something with the expected payload for Connect? I can see through many searches that the maximum payload is 20 bytes, the format should be a byte array etc. The weird thing is the Garmin docs don't even show 13 as a potential status code, everything is just so cryptic, so any help would be much appreciated.