-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOPCClient.h
49 lines (38 loc) · 1.01 KB
/
OPCClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef OPCCLIENT_H
#define OPCCLIENT_H
#include "Opcda.h"
#include "opccomn.h"
#include "OpcEnum.h"
#include <comdef.h>
#include <string>
#include <sstream>
#include <iostream>
#include <cmath>
#include <iomanip>
class OPCClient
{
private:
_bstr_t ServerName, *TagNames;
CLSID CLSIDServer;
IOPCServer *ServerConnected;
OPCHANDLE OPCGroup, *OPCGroupTag;
IOPCItemMgt *TypeReadItem;
IOPCSyncIO *TypeReadSync;
_variant_t *TagValues;
int QtdTags;
void StartCOM(); //inicia a com
void AbortCOM(); // fecha com
void CreateInstance();//acesso o especo de memoria reservado para o servidor
void GetCLSID(); // pega o id do servidor no registro
void StartGroup();
public:
OPCClient();
OPCClient(_bstr_t ServerName);
~OPCClient();
void OPCConnect(_bstr_t ServerName);
void InsertItens(_bstr_t tags[], int QtdTags);
void WriteItens(int TagIndex[], _variant_t Values[], int QtdValues);
void Show(int ShowTime);
_variant_t *ReadItens();
};
#endif //OPCCLIENT_H