Move headers and add string name to discovery response
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/// Generic code for driving a BBNOW interface.
|
||||
|
||||
#ifndef _BBNOW_DRIVER_HPP
|
||||
#define _BBNOW_DRIVER_HPP
|
||||
#ifndef BBNOW_DRIVER_HPP
|
||||
#define BBNOW_DRIVER_HPP
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
||||
#include "bb_expantions.hpp"
|
||||
#include "bbnow_pub.hpp"
|
||||
#include "bbnow_priv.hpp"
|
||||
#include "bbnow/pub.h"
|
||||
#include "bbnow/priv.h"
|
||||
|
||||
class BBNowDriver {
|
||||
public:
|
||||
@@ -57,7 +57,8 @@ public:
|
||||
|
||||
static esp_err_t pair_expander(
|
||||
BlkBoxExpantion type,
|
||||
const MacAddress& mac
|
||||
const MacAddress& mac,
|
||||
std::string name
|
||||
);
|
||||
|
||||
static esp_err_t unpair_expander(
|
||||
@@ -77,4 +78,4 @@ private:
|
||||
static std::vector<PairedExpander> paired_expanders;
|
||||
};
|
||||
|
||||
#endif /* _BBNOW_DRIVER_HPP */
|
||||
#endif /* BBNOW_DRIVER_HPP */
|
||||
@@ -1,12 +1,13 @@
|
||||
/// Types for the BLK_BOX NOW priv protocol
|
||||
|
||||
#ifndef _BBNOW_PRIV_H
|
||||
#define _BBNOW_PRIV_H
|
||||
#ifndef BBNOW_PRIV_HPP
|
||||
#define BBNOW_PRIV_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "bb_expantions.hpp"
|
||||
@@ -24,6 +25,10 @@ struct BBNowPrivAckData {
|
||||
/// The data associated with the `DISCOVERY_RESPONSE` type.
|
||||
struct BBNowPrivDiscoveryResponseData {
|
||||
BlkBoxExpantion expantion_type{};
|
||||
/// The advertised device name. NUL-padded to
|
||||
/// `EXPANDER_DEVICE_NAME_MAX_LEN` on the wire; longer names are
|
||||
/// truncated.
|
||||
std::string name{};
|
||||
};
|
||||
|
||||
///////////////////////////////////////
|
||||
@@ -76,11 +81,12 @@ struct BBNowPrivPacket {
|
||||
);
|
||||
|
||||
/// Discovery response packet size.
|
||||
const static size_t DISCOVERY_RESPONSE_PACKET_SIZE = 6;
|
||||
const static size_t DISCOVERY_RESPONSE_PACKET_SIZE = 38;
|
||||
static_assert(
|
||||
DISCOVERY_RESPONSE_PACKET_SIZE == sizeof(BBNowPrivPacketType) +
|
||||
sizeof(uint16_t) +
|
||||
sizeof(BBNowPrivDiscoveryResponseData),
|
||||
sizeof(BlkBoxExpantion) +
|
||||
EXPANDER_DEVICE_NAME_MAX_LEN,
|
||||
"Discovery response packet size should match it's data size"
|
||||
);
|
||||
|
||||
@@ -143,4 +149,4 @@ struct BBNowPrivPacket {
|
||||
);
|
||||
};
|
||||
|
||||
#endif /* _BBNOW_PRIV_H */
|
||||
#endif /* BBNOW_PRIV_HPP */
|
||||
@@ -1,7 +1,7 @@
|
||||
/// Types for the BLK_BOX NOW pub protocol
|
||||
|
||||
#ifndef _BBNOW_PUB_H
|
||||
#define _BBNOW_PUB_H
|
||||
#ifndef BBNOW_PUB_HPP
|
||||
#define BBNOW_PUB_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
@@ -66,4 +66,4 @@ struct BBNowPubPacket {
|
||||
static BBNowPubPacket new_discovery(BlkBoxNowPubDiscoveryData data);
|
||||
};
|
||||
|
||||
#endif /* _BBNOW_PUB_H */
|
||||
#endif /* BBNOW_PUB_HPP */
|
||||
@@ -0,0 +1,9 @@
|
||||
/// Types for the BLK_BOX NOW protocol
|
||||
|
||||
#ifndef BBNOW_TYPES_HPP
|
||||
#define BBNOW_TYPES_HPP
|
||||
|
||||
#include "bbnow/pub.h" // IWYU pragma: keep
|
||||
#include "bbnow/priv.h" // IWYU pragma: keep
|
||||
|
||||
#endif /* BBNOW_TYPES_HPP */
|
||||
@@ -1,9 +0,0 @@
|
||||
/// Types for the BLK_BOX NOW protocol
|
||||
|
||||
#ifndef _BBNOW_TYPES_H
|
||||
#define _BBNOW_TYPES_H
|
||||
|
||||
#include "bbnow_pub.hpp" // IWYU pragma: keep
|
||||
#include "bbnow_priv.hpp" // IWYU pragma: keep
|
||||
|
||||
#endif /* _BBNOW_TYPES_H */
|
||||
Reference in New Issue
Block a user