pcs.h
Go to the documentation of this file.
1
58 #ifndef __PCS_H__
59 #define __PCS_H__
60
61 #include "gr55xx_sys.h"
62 #include "custom_config.h"
63
68 #define PCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
69 10 : CFG_MAX_CONNECTIONS)
70 #define PCS_MAX_DATA_LEN 244
71 #define PCS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
72 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x05, 0xED, 0xA6
74 #define PCS_SET_PARAM_SUCCESS 0x00
75 #define PCS_SET_PARAM_FAIL 0x81
77 #define PCS_SET_ADV_DATA_3B 0x03
78 #define PCS_SET_ADV_DATA_10B 0x0a
79 #define PCS_SET_ADV_DATA_17B 0x11
80 #define PCS_SET_ADV_DATA_24B 0x18
81 #define PCS_SET_ADV_DATA_31B 0x1f
89 typedef enum
90 {
91 PCS_EVT_INVALID,
92 PCS_EVT_TX_ENABLE,
93 PCS_EVT_TX_DISABLE,
94 PCS_EVT_SETTING_ENABLE,
95 PCS_EVT_SETTING_DISABLE,
96 PCS_EVT_TX_DATA_SENT,
97 PCS_EVT_PARAM_SET,
98 PCS_EVT_DISCONNECTED,
99 } pcs_evt_type_t;
100
102 typedef enum
103 {
104 PCS_SETTING_TYPE_ADV_INTERVAL,
105 PCS_SETTING_TYPE_CONN_PARAM,
106 PCS_SETTING_TYPE_PHY,
107 PCS_SETTING_TYPE_ADV_DATA,
108 PCS_SETTING_TYPE_TX_POWER,
109 } pcs_setting_type_t;
117 typedef struct
118 {
119 uint8_t conn_idx;
120 pcs_evt_type_t evt_type;
121 uint8_t *p_data;
122 uint16_t length;
123 } pcs_evt_t;
131 typedef void (*pcs_evt_handler_t)(pcs_evt_t *p_evt);
139 typedef struct
140 {
141 pcs_evt_handler_t evt_handler;
142 } pcs_init_t;
158 sdk_err_t pcs_service_init(pcs_init_t *p_pcs_init);
159
171 sdk_err_t pcs_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
172
184 sdk_err_t pcs_setting_reply(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
187 #endif
188
PCS_SETTING_TYPE_ADV_DATA
@ PCS_SETTING_TYPE_ADV_DATA
Definition: pcs.h:107
PCS_EVT_SETTING_DISABLE
@ PCS_EVT_SETTING_DISABLE
Definition: pcs.h:95
pcs_evt_t::conn_idx
uint8_t conn_idx
Definition: pcs.h:119
PCS_SETTING_TYPE_ADV_INTERVAL
@ PCS_SETTING_TYPE_ADV_INTERVAL
Definition: pcs.h:104
PCS_EVT_INVALID
@ PCS_EVT_INVALID
Definition: pcs.h:91
PCS_EVT_DISCONNECTED
@ PCS_EVT_DISCONNECTED
Definition: pcs.h:98
pcs_evt_t::length
uint16_t length
Definition: pcs.h:122
pcs_setting_type_t
pcs_setting_type_t
PCS Service settings types.
Definition: pcs.h:103
pcs_evt_t::evt_type
pcs_evt_type_t evt_type
Definition: pcs.h:120
PCS_EVT_TX_DISABLE
@ PCS_EVT_TX_DISABLE
Definition: pcs.h:93
gr55xx_sys.h
GR55XX System API.
PCS_EVT_TX_ENABLE
@ PCS_EVT_TX_ENABLE
Definition: pcs.h:92
PCS_EVT_SETTING_ENABLE
@ PCS_EVT_SETTING_ENABLE
Definition: pcs.h:94
PCS_SETTING_TYPE_CONN_PARAM
@ PCS_SETTING_TYPE_CONN_PARAM
Definition: pcs.h:105
pcs_evt_t
PCS Service event.
Definition: pcs.h:118
pcs_init_t::evt_handler
pcs_evt_handler_t evt_handler
Definition: pcs.h:141
PCS_EVT_TX_DATA_SENT
@ PCS_EVT_TX_DATA_SENT
Definition: pcs.h:96
PCS_EVT_PARAM_SET
@ PCS_EVT_PARAM_SET
Definition: pcs.h:97
pcs_evt_handler_t
void(* pcs_evt_handler_t)(pcs_evt_t *p_evt)
PCS Service event handler type.
Definition: pcs.h:131
pcs_init_t
PCS Service init stucture. This contains all option and data needed for initialization of the service...
Definition: pcs.h:140
pcs_evt_t::p_data
uint8_t * p_data
Definition: pcs.h:121
pcs_setting_reply
sdk_err_t pcs_setting_reply(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Reply parameters set result.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
PCS_SETTING_TYPE_TX_POWER
@ PCS_SETTING_TYPE_TX_POWER
Definition: pcs.h:108
pcs_service_init
sdk_err_t pcs_service_init(pcs_init_t *p_pcs_init)
Initialize a PCS Service instance and add in the database.
PCS_SETTING_TYPE_PHY
@ PCS_SETTING_TYPE_PHY
Definition: pcs.h:106
pcs_tx_data_send
sdk_err_t pcs_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Send data to peer device.
pcs_evt_type_t
pcs_evt_type_t
PCS Service event types.
Definition: pcs.h:90