2021-09-10 05:19:02 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2021-12-08 16:59:40 +03:00
|
|
|
#define SERIAL_SVC_DATA_LEN_MAX (486)
|
|
|
|
#define SERIAL_SVC_CHAR_VALUE_LEN_MAX (243)
|
2021-10-12 14:48:34 +03:00
|
|
|
|
2021-09-10 05:19:02 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-10-14 20:21:23 +03:00
|
|
|
typedef enum {
|
|
|
|
SerialServiceRpcStatusNotActive = 0UL,
|
|
|
|
SerialServiceRpcStatusActive = 1UL,
|
|
|
|
} SerialServiceRpcStatus;
|
|
|
|
|
2021-12-08 14:28:01 +03:00
|
|
|
typedef enum {
|
|
|
|
SerialServiceEventTypeDataReceived,
|
|
|
|
SerialServiceEventTypeDataSent,
|
2022-10-14 20:21:23 +03:00
|
|
|
SerialServiceEventTypesBleResetRequest,
|
2021-12-08 14:28:01 +03:00
|
|
|
} SerialServiceEventType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t* buffer;
|
|
|
|
uint16_t size;
|
|
|
|
} SerialServiceData;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
SerialServiceEventType event;
|
|
|
|
SerialServiceData data;
|
|
|
|
} SerialServiceEvent;
|
|
|
|
|
2022-01-05 19:10:18 +03:00
|
|
|
typedef uint16_t (*SerialServiceEventCallback)(SerialServiceEvent event, void* context);
|
2021-10-12 19:41:42 +03:00
|
|
|
|
2021-09-13 14:25:37 +03:00
|
|
|
void serial_svc_start();
|
2021-09-10 05:19:02 +03:00
|
|
|
|
2022-01-05 19:10:18 +03:00
|
|
|
void serial_svc_set_callbacks(
|
|
|
|
uint16_t buff_size,
|
|
|
|
SerialServiceEventCallback callback,
|
|
|
|
void* context);
|
2021-11-08 22:41:40 +03:00
|
|
|
|
2022-10-14 20:21:23 +03:00
|
|
|
void serial_svc_set_rpc_status(SerialServiceRpcStatus status);
|
|
|
|
|
2021-11-08 22:41:40 +03:00
|
|
|
void serial_svc_notify_buffer_is_empty();
|
2021-10-12 14:48:34 +03:00
|
|
|
|
2021-09-13 14:25:37 +03:00
|
|
|
void serial_svc_stop();
|
2021-09-10 05:19:02 +03:00
|
|
|
|
2021-12-08 14:28:01 +03:00
|
|
|
bool serial_svc_is_started();
|
|
|
|
|
2021-12-08 16:59:40 +03:00
|
|
|
bool serial_svc_update_tx(uint8_t* data, uint16_t data_len);
|
2021-09-10 05:19:02 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|