-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrequest.go
More file actions
191 lines (175 loc) · 5.12 KB
/
Copy pathrequest.go
File metadata and controls
191 lines (175 loc) · 5.12 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package llrp
import (
"math/rand"
)
const (
V_1011_All = iota
V_1011_General_Device_Capabilities
V_1011_LLRP_Capabilities
V_1011_Regulatory_Capabilities
V_1011_Air_Protocol_LLRP_Capabilities
)
/*
This message is issued by the Reader to the Client. This message can be used by the Client to monitor the LLRP-layer connectivity with the Reader. The Client configures the trigger at the Reader to send the Keepalive message. The configuration is done using the KeepaliveSpec parameter
*/
func SEND_KEEPALIVE(messageId int) []byte {
return bundle(
M_KEEPALIVE_ACK,
messageId,
nil,
)
}
/*
This message is issued by the Client to the Reader to get the tag reports. In response to this message, the Reader SHALL return tag reports accumulated. If no reports are available to send as a response to a GET_REPORT message, the Reader MAY return an empty RO_ACCESS_REPORT message.
*/
func GET_REPORT(messageId int) []byte {
return bundle(
M_GET_REPORT,
messageId,
nil,
)
}
// Convert custom pack to protocol []byte
func CustomPack(messageType, messageId int, config []interface{}, params ...[]interface{}) []byte {
return bundle(messageType, messageId, config, params...)
}
/*
This command is issued by the Client to the Reader. This command instructs the Reader to gracefully close its connection with the Client. Under normal operating conditions, a Client SHALL attempt to send this command before closing an LLRP connection
*/
func CLOSE_CONNECTION(messageId int) []byte {
return bundle(
M_CLOSE_CONNECTION,
messageId,
nil,
)
}
/*
This message is issued by the Client to the Reader. Upon receiving the message, the Reader starts the ROSpec corresponding to ROSpecID passed in this message, if the ROSpec is in the enabled state.
*/
func START_ROSPEC(messageId, ROSpecID int) []byte {
return bundle(
M_START_ROSPEC,
messageId,
[]interface{}{
uint32(preventZero(ROSpecID)),
},
)
}
func preventZero(c int) int {
if c == 0 {
return int(rand.Uint32())
}
return c
}
/*
This message is issued by the Client to the Reader. Upon receiving the message, the Reader stops the execution of the ROSpec corresponding to the ROSpecID passed in this message. STOP_ROSPEC overrides all other priorities and stops the execution. This basically moves the ROSpec’s state to Inactive. This message does not the delete the ROSpec.
*/
func STOP_ROSPEC(messageId, ROSpecID int) []byte {
return bundle(
M_STOP_ROSPEC,
messageId,
[]interface{}{
uint32(preventZero(ROSpecID)),
},
)
}
/*
This message is issued by the Client to the Reader. Upon receiving the message, the Reader moves the ROSpec corresponding to the ROSpecID passed in this message to the disabled state.
*/
func DISABLE_ROSPEC(messageId, ROSpecID int) []byte {
return bundle(
M_DISABLE_ROSPEC,
messageId,
[]interface{}{
uint32(ROSpecID),
},
)
}
/*
This message can be issued by the Client to the Reader after a LLRP connection is established. The Client uses this message to inform the Reader that it can remove its hold on event and report messages. Readers that are configured to hold events and reports on reconnection (See Section 13.2.6.4) respond to this message by returning the tag reports accumulated (same way they respond to GET_REPORT (See Section 13.1.1)).
*/
func ENABLE_EVENTS_AND_REPORTS(messageId int) []byte {
return bundle(
M_ENABLE_EVENTS_AND_REPORTS,
messageId,
nil,
)
}
/*
This message is issued by the Client to the Reader. Upon receiving the message, the Reader moves the ROSpec corresponding to the ROSpecID passed in this message from the disabled to the inactive state.
*/
func ENABLE_ROSPEC(messageId, ROSpecID int) []byte {
return bundle(
M_ENABLE_ROSPEC,
messageId,
[]interface{}{
uint32(ROSpecID),
},
)
}
func GET_READER_CAPABILITIES_V1011(messageId, v_1011 int) []byte {
data := []interface{}{
uint8(v_1011),
}
return bundle(
M_GET_READER_CAPABILITIES,
messageId,
data,
)
}
const (
C_GET_READER_CONFIG_All = iota
C_GET_READER_CONFIG_Identification
C_GET_READER_CONFIG_AntennaProperties
C_GET_READER_CONFIG_AntennaConfiguration
C_GET_READER_CONFIG_ROReportSpec
C_GET_READER_CONFIG_ReaderEventNotificationSpec
C_GET_READER_CONFIG_AccessReportSpec
C_GET_READER_CONFIG_LLRPConfigurationStateValue
C_GET_READER_CONFIG_KeepaliveSpec
C_GET_READER_CONFIG_GPIPortCurrentState
C_GET_READER_CONFIG_GPOWriteData
C_GET_READER_CONFIG_EventsAndReports
)
func GET_READER_CONFIG(messageId, AntennaID, C_TYPE, GPIPortNum, GPOPortNum int) []byte {
return bundle(
M_GET_READER_CONFIG,
messageId,
[]interface{}{
uint16(AntennaID),
uint8(C_TYPE),
uint16(GPIPortNum),
uint16(GPOPortNum),
},
)
}
func SET_READER_CONFIG(messageId int, restore_factory_setting bool, params ...[]interface{}) []byte {
f := uint8(0)
if restore_factory_setting {
f = uint8(0x80)
}
config := []interface{}{
f,
}
return bundle(
M_SET_READER_CONFIG,
messageId,
config,
params...,
)
}
func DEL_ROSPEC(messageId, spec int) []byte {
return bundle(
M_DELETE_ROSPEC,
messageId,
[]interface{}{uint32(spec)},
)
}
func ADD_ROSPEC(messageId int, params ...[]interface{}) []byte {
return bundle(
M_ADD_ROSPEC,
messageId,
nil,
params...,
)
}