is it possible to disconnect from a bluetooth device in swift?

585 Views Asked by At

short question Is it possible to disconnect from a bluetooth device in swift? If so, how?

background

I would like to disconnect from my bluetooth device programmatically using swift 4 because I am working with a 3rd party bluetooth library and am noticing that when I call their commands to 'close the connection', that my instance variable of type

EAAccessoryManager.shared().connectedAccessories.count

is still equal to 1, and my EAAccessory instance shows that my connection is open, however my 3rd party library ConnectionManager shows my connection as closed (because I call the command to close it). However, apparently calling this 3rd party library ConnectionManager's 'close connection' function is not enough to actually clear the instance variables of EAAccessoryManager.shared() and EAAccessory

EAAccessoryManager.shared().connectedAccessories

is get-only, so I cannot set the connected accessories to an empty array.

0

There are 0 best solutions below