This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
forked from gozwave/gozw
-
Notifications
You must be signed in to change notification settings - Fork 2
/
capabilities-get.gen.go
84 lines (61 loc) · 1.55 KB
/
capabilities-get.gen.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
// THIS FILE IS AUTO-GENERATED BY ZWGEN
// DO NOT MODIFY
package thermostatsetpointv3
import (
"encoding/gob"
"errors"
"github.com/gozwave/gozw/cc"
)
const CommandCapabilitiesGet cc.CommandID = 0x09
func init() {
gob.Register(CapabilitiesGet{})
cc.Register(cc.CommandIdentifier{
CommandClass: cc.CommandClassID(0x43),
Command: cc.CommandID(0x09),
Version: 3,
}, NewCapabilitiesGet)
}
func NewCapabilitiesGet() cc.Command {
return &CapabilitiesGet{}
}
// <no value>
type CapabilitiesGet struct {
Properties1 struct {
SetpointType byte
}
}
func (cmd CapabilitiesGet) CommandClassID() cc.CommandClassID {
return 0x43
}
func (cmd CapabilitiesGet) CommandID() cc.CommandID {
return CommandCapabilitiesGet
}
func (cmd CapabilitiesGet) CommandIDString() string {
return "THERMOSTAT_SETPOINT_CAPABILITIES_GET"
}
func (cmd *CapabilitiesGet) UnmarshalBinary(data []byte) error {
// According to the docs, we must copy data if we wish to retain it after returning
payload := make([]byte, len(data))
copy(payload, data)
if len(payload) < 2 {
return errors.New("Payload length underflow")
}
i := 2
if len(payload) <= i {
return errors.New("slice index out of bounds")
}
cmd.Properties1.SetpointType = (payload[i] & 0x0F)
i += 1
return nil
}
func (cmd *CapabilitiesGet) MarshalBinary() (payload []byte, err error) {
payload = make([]byte, 2)
payload[0] = byte(cmd.CommandClassID())
payload[1] = byte(cmd.CommandID())
{
var val byte
val |= (cmd.Properties1.SetpointType) & byte(0x0F)
payload = append(payload, val)
}
return
}