ESDDevice.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 SCHUNK GmbH & Co. KG
3  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10 
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include "ESDDevice.h"
19 #if defined (_WIN32)
20 #include "../include/ntcan.h"
21 #endif
22 #if defined(__LINUX__)
23 #include <libntcan/ntcan.h>
24 #endif
25 #if defined (__QNX__)
26 #include "../include/ntcan_qnx.h"
27 #endif
28 
29 // ========================================================================== ;
30 // ;
31 // ---- private auxiliary functions ----------------------------------------- ;
32 // ;
33 // ========================================================================== ;
34 
35 // ========================================================================== ;
36 // ;
37 // ---- protected auxiliary functions --------------------------------------- ;
38 // ;
39 // ========================================================================== ;
40 
41 int CESDDevice::getDeviceError(int iErrorState)
42 {
43  if(iErrorState == NTCAN_CONTR_BUSY)
44  {
45  warning("NTCAN_CONTR_BUSY");
46  return ERRID_DEV_READERROR;
47  }
48  else if(iErrorState == NTCAN_CONTR_OFF_BUS)
49  {
50  warning("NTCAN_CONTR_OFF_BUS");
51  return ERRID_DEV_READERROR;
52  }
53  else if(iErrorState == NTCAN_CONTR_WARN)
54  {
55  warning("NTCAN_CONTR_WARN");
56  return ERRID_DEV_READERROR;
57  }
58  else if(iErrorState == NTCAN_ID_NOT_ENABLED)
59  {
60  warning("NTCAN_ID_NOT_ENABLED");
61  return ERRID_DEV_READERROR;
62  }
63 #if defined(_WIN32)
64  else if(iErrorState == NTCAN_INVALID_HANDLE)
65  {
66  warning("NTCAN_INVALID_HANDLE");
67  return ERRID_DEV_READERROR;
68  }
69  else if(iErrorState == NTCAN_INVALID_HARDWARE)
70  {
71  warning("NTCAN_INVALID_HARDWARE");
72  return ERRID_DEV_READERROR;
73  }
74  else if(iErrorState == NTCAN_INVALID_PARAMETER)
75  {
76  warning("NTCAN_INVALID_PARAMETER");
77  return ERRID_DEV_READERROR;
78  }
79  else if(iErrorState == NTCAN_NET_NOT_FOUND)
80  {
81  warning("NTCAN_NET_NOT_FOUND");
82  return ERRID_DEV_READERROR;
83  }
84 #endif
85  else if(iErrorState == NTCAN_MESSAGE_LOST)
86  {
87  warning("NTCAN_MESSAGE_LOST");
88  return ERRID_DEV_READERROR;
89  }
90  else if(iErrorState == NTCAN_NO_ID_ENABLED)
91  {
92  warning("NTCAN_NO_ID_ENABLED");
93  return ERRID_DEV_READERROR;
94  }
95  else if(iErrorState == NTCAN_RX_TIMEOUT)
96  {
97  warning("NTCAN_RX_TIMEOUT");
98  return ERRID_DEV_READTIMEOUT;
99  }
100  else if(iErrorState == NTCAN_TX_TIMEOUT)
101  {
102  warning("NTCAN_TX_TIMEOUT");
103  return ERRID_DEV_WRITETIMEOUT;
104  }
105  else if(iErrorState == NTCAN_TX_ERROR)
106  {
107  warning("NTCAN_TX_ERROR");
108  return ERRID_DEV_WRITEERROR;
109  }
110  return ERRID_DEV_WRITEERROR;
111 }
112 
114 {
115  int iRetVal = 0;
116  m_iErrorState = 0;
117  switch( m_iBaudRate )
118  {
119  case 125:
120  m_uiBaudRate=0x06; // 125k
121  break;
122  case 250:
123  m_uiBaudRate=0x04; // 250k
124  break;
125  case 500:
126  m_uiBaudRate=0x02; // 500k
127  break;
128  case 1000:
129  m_uiBaudRate=0x00; // 1000k
130  break;
131  default:
132  m_uiBaudRate=0x04; // 250k
133  break;
134  }
135 
136  iRetVal = canSetBaudrate(m_hDevice, m_uiBaudRate);
137  if(iRetVal != NTCAN_SUCCESS)
138  {
139  warning("can set baudrate 0x%x failed Errorcode: %d", m_uiBaudRate, iRetVal);
140  getDeviceError(iRetVal);
142  return m_iErrorState;
143  }
144  iRetVal = canSetBaudrate(m_hSyncDevice, m_uiBaudRate);
145  if(iRetVal != NTCAN_SUCCESS)
146  {
147  warning("can set baudrate 0x%x failed Errorcode: %d", m_uiBaudRate, iRetVal);
148  getDeviceError(iRetVal);
150  return m_iErrorState;
151  }
152  return m_iErrorState;
153 }
154 
155 int CESDDevice::setMessageId(unsigned long uiMessageId)
156 {
157  int iRetVal = 0;
158  m_iErrorState = 0;
159  iRetVal = canIdAdd(m_hDevice, uiMessageId);
160  if(iRetVal != NTCAN_SUCCESS)
161  {
162  warning("can add ID failed Errorcode: %d", iRetVal);
163  getDeviceError(iRetVal);
165  return m_iErrorState;
166  }
167  return m_iErrorState;
168 }
169 
171 {
172  int iRetVal = 0;
173  int32_t iNumberOfMessages = 1;
174  static CMSG clESDProtocolMessage;
175  m_iErrorState = 0;
176  do
177  {
178  iRetVal = canRead(m_hDevice, &clESDProtocolMessage, &iNumberOfMessages, NULL);
179  }while( ! ( ( iNumberOfMessages == 0 ) && ( iRetVal == NTCAN_SUCCESS ) ) );
180 
181  return m_iErrorState;
182 }
183 
184 int CESDDevice::reinit(unsigned char ucBaudRateId)
185 {
186  int i, iRetVal = 0;
187  m_iErrorState = 0;
188  if(!m_bInitFlag)
189  {
190  warning("device not initialized");
192  return m_iErrorState;
193  }
194  switch(ucBaudRateId)
195  {
197  m_iBaudRate = 125;
198  break;
200  m_iBaudRate = 250;
201  break;
203  m_iBaudRate = 500;
204  break;
206  m_iBaudRate = 1000;
207  break;
208  }
209  iRetVal = canClose(m_hDevice);
210  if(iRetVal != NTCAN_SUCCESS)
211  {
212  warning("can close failed Errorcode: %d", iRetVal);
213  getDeviceError(iRetVal);
215  }
216  iRetVal = canClose(m_hSyncDevice);
217  if(iRetVal != NTCAN_SUCCESS)
218  {
219  warning("can close failed Errorcode: %d", iRetVal);
220  getDeviceError(iRetVal);
222  }
223  m_bInitFlag = false;
224  iRetVal = canOpen(
225  m_iDeviceId, // Net
226  0, // Mode
227  m_uiQueueSize, // TX Queue
228  m_uiQueueSize, // RX Queue
229  20*m_uiTimeOut, // Tx Timeout
230  m_uiTimeOut, // Rx Timeout
231  &m_hDevice);
232  if(iRetVal != NTCAN_SUCCESS)
233  {
234  warning("can open failed Errorcode: %d", iRetVal);
235  getDeviceError(iRetVal);
237  return m_iErrorState;
238  }
239  /*iRetVal = canOpen(
240  m_iDeviceId, // Net
241  0, // Mode
242  1, // TX Queue
243  1, // RX Queue
244  600, // Tx Timeout
245  100, // Rx Timeout
246  &m_hSyncDevice);
247  if(iRetVal != NTCAN_SUCCESS)
248  {
249  warning("can open failed Errorcode: %d", iRetVal);
250  getDeviceError(iRetVal);
251  m_iErrorState = ERRID_DEV_INITERROR;
252  return m_iErrorState;
253  }*/
254 
256  if(m_iErrorState != 0)
257  return m_iErrorState;
258 
259  for(i = 0; i <= m_iModuleCountMax; i++)
260  {
261  iRetVal = canIdAdd(m_hDevice, (MSGID_ACK + i));
262  if(iRetVal != NTCAN_SUCCESS)
263  {
264  warning("can add ID failed Errorcode: %d", iRetVal);
265  getDeviceError(iRetVal);
267  return m_iErrorState;
268  }
269  iRetVal = canIdAdd(m_hDevice, (MSGID_STATE + i));
270  if(iRetVal != NTCAN_SUCCESS)
271  {
272  warning("can add ID failed Errorcode: %d", iRetVal);
273  getDeviceError(iRetVal);
275  return m_iErrorState;
276  }
277  }
278 
279  for(i = 0; i < MAX_MP55; i++ )
280  {
281  iRetVal = canIdAdd(m_hDevice, (MSGID_MP55_RECV + i));
282  if(iRetVal != NTCAN_SUCCESS)
283  {
284  warning("can add ID failed Errorcode: %d", iRetVal);
285  getDeviceError(iRetVal);
287  return m_iErrorState;
288  }
289 
290  iRetVal = canIdAdd(m_hDevice, (0x180 + i));
291  if(iRetVal != NTCAN_SUCCESS)
292  {
293  warning("can add ID failed Errorcode: %d", iRetVal);
294  getDeviceError(iRetVal);
296  return m_iErrorState;
297  }
298  }
299 
300  for(i = 0; i < MAX_SCHUNK; i++ )
301  {
302  iRetVal = canIdAdd(m_hDevice, (MSGID_SCHUNK_RECV + i));
303  if(iRetVal != NTCAN_SUCCESS)
304  {
305  warning("can add ID failed Errorcode: %d", iRetVal);
306  getDeviceError(iRetVal);
308  return m_iErrorState;
309  }
310  }
311 
312  iRetVal = canIdAdd(m_hSyncDevice, MSGID_ALL);
313  if(iRetVal != NTCAN_SUCCESS)
314  {
315  warning("can add ID failed Errorcode: %d", iRetVal);
316  getDeviceError(iRetVal);
318  return m_iErrorState;
319  }
320 
322  if(m_iErrorState != 0)
323  return m_iErrorState;
324 
325  if(m_iErrorState == 0)
326  m_bInitFlag = true;
327 
329  return m_iErrorState;
330 }
331 
332 int CESDDevice::readDevice(CProtocolMessage& rclProtocolMessage)
333 {
334  int iRetVal = 0;
335  int32_t iNumberOfMessages = 1;
336  CMSG clESDProtocolMessage;
337  m_iErrorState = 0;
338 
339 #if defined ( _WIN32 )
340  float fTimeDiff = 0;
341  double dFrequency = 0;
342  LARGE_INTEGER liTime, liTimeStart, liTimeEnd;
343 
344  QueryPerformanceFrequency( &liTime );
345  dFrequency = liTime.LowPart;
346 
347  QueryPerformanceCounter( &liTimeStart );
348  do
349  {
350  iNumberOfMessages = 1;
351  iRetVal = canTake( m_hDevice, &clESDProtocolMessage, &iNumberOfMessages );
352  if(iRetVal != NTCAN_SUCCESS)
353  {
354  warning("can read failed Errorcode: %d", iRetVal);
355  m_iErrorState = getDeviceError(iRetVal);
356  return m_iErrorState;
357  }
358  QueryPerformanceCounter( &liTimeEnd );
359  fTimeDiff = (float)(liTimeEnd.LowPart - liTimeStart.LowPart) / (float)dFrequency * 1000;
360 
361  if( fTimeDiff >= m_uiTimeOut )
362  {
364  return m_iErrorState;
365  }
366 
367  } while( iNumberOfMessages == 0 );
368 #else
369  iRetVal = canRead(m_hDevice, &clESDProtocolMessage, &iNumberOfMessages, NULL);
370  if(iRetVal != NTCAN_SUCCESS)
371  {
372  warning("can read failed Errorcode: %d", iRetVal);
373  m_iErrorState = getDeviceError(iRetVal);
374  return m_iErrorState;
375  }
376 #endif
377 
378  rclProtocolMessage.m_uiMessageId = clESDProtocolMessage.id;
379  rclProtocolMessage.m_ucMessageLength = clESDProtocolMessage.len;
380  memcpy(rclProtocolMessage.m_aucMessageData, clESDProtocolMessage.data, rclProtocolMessage.m_ucMessageLength);
381  printMessage(rclProtocolMessage,READ);
382 
383  return m_iErrorState;
384 }
385 
387 {
388  int iRetVal = 0;
389  int32_t iNumberOfMessages = 1;
390  CMSG clESDProtocolMessage;
391  m_iErrorState = 0;
392 
393  //debug output
394 
395  printMessage(rclProtocolMessage,WRITE);
396  clESDProtocolMessage.id = rclProtocolMessage.m_uiMessageId;
397  clESDProtocolMessage.len = rclProtocolMessage.m_ucMessageLength;
398  if(rclProtocolMessage.m_bRTRFlag)
399  clESDProtocolMessage.len |= 0x10;
400  memcpy(clESDProtocolMessage.data, rclProtocolMessage.m_aucMessageData, rclProtocolMessage.m_ucMessageLength);
401  iRetVal = canWrite(m_hDevice, &clESDProtocolMessage, &iNumberOfMessages, NULL);
402 // iRetVal = canSend(m_hDevice, &clESDProtocolMessage, &iNumberOfMessages);
403  if(iRetVal != NTCAN_SUCCESS)
404  {
405  warning("can send failed Errorcode: %d", iRetVal);
406  m_iErrorState = getDeviceError(iRetVal);
407  return m_iErrorState;
408  }
409 
410  return m_iErrorState;
411 }
412 
413 // ========================================================================== ;
414 // ;
415 // ---- constructors / destructor ------------------------------------------- ;
416 // ;
417 // ========================================================================== ;
418 
419 CESDDevice::CESDDevice() : m_hDevice(0), m_hSyncDevice(0), m_iDeviceId(-1), m_uiBaudRate(0), m_uiQueueSize(128), m_uiTimeOut(3) // ESD C331
420 {
422 }
423 
424 CESDDevice::CESDDevice(const CESDDevice& rclESDDevice)
425 {
426  error(-1, "Sorry constructor is not implemented");
427 }
428 
430 {
431  exit();
432 }
433 
434 // ========================================================================== ;
435 // ;
436 // ---- operators ----------------------------------------------------------- ;
437 // ;
438 // ========================================================================== ;
439 
441 {
442  error(-1, "Sorry operator= is not implemented");
443  return *this;
444 }
445 
446 // ========================================================================== ;
447 // ;
448 // ---- query functions ----------------------------------------------------- ;
449 // ;
450 // ========================================================================== ;
451 
452 // ========================================================================== ;
453 // ;
454 // ---- modify functions ---------------------------------------------------- ;
455 // ;
456 // ========================================================================== ;
457 
458 void CESDDevice::setQueueSize(unsigned short uiQueueSize)
459 {
460  m_uiQueueSize = uiQueueSize;
461 }
462 
463 void CESDDevice::setTimeOut(unsigned long uiTimeOut)
464 {
465  m_uiTimeOut= uiTimeOut;
466 }
467 
468 // ========================================================================== ;
469 // ;
470 // ---- I/O functions ------------------------------------------------------- ;
471 // ;
472 // ========================================================================== ;
473 
474 // ========================================================================== ;
475 // ;
476 // ---- exec functions ------------------------------------------------------ ;
477 // ;
478 // ========================================================================== ;
479 
481 {
482  return init(m_acInitString);
483 }
484 
485 int CESDDevice::init(const char* acInitString)
486 {
487  InitializeCriticalSection(&m_csDevice);
488  int i, iRetVal = 0;
489  int txTimeOut = 0;
490  char* pcToken;
491  char acString[128];
492  if(m_bInitFlag)
493  {
494  warning("device already initialized");
496  return m_iErrorState;
497  }
498  m_iDeviceId = -1;
499  m_iErrorState = 0;
500  strncpy(m_acInitString,acInitString,128);
501  strncpy(acString,acInitString,128);
502  pcToken = strtok( acString, ":" );
503  if( !pcToken )
505  return m_iErrorState;
506  }
507  if( strcmp( pcToken, "ESD" ) != 0 )
509  return m_iErrorState;
510  }
511  pcToken = strtok( NULL, "," );
512  if( !pcToken )
514  return m_iErrorState;
515  }
516  m_iDeviceId = atoi(pcToken);
517 
518  pcToken = strtok( NULL, "," );
519  if( !pcToken )
521  return m_iErrorState;
522  }
523  m_iBaudRate = atoi(pcToken);
524 
525 #if defined(__LINUX__)
526  m_uiTimeOut = 6;
527 #endif
528 #if defined (_WIN32)
529  switch( m_iBaudRate )
530  {
531  case 125:
532  case 250:
533  m_uiTimeOut = 4;
534  break;
535  case 500:
536  m_uiTimeOut = 3;
537  break;
538  case 1000:
539  m_uiTimeOut = 2;
540  break;
541  default:
542  m_uiTimeOut = 10;
543  break;
544  }
545 #endif
546 
547  try
548  {
549  iRetVal = canOpen(
550  m_iDeviceId, // Net
551  0, // Mode
552  m_uiQueueSize, // TX Queue
553  m_uiQueueSize, // RX Queue
554  m_uiTimeOut, // Tx Timeout
555  m_uiTimeOut, // Rx Timeout
556  &m_hDevice);
557  if(iRetVal != NTCAN_SUCCESS)
558  {
559  warning("can open failed Errorcode: %d", iRetVal);
560  getDeviceError(iRetVal);
562  return m_iErrorState;
563  }
564  iRetVal = canOpen(
565  m_iDeviceId, // Net
566  0, // Mode
567  1, // TX Queue
568  1, // RX Queue
569  600, // Tx Timeout
570  100, // Rx Timeout
571  &m_hSyncDevice);
572  if(iRetVal != NTCAN_SUCCESS)
573  {
574  warning("can open failed Errorcode: %d", iRetVal);
575  getDeviceError(iRetVal);
577  return m_iErrorState;
578  }
579  }
580  catch(...)
581  {
582  warning("init ESD device failed no library found");
584  return m_iErrorState;
585  }
586 
587  for(i = 0; i <= m_iModuleCountMax; i++)
588  {
589  iRetVal = canIdAdd(m_hDevice, (MSGID_ACK + i));
590  if(iRetVal != NTCAN_SUCCESS)
591  {
592  warning("can add ID failed Errorcode: %d", iRetVal);
593  getDeviceError(iRetVal);
595  return m_iErrorState;
596  }
597  iRetVal = canIdAdd(m_hDevice, (MSGID_STATE + i));
598  if(iRetVal != NTCAN_SUCCESS)
599  {
600  warning("can add ID failed Errorcode: %d", iRetVal);
601  getDeviceError(iRetVal);
603  return m_iErrorState;
604  }
605  }
606 
607  for(i = 0; i <= MAX_MP55; i++ )
608  {
609  iRetVal = canIdAdd(m_hDevice, (MSGID_MP55_RECV + i));
610  if(iRetVal != NTCAN_SUCCESS)
611  {
612  warning("can add ID failed Errorcode: %d", iRetVal);
613  getDeviceError(iRetVal);
615  return m_iErrorState;
616  }
617 
618  iRetVal = canIdAdd(m_hDevice, (0x180 + i));
619  if(iRetVal != NTCAN_SUCCESS)
620  {
621  warning("can add ID failed Errorcode: %d", iRetVal);
622  getDeviceError(iRetVal);
624  return m_iErrorState;
625  }
626  iRetVal = canIdAdd(m_hDevice, (0x600 + i));
627  if(iRetVal != NTCAN_SUCCESS)
628  {
629  warning("can add ID failed Errorcode: %d", iRetVal);
630  getDeviceError(iRetVal);
632  return m_iErrorState;
633  }
634  }
635 
636  for(i = 0; i < MAX_SCHUNK; i++ )
637  {
638  iRetVal = canIdAdd(m_hDevice, (MSGID_SCHUNK_RECV + i));
639  if(iRetVal != NTCAN_SUCCESS)
640  {
641  warning("can add ID failed Errorcode: %d", iRetVal);
642  getDeviceError(iRetVal);
644  return m_iErrorState;
645  }
646  }
647 
648  iRetVal = canIdAdd(m_hSyncDevice, MSGID_ALL);
649  if(iRetVal != NTCAN_SUCCESS)
650  {
651  warning("can add ID failed Errorcode: %d", iRetVal);
652  getDeviceError(iRetVal);
654  return m_iErrorState;
655  }
656 
658  if(m_iErrorState != 0)
659  return m_iErrorState;
660 
662  if(m_iErrorState != 0)
663  return m_iErrorState;
664 
665  if(m_iErrorState == 0)
666  m_bInitFlag = true;
667 
669  return m_iErrorState;
670 }
671 
673 {
674  int iRetVal = 0;
675  m_iErrorState = 0;
676  if(!m_bInitFlag)
677  {
678  warning("device not initialized");
680  return m_iErrorState;
681  }
682  EnterCriticalSection(&m_csDevice);
683  iRetVal = canClose(m_hDevice);
684  if(iRetVal != NTCAN_SUCCESS)
685  {
686  warning("can close failed Errorcode: %d", iRetVal);
687  getDeviceError(iRetVal);
689  }
690  iRetVal = canClose(m_hSyncDevice);
691  if(iRetVal != NTCAN_SUCCESS)
692  {
693  warning("can close failed Errorcode: %d", iRetVal);
694  getDeviceError(iRetVal);
696  }
697  m_bInitFlag = false;
698  LeaveCriticalSection(&m_csDevice);
699  DeleteCriticalSection(&m_csDevice);
700  return m_iErrorState;
701 }
702 
704 {
705  int iRetVal = 0;
706  bool bRecieved = false;
707  int32_t iNumberOfMessages = 1;
708  CMSG clESDProtocolMessage;
709  m_iErrorState = 0;
710 
711  do
712  {
713  iRetVal = canRead(m_hSyncDevice, &clESDProtocolMessage, &iNumberOfMessages, NULL);
714  if(iRetVal != NTCAN_SUCCESS)
715  {
716  warning("can read failed Errorcode: %d", iRetVal);
717  m_iErrorState = getDeviceError(iRetVal);
718  return m_iErrorState;
719  }
720  bRecieved = true;
721  if(clESDProtocolMessage.id != MSGID_ALL)
722  {
723  debug(1, "received CAN-ID %x, expected %x", clESDProtocolMessage.id, MSGID_ALL);
724  bRecieved = false;
725  }
726  if(clESDProtocolMessage.data[0] != CMDID_STARTMOVE)
727  {
728  debug(1, "wrong command ID");
729  bRecieved = false;
730  }
731  }
732  while(!bRecieved);
733  return m_iErrorState;
734 }
735 
void setQueueSize(unsigned short uiQueueSize)
Definition: ESDDevice.cpp:458
#define ERRID_DEV_BADINITSTRING
Definition: m5apiw32.h:209
unsigned short m_uiQueueSize
Definition: ESDDevice.h:51
#define NTCAN_MESSAGE_LOST
#define MSGID_MP55_RECV
#define NTCAN_ID_NOT_ENABLED
#define READ
#define MSGID_SCHUNK_RECV
unsigned char m_aucMessageData[8]
#define MSGID_ACK
uint8_t len
int updateModuleIdMap()
Definition: Device.cpp:3779
int exit()
Definition: ESDDevice.cpp:672
int waitForStartMotionAll()
Definition: ESDDevice.cpp:703
int initMessage(const char *pcClassName, int iDebuglevel=0, bool bDebug=true, bool bDebugFile=false)
Definition: Message.cpp:90
int32_t id
#define NTCAN_SUCCESS
EXPORT NTCAN_RESULT CALLTYPE canWrite(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len, OVERLAPPED *ovrlppd)
CRITICAL_SECTION m_csDevice
EXPORT NTCAN_RESULT CALLTYPE canTake(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len)
int m_iModuleCountMax
Definition: Device.h:46
int writeDevice(CProtocolMessage &rclProtocolMessage)
Definition: ESDDevice.cpp:386
#define ERRID_DEV_ISINITIALIZED
Definition: m5apiw32.h:223
#define NTCAN_CONTR_BUSY
void error(const int iErrorCode, const char *pcErrorMessage,...) const
Definition: Message.cpp:204
#define ERRID_DEV_WRITEERROR
Definition: m5apiw32.h:212
int m_iDeviceId
Definition: ESDDevice.h:49
int clearReadQueue()
Definition: ESDDevice.cpp:170
void setTimeOut(unsigned long uiTimeOut)
Definition: ESDDevice.cpp:463
#define ERRID_DEV_NOTINITIALIZED
Definition: m5apiw32.h:211
#define ERRID_DEV_READTIMEOUT
Definition: m5apiw32.h:215
#define BAUDRATEID_MOD_CAN_250K
Definition: m5apiw32.h:189
unsigned char m_ucMessageLength
int printMessage(CProtocolMessage &rclProtocolMessage, bool read)
int g_iDebugLevel
Definition: Message.cpp:20
#define NTCAN_CONTR_OFF_BUS
#define NTCAN_INVALID_PARAMETER
unsigned long m_uiBaudRate
Definition: ESDDevice.h:50
#define NTCAN_NO_ID_ENABLED
#define MAX_MP55
unsigned long m_uiMessageId
#define MSGID_STATE
#define MAX_SCHUNK
CESDDevice & operator=(const CESDDevice &rclESDDevice)
Definition: ESDDevice.cpp:440
#define ERRID_DEV_WRITETIMEOUT
Definition: m5apiw32.h:214
#define NTCAN_TX_TIMEOUT
void warning(const char *pcWarningMessage,...) const
Definition: Message.cpp:257
int reinit(unsigned char ucBaudRateId)
Definition: ESDDevice.cpp:184
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)
bool g_bDebug
Definition: Message.cpp:22
#define NTCAN_TX_ERROR
#define ERRID_DEV_INITERROR
Definition: m5apiw32.h:210
bool g_bDebugFile
Definition: Message.cpp:21
int setMessageId(unsigned long uiMessageId)
Definition: ESDDevice.cpp:155
bool m_bInitFlag
Definition: Device.h:40
#define NTCAN_INVALID_HARDWARE
EXPORT NTCAN_RESULT CALLTYPE canClose(NTCAN_HANDLE handle)
#define MSGID_ALL
uint8_t data[8]
#define ERRID_DEV_EXITERROR
Definition: m5apiw32.h:219
void debug(const int iDebugLevel, const char *pcDebugMessage,...) const
Definition: Message.cpp:332
int getDeviceError(int iErrorState)
Definition: ESDDevice.cpp:41
#define CMDID_STARTMOVE
#define WRITE
#define ERRID_DEV_NOLIBRARY
Definition: m5apiw32.h:222
EXPORT NTCAN_RESULT CALLTYPE canRead(NTCAN_HANDLE handle, CMSG *cmsg, int32_t *len, OVERLAPPED *ovrlppd)
int setBaudRate()
Definition: ESDDevice.cpp:113
#define BAUDRATEID_MOD_CAN_125K
Definition: m5apiw32.h:188
#define NTCAN_INVALID_HANDLE
int m_iErrorState
Definition: Device.h:50
#define ERRID_DEV_READERROR
Definition: m5apiw32.h:213
#define BAUDRATEID_MOD_CAN_1000K
Definition: m5apiw32.h:191
int init()
Definition: ESDDevice.cpp:480
virtual ~CESDDevice()
destructor
Definition: ESDDevice.cpp:429
CESDDevice()
default constructor
Definition: ESDDevice.cpp:419
#define NTCAN_CONTR_WARN
EXPORT NTCAN_RESULT CALLTYPE canIdAdd(NTCAN_HANDLE handle, int32_t id)
EXPORT NTCAN_RESULT CALLTYPE canSetBaudrate(NTCAN_HANDLE handle, uint32_t baud)
#define NTCAN_RX_TIMEOUT
char m_acInitString[128]
Definition: Device.h:42
unsigned long m_uiTimeOut
Definition: ESDDevice.h:52
int m_iBaudRate
Definition: Device.h:44
#define NTCAN_NET_NOT_FOUND
int readDevice(CProtocolMessage &rclProtocolMessage)
Definition: ESDDevice.cpp:332
#define BAUDRATEID_MOD_CAN_500K
Definition: m5apiw32.h:190


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:19