InterfaceConfig.h
Go to the documentation of this file.
00001 #ifndef INTERFACECONFIG_H
00002 #define INTERFACECONFIG_H
00003 
00004 const int COM_DEVICE = 0;
00005 const int USB_DEVICE = 1;
00006 const int TCP_DEVICE = 2;
00007 
00008 typedef struct _InterfaceSettings
00009 {
00010         // Interface settings
00011         int     iCommMode;
00012         char    cHost[32];
00013         int     iIpPort;
00014         int     iComPortNumber;
00015         int     iBaud;
00016         int     iBusAddress;
00017         char    cFrame[8];
00018         int     iTimeout;
00019         bool    bTxTimeControl;
00020         int     iTxDelayTime;
00021         int     iCharTimeoutMpy;
00022         bool    bRts;
00023         bool    bDtr;
00024         
00025         // Default values
00026         void init()
00027         {
00028                 iCommMode = 0;
00029                 memset(cHost, 0, sizeof(cHost));
00030                 strcpy(cHost, "0.0.0.0");
00031                 iIpPort = 0;
00032                 iComPortNumber = 1;
00033                 iBaud = 38400;
00034                 iBusAddress = 255;
00035                 memset(cFrame, 0, sizeof(cFrame));
00036                 strcpy (cFrame, "8E1");
00037                 iTimeout = 2000;
00038                 bTxTimeControl = true;
00039                 iTxDelayTime = 5;
00040                 iCharTimeoutMpy = 1;
00041                 bRts = false;
00042                 bDtr = false;
00043         }
00044         
00045 } InterfaceSettings;
00046 
00047 class InterfaceConfig
00048 {       
00049   public:
00050         InterfaceConfig();
00051         ~InterfaceConfig();
00052         
00053         void init();
00054         
00055         int writeConfigToFile(char* fileName = "feconfig.dat");
00056         int readConfigFromFile(char* fileName = "feconfig.dat");
00057         
00058         // operations for serial port
00059         int getComPorts(int* iComPorts);
00060         int setComPortConfiguration(int portHandle);
00061         int getComPortConfiguration(int portHandle);
00062         int getLastError();
00063 
00064         void setCommMode(int device);
00065         int  getCommMode();
00066         
00067         void setHost(char* host);
00068         char *getHost();
00069         
00070         void setIPPort(int ipPort = 10001);
00071         int  getIPPort();
00072         
00073         void setComPortNumber(int comPortNumber);
00074         int  getComPortNumber();
00075         
00076         void setBaud(int baud);
00077         int  getBaud(); 
00078         
00079         void setBusAddress(int address);
00080         int  getBusAddress();
00081         
00082         void setFrame(char* frame);
00083         char *getFrame();
00084         
00085         void setTimeout(int timeout);
00086         int  getTimeout();
00087         
00088         void setTxTimeControl(bool txTimeControl);
00089         bool getTxTimeControl();
00090         
00091         void setTxDelayTime(int txDelayTime);
00092         int  getTxDelayTime();
00093         
00094         void setCharTimeoutMpy(int charTimeoutMpy);
00095         int  getCharTimeoutMpy();
00096         
00097         void setRTS(bool rts);
00098         bool getRTS();
00099         
00100         void setDTR(bool dtr);
00101         bool getDTR();
00102   private:
00103         int checkIfIPAddress(char *ip, int len);
00104         InterfaceSettings m_ifSettings;
00105         int  m_iError;
00106 };
00107 
00108 #endif


maggie_rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:05:31