iOS Question iBLE error ReadData Service

Moroz

Member
Licensed User
Longtime User
Good afternoon, there was a problem with the work of the library iBLE
When reading the characteristics, an error occurs.

Application_start
Application_Active
Found: DexcomW7, D2B289C7-6B84-990A-1D79-6553F0BBDB6D, RSSI = -56, (read only map) {
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = DexcomW7;
kCBAdvDataManufacturerData = <d0004603>;
kCBAdvDataServiceUUIDs = (
FEBC
);
}
end
Discovering services
Services discovery completed.
<B4IList: (
"F8083532-849E-531C-C594-30F1F86A4EA5",
180A
)>
Disconnected: <B4IExceptionWrapper: Error Domain = CBErrorDomain Code = 7 "The specified device has disconnected from us." UserInfo = {NSLocalizedDescription = The specified device has disconnected from us.}>

Tell me where to look for the cause?
Used your example BLE Example
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
B4X:
Dim no As NativeObject = BleManager1
no.SetField("delegate", Null)
Dim per As NativeObject = BleManager1.GetPeripheralObject
Dim service As NativeObject = BleManager1.GetServiceObject(ServiceUUIDHere)
per.RunMethod("discoverCharacteristics:forService", Array(Null, service)
Do While True
 Sleep(100)
 Dim chars As List = service.GetField("characteristics")
 Log(chars)
Loop

What does it print?
 
Upvote 0

Moroz

Member
Licensed User
Longtime User
B4X:
Sub BleSrv_Connected(Services As List)
    Dim no As NativeObject = BleSrv
    no.SetField("delegate", Null)
    Dim per As NativeObject = BleSrv.GetPeripheralObject
    Dim service As NativeObject = BleSrv.GetServiceObject("F8083532-849E-531C-C594-30F1F86A4EA5")
    per.RunMethod("discoverCharacteristics:forService", Array(Null, service))
    Do While True
        Sleep(100)
        Dim chars As List = service.GetField("characteristics")
        Log(chars)
    Loop
End Sub
This call you code

Answer:
B4X:
Application_Start
Application_Active
Discovering services
Services discovery completed.
Error occurred on line: 96 (Main)
Method not found: discoverCharacteristics:forService, target: <CBPeripheral: 0x28301d360, identifier = D2B289C7-6B84-990A-1D79-6553F0BBDB6D, name = DexcomW7, state = connected>
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  MyDex                +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 388
  MyDex                -[B4INativeObject RunMethod::] + 216
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  MyDex                +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  MyDex                -[B4IShell runVoidMethod] + 232
  MyDex                -[B4IShell raiseEventImpl:method:args::] + 1792
 MyDex                -[B4IShellBI raiseEvent:event:params:] + 1372
 MyDex                +[B4IObjectWrapper raiseEvent:::] + 300
 MyDex                -[BlePeripheralDel peripheral:didDiscoverServices:] + 708
 CoreBluetooth        <redacted> + 932
 CoreBluetooth        <redacted> + 352
 CoreBluetooth        <redacted> + 204
 CoreBluetooth        <redacted> + 60
 libdispatch.dylib    <redacted> + 24
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 592
 libdispatch.dylib    <redacted> + 480
 libdispatch.dylib    <redacted> + 784
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 1924
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 104
 UIKitCore            UIApplicationMain + 212
 MyDex                main + 124
 libdyld.dylib        <redacted> + 4
)
 
Upvote 0

Moroz

Member
Licensed User
Longtime User
Yeaaaaaaaaaaaaa!!!!
B4X:
Application_Start
Application_Active
Discovering services
Services discovery completed.
<B4IList: (
    "<CBCharacteristic: 0x28121c1e0, UUID = F8083533-849E-531C-C594-30F1F86A4EA5, properties = 0x12, value = (null), notifying = NO>",
    "<CBCharacteristic: 0x28121c720, UUID = F8083534-849E-531C-C594-30F1F86A4EA5, properties = 0x28, value = (null), notifying = NO>",
    "<CBCharacteristic: 0x28121c840, UUID = F8083535-849E-531C-C594-30F1F86A4EA5, properties = 0x2A, value = (null), notifying = NO>",
    "<CBCharacteristic: 0x28121c8a0, UUID = F8083536-849E-531C-C594-30F1F86A4EA5, properties = 0x1A, value = (null), notifying = NO>",
    "<CBCharacteristic: 0x28121c9c0, UUID = F8083537-849E-531C-C594-30F1F86A4EA5, properties = 0x2, value = (null), notifying = NO>"
)>
Error occurred on line: 98 (Main)
Object was not initialized (NSObject)
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  MyDex                -[B4IObjectWrapper object] + 152
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  MyDex                +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
  MyDex                -[B4IShell runMethod:] + 448
  MyDex                -[B4IShell raiseEventImpl:method:args::] + 1640
  MyDex                -[B4IShellBI raiseEvent:event:params:] + 1372
 MyDex                -[B4IDebugResumableSub resume::] + 356
 MyDex                __21-[B4ICommon Sleep:::]_block_invoke + 60
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 412
 libdispatch.dylib    <redacted> + 1308
 libdispatch.dylib    <redacted> + 784
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 1924
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 104
 UIKitCore            UIApplicationMain + 212
 MyDex                main + 124
 libdyld.dylib        <redacted> + 4
)
Device answer!!!!!!!!!!!!!!!!!!
 
Upvote 0

Moroz

Member
Licensed User
Longtime User
Your help is just endless.
Thank you for not leaving your users unanswered.
Very grateful to you !!!
I will continue to try to work with the device.
 
Upvote 0
Top