-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadapter_reset.go
More file actions
49 lines (37 loc) · 857 Bytes
/
adapter_reset.go
File metadata and controls
49 lines (37 loc) · 857 Bytes
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
package zstack
import "context"
func (z *ZStack) resetAdapter(ctx context.Context, resetType ResetType) (Version, error) {
resetInd := &SysResetInd{}
err := z.requestResponder.RequestResponse(ctx, SysResetReq{ResetType: resetType}, resetInd)
return resetInd.Version, err
}
type ResetType uint8
const (
Hard ResetType = 0
Soft ResetType = 1
)
type SysResetReq struct {
ResetType ResetType
}
const SysResetReqID uint8 = 0x00
type ResetReason uint8
const (
PowerUp ResetReason = 0
External ResetReason = 1
Watchdog ResetReason = 2
)
type SysResetInd struct {
Reason ResetReason
Version Version
}
type Version struct {
TransportRevision uint8
ProductID uint8
MajorRelease uint8
MinorRelease uint8
HardwareRevision uint8
}
func (v Version) IsV3() bool {
return v.ProductID > 0
}
const SysResetIndID uint8 = 0x80