M megaB4x Member Licensed User Longtime User Oct 19, 2016 #1 Hi all, I am having an issue here. I am using a BLE module and I can read and write characteristic fine using BLE explorer and LightBlue apps. However, when I try to write some data to same characteristic there is no error message but it does not write to the characteristic. The code snippet below is pretty simple but any ideas what else I can look for? BTW I do read the values before I write as explained in the documentation. Thanks all! Code: Copy Dim ByteC As ByteConverter Dim data() As Byte data=ByteC.HexToBytes("2222") manager.WriteData("AB230001-4A12-1234-ABCD-123456789012", "AB230003-4A12-1234-ABCD-123456789012", data)
Hi all, I am having an issue here. I am using a BLE module and I can read and write characteristic fine using BLE explorer and LightBlue apps. However, when I try to write some data to same characteristic there is no error message but it does not write to the characteristic. The code snippet below is pretty simple but any ideas what else I can look for? BTW I do read the values before I write as explained in the documentation. Thanks all! Code: Copy Dim ByteC As ByteConverter Dim data() As Byte data=ByteC.HexToBytes("2222") manager.WriteData("AB230001-4A12-1234-ABCD-123456789012", "AB230003-4A12-1234-ABCD-123456789012", data)
Erel B4X founder Staff member Licensed User Longtime User Oct 19, 2016 #2 What is the output of: Code: Copy Log("Service: " & Service) Log(Characteristics) Put it in the DataAvailable event sub. Upvote 0
What is the output of: Code: Copy Log("Service: " & Service) Log(Characteristics) Put it in the DataAvailable event sub.
M megaB4x Member Licensed User Longtime User Oct 21, 2016 #3 Hi Erel, Code: Copy Sub btnWrite_Click Dim ByteC As ByteConverter Dim data() As Byte data=ByteC.HexToBytes("11") manager.WriteData("11111111-1111-1111-1111-111111111111", "33333333-3333-3333-3333-333333333333", data) End Sub Above is the current code and below is the output of DataAvailable: Service: 180A NSMapTable { [9] Model Number String -> <B4IArray: 0x17eb4b70> [12] System ID -> <B4IArray: 0x17e77560> [13] Manufacturer Name String -> <B4IArray: 0x17e9cce0> } Service: 11111111-1111-1111-1111-111111111111 NSMapTable { [12] 22222222-2222-2222-2222-222222222222 -> <B4IArray: 0x17e72ec0> [15] 33333333-3333-3333-3333-333333333333 -> <B4IArray: 0x17eb1dc0> } Thanks! Upvote 0
Hi Erel, Code: Copy Sub btnWrite_Click Dim ByteC As ByteConverter Dim data() As Byte data=ByteC.HexToBytes("11") manager.WriteData("11111111-1111-1111-1111-111111111111", "33333333-3333-3333-3333-333333333333", data) End Sub Above is the current code and below is the output of DataAvailable: Service: 180A NSMapTable { [9] Model Number String -> <B4IArray: 0x17eb4b70> [12] System ID -> <B4IArray: 0x17e77560> [13] Manufacturer Name String -> <B4IArray: 0x17e9cce0> } Service: 11111111-1111-1111-1111-111111111111 NSMapTable { [12] 22222222-2222-2222-2222-222222222222 -> <B4IArray: 0x17e72ec0> [15] 33333333-3333-3333-3333-333333333333 -> <B4IArray: 0x17eb1dc0> } Thanks!
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2016 #4 Try to use WriteDataWithResponse instead of WriteData. Upvote 0
M megaB4x Member Licensed User Longtime User Oct 25, 2016 #5 That worked like a charm! Thanks very much Erel! Upvote 0