PCanDevice.h
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 #ifndef CPCANDEVICE_H
19 #define CPCANDEVICE_H
20 
21 #include "../Device/ProtocolDevice.h"
22 #include <libpcan/libpcan.h>
23 
25 {
26  private:
27 
28  // ---- private data ---------------------------------------------------- ;
29 
30  // ---- private auxiliary functions ------------------------------------- ;
31 
32  protected:
33 
34  // ---- protected data -------------------------------------------------- ;
35 
36  HANDLE m_handle;
37  int m_hDevice;
41  unsigned long m_uiBaudRate;
42  unsigned short m_uiQueueSize;
43  unsigned long m_uiTimeOut;
45 
46  // ---- protected auxiliary functions ----------------------------------- ;
47 
48  int getDeviceError(int iErrorState);
49  int setBaudRate();
50  int setBaudRate(unsigned char iBaudRate);
51  int setMessageId(unsigned long uiMessageId);
52  int clearReadQueue();
53  int reinit(unsigned char ucBaudRateId);
54  int readDevice(CProtocolMessage& rclProtocolMessage);
55  int writeDevice(CProtocolMessage& rclProtocolMessage);
56  char * m_DeviceName;
57 
58  public:
59 
60  // ---- public data ----------------------------------------------------- ;
61 
62 
63 
64  // ---- constructors / destructor --------------------------------------- ;
65 
67  CPCanDevice();
69  CPCanDevice(const CPCanDevice& rclPCanDevice);
71  virtual ~CPCanDevice();
72 
73  // ---- operators ------------------------------------------------------- ;
74 
75  // assignment operator
76  CPCanDevice& operator=(const CPCanDevice& rclPCanDevice);
77 
78  // ---- query functions ------------------------------------------------- ;
79 
80  // ---- modify functions ------------------------------------------------ ;
81 
82  void setQueueSize(unsigned short uiQueueSize);
83  void setTimeOut(unsigned long uiTimeOut);
84 
85  // ---- I/O functions --------------------------------------------------- ;
86 
87  // ---- exec functions -------------------------------------------------- ;
88 
89  int init();
90  int init(unsigned long baudRate);
91  int init(const char* acInitString);
92  int exit();
94 };
95 
96 #endif
int setMessageId(unsigned long uiMessageId)
Definition: PCanDevice.cpp:169
int setBaudRate()
Definition: PCanDevice.cpp:115
int reinit(unsigned char ucBaudRateId)
Definition: PCanDevice.cpp:211
unsigned short m_uiQueueSize
Definition: PCanDevice.h:42
int readDevice(CProtocolMessage &rclProtocolMessage)
Definition: PCanDevice.cpp:348
virtual ~CPCanDevice()
destructor
Definition: PCanDevice.cpp:441
char * m_DeviceName
Definition: PCanDevice.h:56
unsigned long m_uiTimeOut
Definition: PCanDevice.h:43
int m_iNoOfRetries
Definition: PCanDevice.h:44
int m_iDeviceId
Definition: PCanDevice.h:39
void setQueueSize(unsigned short uiQueueSize)
Definition: PCanDevice.cpp:472
int waitForStartMotionAll()
Definition: PCanDevice.cpp:763
int getDeviceError(int iErrorState)
Definition: PCanDevice.cpp:35
int m_hSyncDevice
Definition: PCanDevice.h:38
HANDLE m_handle
Definition: PCanDevice.h:36
CPCanDevice & operator=(const CPCanDevice &rclPCanDevice)
Definition: PCanDevice.cpp:454
int m_hDevice
Definition: PCanDevice.h:37
CPCanDevice()
default constructor
Definition: PCanDevice.cpp:429
int clearReadQueue()
Definition: PCanDevice.cpp:186
bool m_bInitialized
Definition: PCanDevice.h:40
int writeDevice(CProtocolMessage &rclProtocolMessage)
Definition: PCanDevice.cpp:392
void setTimeOut(unsigned long uiTimeOut)
Definition: PCanDevice.cpp:477
unsigned long m_uiBaudRate
Definition: PCanDevice.h:41


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