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;
68 for (
size_t i = 0; i !=
length; i++) {
72 node->
nodes.emplace_back(std::move(child_node));
86 std::vector<ObisInfo> obis_info;
87 for (
auto const &message :
messages) {
88 const auto &message_body = message.nodes[3];
89 uint16_t message_type =
bytes_to_uint(message_body.nodes[0].value_bytes);
93 const auto &get_list_response = message_body.nodes[1];
94 const auto &server_id = get_list_response.nodes[1].value_bytes;
95 const auto &val_list = get_list_response.nodes[4];
97 for (
auto const &val_list_entry : val_list.nodes) {
98 obis_info.emplace_back(server_id, val_list_entry);
106 for (
auto const value : buffer) {
114 for (
auto const value : buffer) {
126 if (buffer.
size() < 8) {
127 const int bits = buffer.
size() * 8;
128 const uint64_t
m = 1ull << (bits - 1);
139 this->
code = val_list_entry.
nodes[0].value_bytes;
140 this->
status = val_list_entry.
nodes[1].value_bytes;
143 const auto &value_node = val_list_entry.
nodes[5];
144 this->
value = value_node.value_bytes;
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.
std::string str_sprintf(const char *fmt,...)