ProtocolDevice.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 CPROTOCOLDEVICE_H
19 #define CPROTOCOLDEVICE_H
20 
21 #include "../Device/Device.h"
22 #include "../Device/ProtocolMessage.h"
23 #include "../Util/Random.h"
24 #include "../Util/StopWatch.h"
25 
26 #define READ 1
27 #define WRITE 0
28 
29 class CProtocolDevice : public CDevice
30 {
31  private:
32 
33  // ---- private data ---------------------------------------------------- ;
34 
35  // ---- private auxiliary functions ------------------------------------- ;
36 
37  protected:
38 
39  // ---- protected data -------------------------------------------------- ;
40 
41  CRITICAL_SECTION m_csDevice;
43 
44  // ---- protected auxiliary functions ----------------------------------- ;
45 
46  int getUnsignedLong(int iModuleId, unsigned long* puiData);
47 
48  int readChar(int iModuleId, int iCommandId, int iParameterId, char* pcData);
49  int readUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char* pucData);
50  int readShort(int iModuleId, int iCommandId, int iParameterId, short* piData);
51  int readUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short* puiData);
52  int readLong(int iModuleId, int iCommandId, int iParameterId, long* piData);
53  int readUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long* puiData);
54  int readFloat(int iModuleId, int iCommandId, int iParameterId, float* pfData);
55 
56  int readLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long* piData, unsigned char* pucData1, unsigned char* pucData2);
57  int readFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
58 
59  int write8Bytes(int iModuleId, bool bAck, void* pBytes);
60 
61  int writeChar(int iModuleId, int iCommandId, int iParameterId, char cData);
62  int writeUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char ucData);
63  int writeShort(int iModuleId, int iCommandId, int iParameterId, short iData);
64  int writeUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short uiData);
65  int writeLong(int iModuleId, int iCommandId, int iParameterId, long iData);
66  int writeUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long uiData);
67  int writeFloat(int iModuleId, int iCommandId, int iParameterId, float fData);
68 
69  int writeAll(int iCommandId, int iParameterId);
70  int writeCommand(int iModuleId, int iCommandId);
71 
72  int writeLongShort(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2);
73  int writeFloatShort(int iModuleId, int iCommandId, int iParameterId, float fData, short iData);
74 
75  int writeShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, short iData, long* piData, unsigned char* pucData1, unsigned char* pucData2);
76  int writeLongReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData, long* piData, unsigned char* pucData1, unsigned char* pucData2);
77  int writeLongShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2, long* piData, unsigned char* pucData1, unsigned char* pucData2);
78  int writeFloatReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
79  int writeFloatShortReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, short iData, float* pfData, unsigned char* pucData1, unsigned char* pucData2);
80 
81  virtual int reinit(unsigned char ucBaudRateId) = 0;
82  virtual int clearReadQueue() = 0;
83  virtual int setMessageId(unsigned long uiMessageId) = 0;
84  virtual int readDevice(CProtocolMessage& rclProtocolMessage) = 0;
85  virtual int writeDevice(CProtocolMessage& rclProtocolMessage) = 0;
86  int printMessage(CProtocolMessage & rclProtocolMessage, bool read);
87 
88  public:
89 
90  // ---- public data ----------------------------------------------------- ;
91 
92 
93  // ---- constructors / destructor --------------------------------------- ;
94 
98  CProtocolDevice(const CProtocolDevice& rclProtocolDevice);
100  virtual ~CProtocolDevice();
101 
102  // ---- operators ------------------------------------------------------- ;
103 
104  // assignment operator
105  CProtocolDevice& operator=(const CProtocolDevice& rclProtocolDevice);
106 
107  // ---- query functions ------------------------------------------------- ;
108 
109  int getDataDLR_FTS(std::vector<float>& rafData, long* piState);
110  int getDataSCHUNK_FTC(int iModuleId, int iChannelTypeId, std::vector<float>& rafData, short* piState);
111  int getDataMP55_IO(int iModuleId, float* pfData);
112  int getDataMP55_IO_fast(int iModuleId, float* pfData);
113  int getCanOpenRawAbsEnc(int iModuleId, short* piValue);
114 
115  // ---- modify functions ------------------------------------------------ ;
116 
117  int setNullSCHUNK_FTC(int iModuleId, short* piState);
118  int setTaraMP55_IO(int iModuleId, float fTara);
119  int setInitMP55_IO_fast(int iModuleId);
120 
121  // ---- I/O functions --------------------------------------------------- ;
122 
123  // ---- exec functions -------------------------------------------------- ;
124 
125  int initDLR_FTS();
126 
127 };
128 
129 #endif
CProtocolDevice::writeFloatShort
int writeFloatShort(int iModuleId, int iCommandId, int iParameterId, float fData, short iData)
Definition: ProtocolDevice.cpp:1506
CProtocolDevice
Definition: ProtocolDevice.h:29
CProtocolDevice::writeShortReadLongUnsignedChars
int writeShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, short iData, long *piData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:1587
CProtocolDevice::writeDevice
virtual int writeDevice(CProtocolMessage &rclProtocolMessage)=0
CProtocolDevice::CProtocolDevice
CProtocolDevice()
default constructor
Definition: ProtocolDevice.cpp:2027
CProtocolDevice::readFloatUnsignedChars
int readFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:727
CProtocolDevice::writeFloat
int writeFloat(int iModuleId, int iCommandId, int iParameterId, float fData)
Definition: ProtocolDevice.cpp:1262
CProtocolDevice::writeShort
int writeShort(int iModuleId, int iCommandId, int iParameterId, short iData)
Definition: ProtocolDevice.cpp:954
CProtocolDevice::readChar
int readChar(int iModuleId, int iCommandId, int iParameterId, char *pcData)
Definition: ProtocolDevice.cpp:107
CProtocolDevice::writeLongShort
int writeLongShort(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2)
Definition: ProtocolDevice.cpp:1425
CProtocolDevice::writeChar
int writeChar(int iModuleId, int iCommandId, int iParameterId, char cData)
Definition: ProtocolDevice.cpp:808
CProtocolDevice::printMessage
int printMessage(CProtocolMessage &rclProtocolMessage, bool read)
Definition: ProtocolDevice.cpp:3147
CProtocolDevice::getDataDLR_FTS
int getDataDLR_FTS(std::vector< float > &rafData, long *piState)
Definition: ProtocolDevice.cpp:2058
CProtocolDevice::writeUnsignedLong
int writeUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long uiData)
Definition: ProtocolDevice.cpp:1184
CProtocolDevice::writeFloatReadFloatUnsignedChars
int writeFloatReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:1846
CProtocolDevice::readUnsignedChar
int readUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char *pucData)
Definition: ProtocolDevice.cpp:181
CProtocolDevice::setTaraMP55_IO
int setTaraMP55_IO(int iModuleId, float fTara)
Definition: ProtocolDevice.cpp:2764
CStopWatch
Definition: StopWatch.h:40
CProtocolDevice::writeAll
int writeAll(int iCommandId, int iParameterId)
Definition: ProtocolDevice.cpp:1340
CProtocolDevice::initDLR_FTS
int initDLR_FTS()
Definition: ProtocolDevice.cpp:2989
CProtocolDevice::setMessageId
virtual int setMessageId(unsigned long uiMessageId)=0
CProtocolDevice::readLongUnsignedChars
int readLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long *piData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:646
CProtocolDevice::writeLongReadLongUnsignedChars
int writeLongReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData, long *piData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:1671
CProtocolDevice::getDataSCHUNK_FTC
int getDataSCHUNK_FTC(int iModuleId, int iChannelTypeId, std::vector< float > &rafData, short *piState)
Definition: ProtocolDevice.cpp:2271
CProtocolDevice::~CProtocolDevice
virtual ~CProtocolDevice()
destructor
Definition: ProtocolDevice.cpp:2036
CProtocolDevice::readFloat
int readFloat(int iModuleId, int iCommandId, int iParameterId, float *pfData)
Definition: ProtocolDevice.cpp:568
CProtocolDevice::write8Bytes
int write8Bytes(int iModuleId, bool bAck, void *pBytes)
Definition: ProtocolDevice.cpp:32
CProtocolDevice::writeCommand
int writeCommand(int iModuleId, int iCommandId)
Definition: ProtocolDevice.cpp:1365
CProtocolDevice::getDataMP55_IO
int getDataMP55_IO(int iModuleId, float *pfData)
Definition: ProtocolDevice.cpp:2473
CProtocolDevice::m_csDevice
CRITICAL_SECTION m_csDevice
Definition: ProtocolDevice.h:41
CDevice
Definition: Device.h:28
CProtocolDevice::writeUnsignedShort
int writeUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short uiData)
Definition: ProtocolDevice.cpp:1030
CProtocolDevice::getDataMP55_IO_fast
int getDataMP55_IO_fast(int iModuleId, float *pfData)
Definition: ProtocolDevice.cpp:2544
CProtocolDevice::readUnsignedLong
int readUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long *puiData)
Definition: ProtocolDevice.cpp:488
CProtocolDevice::readDevice
virtual int readDevice(CProtocolMessage &rclProtocolMessage)=0
CProtocolDevice::getCanOpenRawAbsEnc
int getCanOpenRawAbsEnc(int iModuleId, short *piValue)
Definition: ProtocolDevice.cpp:2611
CProtocolDevice::reinit
virtual int reinit(unsigned char ucBaudRateId)=0
CProtocolDevice::readShort
int readShort(int iModuleId, int iCommandId, int iParameterId, short *piData)
Definition: ProtocolDevice.cpp:255
CProtocolDevice::clearReadQueue
virtual int clearReadQueue()=0
CProtocolDevice::m_clTimer
CStopWatch m_clTimer
Definition: ProtocolDevice.h:42
CProtocolDevice::getUnsignedLong
int getUnsignedLong(int iModuleId, unsigned long *puiData)
Definition: ProtocolDevice.cpp:71
CProtocolDevice::setInitMP55_IO_fast
int setInitMP55_IO_fast(int iModuleId)
Definition: ProtocolDevice.cpp:2831
CProtocolDevice::operator=
CProtocolDevice & operator=(const CProtocolDevice &rclProtocolDevice)
Definition: ProtocolDevice.cpp:2046
CProtocolMessage
Definition: ProtocolMessage.h:23
CProtocolDevice::setNullSCHUNK_FTC
int setNullSCHUNK_FTC(int iModuleId, short *piState)
Definition: ProtocolDevice.cpp:2690
CProtocolDevice::writeLong
int writeLong(int iModuleId, int iCommandId, int iParameterId, long iData)
Definition: ProtocolDevice.cpp:1106
CProtocolDevice::writeFloatShortReadFloatUnsignedChars
int writeFloatShortReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, short iData, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:1932
CProtocolDevice::writeUnsignedChar
int writeUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char ucData)
Definition: ProtocolDevice.cpp:881
CProtocolDevice::readLong
int readLong(int iModuleId, int iCommandId, int iParameterId, long *piData)
Definition: ProtocolDevice.cpp:409
CProtocolDevice::readUnsignedShort
int readUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short *puiData)
Definition: ProtocolDevice.cpp:332
CProtocolDevice::writeLongShortReadLongUnsignedChars
int writeLongShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2, long *piData, unsigned char *pucData1, unsigned char *pucData2)
Definition: ProtocolDevice.cpp:1757


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Sat May 7 2022 02:17:13