-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.go
172 lines (144 loc) · 3.85 KB
/
response.go
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
// Copyright 2018 The Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package nuki
import (
"time"
)
const (
StateUncalibrated State = 0
StateLocked State = 1
StateUnlocking State = 2
StateUnlocked State = 3
StateLocking State = 4
StateUnlatched State = 5
StateUnlockedLockNgo State = 6
StateUnlatching State = 7
StateMotorBlocked State = 254
StateUndefined State = 255
ActionUnlock Action = 1
ActionLock Action = 2
ActionUnlatch Action = 3
ActionLockNgo Action = 4
ActionLockNgoWithUnlatch Action = 5
)
type State int
var StateName = map[int]string{
0: "UNCALIBRATED",
1: "LOCKED",
2: "UNLOCKING",
3: "UNLOCKED",
4: "LOCKING",
5: "UNLATCHED",
6: "UNLOCKED_LOCK_N_GO",
7: "UNLATCHING",
254: "MOTOR_BLOCKED",
255: "UNDEFINED",
}
var StateValue = map[string]int{
"UNCALIBRATED": 0,
"LOCKED": 1,
"UNLOCKING": 2,
"UNLOCKED": 3,
"LOCKING": 4,
"UNLATCHED": 5,
"UNLOCKED_LOCK_N_GO": 6,
"UNLATCHING": 7,
"MOTOR_BLOCKED": 254,
"UNDEFINED": 255,
}
type Action int
var ActionName = map[int]string{
1: "UNLOCK",
2: "LOCK",
3: "UNLATCH",
4: "LOCK_N_GO",
5: "LOCK_N_GO_WITH_UNLATCH",
}
// Action_Lock_value represents ...
var ActionValue = map[string]int{
"UNLOCK": 1,
"LOCK": 2,
"UNLATCH": 3,
"LOCK_N_GO": 4,
"LOCK_N_GO_WITH_UNLATCH": 5,
}
type BridgesResponse struct {
Bridges []Bridge `json:"bridges"`
ErrorCode int `json:"errorCode"`
}
type AuthReponse struct {
Token string `json:"token"`
Success bool `json:"success"`
}
type ConfigAuthResponse struct {
Success string `json:"success"`
}
type ListResponse struct {
NukiID int `json:"nukiId"`
Name string `json:"name"`
LastKnownState LastKnownState `json:"lastKnownState"`
}
type LockStateResponse struct {
State int `json:"state"`
StateName string `json:"stateName"`
BatteryCritical bool `json:"batteryCritical"`
Success bool `json:"success"`
}
type UnpairResponse struct {
Success string `json:"success"`
}
type InfoResponse struct {
BridgeType int `json:"bridgeType"`
Ds Ds `json:"ds"`
Versions Versions `json:"versions"`
Uptime int `json:"uptime"`
CurrentTime time.Time `json:"currentTime"`
ServerConnected bool `json:"serverConnected"`
ScanResults []ScanResult `json:"scanResults"`
}
type Versions struct {
FirmwareVersion string `json:"firmwareVersion"`
WifiFirmwareVersion string `json:"wifiFirmwareVersion"`
}
type Ds struct {
HardwareID int `json:"hardwareId"`
ServerID int `json:"serverId"`
}
type ScanResult struct {
NukiID int `json:"nukiId"`
Name string `json:"name"`
Rssi int `json:"rssi"`
Paired bool `json:"paired"`
}
type LastKnownState struct {
State int `json:"state"`
StateName string `json:"stateName"`
BatteryCritical bool `json:"batteryCritical"`
Timestamp time.Time `json:"timestamp"`
}
type Bridge struct {
BridgeID int `json:"bridgeId"`
IP string `json:"ip"`
Port int `json:"port"`
DateUpdated string `json:"dateUpdated"`
}
type LockActionResponse struct {
Success bool `json:"success"`
BatteryCritical bool `json:"batteryCritical"`
}
type CallbackReponse struct {
Success bool `json:"success"`
Callbacks []Callbacks `json:"callbacks"`
}
type Callbacks struct {
ID int `json:"id"`
URL string `json:"url"`
}
type AutoGenerated struct {
}
type LogResponse []Log
type Log struct {
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"`
}