You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Want to be able to connect, disconnect, and then reconnect from BLE devices in a longer running process. Currently the code only calls BluetoothDevice.DisposeAllNativeObjects in a deconstructor I can't manually invoke.
Overall workflow:
Connect to Gatt
Connect to Service
Connect to characteristics
Do the BLE things
Dispose of entire stack
Reconnect if desired (start back at 1)
Was able to successfully implement my workflow by making BluetoothDevice implement IDisposable and have that call DisposeAllNativeObjects()
privatevoidDispose(booldisposing){if(!disposedValue){if(disposing){// TODO: dispose managed state (managed objects)}DisposeAllNativeObjects();disposedValue=true;}}~BluetoothDevice(){Dispose(disposing:false);}publicvoidDispose(){Dispose(disposing:true);GC.SuppressFinalize(this);}
NOTE: implemented this in Platforms/Windows/BluetoothDevice.windows.cs
Now calling BluetoothDevice.Dispose() properly frees up resources and allows for follow on connects if needed.
The text was updated successfully, but these errors were encountered:
Want to be able to connect, disconnect, and then reconnect from BLE devices in a longer running process. Currently the code only calls
BluetoothDevice.DisposeAllNativeObjects
in a deconstructor I can't manually invoke.Overall workflow:
Was able to successfully implement my workflow by making
BluetoothDevice
implementIDisposable
and have that callDisposeAllNativeObjects()
NOTE: implemented this in
Platforms/Windows/BluetoothDevice.windows.cs
Now calling
BluetoothDevice.Dispose()
properly frees up resources and allows for follow on connects if needed.The text was updated successfully, but these errors were encountered: