wip
This commit is contained in:
parent
d20f78ddfe
commit
fb9dc91392
2 changed files with 8 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
#include "fastcon_controller.h"
|
#include "fastcon_controller.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
|
|
||||||
namespace esphome
|
namespace esphome
|
||||||
{
|
{
|
||||||
namespace fastcon
|
namespace fastcon
|
||||||
|
|
@ -84,9 +85,14 @@ namespace esphome
|
||||||
adv_data_raw[adv_data_len++] = MANUFACTURER_DATA_ID & 0xFF;
|
adv_data_raw[adv_data_len++] = MANUFACTURER_DATA_ID & 0xFF;
|
||||||
adv_data_raw[adv_data_len++] = (MANUFACTURER_DATA_ID >> 8) & 0xFF;
|
adv_data_raw[adv_data_len++] = (MANUFACTURER_DATA_ID >> 8) & 0xFF;
|
||||||
|
|
||||||
|
const auto str = format_hex_pretty(cmd.data);
|
||||||
|
ESP_LOGI(TAG, "cmd: %s", str.c_str());
|
||||||
|
|
||||||
memcpy(&adv_data_raw[adv_data_len], cmd.data.data(), cmd.data.size());
|
memcpy(&adv_data_raw[adv_data_len], cmd.data.data(), cmd.data.size());
|
||||||
adv_data_len += cmd.data.size();
|
adv_data_len += cmd.data.size();
|
||||||
|
|
||||||
|
const auto adv = format_hex_pretty(adv_data_raw);
|
||||||
|
ESP_LOGI(TAG, "adv: %s", adv.c_str());
|
||||||
esp_err_t err = esp_ble_gap_config_adv_data_raw(adv_data_raw, adv_data_len);
|
esp_err_t err = esp_ble_gap_config_adv_data_raw(adv_data_raw, adv_data_len);
|
||||||
if (err != ESP_OK)
|
if (err != ESP_OK)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/components/esp32_ble_server/ble_server.h"
|
#include "esphome/components/esp32_ble/ble.h"
|
||||||
|
|
||||||
namespace esphome
|
namespace esphome
|
||||||
{
|
{
|
||||||
namespace fastcon
|
namespace fastcon
|
||||||
{
|
{
|
||||||
|
|
||||||
class FastconController : public Component
|
class FastconController : public Component, public esp32_ble::GAPEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FastconController() = default;
|
FastconController() = default;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue