I iCAB Well-Known Member Licensed User Longtime User Mar 5, 2021 #1 Hi There, I am trying the felUSBSerial library and I am wondering if there is a reliable way to check for connect/disconnect instead of continuously checking: B4X: manager.GetDevices.Length Thanks iCAB Last edited: Mar 6, 2021
Hi There, I am trying the felUSBSerial library and I am wondering if there is a reliable way to check for connect/disconnect instead of continuously checking: B4X: manager.GetDevices.Length Thanks iCAB
Erel B4X founder Staff member Licensed User Longtime User Mar 7, 2021 #2 B4X: Sub CheckConnection Dim PrevLength As Int Do While True Dim NewLength As Int = manager.GetDevices.Length If PrevLength <> NewLength Then NewLength = PrevLength StateChangedSub (NewLength) End If Sleep(500) End Sub Upvote 0
B4X: Sub CheckConnection Dim PrevLength As Int Do While True Dim NewLength As Int = manager.GetDevices.Length If PrevLength <> NewLength Then NewLength = PrevLength StateChangedSub (NewLength) End If Sleep(500) End Sub
I iCAB Well-Known Member Licensed User Longtime User Mar 7, 2021 #3 Thanks Erel, is there some sort of an event instead of polling? Upvote 0