-
Notifications
You must be signed in to change notification settings - Fork 0
/
recoContact.h
71 lines (59 loc) · 1.56 KB
/
recoContact.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef RECOCONTACT_H_
#define RECOCONTACT_H_
#include <errno.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "equipment.h"
#define SCANINS "YZ-RECOSCAN\0"
#define SWITCHONINS "AT+YZSWITCH=1,on,201705011455"
#define SWITCHOFFINS "AT+YZSWITCH=1,off,201705011455"
#define GETINFOINS "AT+YZOUT\r\n"
#define RESULTOK "+OK"
#define RESULTERROR "+ERROR"
#define grantChar 5
#define grantLocalPort 49999
#define grantDstPort 49999
#define ScanDstPort 48899
#define dataSize 128
using namespace std;
//int grantsocket,retimes=0;
struct UDPGrantInfo{
int port;
struct sockaddr_in addr;
char data;
};
struct UDPScanInfo{
int port;
struct sockaddr_in addr;
char data[dataSize];
};
struct TCPinfo{
int num;
int port;
struct sockaddr_in addr;
char data[dataSize];
};
class recoContact{
private:
char UDPGrantAddress[20]="192.168.253.255";
int UDPGrantCount=3,UDPGrantBeginNum=89,UDPGrantEndNum=86;
public:
struct UDPGrantInfo UGI;
void Grant(int grantsocket);
int UDPSend(int grantsocket,int len);
int RecoScan(struct smartSwitch *head, char addr[]);
int RecoGrant();
int recordReco(char buf[],struct smartSwitch *ss,struct smartSwitch *head);
int contral(char ins[],struct smartSwitch *ss);
int recordReco1(char buf[],struct smartSwitch *ss);
int RecoScan1(struct smartSwitch *head,char addr[]);
struct smartSwitch* getSmartSwitch(char *sn, struct smartSwitch *ss);
};
#endif