42 std::cout <<
"Closing CAN handle" << std::endl;
64 std::cout <<
"Initializing CAN network with id =" << iCanNet <<
", baudrate=" << iBaudrateVal << std::endl;
74 std::cout <<
"CanESD::CanESD(), init ok" << std::endl;
76 std::cout <<
"error in CANESD::receiveMsg: " <<
GetErrorStr(iRet) << std::endl;
80 std::cout <<
"CanESD::CanESD(), canSetBaudrate ok" << std::endl;
82 std::cout <<
"error in CANESD::receiveMsg: " <<
GetErrorStr(iRet) << std::endl;
89 for(
int i=0; i<=0x7FF; ++i ) {
92 std::cout <<
"error in CANESD::receiveMsg: " <<
GetErrorStr(iRet) << std::endl;
114 for(
int i=0; i<8; i++)
130 std::cout <<
"error in CANESD::transmitMsg: " <<
GetErrorStr(ret) << std::endl;
163 while((len == 0) && (i < iNrOfRetry));
168 std::cout <<
"error in CANESD::receiveMsgRetry: " <<
GetErrorStr(ret) << std::endl;
196 NTCANMsg.
data[0] = 0;
197 NTCANMsg.
data[1] = 0;
198 NTCANMsg.
data[2] = 0;
199 NTCANMsg.
data[3] = 0;
200 NTCANMsg.
data[4] = 0;
201 NTCANMsg.
data[5] = 0;
202 NTCANMsg.
data[6] = 0;
203 NTCANMsg.
data[7] = 0;
208 pCMsg->
set(0,0,0,0,0,0,0,0);
235 std::cout <<
"error in CANESD::receiveMsg: " <<
GetErrorStr(ret) << std::endl;
239 pCMsg->
set(0,0,0,0,0,0,0,0);
247 pCMsg->
set(0,0,0,0,0,0,0,0);
259 std::cout << (int)(NTCANMsg.
msg_lost) <<
" messages lost!" << std::endl;
287 for( i=0; i<8; ++i) {
291 std::cout <<
"Adding CAN ID " << cmd_id+i <<
" failed with errorcode: " << iRes <<
" " <<
GetErrorStr(iRes) << std::endl;
331 sprintf(msg,
"unknown error code %d", ntstatus);
361 std::cout <<
"BUS OFF" << std::endl;
365 std::cout <<
"ERROR PASSIVE" << std::endl;
370 std::cout <<
"Lost " << (int)evmsg.
evdata.
s[3] <<
" messages" << std::endl;
371 }
else if( evmsg.
evdata.
s[5] != 0 ) {
373 std::cout <<
"Lost " << (int)evmsg.
evdata.
s[5] <<
" messages from fifo" << std::endl;
bool receiveMsgRetry(CanMsg *pCMsg, int iNrOfRetry)
#define NTCAN_MESSAGE_LOST
#define NTCAN_INVALID_FIRMWARE
#define NTCAN_ID_NOT_ENABLED
CanESD(const char *cIniFile, bool bObjectMode=false)
EXPORT NTCAN_RESULT CALLTYPE canWrite(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len, OVERLAPPED *ovrlppd)
EXPORT NTCAN_RESULT CALLTYPE canIoctl(NTCAN_HANDLE handle, uint32_t ulCmd, void *pArg)
EXPORT NTCAN_RESULT CALLTYPE canTake(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len)
EXPORT NTCAN_RESULT CALLTYPE canReadEvent(NTCAN_HANDLE handle, EVMSG *evmsg, OVERLAPPED *ovrlppd)
bool receiveMsg(CanMsg *pCMsg)
bool transmitMsg(CanMsg CMsg, bool bBlocking=true)
#define NTCAN_CONTR_OFF_BUS
#define NTCAN_INVALID_PARAMETER
#define NTCAN_NO_ID_ENABLED
#define NTCAN_ID_ALREADY_ENABLED
#define NTCAN_EV_CAN_ERROR
int canIdAddGroup(NTCAN_HANDLE handle, int id)
int GetKeyInt(const char *pSect, const char *pKey, int *pValue, bool bWarnIfNotfound=true)
EXPORT NTCAN_RESULT CALLTYPE canOpen(int32_t net, uint32_t flags, int32_t txqueuesize, int32_t rxqueuesize, int32_t txtimeout, int32_t rxtimeout, NTCAN_HANDLE *handle)
#define NTCAN_INVALID_HARDWARE
#define NTCAN_OPERATION_ABORTED
#define NTCAN_MODE_OBJECT
EXPORT NTCAN_RESULT CALLTYPE canClose(NTCAN_HANDLE handle)
#define NTCAN_INSUFFICIENT_RESOURCES
#define NTCAN_IOCTL_FLUSH_RX_FIFO
#define NTCAN_INVALID_DRIVER
int SetFileName(std::string fileName, std::string strIniFileUsedBy="", bool bCreate=false)
bool receiveMsgTimeout(CanMsg *pCMsg, int nMicroSeconds)
std::string GetErrorStr(int ntstatus) const
#define NTCAN_PENDING_READ
#define NTCAN_INVALID_HANDLE
void set(BYTE Data0=0, BYTE Data1=0, BYTE Data2=0, BYTE Data3=0, BYTE Data4=0, BYTE Data5=0, BYTE Data6=0, BYTE Data7=0)
EXPORT NTCAN_RESULT CALLTYPE canSend(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len)
#define NTCAN_PENDING_WRITE
EXPORT NTCAN_RESULT CALLTYPE canIdAdd(NTCAN_HANDLE handle, int32_t id)
EXPORT NTCAN_RESULT CALLTYPE canSetBaudrate(NTCAN_HANDLE handle, uint32_t baud)
void Sleep(long dwMilliseconds)
#define NTCAN_NET_NOT_FOUND