Serveur OPCUA générique
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Macros
hardware_tcp.h
Aller à la documentation de ce fichier.
1 /******************************************************************************
2 
3  ******************************************************************************/
4 #ifndef __HARDWARE_TCP_H__
5 #define __HARDWARE_TCP_H__
6 
7 #include "nodemanagerroot.h"
8 
9 #include "uabase.h"
10 #include "uastring.h"
11 #include "statuscode.h"
12 #include "uaarraytemplates.h"
13 #include "uathread.h"
14 #include "nodemanagerbase.h"
15 #include "string"
16 #include "../socket/socket.h"
17 
18 namespace CTA_UA {
19 class NodeManagerCTA;
20 class ControllerObject;
21 class HardWareInterface;
22 }
23 
24 namespace CTA_Hardware {
25 class HardWareInterface;
26 class Socket;
27 }
28 
29 class PluginsLoader;
30 class DataSenderReceiver;
31 namespace CTA_Slc {
32 class NodeManagerSlc;
33 class XmlManager;
34 }
35 namespace CTA_Slc_Dict {
36 class SimpleDevice;
37 }
38 
39 namespace CTA_Hardware {
40 
41 class HardWare_TCP: public HardWareInterface, public Socket {
42 public:
43  HardWare_TCP(std::string address, int port, std::string full,
44  DataSenderReceiver *my_plugins, int manageInterface);
45  ~HardWare_TCP();
46  int open();
47  int close();
48  int init(std::string name);
49  void traite(std::string value);
50  void getId(std::string *id1, std::string *id2);
51 
52  int write(std::string cmd);
53  int set(std::string value);
54  int set(std::string value, std::vector<Byte> res) {
55  return 0;
56  }
57  ;
58  int set(std::string value, std::vector<short int> res) {
59  return 0;
60  }
61  ;
62  int set(std::string value, std::vector<int> res) {
63  return 0;
64  }
65  ;
66  int set(std::string value, std::vector<long> res) {
67  return 0;
68  }
69  ;
70  int set(std::string value, std::vector<float> res) ;
71 
72  int get(std::string command, std::vector<Byte> *res);
73  int get(std::string command, std::vector<short int> *res);
74  int get(std::string command, std::vector<int> *res);
75  int get(std::string command, std::vector<long> *res);
76  int get(std::string command, std::vector<float> *res);
77 
78  int cmd(std::string value, std::string *retValue);
79  int get(std::string command, std::string *result);
80  int read();
81 
82 private:
83  int setTrame(std::string value, std::string *retValue);
84  int getTrame(std::string value, std::string *retValue);
85  void makeArgv(std::string chaine, int *argc, char** *argv);
86  //int traiteTrame(std::string *bloc, UaVariant *value2, int *type);
87  int write(std::string ip, int port, char *sendBuffer);
88  int get(std::string command);
89 
90 public:
91  OpcUa_Int value;
92  //int socketIdCtrl;
93  //referenceIP_FrontEnd m_referenceIP_FrontEnd;
94  //referenceFE_Trame m_referenceFE_Trame;
95  //referenceFE_Trame m_referenceFE_Trame2;
99 
100 private:
101  int m_timeOut_sec;
102  int m_timeOut_usec;
103  std::string m_pullPush;
104  std::string m_name;
105  int m_header_Size;
106  std::string m_data_Type;
107  std::string m_headerId;
108  int m_footer_Size;
109  int m_id1_Size;
110  int m_id2_Size;
111  std::string m_id1;
112  std::string m_id2;
113  UaVariant value2;
114  char recvBuffer[8192];
115  int sizeReceived;
116  std::string m_full;
117  int m_isTrame;
118  int m_manageInterface;
119  CTA_Slc::XmlManager *m_pAnalyserManager;
120 };
121 }
122 #endif