11 while (this->pos_ < this->
buffer_.size()) {
18 this->
messages.emplace_back(message);
25 bool is_list = (type & 0x07) ==
SML_LIST;
26 bool has_extended_length = type & 0x08;
27 uint8_t parse_length =
length;
28 if (has_extended_length) {
29 length = (length << 4) + (this->
buffer_[this->
pos_ + 1] & 0x0f);
30 parse_length = length - 1;
34 if (this->
pos_ + parse_length >= this->
buffer_.size())
37 node->
type = type & 0x07;
44 node->
nodes.reserve(parse_length);
45 for (
size_t i = 0; i != parse_length; i++) {
49 node->
nodes.emplace_back(child_node);
54 this->
pos_ += parse_length;
60 std::vector<ObisInfo> obis_info;
61 for (
auto const &message :
messages) {
68 bytes server_id = get_list_response.
nodes[1].value_bytes;
71 for (
auto const &val_list_entry : val_list.
nodes) {
72 obis_info.emplace_back(server_id, val_list_entry);
80 for (
auto const value : buffer) {
88 for (
auto const value : buffer) {
89 val = (val << 8) + value;
100 if (buffer.size() < 8) {
101 const int bits = buffer.size() * 8;
102 const uint64_t
m = 1u << (bits - 1);
113 this->
code = val_list_entry.
nodes[0].value_bytes;
114 this->
status = val_list_entry.
nodes[1].value_bytes;
std::string bytes_repr(const bytes &buffer)
int64_t bytes_to_int(const bytes &buffer)
uint64_t bytes_to_uint(const bytes &buffer)
std::string bytes_to_string(const bytes &buffer)
std::string str_sprintf(const char *fmt,...)
ObisInfo(bytes server_id, SmlNode val_list_entry)
std::vector< ObisInfo > get_obis_info()
Implementation of SPI Controller mode.
std::vector< uint8_t > bytes
bool setup_node(SmlNode *node)
std::string code_repr() const
std::vector< SmlNode > messages
std::vector< SmlNode > nodes