12 if (this->buffer_[this->pos_] == 0x00)
16 if (!this->setup_node(&message))
18 this->messages.emplace_back(std::move(message));
33 bool overlength = (this->
buffer_[this->
pos_] >> 4) & 0x08;
70 for (
size_t i = 0; i !=
length; i++) {
74 node->
nodes.emplace_back(std::move(child_node));
88 std::vector<ObisInfo> obis_info;
90 const auto &message_body =
message.nodes[3];
91 uint16_t message_type =
bytes_to_uint(message_body.nodes[0].value_bytes);
95 const auto &get_list_response = message_body.nodes[1];
96 const auto &server_id = get_list_response.nodes[1].value_bytes;
97 const auto &val_list = get_list_response.nodes[4];
99 for (
auto const &val_list_entry : val_list.nodes) {
100 obis_info.emplace_back(server_id, val_list_entry);
108 for (
auto const value : buffer) {
111 snprintf(hex_buf,
sizeof(hex_buf),
"%02x",
static_cast<unsigned int>(value));
119 for (
auto const value : buffer) {
131 if (buffer.
size() < 8) {
132 const int bits = buffer.
size() * 8;
133 const uint64_t
m = 1ull << (bits - 1);
144 this->
code = val_list_entry.
nodes[0].value_bytes;
145 this->
status = val_list_entry.
nodes[1].value_bytes;
148 const auto &value_node = val_list_entry.
nodes[5];
149 this->
value = value_node.value_bytes;
156 snprintf(buf,
sizeof(buf),
"%d-%d:%d.%d.%d", this->
code[0], this->
code[1], this->
code[2], this->
code[3],
const uint8_t * begin() const noexcept
const uint8_t * end() const noexcept
BytesView subview(size_t offset, size_t count) const noexcept
size_t size() const noexcept
std::string code_repr() const
ObisInfo(const BytesView &server_id, const SmlNode &val_list_entry)
SmlFile(const BytesView &buffer)
std::vector< ObisInfo > get_obis_info()
std::vector< SmlNode > messages
bool setup_node(SmlNode *node)
std::vector< SmlNode > nodes
std::string bytes_repr(const BytesView &buffer)
int64_t bytes_to_int(const BytesView &buffer)
std::string bytes_to_string(const BytesView &buffer)
uint64_t bytes_to_uint(const BytesView &buffer)
Providing packet encoding functions for exchanging data with a remote host.