iOS Question iBLE - WriteData Problems

Jo1968

New Member
Licensed User
Longtime User
Hi,
I try to establish a serial communication with a BLE - serial gateway device using a TI CC254x chip (BT4.0). With my B4A program using BLE2 library V1.30 the communication works great. I am using almost the same code in my B4I program with the iBLE library V2.00. The problem is, the WriteData has no effect. The connection and the reading works fine, even the write is executed with no erros, but nothing happens on the gateway output.

I have another different BLE serial gateway. This device works with this B4I program without any problems. But with this device with B4A there is the same problem!!! Everything seems to work but nothing happens on the gateway output with this device with B4A.

I have tried even more BLE gateway devices with the same result. The device works with B4A or B4I, never on both systems.

Does anyone have an idea what I'm doing wrong?

Thanks

---------------------------------------------------------------------------------------------
B4I Log for TI CC254x with Blueradios stack:

Found: BlueRadios0B95F2, 9001BE7E-8915-678C-0706-133D74CCAE06, RSSI = -79, Advertising Data:
Connecting with 9001BE7E-8915-678C-0706-133D74CCAE06
Discovering services
Services discovery completed.
Connected! Available Services:
180F
DA2B84F1-6279-48DE-BDC0-AFBEA0226079
MBMaster Init
ModbusStart raise event MBDataService_Connected
BleManager.ReadData:
A87988B9-694C-479C-900E-95DFA6C00A24=
BF03260C-7205-4C25-AF43-93B1C299D159=
FDD6B4D3-046D-4330-BDEC-1FD0C90CB43B=
99564A02-DC01-4D3C-B04E-3BB1EF0571B2=
0A1934F5-24B8-4F13-9842-37BB167C6AFF=
Enable Notification for 18CDA784-4BD3-4370-85BB-BFED91EC86AF
Notification state changed for characteristic: 18CDA784-4BD3-4370-85BB-BFED91EC86AF
setting mode char. = 1
BleManager.WriteData:
Serv.: DA2B84F1-6279-48DE-BDC0-AFBEA0226079
Char.: BF03260C-7205-4C25-AF43-93B1C299D159
Data: F70300000032D089
 

Jo1968

New Member
Licensed User
Longtime User
Hi,

I'm handling upper and lower case UUID's. I think this function is very special. I'am using the full UUID strings lower case for android and upper case for iOS. Any other UUID format results in an error "characteristic or service not found" . I think the UUID's I use are correct.

The iBLE 2.0 library seems to have no WriteComplete event! There is also no such event in the description of iBLE. I have tried the same function like in B4A but nothing happens. Besides the WriteComplete event, the SetIndication function seems to be also not available in the iBLE 2.0 Library. This function is required by some devices.

Then I tried the the WriteComplete event in B4A with my devices under Android . The WriteComplete fires with status = 0 with a working device and the not working device. I think status=0 indicates a successfull write!?

(Please remind that the not working device under Android is working under iOS and the device working under Android is not working under iOS.)


Android Log of not working device (write has no effect -> ExceptionCode = 10 is a timeout of my communication stack)
(this BLE device works under iOS iBLE2.0 with the same but upper case UUID's)

BleManager.WriteData:
Serv.: 2456e1b9-26e2-8f83-e744-f34f01e9d701
char.: 2456e1b9-26e2-8f83-e744-f34f01e9d703
Data: F70300000032D089
BleManager_WriteComplete: Characteristic: 2456e1b9-26e2-8f83-e744-f34f01e9d703 Status: 0
MBRESP_Response.ExceptionCode = 10


Android Log of a working device (write ok, data available OK)
(this BLE device is not working under iOS iBLE2.0 with the same but upper case UUID's)

BleManager.WriteData:
Serv.: da2b84f1-6279-48de-bdc0-afbea0226079
char.: bf03260c-7205-4c25-af43-93b1c299d159
Data: F70300000032D089
BleManager_WriteComplete: Characteristic: bf03260c-7205-4c25-af43-93b1c299d159 Status: 0
MBRESP_Response.Adding MBDataList: 3.0=0
MBRESP_Response.Adding MBDataList: 3.1=32769
...
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a WriteCompleted event:

SS-2016-07-26_09.15.48.png
 
Upvote 0

Jo1968

New Member
Licensed User
Longtime User
Hi Erel,

Good news! I have a working communication with all my serial gateway devices under iOS:)

Using WriteDataWithResponse under iOS makes the difference. With B4A the WriteData function does fire the WriteComplete event and it seems for me, that there is no difference between WriteDataWithResponse and WriteData.

Under iOS only WriteDataWithResponse fires the event and is working with my CC2541 devices. Even the SetNotify works under iOS on a characteristic with an indicate property, where under Android I must use the SetIndication function to get responses.

Do have some more information about the differences between WriteDataWithResponse and WriteData to find out why WriteData is not working with my CC2541 devices?

Thanks for your help!
 
Upvote 0
Top