B4i: manager.WriteDataWithResponse(CurService,CurCharWrite,ATCmdOut.GetBytes("UTF8"))
B4A: Starter.manager.WriteData(Starter.CurService,Starter.CurCharWrite,ATCmdOut.GetBytes("UTF8"))
Dim jo As JavaObject = BleManager1
Dim ser As JavaObject = jo.RunMethod("getService", Array(ServiceId))
Dim chrc As JavaObject = jo.RunMethod("getChar", Array (ser, CharacteristicId))
chrc.RunMethod("setWriteType", Array (2)) '2 = with response, 1 = no response
'... now call the regular Write method.
and where the core.jar are located, yes.By "internal libraries folder" I assume you mean the Libraries folder under Basic4android where the current BLE2.jar was located.
The library calls the only write API available. It is different than in iOS.Can you add a debug message when you execute the WriteData that says which type it is actually using?
Then just a log message that the WriteType has been changed by this new "SetWriteType".
log(chrc.RunMethod("getWriteType", Null))
Hard to say. The first step is to try to check it with a different Android device.What else could be stopping the response from one adapter and not the other? Both adapters work fine in B4i.
Now I can solve my problem by using BLE2 instead of BluetoothAdmin to scan BLE device. And use BleExtEx to send/read data to/from BLE device (HM-10). Data that I mentioned here is the same serial data that we send using Serial library with Bluetooth 2 device (HC-05).Good evening Erel,
In the previous version of BleExtEx (version: 1.10), we can read/write data (serial data from/to BLE device) by using
'Read:
Sub Manager_CharacteristicChanged (Characteristic As BleCharacteristic)
Dim StrIn As String
StrIn = Characteristic.GetStringValue(0)
Log(" RxD <" & StrIn & ">")
End Sub
'Wite:
cwrite.SetStringValue(StrOutBT)
Manager.WriteCharacteristic(cwrite)
With this new BLE2 (version: 1.10), could you please tell us how to do it?
Note: The reason I move from BleExtEx to BLE2 is that BleExtEx could not allow Nexus Android Version 6.0.1 to find BLE device.
And it seem that all Android Version 6.0.1 could not find BLE device with EleExtEx library.
Looking forward to hearing from you soon...