MarcoLaudati
Member
I thank you for your help so far, this is the situation right now, I have the scp32 chip configured with the following services:
The control unit provides the tablet client with a single primary station service with uuid: 0000a002-0000-1000-8000-00805f9b34fb.
Below are summarized in a table the features present in the service:
1
C300-0000-1000-8000- 00805f9b34fb
COMMAND
1
READ-WRITE
ASCII CODE
2
C301 ...
ANSWER
2
READ-WRITE
ASCII CODE
3
C302 ...
HEIGHT
4
READ-WRITE
ASCII CODE
4
C303 ...
POSIZIONEBILANCIA
1
READ-WRITE
ASCII CODE
5
C304 ...
CIRCUMFERENCE
4
etc ..
currently I have configured the code in this way:
ON STARTER
ON MAIN
The startup application sees my chip with its MAc Adress, but remains in a connection waiting state, as you can see from my attachment.
if I try to connect with Nrf connect I connect and retrieve all the UUIDs present in the chip database correctly. Thank you in advance for your help.
The control unit provides the tablet client with a single primary station service with uuid: 0000a002-0000-1000-8000-00805f9b34fb.
Below are summarized in a table the features present in the service:
1
C300-0000-1000-8000- 00805f9b34fb
COMMAND
1
READ-WRITE
ASCII CODE
2
C301 ...
ANSWER
2
READ-WRITE
ASCII CODE
3
C302 ...
HEIGHT
4
READ-WRITE
ASCII CODE
4
C303 ...
POSIZIONEBILANCIA
1
READ-WRITE
ASCII CODE
5
C304 ...
CIRCUMFERENCE
4
etc ..
currently I have configured the code in this way:
ON STARTER
B4X:
Sub Service_Create
'This is the program entry point.
'This is a good place for a single activity.
Log ("Service Create Starter")
CallSubDelayed (FirebaseMessaging, "SubscribeToTopics")
'BLE
manager.Initialize ( "manager")
ServiceId = UUID ("0000a002")
ReadChar = UUID ("1001")
WriteChar = UUID ("1002")
messagesToSend.Initialize
Serial1.Initialize (115200)
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub
Private Sub Manager_StateChanged (State As Int)
If State <> manager.STATE_POWERED_ON Then
ToastMessageShow ("Please enable Bluetooth", True)
else
StartScan
End If
End Sub
Public Sub StartScan
If rp.Check (rp.PERMISSION_ACCESS_COARSE_LOCATION) Then
If manager.State = manager.STATE_POWERED_ON Then
'manager.Scan (Array (ServiceId))
manager.Scan (Null)
End If
End If
End Sub
Private Sub Manager_DeviceFound (Name As String, DeviceId As String, AdvertisingData As Map, RSSI As Double)
Log ($ "DeviceFound: $ {Name}" $)
Log ("Found: Name =" & Name & ", id =" & DeviceId & ", RSSI =" & RSSI & ", AdvertisingData =" & AdvertisingData) 'ignore
manager.Connect2 (DeviceId, False)
manager.StopScan
End Sub
Private Sub Manager_Connected (Services As List)
Log ( "Connected")
manager.SetNotify (ServiceId, ReadChar, True)
connected = True
CallSub2 (Main, "SetState", connected)
messagesToSend.Clear
End Sub
ON MAIN
B4X:
Public Sub SetState (connected As Boolean)
If connected Then
ProgressDialogHide
else
ProgressDialogShow2 ("Trying to connect", False)
End If
End Sub
The startup application sees my chip with its MAc Adress, but remains in a connection waiting state, as you can see from my attachment.
if I try to connect with Nrf connect I connect and retrieve all the UUIDs present in the chip database correctly. Thank you in advance for your help.