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
virtual int readDevice(CProtocolMessage &rclProtocolMessage)=0
int readFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
int getDataSCHUNK_FTC(int iModuleId, int iChannelTypeId, std::vector< float > &rafData, short *piState)
int writeLong(int iModuleId, int iCommandId, int iParameterId, long iData)
int setInitMP55_IO_fast(int iModuleId)
CRITICAL_SECTION m_csDevice
int getUnsignedLong(int iModuleId, unsigned long *puiData)
int readUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short *puiData)
int writeLongShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2, long *piData, unsigned char *pucData1, unsigned char *pucData2)
int getDataMP55_IO_fast(int iModuleId, float *pfData)
int readLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long *piData, unsigned char *pucData1, unsigned char *pucData2)
int writeAll(int iCommandId, int iParameterId)
int setNullSCHUNK_FTC(int iModuleId, short *piState)
CProtocolDevice()
default constructor
int writeFloatReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
int writeChar(int iModuleId, int iCommandId, int iParameterId, char cData)
int printMessage(CProtocolMessage &rclProtocolMessage, bool read)
int readFloat(int iModuleId, int iCommandId, int iParameterId, float *pfData)
int writeUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long uiData)
int readUnsignedLong(int iModuleId, int iCommandId, int iParameterId, unsigned long *puiData)
virtual int clearReadQueue()=0
CProtocolDevice & operator=(const CProtocolDevice &rclProtocolDevice)
virtual ~CProtocolDevice()
destructor
virtual int reinit(unsigned char ucBaudRateId)=0
int getDataDLR_FTS(std::vector< float > &rafData, long *piState)
int getCanOpenRawAbsEnc(int iModuleId, short *piValue)
int writeLongReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, long iData, long *piData, unsigned char *pucData1, unsigned char *pucData2)
int writeUnsignedShort(int iModuleId, int iCommandId, int iParameterId, unsigned short uiData)
Definition: Device.h:28
int writeShort(int iModuleId, int iCommandId, int iParameterId, short iData)
int readLong(int iModuleId, int iCommandId, int iParameterId, long *piData)
int write8Bytes(int iModuleId, bool bAck, void *pBytes)
int readUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char *pucData)
int readShort(int iModuleId, int iCommandId, int iParameterId, short *piData)
int writeUnsignedChar(int iModuleId, int iCommandId, int iParameterId, unsigned char ucData)
int writeShortReadLongUnsignedChars(int iModuleId, int iCommandId, int iParameterId, short iData, long *piData, unsigned char *pucData1, unsigned char *pucData2)
int writeFloat(int iModuleId, int iCommandId, int iParameterId, float fData)
int readChar(int iModuleId, int iCommandId, int iParameterId, char *pcData)
virtual int writeDevice(CProtocolMessage &rclProtocolMessage)=0
int writeFloatShortReadFloatUnsignedChars(int iModuleId, int iCommandId, int iParameterId, float fData, short iData, float *pfData, unsigned char *pucData1, unsigned char *pucData2)
int writeCommand(int iModuleId, int iCommandId)
virtual int setMessageId(unsigned long uiMessageId)=0
int getDataMP55_IO(int iModuleId, float *pfData)
int writeLongShort(int iModuleId, int iCommandId, int iParameterId, long iData1, short iData2)
CStopWatch m_clTimer
int setTaraMP55_IO(int iModuleId, float fTara)
int writeFloatShort(int iModuleId, int iCommandId, int iParameterId, float fData, short iData)


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