gus_c.h
Go to the documentation of this file.
1
59 #ifndef __GUS_C_H__
60 #define __GUS_C_H__
61
62 #include "ble_prf_types.h"
63 #include "gr55xx_sys.h"
64 #include "custom_config.h"
65 #include <stdint.h>
66 #include <stdbool.h>
67
72 #define GUS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
73 10 : CFG_MAX_CONNECTIONS)
74 #define FLOW_ON 0x01
75 #define FLOW_OFF 0x00
81 #define GUS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
82 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6}
83 #define GUS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
84 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6}
85 #define GUS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
86 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6}
87 #define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
88 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6}
97 typedef enum
98 {
99 GUS_C_EVT_INVALID,
100 GUS_C_EVT_DISCOVERY_COMPLETE,
101 GUS_C_EVT_DISCOVERY_FAIL,
102 GUS_C_EVT_TX_NTF_SET_SUCCESS,
103 GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS,
104 GUS_C_EVT_PEER_DATA_RECEIVE,
105 GUS_C_EVT_TX_CPLT,
106 GUS_C_EVT_TX_FLOW_OFF,
107 GUS_C_EVT_TX_FLOW_ON,
108 GUS_C_EVT_RX_FLOW_UPDATE_CPLT,
109 GUS_C_EVT_WRITE_OP_ERR,
110 } gus_c_evt_type_t;
118 typedef struct
119 {
120 uint16_t gus_srvc_start_handle;
121 uint16_t gus_srvc_end_handle;
122 uint16_t gus_tx_handle;
123 uint16_t gus_tx_cccd_handle;
124 uint16_t gus_rx_handle;
125 uint16_t gus_flow_ctrl_handle;
126 uint16_t gus_flow_ctrl_cccd_handle;
127 } gus_c_handles_t;
128
130 typedef struct
131 {
132 uint8_t conn_idx;
133 gus_c_evt_type_t evt_type;
134 uint16_t length;
135 uint8_t *p_data;
136 } gus_c_evt_t;
144 typedef void (* gus_c_evt_handler_t)(gus_c_evt_t *p_evt);
160 sdk_err_t gus_client_init(gus_c_evt_handler_t evt_handler);
161
171 sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx);
172
183 sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable);
184
195 sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable);
196
208 sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
209
220 sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl);
222 #endif
223
GUS_C_EVT_TX_FLOW_OFF
@ GUS_C_EVT_TX_FLOW_OFF
Definition: gus_c.h:106
GUS_C_EVT_DISCOVERY_FAIL
@ GUS_C_EVT_DISCOVERY_FAIL
Definition: gus_c.h:101
GUS_C_EVT_TX_FLOW_ON
@ GUS_C_EVT_TX_FLOW_ON
Definition: gus_c.h:107
gus_c_evt_t::p_data
uint8_t * p_data
Definition: gus_c.h:135
gus_c_evt_t::conn_idx
uint8_t conn_idx
Definition: gus_c.h:132
GUS_C_EVT_DISCOVERY_COMPLETE
@ GUS_C_EVT_DISCOVERY_COMPLETE
Definition: gus_c.h:100
gus_c_handles_t::gus_srvc_end_handle
uint16_t gus_srvc_end_handle
Definition: gus_c.h:121
gr55xx_sys.h
GR55XX System API.
GUS_C_EVT_PEER_DATA_RECEIVE
@ GUS_C_EVT_PEER_DATA_RECEIVE
Definition: gus_c.h:104
gus_c_handles_t::gus_rx_handle
uint16_t gus_rx_handle
Definition: gus_c.h:124
gus_c_evt_t::length
uint16_t length
Definition: gus_c.h:134
GUS_C_EVT_TX_CPLT
@ GUS_C_EVT_TX_CPLT
Definition: gus_c.h:105
gus_c_handles_t::gus_flow_ctrl_cccd_handle
uint16_t gus_flow_ctrl_cccd_handle
Definition: gus_c.h:126
gus_c_handles_t::gus_tx_handle
uint16_t gus_tx_handle
Definition: gus_c.h:122
gus_c_tx_data_send
sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Send data to the server.
GUS_C_EVT_INVALID
@ GUS_C_EVT_INVALID
Definition: gus_c.h:99
gus_c_handles_t
Handles on the connected peer device needed to interact with it.
Definition: gus_c.h:119
gus_c_disc_srvc_start
sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx)
Discovery GUS on peer.
GUS_C_EVT_WRITE_OP_ERR
@ GUS_C_EVT_WRITE_OP_ERR
Definition: gus_c.h:109
gus_c_evt_type_t
gus_c_evt_type_t
Goodix UART Service Client event type.
Definition: gus_c.h:98
GUS_C_EVT_RX_FLOW_UPDATE_CPLT
@ GUS_C_EVT_RX_FLOW_UPDATE_CPLT
Definition: gus_c.h:108
ble_prf_types.h
Profile/Service Common Types.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
gus_c_handles_t::gus_tx_cccd_handle
uint16_t gus_tx_cccd_handle
Definition: gus_c.h:123
gus_c_handles_t::gus_flow_ctrl_handle
uint16_t gus_flow_ctrl_handle
Definition: gus_c.h:125
gus_c_evt_t
Goodix UART Service Client event.
Definition: gus_c.h:131
gus_c_evt_t::evt_type
gus_c_evt_type_t evt_type
Definition: gus_c.h:133
gus_c_handles_t::gus_srvc_start_handle
uint16_t gus_srvc_start_handle
Definition: gus_c.h:120
gus_c_tx_notify_set
sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer GUS Tx characteristic notify.
gus_client_init
sdk_err_t gus_client_init(gus_c_evt_handler_t evt_handler)
Register GUS Client event handler.
GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS
@ GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS
Definition: gus_c.h:103
gus_c_evt_handler_t
void(* gus_c_evt_handler_t)(gus_c_evt_t *p_evt)
Goodix UART Service Client event handler type.
Definition: gus_c.h:144
gus_c_rx_flow_ctrl_set
sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl)
Send GUS Client Rx flow control state to peer device.
GUS_C_EVT_TX_NTF_SET_SUCCESS
@ GUS_C_EVT_TX_NTF_SET_SUCCESS
Definition: gus_c.h:102
gus_c_flow_ctrl_notify_set
sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer device GUS flow control notify.