Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flags for transmit messages cannot be set with the Swift wrapper #23

Closed
mac-can opened this issue Jun 15, 2022 · 0 comments
Closed

Flags for transmit messages cannot be set with the Swift wrapper #23

mac-can opened this issue Jun 15, 2022 · 0 comments

Comments

@mac-can
Copy link
Owner

mac-can commented Jun 15, 2022

Stupidly, there is a copy-paste error in the CAN API Swift wrapper that prevents to set message flags other than standard frames for transmit messages.

Wrong:

    public struct Message {
        public struct Flags: OptionSet {
            // message flags as option set
            public static let StandardFrame = Flags([])
            public static let ExtendedFrame = Mode(rawValue: 0x01)
            public static let RemoteFrame = Mode(rawValue: 0x02)
            public static let CanFdLongFrame = Mode(rawValue: 0x04)
            public static let CanFdFastFrame = Mode(rawValue: 0x08)
            // message flags from C interface
            ...

Much better:

    public struct Message {
        public struct Flags: OptionSet {
            // message flags as option set
            public static let StandardFrame = Flags([])
            public static let ExtendedFrame = Flags(rawValue: 0x01)
            public static let RemoteFrame = Flags(rawValue: 0x02)
            public static let CanFdLongFrame = Flags(rawValue: 0x04)
            public static let CanFdFastFrame = Flags(rawValue: 0x08)
            // message flags from C interface
            ...

See also KvaserCAN issue #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant