2026-04-13 10:10:46 +08:00
|
|
|
#ifndef BLINKY_BLE_SERIAL_TX_EVENT_H_
|
|
|
|
|
#define BLINKY_BLE_SERIAL_TX_EVENT_H_
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2026-04-13 10:10:46 +08:00
|
|
|
#include <app_event_manager.h>
|
|
|
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct ble_serial_tx_event {
|
|
|
|
|
struct app_event_header header;
|
|
|
|
|
struct event_dyndata dyndata;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
APP_EVENT_TYPE_DYNDATA_DECLARE(ble_serial_tx_event);
|
|
|
|
|
|
2026-04-14 16:42:04 +08:00
|
|
|
static inline int submit_ble_serial_tx_event(const uint8_t *data, size_t len)
|
|
|
|
|
{
|
|
|
|
|
struct ble_serial_tx_event *event;
|
|
|
|
|
|
|
|
|
|
if ((data == NULL) && (len > 0U)) {
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event = new_ble_serial_tx_event(len);
|
|
|
|
|
if (len > 0U) {
|
|
|
|
|
memcpy(event->dyndata.data, data, len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APP_EVENT_SUBMIT(event);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-13 10:10:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BLINKY_BLE_SERIAL_TX_EVENT_H_ */
|