00001 /* 00002 * Copyright (c) 2012 SCHUNK GmbH & Co. KG 00003 * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef CESDDEVICE_H 00019 #define CESDDEVICE_H 00020 00021 #include "../Device/ProtocolDevice.h" 00022 00023 class CESDDevice : public CProtocolDevice 00024 { 00025 private: 00026 00027 // ---- private data ---------------------------------------------------- ; 00028 00029 // ---- private auxiliary functions ------------------------------------- ; 00030 00031 protected: 00032 00033 // ---- protected data -------------------------------------------------- ; 00034 00035 #if defined (_WIN32) 00036 HANDLE m_hDevice; 00037 HANDLE m_hSyncDevice; 00038 #endif 00039 #if defined(__LINUX__) 00040 // HANDLE m_hDevice; 00041 // HANDLE m_hSyncDevice; 00042 int m_hDevice; 00043 int m_hSyncDevice; 00044 #endif 00045 #if defined (__QNX__) 00046 int m_hDevice; 00047 int m_hSyncDevice; 00048 #endif 00049 int m_iDeviceId; 00050 unsigned long m_uiBaudRate; 00051 unsigned short m_uiQueueSize; 00052 unsigned long m_uiTimeOut; 00053 00054 // ---- protected auxiliary functions ----------------------------------- ; 00055 00056 int getDeviceError(int iErrorState); 00057 int setBaudRate(); 00058 int setMessageId(unsigned long uiMessageId); 00059 int clearReadQueue(); 00060 int reinit(unsigned char ucBaudRateId); 00061 int readDevice(CProtocolMessage& rclProtocolMessage); 00062 int writeDevice(CProtocolMessage& rclProtocolMessage); 00063 00064 public: 00065 00066 // ---- public data ----------------------------------------------------- ; 00067 00068 00069 00070 // ---- constructors / destructor --------------------------------------- ; 00071 00073 CESDDevice(); 00075 CESDDevice(const CESDDevice& rclESDDevice); 00077 virtual ~CESDDevice(); 00078 00079 // ---- operators ------------------------------------------------------- ; 00080 00081 // assignment operator 00082 CESDDevice& operator=(const CESDDevice& rclESDDevice); 00083 00084 // ---- query functions ------------------------------------------------- ; 00085 00086 // ---- modify functions ------------------------------------------------ ; 00087 00088 void setQueueSize(unsigned short uiQueueSize); 00089 void setTimeOut(unsigned long uiTimeOut); 00090 00091 // ---- I/O functions --------------------------------------------------- ; 00092 00093 // ---- exec functions -------------------------------------------------- ; 00094 00095 int init(); 00096 int init(const char* acInitString); 00097 int exit(); 00098 int waitForStartMotionAll(); 00099 }; 00100 00101 #endif