SerialConnection error on macOS?

  1. 2 weeks ago

    Ulrich B

    Jan 11 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...
    Edited 2 weeks ago

    I am using the SerialConnection classes in a console helper application to access a Serial-to-USB device on Windows and macOS.
    Basically connection looks like this:

    Var seriald As serialdevice = SerialDevice.WithName(Me.PortName)
    If seriald <> Nil Then
      serial.Baud = Me.Baud
      serial.Bits = Me.Bits
      serial.CTS = Me.cts
      serial.DTR = Me.dtr
      serial.Parity = CType(Me.Parity, SerialConnection.Parities)
      serial.StopBit = CType(Me.StopBits, SerialConnection.StopBits)
      serial.XON = Me.xon
      serial.Device = seriald
      serial.Connect
      Return True
    End If

    With an exception handler following, returning False.
    Serial is an already created instance property of type SerialConnection, with its three events linked to class methods via Addhandler.

    This works nicely on Windows, and I can read data in the DataAvailable Handler.
    On macOS, the SerialConnection.Error handler fires twice before the connect method returns true (sic!).
    Errorcode both times is 2, which most possibly means kBluetoothSDPErrorCodeInvalidServiceRecordHandle – at least this would correspond to the SerialConnection’s handle which is Nil (or rather -1) while its Device property is set correctly.
    Any hints what I might be doing wrongly? Or a Xojo 2019r3 bug?

    EDIT: An old project using the old serial class works.

    I think I found the error to be located in SerialDevice.WithName which I was using. Does not create a valid Device on macOS.
    SerialDevice.At does. With this limitation you could use 2019r3.

  2. Rick A

    Jan 11 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 2 weeks ago

    @Ulrich B Any hints what I might be doing wrongly?
    Or a Xojo 2019r3 bug?
    using the old serial class works.

    That means that 2019r3 is also bugged, and is unusable for me for my next project for Mac targets.

    Please file a feedback bug.

  3. Mark C

    Jan 11 Pre-Release Testers, Xojo Pro Spain 03170

    I have not tried the new API2 serial stuff, why is it there when we have a perfectly working API 1 version?
    19R3 with the existing serial class is working without any issue in all my projects.
    I would be happy to hear comment from staff as to what the API2 serial class is designed to 'update' over the original.

  4. Christian M

    Jan 11 Pre-Release Testers, Xojo Pro Germany

    There is a video from the last XDC where Xojo stuff explains the benefits of API 2.0 here:
    https://www.youtube.com/watch?v=rPjbH4_sARs

  5. Ulrich B

    Jan 12 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    Thanks all. I opened a private beta case as this is part of a customer’s project which I did not want to strip down.
    I’ll keep you updated.

    @Mark C : From my point of view, SerialConnection follows the same structure other sockets have too under API 2.0: The same event names, the same error handling. Makes it easier to adapt code to different sockets.
    Besides from that, I don’t have the feeling things changed under the hood. Except for, well, the inability to connect under macOS ;)

  6. Rick A

    Jan 12 Pre-Release Testers (Brazil. UTC-3:00)

    @Ulrich B I’ll keep you updated.

    Thanks.

  7. Ulrich B

    Jan 13 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    As expected:
    »Switched to a regular bug because the user indicates that it is reproducible in the current public release.«

  8. Ulrich B

    Jan 13 Pre-Release Testers, Xojo Pro Answer Europe (Germany, Berlin) · xo...

    I think I found the error to be located in SerialDevice.WithName which I was using. Does not create a valid Device on macOS.
    SerialDevice.At does. With this limitation you could use 2019r3.

  9. Derk J

    Jan 13 Pre-Release Testers, Xojo Pro

    @Ulrich B I think I found the error to be located in SerialDevice.WithName which I was using. Does not create a valid Device on macOS.
    SerialDevice.At does. With this limitation you could use 2019r3.

    I historically made a bug report about this some time ago, in the old api. I guess they not even updated the newer API 2.0 code.

    Getting a serial device by it's name didn't work but testing against it trough an indexed loop was the only way. I'll try to find the bug report when on the computer.

  10. Derk J

    Jan 14 Pre-Release Testers, Xojo Pro
    Edited 2 weeks ago

    Case #52659

    from 2018, verified and not fixed.

  11. Ulrich B

    Jan 14 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    D’oh! So the class was modernized and the bug was ported instead of fixed.
    Thank you, Derk! Added your ticket to my case.

  12. Derk J

    Jan 14 Pre-Release Testers, Xojo Pro
    Edited 2 weeks ago

    @Ulrich B D’oh! So the class was modernized and the bug was ported instead of fixed.
    Thank you, Derk! Added your ticket to my case.

    bug re-ported (now that makes sense)

    No thanks, i'd rather have xojo fixing it!

  13. Ulrich B

    Jan 14 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    Well, officially your ticket was for API 1, mine is for API 2. New case. :D

  14. Rick A

    Jan 14 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 2 weeks ago

    Both seems related, maybe even use the same broken code in an underlying layer below the API's interfaces. Maybe one stone hits two rabbits.

  15. last week

    Ulrich B

    Jan 20 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    I have the feeling that at least for API 2 this bug will soon be fixed …

or Sign Up to reply!