Skip to content

The api in the class LibcNativeMethods are bloated #120

Description

@Vincent-X-Zhang

The api in the class LibcNativeMethods such as:

        /// <summary>
        /// Write the BcmCanFdMessage to the socket. Variant for 32-bit.
        /// </summary>
        /// <param name="socketHandle">Socket Handle Wrapper Instance</param>
        /// <param name="message">BCM Message to write</param>
        /// <param name="msgSize">Size of BCM Message in bytes</param>
        /// <returns>The number of bytes written on success, -1 on error</returns>
        [DllImport("libc", EntryPoint="write", SetLastError=true)]
        public static extern int Write(SafeFileDescriptorHandle socketHandle, BcmCanFdMessage32 message, int msgSize);

        /// <summary>
        /// Write the BcmCanSingleMessage to the socket. Variant for 32-bit.
        /// </summary>
        /// <param name="socketHandle">Socket Handle Wrapper Instance</param>
        /// <param name="message">Special Single Frame BCM Message to write</param>
        /// <param name="msgSize">Size of BCM Message in bytes</param>
        /// <returns>The number of bytes written on success, -1 on error</returns>
        [DllImport("libc", EntryPoint="write", SetLastError=true)]
        public static extern int Write(SafeFileDescriptorHandle socketHandle, BcmCanSingleMessage32 message, int msgSize);

They actually are the same native api:

ssize_t write(int fd, const void* buf, size_t count);

I mean, maybe there is a better way to unify them?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions