public TPCANStatus WriteFrame(UInt32 Id, int DataLength, byte[] Data) { TPCANMsg CANMsg; // Create a TPCANMsg message structure CANMsg = new TPCANMsg(); // Configure the Message Type. CANMsg.MSGTYPE = TPCANMessageType.PCAN_MESSAGE_STANDARD; // Message contents (ID, Length of the Data, Data) CANMsg.ID = Id; CANMsg.LEN = (byte)DataLength; CANMsg.DATA = Data; // The message is sent to the configured hardware LastOperationStatus = PCANBasic.Write(PeakCANHandle, ref CANMsg); if (LastOperationStatus != TPCANStatus.PCAN_ERROR_OK) { LastOperationErrorMessage(); } return(LastOperationStatus); }
public static extern TPCANStatus Write( [MarshalAs(UnmanagedType.U2)] TPCANHandle Channel, ref TPCANMsg MessageBuffer);
/// <summary> /// Reads a CAN message from the receive queue of a PCAN Channel /// </summary> /// <param name="Channel">The handle of a PCAN Channel</param> /// <param name="MessageBuffer">A TPCANMsg structure buffer to store the CAN message</param> /// <returns>A TPCANStatus error code</returns> public static TPCANStatus Read( TPCANHandle Channel, out TPCANMsg MessageBuffer) { return(Read(Channel, out MessageBuffer, IntPtr.Zero)); }
private static extern TPCANStatus Read( [MarshalAs(UnmanagedType.U2)] TPCANHandle Channel, out TPCANMsg MessageBuffer, IntPtr bufferPointer);
public static extern TPCANStatus Read( [MarshalAs(UnmanagedType.U2)] TPCANHandle Channel, out TPCANMsg MessageBuffer, out TPCANTimestamp TimestampBuffer);