MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / Command

Class Command

include/internal/libfreenect2/protocol/command.h:101–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100template<uint32_t CommandId, uint32_t MaxResponseLength, uint32_t MinResponseLength, uint32_t NParam>
101class Command : public CommandBase
102{
103public:
104 typedef CommandData<NParam> Data;
105
106 static const uint32_t MagicNumber = 0x06022009;
107 static const uint32_t Size = sizeof(Data);
108
109 uint32_t min_response_length;
110
111 Command(uint32_t seq)
112 {
113 data_.magic = MagicNumber;
114 data_.sequence = seq;
115 data_.max_response_length = MaxResponseLength;
116 data_.command = CommandId;
117 data_.reserved0 = 0;
118 min_response_length = MinResponseLength;
119 }
120
121 virtual ~Command()
122 {
123 }
124
125 virtual uint32_t sequence() const
126 {
127 return data_.sequence;
128 }
129
130 virtual uint32_t maxResponseLength() const
131 {
132 return data_.max_response_length;
133 }
134
135 virtual uint32_t minResponseLength() const
136 {
137 return min_response_length;
138 }
139
140 virtual const uint8_t *data() const
141 {
142 return reinterpret_cast<const uint8_t *>(&data_);
143 }
144
145 virtual uint32_t size() const
146 {
147 return Size;
148 }
149
150protected:
151 Data data_;
152};
153
154template<uint32_t CommandId, uint32_t MaxResponseLength>
155struct CommandWith0Params : public Command<CommandId, MaxResponseLength, MaxResponseLength, 0>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected