[Bug]: First OnCharacteristicChanged not triggering subscription #1542
Labels
bug
Something isn't working
more-info-needed
More information needs to be provided by the issue author
unverified
This issue has not been verified by a maintainer
Component/Nuget
BluetoothLE Client (Shiny.BluetoothLE)
What operating system(s) are effected?
Version(s) of Operation Systems
Android 14
iOS 18.2
Hosting Model
Steps To Reproduce
`IDisposable notificationSubscription;
var c = await x.GetCharacteristicAsync("49535343-fe7d-4ae5-8fa9-9fafd205e455", "49535343-1e4d-4bd9-ba61-23c647249616");
if (c != null)
{
Debug.WriteLine($"Characteristic found");
if (c.CanNotify())
{
Debug.WriteLine($"Characteristic can notify");
Debug.WriteLine($"Subscribing characteristic");
this.notificationSubscription = x.NotifyCharacteristic(c).SubscribeAsync(async v =>
{
Debug.WriteLine("######################################################################");
}
}
}`
Expected Behavior
Shiny.BluetoothLE.IPeripheral: Information: [Native Method - OnCharacteristicChanged
should always trigger the logic in the subscription.
Actual Behavior
Shiny.BluetoothLE.IPeripheral: Information: [Native Method - OnCharacteristicChanged
sometimes is not firing the subscription for the first OnCharacteristicChanged.
Exception or Log output
[BluetoothAdapter] getBleEnabledArray(): ON [BluetoothAdapter] BLE support array set: [true, true, true, true, true, true, true] [BluetoothAdapter] getBleEnabledArray(): ON [BluetoothAdapter] semIsBleEnabled(): ON [BluetoothAdapter] getBleEnabledArray(): ON [BluetoothLeScanner] Start Scan with callback [BluetoothLeScanner] onScannerRegistered() - status=0 scannerId=5 mScannerId=0 [ViewRootImpl@d69eb92[MainActivity]] onDisplayChanged oldDisplayState=2 newDisplayState=2 [ProfileInstaller] Installing profile for de.companyname.app [BluetoothAdapter] getBleEnabledArray(): ON [BluetoothAdapter] getBleEnabledArray(): ON [BluetoothLeScanner] Stop Scan with callback [BluetoothAdapter] BluetoothAdapter() : de.companyname.app [0:] DEVICE disconnected [DOTNET] Disconnected [BluetoothAdapter] getBleEnabledArray(): ON [CompatibilityChangeReporter] Compat change id reported: 265103382; UID 10367; state: ENABLED [BluetoothGatt] connect() - device: XX:XX:XX:XX:FC:C9, auto: false [BluetoothGatt] registerApp() [BluetoothGatt] registerApp() - UUID=3793644c-b5c6-4adf-902e-e280aa9b8217 [BluetoothGatt] onClientRegistered() - status=0 clientIf=7 [BluetoothGatt] requestConnectionPriority() - params: 0 [DOTNET] Connecting [BluetoothAdapter] getBleEnabledArray(): ON [BluetoothGatt] onClientConnectionState() - status=0 clientIf=7 device=XX:XX:XX:XX:FC:C9 Thread started: #15 [0:] Searching Characteristics [app] Accessing hidden method Landroid/bluetooth/BluetoothGatt;->refresh()Z (unsupported, reflection, allowed) [BluetoothGatt] refresh() - device: XX:XX:XX:XX:FC:C9 [0:] Shiny.BluetoothLE.IPeripheral: Information: Clear Internal Cache Refresh Result: True [BluetoothGatt] discoverServices() - device: XX:XX:XX:XX:FC:C9 [DOTNET] Connected [0:] [BluetoothGatt] onConnectionUpdated() - Device=XX:XX:XX:XX:FC:C9 interval=6 latency=0 timeout=500 status=0 [BluetoothGatt] onConnectionUpdated() - Device=XX:XX:XX:XX:FC:C9 interval=36 latency=0 timeout=500 status=0 [BluetoothGatt] onConnectionUpdated() - Device=XX:XX:XX:XX:FC:C9 interval=6 latency=0 timeout=500 status=0 [BluetoothGatt] onSearchComplete() = Device=XX:XX:XX:XX:FC:C9 Status=0 [BluetoothGatt] onConnectionUpdated() - Device=XX:XX:XX:XX:FC:C9 interval=36 latency=0 timeout=500 status=0 [0:] Characteristic found [0:] Characteristic can notify [0:] Subscribing characteristic [0:] Shiny.BluetoothLE.IPeripheral: Information: Subscribing to Notification Characteristic 49535343-fe7d-4ae5-8fa9-9fafd205e455 / 49535343-1e4d-4bd9-ba61-23c647249616 [BluetoothGatt] setCharacteristicNotification() - uuid: 49535343-1e4d-4bd9-ba61-23c647249616 enable: true [0:] Shiny.BluetoothLE.IPeripheral: Information: Subscribed to Notification Characteristic 49535343-fe7d-4ae5-8fa9-9fafd205e455 / 49535343-1e4d-4bd9-ba61-23c647249616 [0:] Shiny.BluetoothLE.IPeripheral: Information: [Native Method - OnCharacteristicChanged] Service: 49535343-fe7d-4ae5-8fa9-9fafd205e455 - Characteristic: 49535343-1e4d-4bd9-ba61-23c647249616 - Status: <======= No Log output (##########) for this OnCharacteristicChanged Thread started: #16 [0:] Shiny.BluetoothLE.IPeripheral: Information: [Native Method - OnCharacteristicChanged] Service: 49535343-fe7d-4ae5-8fa9-9fafd205e455 - Characteristic: 49535343-1e4d-4bd9-ba61-23c647249616 - Status: [0:] ###################################################################### [0:] [Received] 0146F6","FID":"E4625 [0:] Shiny.BluetoothLE.IPeripheral: Information: [Native Method - OnCharacteristicChanged] Service: 49535343-fe7d-4ae5-8fa9-9fafd205e455 - Characteristic: 49535343-1e4d-4bd9-ba61-23c647249616 - Status: [0:] ###################################################################### [0:] [Received] 0224F435726","Ser":"
Code Sample
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: