lns.h
Go to the documentation of this file.
1
54 #ifndef __LNS_H__
55 #define __LNS_H__
56
57 #include "gr55xx_sys.h"
58 #include "custom_config.h"
59 #include "fault_trace.h"
60 #include <stdint.h>
61 #include <stdbool.h>
62
67 #define LNS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
68 10 : CFG_MAX_CONNECTIONS)
69 #define LNS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
70 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x08, 0xED, 0xA6
71 #define LNS_LOG_INFO_VAL_LEN 244
72 #define LNS_LOG_CTRL_PT_VAL_LEN 1
80 typedef enum
81 {
82 LNS_CTRL_PT_TRACE_STATUS_GET = 0x01,
83 LNS_CTRL_PT_TRACE_INFO_DUMP,
84 LNS_CTRL_PT_TRACE_INFO_CLEAR,
85 } lns_ctrl_pt_t;
86
88 typedef enum
89 {
90 LNS_EVT_INVALID,
91 LNS_EVT_LOG_INFO_NTF_ENABLE,
92 LNS_EVT_LOG_INFO_NTF_DISABLE,
93 LNS_EVT_CTRL_PT_IND_ENABLE,
94 LNS_EVT_CTRL_PT_IND_DISABLE,
95 LNS_EVT_TRACE_STATUS_GET,
96 LNS_EVT_TRACE_INFO_DUMP,
97 LNS_EVT_TRACE_INFO_CLEAR,
98 } lns_evt_type_t;
106 typedef struct
107 {
108 uint8_t conn_idx;
109 lns_evt_type_t evt_type;
110 } lns_evt_t;
111
113 typedef struct
114 {
115 uint8_t *p_data;
116 uint32_t length;
117 uint32_t offset;
118 } lns_log_data_t;
126 typedef void (*lns_evt_handler_t)(lns_evt_t *p_evt);
142 sdk_err_t lns_service_init(lns_evt_handler_t evt_handler);
143
154 sdk_err_t lns_pay_load_update(uint8_t conn_idx, const uint16_t payload_len);
155
165 sdk_err_t lns_log_info_send(uint8_t conn_idx);
166
177 sdk_err_t lns_log_status_send(uint8_t conn_idx, const uint8_t log_num);
180 #endif
181
LNS_CTRL_PT_TRACE_INFO_DUMP
@ LNS_CTRL_PT_TRACE_INFO_DUMP
Definition: lns.h:83
lns_evt_type_t
lns_evt_type_t
Log Notification Service event type.
Definition: lns.h:89
lns_log_info_send
sdk_err_t lns_log_info_send(uint8_t conn_idx)
Notify saved log information if it`s cccd is enabled.
LNS_EVT_TRACE_INFO_CLEAR
@ LNS_EVT_TRACE_INFO_CLEAR
Definition: lns.h:97
lns_log_data_t::offset
uint32_t offset
Definition: lns.h:117
lns_evt_t
Log Notification Service event.
Definition: lns.h:107
LNS_EVT_CTRL_PT_IND_ENABLE
@ LNS_EVT_CTRL_PT_IND_ENABLE
Definition: lns.h:93
LNS_EVT_CTRL_PT_IND_DISABLE
@ LNS_EVT_CTRL_PT_IND_DISABLE
Definition: lns.h:94
gr55xx_sys.h
GR55XX System API.
lns_service_init
sdk_err_t lns_service_init(lns_evt_handler_t evt_handler)
Initialize a Log Notification Service instance and add in the DB.
LNS_EVT_INVALID
@ LNS_EVT_INVALID
Definition: lns.h:90
lns_log_data_t::length
uint32_t length
Definition: lns.h:116
lns_evt_t::evt_type
lns_evt_type_t evt_type
Definition: lns.h:109
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
LNS_CTRL_PT_TRACE_INFO_CLEAR
@ LNS_CTRL_PT_TRACE_INFO_CLEAR
Definition: lns.h:84
LNS_CTRL_PT_TRACE_STATUS_GET
@ LNS_CTRL_PT_TRACE_STATUS_GET
Definition: lns.h:82
lns_log_data_t::p_data
uint8_t * p_data
Definition: lns.h:115
lns_pay_load_update
sdk_err_t lns_pay_load_update(uint8_t conn_idx, const uint16_t payload_len)
Update lns gatt payload length (MTU - 3).
lns_log_data_t
Log Information data.
Definition: lns.h:114
LNS_EVT_TRACE_INFO_DUMP
@ LNS_EVT_TRACE_INFO_DUMP
Definition: lns.h:96
LNS_EVT_LOG_INFO_NTF_DISABLE
@ LNS_EVT_LOG_INFO_NTF_DISABLE
Definition: lns.h:92
lns_log_status_send
sdk_err_t lns_log_status_send(uint8_t conn_idx, const uint8_t log_num)
Send saved log status.
LNS_EVT_LOG_INFO_NTF_ENABLE
@ LNS_EVT_LOG_INFO_NTF_ENABLE
Definition: lns.h:91
lns_evt_t::conn_idx
uint8_t conn_idx
Definition: lns.h:108
lns_evt_handler_t
void(* lns_evt_handler_t)(lns_evt_t *p_evt)
Log Notification Service event handler type.
Definition: lns.h:126
LNS_EVT_TRACE_STATUS_GET
@ LNS_EVT_TRACE_STATUS_GET
Definition: lns.h:95
lns_ctrl_pt_t
lns_ctrl_pt_t
Log Notification Service Control Point.
Definition: lns.h:81