#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
/* automatically generated by rust-bindgen 0.72.1 */
pub const PCAN_NONEBUS: u32 = 0;
pub const PCAN_ISABUS1: u32 = 33;
pub const PCAN_ISABUS2: u32 = 34;
pub const PCAN_ISABUS3: u32 = 35;
pub const PCAN_ISABUS4: u32 = 36;
pub const PCAN_ISABUS5: u32 = 37;
pub const PCAN_ISABUS6: u32 = 38;
pub const PCAN_ISABUS7: u32 = 39;
pub const PCAN_ISABUS8: u32 = 40;
pub const PCAN_DNGBUS1: u32 = 49;
pub const PCAN_PCIBUS1: u32 = 65;
pub const PCAN_PCIBUS2: u32 = 66;
pub const PCAN_PCIBUS3: u32 = 67;
pub const PCAN_PCIBUS4: u32 = 68;
pub const PCAN_PCIBUS5: u32 = 69;
pub const PCAN_PCIBUS6: u32 = 70;
pub const PCAN_PCIBUS7: u32 = 71;
pub const PCAN_PCIBUS8: u32 = 72;
pub const PCAN_PCIBUS9: u32 = 1033;
pub const PCAN_PCIBUS10: u32 = 1034;
pub const PCAN_PCIBUS11: u32 = 1035;
pub const PCAN_PCIBUS12: u32 = 1036;
pub const PCAN_PCIBUS13: u32 = 1037;
pub const PCAN_PCIBUS14: u32 = 1038;
pub const PCAN_PCIBUS15: u32 = 1039;
pub const PCAN_PCIBUS16: u32 = 1040;
pub const PCAN_USBBUS1: u32 = 81;
pub const PCAN_USBBUS2: u32 = 82;
pub const PCAN_USBBUS3: u32 = 83;
pub const PCAN_USBBUS4: u32 = 84;
pub const PCAN_USBBUS5: u32 = 85;
pub const PCAN_USBBUS6: u32 = 86;
pub const PCAN_USBBUS7: u32 = 87;
pub const PCAN_USBBUS8: u32 = 88;
pub const PCAN_USBBUS9: u32 = 1289;
pub const PCAN_USBBUS10: u32 = 1290;
pub const PCAN_USBBUS11: u32 = 1291;
pub const PCAN_USBBUS12: u32 = 1292;
pub const PCAN_USBBUS13: u32 = 1293;
pub const PCAN_USBBUS14: u32 = 1294;
pub const PCAN_USBBUS15: u32 = 1295;
pub const PCAN_USBBUS16: u32 = 1296;
pub const PCAN_PCCBUS1: u32 = 97;
pub const PCAN_PCCBUS2: u32 = 98;
pub const PCAN_LANBUS1: u32 = 2049;
pub const PCAN_LANBUS2: u32 = 2050;
pub const PCAN_LANBUS3: u32 = 2051;
pub const PCAN_LANBUS4: u32 = 2052;
pub const PCAN_LANBUS5: u32 = 2053;
pub const PCAN_LANBUS6: u32 = 2054;
pub const PCAN_LANBUS7: u32 = 2055;
pub const PCAN_LANBUS8: u32 = 2056;
pub const PCAN_LANBUS9: u32 = 2057;
pub const PCAN_LANBUS10: u32 = 2058;
pub const PCAN_LANBUS11: u32 = 2059;
pub const PCAN_LANBUS12: u32 = 2060;
pub const PCAN_LANBUS13: u32 = 2061;
pub const PCAN_LANBUS14: u32 = 2062;
pub const PCAN_LANBUS15: u32 = 2063;
pub const PCAN_LANBUS16: u32 = 2064;
pub const PCAN_ERROR_OK: u32 = 0;
pub const PCAN_ERROR_XMTFULL: u32 = 1;
pub const PCAN_ERROR_OVERRUN: u32 = 2;
pub const PCAN_ERROR_BUSLIGHT: u32 = 4;
pub const PCAN_ERROR_BUSHEAVY: u32 = 8;
pub const PCAN_ERROR_BUSWARNING: u32 = 8;
pub const PCAN_ERROR_BUSPASSIVE: u32 = 262144;
pub const PCAN_ERROR_BUSOFF: u32 = 16;
pub const PCAN_ERROR_ANYBUSERR: u32 = 262172;
pub const PCAN_ERROR_QRCVEMPTY: u32 = 32;
pub const PCAN_ERROR_QOVERRUN: u32 = 64;
pub const PCAN_ERROR_QXMTFULL: u32 = 128;
pub const PCAN_ERROR_REGTEST: u32 = 256;
pub const PCAN_ERROR_NODRIVER: u32 = 512;
pub const PCAN_ERROR_HWINUSE: u32 = 1024;
pub const PCAN_ERROR_NETINUSE: u32 = 2048;
pub const PCAN_ERROR_ILLHW: u32 = 5120;
pub const PCAN_ERROR_ILLNET: u32 = 6144;
pub const PCAN_ERROR_ILLCLIENT: u32 = 7168;
pub const PCAN_ERROR_ILLHANDLE: u32 = 7168;
pub const PCAN_ERROR_RESOURCE: u32 = 8192;
pub const PCAN_ERROR_ILLPARAMTYPE: u32 = 16384;
pub const PCAN_ERROR_ILLPARAMVAL: u32 = 32768;
pub const PCAN_ERROR_UNKNOWN: u32 = 65536;
pub const PCAN_ERROR_ILLDATA: u32 = 131072;
pub const PCAN_ERROR_ILLMODE: u32 = 524288;
pub const PCAN_ERROR_CAUTION: u32 = 33554432;
pub const PCAN_ERROR_INITIALIZE: u32 = 67108864;
pub const PCAN_ERROR_ILLOPERATION: u32 = 134217728;
pub const PCAN_NONE: u32 = 0;
pub const PCAN_PEAKCAN: u32 = 1;
pub const PCAN_ISA: u32 = 2;
pub const PCAN_DNG: u32 = 3;
pub const PCAN_PCI: u32 = 4;
pub const PCAN_USB: u32 = 5;
pub const PCAN_PCC: u32 = 6;
pub const PCAN_VIRTUAL: u32 = 7;
pub const PCAN_LAN: u32 = 8;
pub const PCAN_DEVICE_ID: u32 = 1;
pub const PCAN_5VOLTS_POWER: u32 = 2;
pub const PCAN_RECEIVE_EVENT: u32 = 3;
pub const PCAN_MESSAGE_FILTER: u32 = 4;
pub const PCAN_API_VERSION: u32 = 5;
pub const PCAN_CHANNEL_VERSION: u32 = 6;
pub const PCAN_BUSOFF_AUTORESET: u32 = 7;
pub const PCAN_LISTEN_ONLY: u32 = 8;
pub const PCAN_LOG_LOCATION: u32 = 9;
pub const PCAN_LOG_STATUS: u32 = 10;
pub const PCAN_LOG_CONFIGURE: u32 = 11;
pub const PCAN_LOG_TEXT: u32 = 12;
pub const PCAN_CHANNEL_CONDITION: u32 = 13;
pub const PCAN_HARDWARE_NAME: u32 = 14;
pub const PCAN_RECEIVE_STATUS: u32 = 15;
pub const PCAN_CONTROLLER_NUMBER: u32 = 16;
pub const PCAN_TRACE_LOCATION: u32 = 17;
pub const PCAN_TRACE_STATUS: u32 = 18;
pub const PCAN_TRACE_SIZE: u32 = 19;
pub const PCAN_TRACE_CONFIGURE: u32 = 20;
pub const PCAN_CHANNEL_IDENTIFYING: u32 = 21;
pub const PCAN_CHANNEL_FEATURES: u32 = 22;
pub const PCAN_BITRATE_ADAPTING: u32 = 23;
pub const PCAN_BITRATE_INFO: u32 = 24;
pub const PCAN_BITRATE_INFO_FD: u32 = 25;
pub const PCAN_BUSSPEED_NOMINAL: u32 = 26;
pub const PCAN_BUSSPEED_DATA: u32 = 27;
pub const PCAN_IP_ADDRESS: u32 = 28;
pub const PCAN_LAN_SERVICE_STATUS: u32 = 29;
pub const PCAN_ALLOW_STATUS_FRAMES: u32 = 30;
pub const PCAN_ALLOW_RTR_FRAMES: u32 = 31;
pub const PCAN_ALLOW_ERROR_FRAMES: u32 = 32;
pub const PCAN_INTERFRAME_DELAY: u32 = 33;
pub const PCAN_ACCEPTANCE_FILTER_11BIT: u32 = 34;
pub const PCAN_ACCEPTANCE_FILTER_29BIT: u32 = 35;
pub const PCAN_IO_DIGITAL_CONFIGURATION: u32 = 36;
pub const PCAN_IO_DIGITAL_VALUE: u32 = 37;
pub const PCAN_IO_DIGITAL_SET: u32 = 38;
pub const PCAN_IO_DIGITAL_CLEAR: u32 = 39;
pub const PCAN_IO_ANALOG_VALUE: u32 = 40;
pub const PCAN_FIRMWARE_VERSION: u32 = 41;
pub const PCAN_ATTACHED_CHANNELS_COUNT: u32 = 42;
pub const PCAN_ATTACHED_CHANNELS: u32 = 43;
pub const PCAN_ALLOW_ECHO_FRAMES: u32 = 44;
pub const PCAN_DEVICE_PART_NUMBER: u32 = 45;
pub const PCAN_DEVICE_NUMBER: u32 = 1;
pub const PCAN_PARAMETER_OFF: u32 = 0;
pub const PCAN_PARAMETER_ON: u32 = 1;
pub const PCAN_FILTER_CLOSE: u32 = 0;
pub const PCAN_FILTER_OPEN: u32 = 1;
pub const PCAN_FILTER_CUSTOM: u32 = 2;
pub const PCAN_CHANNEL_UNAVAILABLE: u32 = 0;
pub const PCAN_CHANNEL_AVAILABLE: u32 = 1;
pub const PCAN_CHANNEL_OCCUPIED: u32 = 2;
pub const PCAN_CHANNEL_PCANVIEW: u32 = 3;
pub const PCAN_MESSAGE_STANDARD: u32 = 0;
pub const PCAN_MESSAGE_RTR: u32 = 1;
pub const PCAN_MESSAGE_EXTENDED: u32 = 2;
pub const PCAN_MESSAGE_FD: u32 = 4;
pub const PCAN_MESSAGE_BRS: u32 = 8;
pub const PCAN_MESSAGE_ESI: u32 = 16;
pub const PCAN_MESSAGE_ECHO: u32 = 32;
pub const PCAN_MESSAGE_ERRFRAME: u32 = 64;
pub const PCAN_MESSAGE_STATUS: u32 = 128;
pub const PCAN_MODE_STANDARD: u32 = 0;
pub const PCAN_MODE_EXTENDED: u32 = 2;
pub const PCAN_BAUD_1M: u32 = 20;
pub const PCAN_BAUD_800K: u32 = 22;
pub const PCAN_BAUD_500K: u32 = 28;
pub const PCAN_BAUD_250K: u32 = 284;
pub const PCAN_BAUD_125K: u32 = 796;
pub const PCAN_BAUD_100K: u32 = 17199;
pub const PCAN_BAUD_95K: u32 = 49998;
pub const PCAN_BAUD_83K: u32 = 34091;
pub const PCAN_BAUD_50K: u32 = 18223;
pub const PCAN_BAUD_47K: u32 = 5140;
pub const PCAN_BAUD_33K: u32 = 35631;
pub const PCAN_BAUD_20K: u32 = 21295;
pub const PCAN_BAUD_10K: u32 = 26415;
pub const PCAN_BAUD_5K: u32 = 32639;
pub const PCAN_TYPE_ISA: u32 = 1;
pub const PCAN_TYPE_ISA_SJA: u32 = 9;
pub const PCAN_TYPE_ISA_PHYTEC: u32 = 4;
pub const PCAN_TYPE_DNG: u32 = 2;
pub const PCAN_TYPE_DNG_EPP: u32 = 3;
pub const PCAN_TYPE_DNG_SJA: u32 = 5;
pub const PCAN_TYPE_DNG_SJA_EPP: u32 = 6;
pub type LPSTR = *mut ::std::os::raw::c_char;
pub type DWORD = u32;
pub type WORD = u16;
pub type BYTE = u8;
pub type UINT64 = u64;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tagTPCANMsg {
pub ID: DWORD,
pub MSGTYPE: BYTE,
pub LEN: BYTE,
pub DATA: [BYTE; 8usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of tagTPCANMsg"][::std::mem::size_of::<tagTPCANMsg>() - 16usize];
["Alignment of tagTPCANMsg"]
[::std::mem::align_of::<tagTPCANMsg>() - 4usize];
["Offset of field: tagTPCANMsg::ID"]
[::std::mem::offset_of!(tagTPCANMsg, ID) - 0usize];
["Offset of field: tagTPCANMsg::MSGTYPE"]
[::std::mem::offset_of!(tagTPCANMsg, MSGTYPE) - 4usize];
["Offset of field: tagTPCANMsg::LEN"]
[::std::mem::offset_of!(tagTPCANMsg, LEN) - 5usize];
["Offset of field: tagTPCANMsg::DATA"]
[::std::mem::offset_of!(tagTPCANMsg, DATA) - 6usize];
};
pub type TPCANMsg = tagTPCANMsg;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tagTPCANTimestamp {
pub millis: DWORD,
pub millis_overflow: WORD,
pub micros: WORD,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of tagTPCANTimestamp"]
[::std::mem::size_of::<tagTPCANTimestamp>() - 8usize];
["Alignment of tagTPCANTimestamp"]
[::std::mem::align_of::<tagTPCANTimestamp>() - 4usize];
["Offset of field: tagTPCANTimestamp::millis"]
[::std::mem::offset_of!(tagTPCANTimestamp, millis) - 0usize];
["Offset of field: tagTPCANTimestamp::millis_overflow"]
[::std::mem::offset_of!(tagTPCANTimestamp, millis_overflow) - 4usize];
["Offset of field: tagTPCANTimestamp::micros"]
[::std::mem::offset_of!(tagTPCANTimestamp, micros) - 6usize];
};
pub type TPCANTimestamp = tagTPCANTimestamp;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tagTPCANMsgFD {
pub ID: DWORD,
pub MSGTYPE: BYTE,
pub DLC: BYTE,
pub DATA: [BYTE; 64usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of tagTPCANMsgFD"][::std::mem::size_of::<tagTPCANMsgFD>() - 72usize];
["Alignment of tagTPCANMsgFD"]
[::std::mem::align_of::<tagTPCANMsgFD>() - 4usize];
["Offset of field: tagTPCANMsgFD::ID"]
[::std::mem::offset_of!(tagTPCANMsgFD, ID) - 0usize];
["Offset of field: tagTPCANMsgFD::MSGTYPE"]
[::std::mem::offset_of!(tagTPCANMsgFD, MSGTYPE) - 4usize];
["Offset of field: tagTPCANMsgFD::DLC"]
[::std::mem::offset_of!(tagTPCANMsgFD, DLC) - 5usize];
["Offset of field: tagTPCANMsgFD::DATA"]
[::std::mem::offset_of!(tagTPCANMsgFD, DATA) - 6usize];
};
pub type TPCANMsgFD = tagTPCANMsgFD;
pub struct libPCBUSB {
__library: ::libloading::Library,
pub CAN_Initialize: Result<
unsafe extern "C" fn(
Channel: WORD,
Btr0Btr1: WORD,
HwType: BYTE,
IOPort: DWORD,
Interrupt: WORD,
) -> DWORD,
::libloading::Error,
>,
pub CAN_InitializeFD: Result<
unsafe extern "C" fn(Channel: WORD, BitrateFD: LPSTR) -> DWORD,
::libloading::Error,
>,
pub CAN_Uninitialize: Result<
unsafe extern "C" fn(Channel: WORD) -> DWORD,
::libloading::Error,
>,
pub CAN_Reset: Result<
unsafe extern "C" fn(Channel: WORD) -> DWORD,
::libloading::Error,
>,
pub CAN_GetStatus: Result<
unsafe extern "C" fn(Channel: WORD) -> DWORD,
::libloading::Error,
>,
pub CAN_Read: Result<
unsafe extern "C" fn(
Channel: WORD,
MessageBuffer: *mut TPCANMsg,
TimestampBuffer: *mut TPCANTimestamp,
) -> DWORD,
::libloading::Error,
>,
pub CAN_ReadFD: Result<
unsafe extern "C" fn(
Channel: WORD,
MessageBuffer: *mut TPCANMsgFD,
TimestampBuffer: *mut UINT64,
) -> DWORD,
::libloading::Error,
>,
pub CAN_Write: Result<
unsafe extern "C" fn(
Channel: WORD,
MessageBuffer: *mut TPCANMsg,
) -> DWORD,
::libloading::Error,
>,
pub CAN_WriteFD: Result<
unsafe extern "C" fn(
Channel: WORD,
MessageBuffer: *mut TPCANMsgFD,
) -> DWORD,
::libloading::Error,
>,
pub CAN_FilterMessages: Result<
unsafe extern "C" fn(
Channel: WORD,
FromID: DWORD,
ToID: DWORD,
Mode: BYTE,
) -> DWORD,
::libloading::Error,
>,
pub CAN_GetValue: Result<
unsafe extern "C" fn(
Channel: WORD,
Parameter: BYTE,
Buffer: *mut ::std::os::raw::c_void,
BufferLength: DWORD,
) -> DWORD,
::libloading::Error,
>,
pub CAN_SetValue: Result<
unsafe extern "C" fn(
Channel: WORD,
Parameter: BYTE,
Buffer: *mut ::std::os::raw::c_void,
BufferLength: DWORD,
) -> DWORD,
::libloading::Error,
>,
pub CAN_GetErrorText: Result<
unsafe extern "C" fn(
Error: DWORD,
Language: WORD,
Buffer: LPSTR,
) -> DWORD,
::libloading::Error,
>,
pub CAN_LookUpChannel: Result<
unsafe extern "C" fn(
Parameters: LPSTR,
FoundChannel: *mut WORD,
) -> DWORD,
::libloading::Error,
>,
}
impl libPCBUSB {
pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
where
P: AsRef<::std::ffi::OsStr>,
{
let library = unsafe { ::libloading::Library::new(path) }?;
unsafe { Self::from_library(library) }
}
pub unsafe fn from_library<L>(
library: L,
) -> Result<Self, ::libloading::Error>
where
L: Into<::libloading::Library>,
{
let __library = library.into();
let CAN_Initialize =
unsafe { __library.get(b"CAN_Initialize\0") }.map(|sym| *sym);
let CAN_InitializeFD =
unsafe { __library.get(b"CAN_InitializeFD\0") }.map(|sym| *sym);
let CAN_Uninitialize =
unsafe { __library.get(b"CAN_Uninitialize\0") }.map(|sym| *sym);
let CAN_Reset =
unsafe { __library.get(b"CAN_Reset\0") }.map(|sym| *sym);
let CAN_GetStatus =
unsafe { __library.get(b"CAN_GetStatus\0") }.map(|sym| *sym);
let CAN_Read = unsafe { __library.get(b"CAN_Read\0") }.map(|sym| *sym);
let CAN_ReadFD =
unsafe { __library.get(b"CAN_ReadFD\0") }.map(|sym| *sym);
let CAN_Write =
unsafe { __library.get(b"CAN_Write\0") }.map(|sym| *sym);
let CAN_WriteFD =
unsafe { __library.get(b"CAN_WriteFD\0") }.map(|sym| *sym);
let CAN_FilterMessages =
unsafe { __library.get(b"CAN_FilterMessages\0") }.map(|sym| *sym);
let CAN_GetValue =
unsafe { __library.get(b"CAN_GetValue\0") }.map(|sym| *sym);
let CAN_SetValue =
unsafe { __library.get(b"CAN_SetValue\0") }.map(|sym| *sym);
let CAN_GetErrorText =
unsafe { __library.get(b"CAN_GetErrorText\0") }.map(|sym| *sym);
let CAN_LookUpChannel =
unsafe { __library.get(b"CAN_LookUpChannel\0") }.map(|sym| *sym);
Ok(libPCBUSB {
__library,
CAN_Initialize,
CAN_InitializeFD,
CAN_Uninitialize,
CAN_Reset,
CAN_GetStatus,
CAN_Read,
CAN_ReadFD,
CAN_Write,
CAN_WriteFD,
CAN_FilterMessages,
CAN_GetValue,
CAN_SetValue,
CAN_GetErrorText,
CAN_LookUpChannel,
})
}
#[doc = " <summary>\n Initializes a PCAN Channel\n </summary>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"Btr0Btr1\">\"The speed for the communication (BTR0BTR1 code)\"</param>\n <param name=\"HwType\">\"Non-PnP: The type of hardware and operation mode\"</param>\n <param name=\"IOPort\">\"Non-PnP: The I/O address for the parallel port\"</param>\n <param name=\"Interrupt\">\"Non-PnP: Interrupt number of the parallel port\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_Initialize(
&self,
Channel: WORD,
Btr0Btr1: WORD,
HwType: BYTE,
IOPort: DWORD,
Interrupt: WORD,
) -> DWORD {
unsafe {
(self
.CAN_Initialize
.as_ref()
.expect("Expected function, got error."))(
Channel, Btr0Btr1, HwType, IOPort, Interrupt,
)
}
}
#[doc = " <example>f_clock=80000000,nom_brp=10,nom_tseg1=5,nom_tseg2=2,nom_sjw=1,data_brp=4,data_tseg1=7,data_tseg2=2,data_sjw=1</example>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_InitializeFD(
&self,
Channel: WORD,
BitrateFD: LPSTR,
) -> DWORD {
unsafe {
(self
.CAN_InitializeFD
.as_ref()
.expect("Expected function, got error."))(
Channel, BitrateFD
)
}
}
#[doc = " <summary>\n Uninitializes one or all PCAN Channels initialized by CAN_Initialize\n </summary>\n <remarks>Giving the TPCANHandle value \"PCAN_NONEBUS\",\n uninitialize all initialized channels</remarks>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_Uninitialize(&self, Channel: WORD) -> DWORD {
unsafe {
(self
.CAN_Uninitialize
.as_ref()
.expect("Expected function, got error."))(Channel)
}
}
#[doc = " <summary>\n Resets the receive and transmit queues of the PCAN Channel\n </summary>\n <remarks>\n A reset of the CAN controller is not performed.\n </remarks>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_Reset(&self, Channel: WORD) -> DWORD {
unsafe {
(self
.CAN_Reset
.as_ref()
.expect("Expected function, got error."))(Channel)
}
}
#[doc = " <summary>\n Gets the current status of a PCAN Channel\n </summary>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_GetStatus(&self, Channel: WORD) -> DWORD {
unsafe {
(self
.CAN_GetStatus
.as_ref()
.expect("Expected function, got error."))(Channel)
}
}
#[doc = " <summary>\n Reads a CAN message from the receive queue of a PCAN Channel\n </summary>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"MessageBuffer\">\"A TPCANMsg structure buffer to store the CAN message\"</param>\n <param name=\"TimestampBuffer\">\"A TPCANTimestamp structure buffer to get\n the reception time of the message. If this value is not desired, this parameter\n should be passed as NULL\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_Read(
&self,
Channel: WORD,
MessageBuffer: *mut TPCANMsg,
TimestampBuffer: *mut TPCANTimestamp,
) -> DWORD {
unsafe {
(self
.CAN_Read
.as_ref()
.expect("Expected function, got error."))(
Channel,
MessageBuffer,
TimestampBuffer,
)
}
}
#[doc = " <summary>\n Reads a CAN message from the receive queue of a FD capable PCAN Channel\n </summary>\n <param name=\"Channel\">\"The handle of a FD capable PCAN Channel\"</param>\n <param name=\"MessageBuffer\">\"A TPCANMsgFD structure buffer to store the CAN message\"</param>\n <param name=\"TimestampBuffer\">\"A TPCANTimestampFD buffer to get\n the reception time of the message. If this value is not desired, this parameter\n should be passed as NULL\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_ReadFD(
&self,
Channel: WORD,
MessageBuffer: *mut TPCANMsgFD,
TimestampBuffer: *mut UINT64,
) -> DWORD {
unsafe {
(self
.CAN_ReadFD
.as_ref()
.expect("Expected function, got error."))(
Channel,
MessageBuffer,
TimestampBuffer,
)
}
}
#[doc = " <summary>\n Transmits a CAN message\n </summary>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"MessageBuffer\">\"A TPCANMsg buffer with the message to be sent\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_Write(
&self,
Channel: WORD,
MessageBuffer: *mut TPCANMsg,
) -> DWORD {
unsafe {
(self
.CAN_Write
.as_ref()
.expect("Expected function, got error."))(
Channel,
MessageBuffer,
)
}
}
#[doc = " <summary>\n Transmits a CAN message over a FD capable PCAN Channel\n </summary>\n <param name=\"Channel\">\"The handle of a FD capable PCAN Channel\"</param>\n <param name=\"MessageBuffer\">\"A TPCANMsgFD buffer with the message to be sent\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_WriteFD(
&self,
Channel: WORD,
MessageBuffer: *mut TPCANMsgFD,
) -> DWORD {
unsafe {
(self
.CAN_WriteFD
.as_ref()
.expect("Expected function, got error."))(
Channel,
MessageBuffer,
)
}
}
#[doc = " <summary>\n Configures the reception filter.\n </summary>\n <remarks>The message filter will be expanded with every call to\n this function. If it is desired to reset the filter, please use\n the CAN_SetValue function</remarks>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"FromID\">\"The lowest CAN ID to be received\"</param>\n <param name=\"ToID\">\"The highest CAN ID to be received\"</param>\n <param name=\"Mode\">\"Message type, Standard (11-bit identifier) or\n Extended (29-bit identifier)\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_FilterMessages(
&self,
Channel: WORD,
FromID: DWORD,
ToID: DWORD,
Mode: BYTE,
) -> DWORD {
unsafe {
(self
.CAN_FilterMessages
.as_ref()
.expect("Expected function, got error."))(
Channel, FromID, ToID, Mode,
)
}
}
#[doc = " <summary>\n Retrieves a PCAN Channel value\n </summary>\n <remarks>Parameters can be present or not according with the kind\n of Hardware (PCAN Channel) being used. If a parameter is not available,\n a PCAN_ERROR_ILLPARAMTYPE error will be returned</remarks>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"Parameter\">\"The TPCANParameter parameter to get\"</param>\n <param name=\"Buffer\">\"Buffer for the parameter value\"</param>\n <param name=\"BufferLength\">\"Size in bytes of the buffer\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_GetValue(
&self,
Channel: WORD,
Parameter: BYTE,
Buffer: *mut ::std::os::raw::c_void,
BufferLength: DWORD,
) -> DWORD {
unsafe {
(self
.CAN_GetValue
.as_ref()
.expect("Expected function, got error."))(
Channel,
Parameter,
Buffer,
BufferLength,
)
}
}
#[doc = " <summary>\n Configures or sets a PCAN Channel value\n </summary>\n <remarks>Parameters can be present or not according with the kind\n of Hardware (PCAN Channel) being used. If a parameter is not available,\n a PCAN_ERROR_ILLPARAMTYPE error will be returned</remarks>\n <param name=\"Channel\">\"The handle of a PCAN Channel\"</param>\n <param name=\"Parameter\">\"The TPCANParameter parameter to set\"</param>\n <param name=\"Buffer\">\"Buffer with the value to be set\"</param>\n <param name=\"BufferLength\">\"Size in bytes of the buffer\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_SetValue(
&self,
Channel: WORD,
Parameter: BYTE,
Buffer: *mut ::std::os::raw::c_void,
BufferLength: DWORD,
) -> DWORD {
unsafe {
(self
.CAN_SetValue
.as_ref()
.expect("Expected function, got error."))(
Channel,
Parameter,
Buffer,
BufferLength,
)
}
}
#[doc = " <summary>\n Returns a descriptive text of a given TPCANStatus error\n code, in any desired language\n </summary>\n <remarks>The current languages available for translation are:\n Neutral (0x00), German (0x07), English (0x09), Spanish (0x0A),\n Italian (0x10) and French (0x0C)</remarks>\n <param name=\"Error\">\"A TPCANStatus error code\"</param>\n <param name=\"Language\">\"Indicates a 'Primary language ID'\"</param>\n <param name=\"Buffer\">\"Buffer for a null terminated char array\"</param>\n <returns>\"A TPCANStatus error code\"</returns>"]
pub unsafe fn CAN_GetErrorText(
&self,
Error: DWORD,
Language: WORD,
Buffer: LPSTR,
) -> DWORD {
unsafe {
(self
.CAN_GetErrorText
.as_ref()
.expect("Expected function, got error."))(
Error, Language, Buffer,
)
}
}
#[doc = " <summary>\n Finds a PCAN-Basic channel that matches with the given parameters\n </summary>\n <param name=\"Parameters\">A comma separated string contained pairs of\n parameter-name/value to be matched within a PCAN-Basic channel</param>\n <param name=\"FoundChannel\">Buffer for returning the PCAN-Basic channel,\n when found</param>\n <returns>A TPCANStatus error code</returns>"]
pub unsafe fn CAN_LookUpChannel(
&self,
Parameters: LPSTR,
FoundChannel: *mut WORD,
) -> DWORD {
unsafe {
(self
.CAN_LookUpChannel
.as_ref()
.expect("Expected function, got error."))(
Parameters,
FoundChannel,
)
}
}
}