Zigbee Protocol Controller 1.6.0
dotdot_bitmap.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2021 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
24#ifndef DOTDOT_BITMAP_HPP
25#define DOTDOT_BITMAP_HPP
26
27// Standard library
28#include <vector>
29#include <map>
30#include <string>
31#include <nlohmann/json.hpp>
32
34{
35 private:
36 const uint8_t idx_name = 0;
37 const uint8_t idx_type = 1;
38 const uint8_t idx_mask = 2;
39 const uint8_t idx_shiftright = 3;
40
42 std::vector<std::vector<std::string>> enum_element,
43 uint32_t enum_idx) const;
45 std::vector<std::vector<std::string>> enum_element,
46 const std::string &name) const;
47
48 const std::string attribute_name;
49 const std::string map_type_string;
50 const std::vector<
51 std::pair<std::vector<std::string>, std::vector<std::vector<std::string>>>>
53
54 uint32_t convert_hex_string_to_uint32_t(const std::string &hex) const;
55
56 public:
58 const std::string &input_attribute_name,
59 const std::string &input_map_type,
60 const std::vector<std::pair<std::vector<std::string>,
61 std::vector<std::vector<std::string>>>>
62 &input_bitmap_data) :
63 attribute_name(input_attribute_name),
64 map_type_string(input_map_type),
65 bitmap_data(input_bitmap_data) {};
66
67 std::vector<std::pair<std::string, std::string>>get_bitmap_values(uint32_t bitmap_value) const;
68
69 nlohmann::json get_bitmap_values_as_json_tree(uint32_t bitmap_value) const;
70
71 // bitmap_jsn param can't be a const because of limitations of the "const []" operator,
72 // overloaded for nlohmann::json class
73 uint32_t get_bitmap_state_value_from_json_tree(nlohmann::json &bitmap_jsn) const;
74};
75
76#endif //DOTDOT_BITMAP_HPP
Definition: dotdot_bitmap.hpp:34
const uint8_t idx_type
Definition: dotdot_bitmap.hpp:37
uint32_t get_enum_value_of_element_by_name(std::vector< std::vector< std::string > > enum_element, const std::string &name) const
std::string get_enum_name_of_element_by_value(std::vector< std::vector< std::string > > enum_element, uint32_t enum_idx) const
uint32_t get_bitmap_state_value_from_json_tree(nlohmann::json &bitmap_jsn) const
std::vector< std::pair< std::string, std::string > > get_bitmap_values(uint32_t bitmap_value) const
dotdot_bitmap(const std::string &input_attribute_name, const std::string &input_map_type, const std::vector< std::pair< std::vector< std::string >, std::vector< std::vector< std::string > > > > &input_bitmap_data)
Definition: dotdot_bitmap.hpp:57
const uint8_t idx_name
Definition: dotdot_bitmap.hpp:36
const uint8_t idx_mask
Definition: dotdot_bitmap.hpp:38
const std::string attribute_name
Definition: dotdot_bitmap.hpp:48
const std::string map_type_string
Definition: dotdot_bitmap.hpp:49
const std::vector< std::pair< std::vector< std::string >, std::vector< std::vector< std::string > > > > bitmap_data
Definition: dotdot_bitmap.hpp:52
uint32_t convert_hex_string_to_uint32_t(const std::string &hex) const
nlohmann::json get_bitmap_values_as_json_tree(uint32_t bitmap_value) const
const uint8_t idx_shiftright
Definition: dotdot_bitmap.hpp:39