OpcUaCanOpen
CANopen OPC-UA server
pkcan.h
Go to the documentation of this file.
1 /*
2  *pkcan.h
3  *
4  * Created on: JUL 2, 2012
5  * Author: vfilimon
6  */
7 
8 #ifndef CCANPKSCAN_H_
9 #define CCANPKSCAN_H_
10 
11 
12 #include <string>
13 using namespace std;
14 
15 #include "windows.h"
16 
17 #ifdef WIN32
18 #include "Winsock2.h"
19 #endif
20 
21 #include <PCANBasic.h>
22 #include "CCanAccess.h"
23 
24 //class CCanCallback;
25 
26 class PKCanScan: public CCanAccess
27 {
28 public:
29  PKCanScan();
30  virtual ~PKCanScan();
31  virtual bool createBUS(const char * ,const char *);
32  virtual bool sendMessage(short cobID, unsigned char len, unsigned char *message);
33  virtual bool sendRemoteRequest(short cobID);
34 
35  virtual bool getErrorMessage(long error, char **message);
36 private:
37  TPCANHandle getHandle(const char *name);
38  string getNamePort() { return canName; }
39  bool sendErrorCode(long);
40 
41  TPCANStatus bus_status;
42  bool run_can;
44  unsigned int BaudRate;
45 
46  string canName;
47 
48 #define Timeout 1000
49 
50  TPCANHandle canObjHandler;
51  bool configureCanboard(const char *,const char *);
52 
54  HANDLE m_ReadEvent;
55 
56  // Thread ID for the CAN update scan manager thread.
58 
59  static DWORD WINAPI CanScanControlThread(LPVOID pCanScan);
60 
61 };
62 
63 #endif