ESPHome  2024.6.6
xiaomi_ble.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <vector>
7 
8 #ifdef USE_ESP32
9 
10 namespace esphome {
11 namespace xiaomi_ble {
12 
14  enum {
32  } type;
33  std::string name;
47  bool has_data; // 0x40
48  bool has_capability; // 0x20
49  bool has_encryption; // 0x08
52 };
53 
55  uint8_t key[16];
56  uint8_t plaintext[16];
57  uint8_t ciphertext[16];
58  uint8_t authdata[16];
59  uint8_t iv[16];
60  uint8_t tag[16];
61  size_t keysize;
62  size_t authsize;
63  size_t datasize;
64  size_t tagsize;
65  size_t ivsize;
66 };
67 
68 bool parse_xiaomi_value(uint16_t value_type, const uint8_t *data, uint8_t value_length, XiaomiParseResult &result);
69 bool parse_xiaomi_message(const std::vector<uint8_t> &message, XiaomiParseResult &result);
71 bool decrypt_xiaomi_payload(std::vector<uint8_t> &raw, const uint8_t *bindkey, const uint64_t &address);
72 bool report_xiaomi_results(const optional<XiaomiParseResult> &result, const std::string &address);
73 
75  public:
76  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
77 };
78 
79 } // namespace xiaomi_ble
80 } // namespace esphome
81 
82 #endif
uint8_t raw[35]
Definition: bl0939.h:19
bool parse_xiaomi_value(uint16_t value_type, const uint8_t *data, uint8_t value_length, XiaomiParseResult &result)
Definition: xiaomi_ble.cpp:15
bool decrypt_xiaomi_payload(std::vector< uint8_t > &raw, const uint8_t *bindkey, const uint64_t &address)
Definition: xiaomi_ble.cpp:234
enum esphome::xiaomi_ble::XiaomiParseResult::@129 type
bool parse_xiaomi_message(const std::vector< uint8_t > &message, XiaomiParseResult &result)
Definition: xiaomi_ble.cpp:90
optional< XiaomiParseResult > parse_xiaomi_header(const esp32_ble_tracker::ServiceData &service_data)
Definition: xiaomi_ble.cpp:138
bool report_xiaomi_results(const optional< XiaomiParseResult > &result, const std::string &address)
Definition: xiaomi_ble.cpp:322
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7