Hi guys,
I'm trying to read enviroment data from a module called thingy52,
the log below mean the module is not sending any data
I think because I have to active the notify in the module, I tried this:
I got this error: "Caused by: java.lang.RuntimeException: Service not found"
line 79 is: manager.SetNotify("EF680200-9B35-4933-9B10-52FFA9740042","EF680201-9B35-4933-9B10-52FFA9740042",True)
I'm trying to read enviroment data from a module called thingy52,
the log below mean the module is not sending any data
Found: AntuTech, FF:B0:19:AF:F0:9F, RSSI = -45, (MyMap) {1=[B@42a20ab8, 6=[B@42a20b20, 8=[B@42a20b70, -1=[B@42a20bb8, 0=[B@42a20660}
Este = 1: 06
Este = 6: 420074A9FF52109B3349359B000168EF
Este = 8: 416E747554656368
Este = -1: 5900623EC2FA
Este = 0: 0201061106420074A9FF52109B3349359B000168EF0908416E74755465636807FF5900623EC2FA0000000000000000000000000000000000000000000000
Discovering services.
Connected
Key: 00002a05-0000-1000-8000-00805f9b34fb, value:
Key: 8ec90003-f315-4f60-9fb8-838830daea50, value:
Key: 00002a00-0000-1000-8000-00805f9b34fb, value: 416E7475546563683532
Key: 00002a01-0000-1000-8000-00805f9b34fb, value: 0000
Key: 00002a04-0000-1000-8000-00805f9b34fb, value: 0600180000004001
Key: 00002aa6-0000-1000-8000-00805f9b34fb, value: 01
Key: ef680101-9b35-4933-9b10-52ffa9740042, value: 416E7475546563683532
Key: ef680102-9b35-4933-9b10-52ffa9740042, value: 6002B4
Key: ef680104-9b35-4933-9b10-52ffa9740042, value: 0600180000004001
Key: ef680105-9b35-4933-9b10-52ffa9740042, value: 03676F6F2E676C2F704957646972
Key: ef680106-9b35-4933-9b10-52ffa9740042, value:
Key: ef680107-9b35-4933-9b10-52ffa9740042, value: 020100
Key: ef680108-9b35-4933-9b10-52ffa9740042, value: 001700
Key: ef680206-9b35-4933-9b10-52ffa9740042, value: D007D007D007DC0502674E1D
Key: ef680201-9b35-4933-9b10-52ffa9740042, value:
Key: ef680202-9b35-4933-9b10-52ffa9740042, value:
Key: ef680203-9b35-4933-9b10-52ffa9740042, value:
Key: ef680204-9b35-4933-9b10-52ffa9740042, value:
Key: ef680205-9b35-4933-9b10-52ffa9740042, value:
Key: ef680401-9b35-4933-9b10-52ffa9740042, value: E803F401F4010A0001
Key: ef680402-9b35-4933-9b10-52ffa9740042, value:
Key: ef680403-9b35-4933-9b10-52ffa9740042, value:
Key: ef680404-9b35-4933-9b10-52ffa9740042, value:
Key: ef680405-9b35-4933-9b10-52ffa9740042, value:
Key: ef680406-9b35-4933-9b10-52ffa9740042, value:
Key: ef680407-9b35-4933-9b10-52ffa9740042, value:
Key: ef680408-9b35-4933-9b10-52ffa9740042, value:
Key: ef680409-9b35-4933-9b10-52ffa9740042, value:
Key: ef68040a-9b35-4933-9b10-52ffa9740042, value:
Key: ef680301-9b35-4933-9b10-52ffa9740042, value: 020512AC0D
Key: ef680303-9b35-4933-9b10-52ffa9740042, value: 00000000
Key: ef680302-9b35-4933-9b10-52ffa9740042, value:
Key: ef680501-9b35-4933-9b10-52ffa9740042, value: 0101
Key: ef680502-9b35-4933-9b10-52ffa9740042, value:
Key: ef680503-9b35-4933-9b10-52ffa9740042, value:
Key: ef680504-9b35-4933-9b10-52ffa9740042, value:
Key: 00002a19-0000-1000-8000-00805f9b34fb, value: 43
I think because I have to active the notify in the module, I tried this:
B4X:
Public Sub writeData1
manager.SetNotify("EF680200-9B35-4933-9B10-52FFA9740042","EF680201-9B35-4933-9B10-52FFA9740042",True)
Log("Set Notify")
End Sub
Sub Manager_DataAvailable (ServiceId As String, Characteristics As Map)
CallSub3(Main, "DataAvailable", ServiceId, Characteristics)
Dim bc As ByteConverter
Dim KeyCode As String
Dim bc As ByteConverter
For Each key As String In Characteristics.Keys
Dim b() As Byte = Characteristics.Get(key)
Log("Key: " & key &", value: " & bc.HexFromBytes(b))
'Log(BytesToString(b, 0, b.Length, "utf8") 'useful if the data is actually a string
If key = "" Then
End If
Next
' https://nordicsemiconductor.github.io/Nordic-Thingy52-FW/documentation/firmware_architecture.html#fw_arch_ble_services
' Environment Service:
' Base UUID: EF68xxxx-9B35-4933-9B10-52FFA9740042
' Temperature characteristic: EF680201-9B35-4933-9B10-52FFA9740042
' Pressure characteristic : EF680202-9B35-4933-9B10-52FFA9740042
' Humidity characteristic: EF680203-9B35-4933-9B10-52FFA9740042
End Sub
I got this error: "Caused by: java.lang.RuntimeException: Service not found"
line 79 is: manager.SetNotify("EF680200-9B35-4933-9B10-52FFA9740042","EF680201-9B35-4933-9B10-52FFA9740042",True)
Error occurred on line: 79 (Starter)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1026)
at b4a.example3.main._button1_click(main.java:570)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:4475)
at android.view.View$PerformClick.run(View.java:18786)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:333)
at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:279)
... 26 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:315)
... 27 more
Caused by: java.lang.RuntimeException: Service not found
at anywheresoftware.b4a.objects.BleManager2.getService(BleManager2.java:375)
at anywheresoftware.b4a.objects.BleManager2.setNotify(BleManager2.java:301)
at anywheresoftware.b4a.objects.BleManager2.SetNotify(BleManager2.java:298)
at b4a.example3.starter._writedata1(starter.java:210)
... 30 more
Last edited: