-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathat_command_frame.cc
More file actions
31 lines (25 loc) · 1023 Bytes
/
Copy pathat_command_frame.cc
File metadata and controls
31 lines (25 loc) · 1023 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
#include "at_command_frame.h"
const std::vector<uint8_t> at_command_frame::REGISTER_QUERY;
// TODO: for frame types that can be created as invalid even when using ctor, use helper func that
// validates or throw?
// TODO: could also require at_command_frame to be constructed from at_command, would still have to
// validate in there
at_command_frame::at_command_frame(
const std::string &command, const std::vector<uint8_t> ¶meter, bool test_frame_id)
: frame_data(api_identifier::at_command), frame_id(test_frame_id ? 1 : get_next_frame_id()),
at_command(command), parameter(parameter)
{
}
const std::string &at_command_frame::get_at_command() const
{
return at_command;
}
at_command_frame::operator std::vector<uint8_t>() const
{
std::vector<uint8_t> frame;
frame.push_back(api_identifier_value);
frame.push_back(frame_id);
frame.insert(frame.end(), at_command.begin(), at_command.end());
frame.insert(frame.end(), parameter.begin(), parameter.end());
return frame;
}