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 CCP5X11DEVICE_H 00019 #define CCP5X11DEVICE_H 00020 00021 #include "../Device/ProtocolDevice.h" 00022 #include "../Util/StopWatch.h" 00023 00024 class CCP5X11Device : public CProtocolDevice 00025 { 00026 private: 00027 00028 // ---- private data ---------------------------------------------------- ; 00029 00030 // ---- private auxiliary functions ------------------------------------- ; 00031 00032 protected: 00033 00034 // ---- protected data -------------------------------------------------- ; 00035 00036 unsigned char m_hDevice; 00037 unsigned char m_access; 00038 00039 unsigned long m_uiTimeOut; 00040 unsigned char m_teaser; 00041 CStopWatch m_clTimer; 00042 00043 // ---- protected auxiliary functions ----------------------------------- ; 00044 00045 int getDeviceError(int iErrorState); 00046 int setBaudRate(); 00047 int setMessageId(unsigned long uiMessageId); 00048 int clearReadQueue(); 00049 int reinit(unsigned char ucBaudRateId); 00050 int readDevice(CProtocolMessage& rclProtocolMessage); 00051 int writeDevice(CProtocolMessage& rclProtocolMessage); 00052 00053 public: 00054 00055 // ---- public data ----------------------------------------------------- ; 00056 00057 00058 00059 // ---- constructors / destructor --------------------------------------- ; 00060 00062 CCP5X11Device(); 00064 CCP5X11Device(const CCP5X11Device& rclCP5X11Device); 00066 virtual ~CCP5X11Device(); 00067 00068 // ---- operators ------------------------------------------------------- ; 00069 00070 // assignment operator 00071 CCP5X11Device& operator=(const CCP5X11Device& rclCP5X11Device); 00072 00073 // ---- query functions ------------------------------------------------- ; 00074 00075 // ---- modify functions ------------------------------------------------ ; 00076 00077 void setTimeOut(unsigned long uiTimeOut); 00078 00079 // ---- I/O functions --------------------------------------------------- ; 00080 00081 00082 // ---- exec functions -------------------------------------------------- ; 00083 00084 int init(); 00085 int init(const char* acInitString); 00086 int exit(); 00087 }; 00088 00089 #endif