DeviceAuth.java
4.4 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package com.jfinal.weixin.iot.api;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 设备授权属性
*/
public class DeviceAuth implements Serializable {
private static final long serialVersionUID = -3535838682817586669L;
/**
* 设备的deviceid
*/
private String id;
/**
* 设备的mac地址(48bit)格式采用16进制串的方式(长度为12字节),不需要0X前缀,如: 1234567890AB
*/
private String mac;
/**
* android classic bluetooth – 1 ios classic bluetooth – 2 ble – 3 wifi -- 4
* 一个设备可以支持多种连接类型,用符号"|"做分割, 客户端优先选择靠前的连接方式(优先级按|关系的排序依次降低)
*/
@JsonProperty("connect_protocol")
@JSONField(name = "connect_protocol")
private String connectProtocol;
/**
* auth及通信的加密key,第三方需要将key烧制在设备上(128bit), 格式采用16进制串的方式(长度为32字节),不需要0X前缀,如:
* 1234567890ABCDEF1234567890ABCDEF
*/
@JsonProperty("auth_key")
@JSONField(name = "auth_key")
private String authKey;
/**
* 断开策略,目前支持: 1:退出公众号页面时即断开连接 2:退出公众号之后保持连接不断开
* 3:退出公众号之后一直保持连接(设备主动断开连接后,微信尝试重连)
*/
@JsonProperty("close_strategy")
@JSONField(name = "close_strategy")
private String closeStrategy;
/**
* 连接策略,32位整型,按bit位置位,目前仅第1bit和第3bit位有效(bit置0为无效,1为有效;第2bit已被废弃),且bit位可以按或置位
* (如1|4=5),各bit置位含义说明如下:<br>
* 1:(第1bit置位)在公众号对话页面,不停的尝试连接设备<br>
* 4:(第3bit置位)处于非公众号页面(如主界面等),微信自动连接。当用户切换微信到前台时,可能尝试去连接设备,连上后一定时间会断开<br>
* 8:(第4bit置位),进入微信后即刻开始连接。只要微信进程在运行就不会主动断开
*/
@JsonProperty("conn_strategy")
@JSONField(name = "conn_strategy")
private String connStrategy;
/**
* auth加密方法,目前支持两种取值: 0:不加密 1:AES加密(CBC模式,PKCS7填充方式)
*/
@JsonProperty("crypt_method")
@JSONField(name = "crypt_method")
private String cryptMethod = "0";
@JsonProperty("auth_ver")
@JSONField(name = "auth_ver")
private String authVer;// 0:不加密的version 1:version 1
/**
* 表示mac地址在厂商广播manufature data里含有mac地址的偏移,取值如下: -1:在尾部、 -2:表示不包含mac地址
* 其他:非法偏移
*/
@JsonProperty("manu_mac_pos")
@JSONField(name = "manu_mac_pos")
private String manuMacPos;
/**
* 表示mac地址在厂商serial number里含有mac地址的偏移,取值如下: -1:表示在尾部 -2:表示不包含mac地址 其他:非法偏移
*/
@JsonProperty("ser_mac_pos")
@JSONField(name = "ser_mac_pos")
private String serMacPos;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMac() {
return mac;
}
public void setMac(String mac) {
this.mac = mac;
}
public String getConnectProtocol() {
return connectProtocol;
}
public void setConnectProtocol(String connectProtocol) {
this.connectProtocol = connectProtocol;
}
public String getAuthKey() {
return authKey;
}
public void setAuthKey(String authKey) {
this.authKey = authKey;
}
public String getCloseStrategy() {
return closeStrategy;
}
public void setCloseStrategy(String closeStrategy) {
this.closeStrategy = closeStrategy;
}
public String getConnStrategy() {
return connStrategy;
}
public void setConnStrategy(String connStrategy) {
this.connStrategy = connStrategy;
}
public String getCryptMethod() {
return cryptMethod;
}
public void setCryptMethod(String cryptMethod) {
this.cryptMethod = cryptMethod;
}
public String getAuthVer() {
return authVer;
}
public void setAuthVer(String authVer) {
this.authVer = authVer;
}
public String getManuMacPos() {
return manuMacPos;
}
public void setManuMacPos(String manuMacPos) {
this.manuMacPos = manuMacPos;
}
public String getSerMacPos() {
return serMacPos;
}
public void setSerMacPos(String serMacPos) {
this.serMacPos = serMacPos;
}
}