I’m (trying) to make the move from Serial to SerialConnection (2019 R3.1) and am having a fundamental issue - detecting if the port opened successfully. Does anyone have a work-around, perhaps some property that can be read after a successful (or unsuccessful) connection? Or should I just revert back to using Serial and stop banging my head against the wall?
Try
App.SerialController.Connect
Catch error As IOException
MessageBox("The serial connection could not be opened.")
End Try
file a bug report about this
and go back to the old API and check the error code maybe ?
you’re not the first to bump into a replacement no behaving as documented or expected
its what make me nervous about moving any code to API 2
Try
App.SerialController.Connect
MessageBox("The port is open, to see if it has connected check the Error(err) err.Message parameter")
// Here it is open since we to after the .Connect call.
Catch error As IOException
MessageBox("The serial connection could not be opened.")
End Try
It says .Connect but connected is not the same as Open since xojo changed the method internally i guess its checking the open state and the connected state.
It’s kinda missing a .IsConnected flag… which would be realllllly useful
How do you get the SerialDevice? With SerialDevice.WithName?
If so, that has a bug still. The method was fixed for 2019r3.1 and now returns a SerialDevice, but you cannot use it. So your code is probably giving you a different exception than an IOException.
Get the device with SerialDevice.At. That produces a serial you can work with.
[quote=482999:@Ulrich Bogun]How do you get the SerialDevice? With SerialDevice.WithName?
If so, that has a bug still. The method was fixed for 2019r3.1 and now returns a SerialDevice, but you cannot use it. So your code is probably giving you a different exception than an IOException.
Get the device with SerialDevice.At. That produces a serial you can work with.[/quote]
That still not fixed?