otas_c.h
Go to the documentation of this file.
1 
55 #ifndef __OTAS_C_H__
56 #define __OTAS_C_H__
57 
58 #include "ble_prf_types.h"
59 #include "gr55xx_sys.h"
60 #include "custom_config.h"
61 #include <stdint.h>
62 #include <stdbool.h>
63 
68 #define OTAS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
69  10 : CFG_MAX_CONNECTIONS)
76 #define OTAS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \
77  0x0A, 0x46, 0x44, 0xD3, 0x01, 0x04, 0xED, 0xA6}
78 #define OTAS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \
79  0x0A, 0x46, 0x44, 0xD3, 0x02, 0x04, 0xED, 0xA6}
80 #define OTAS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \
81  0x0A, 0x46, 0x44, 0xD3, 0x03, 0x04, 0xED, 0xA6}
82 #define OTAS_CTRL_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \
83  0x0A, 0x46, 0x44, 0xD3, 0x04, 0x04, 0xED, 0xA6}
92 typedef enum
93 {
110 typedef struct
111 {
114  uint16_t otas_tx_handle;
116  uint16_t otas_rx_handle;
117  uint16_t otas_ctrl_handle;
119 
121 typedef struct
122 {
123  uint8_t conn_idx;
125  uint8_t *p_data;
126  uint16_t length;
127 } otas_c_evt_t;
135 typedef void (*otas_c_evt_handler_t)(otas_c_evt_t *p_evt);
152 
163 
174 sdk_err_t otas_c_tx_notify_set(uint8_t conn_idx, bool is_enable);
175 
186 sdk_err_t otas_c_ctrl_data_send(uint8_t conn_idx, uint32_t data);
187 
199 sdk_err_t otas_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
201 #endif
202 
OTAS_C_EVT_CTRL_SUCCESS
@ OTAS_C_EVT_CTRL_SUCCESS
Definition: otas_c.h:98
otas_c_evt_t::length
uint16_t length
Definition: otas_c.h:126
otas_c_handles_t::otas_rx_handle
uint16_t otas_rx_handle
Definition: otas_c.h:116
otas_c_handles_t::otas_ctrl_handle
uint16_t otas_ctrl_handle
Definition: otas_c.h:117
OTAS_C_EVT_DISCOVERY_FAIL
@ OTAS_C_EVT_DISCOVERY_FAIL
Definition: otas_c.h:96
OTAS_C_EVT_INVALID
@ OTAS_C_EVT_INVALID
Definition: otas_c.h:94
gr55xx_sys.h
GR55XX System API.
otas_c_handles_t
Handles on the connected peer device needed to interact with it.
Definition: otas_c.h:111
otas_c_evt_t::conn_idx
uint8_t conn_idx
Definition: otas_c.h:123
otas_c_handles_t::otas_srvc_start_handle
uint16_t otas_srvc_start_handle
Definition: otas_c.h:112
OTAS_C_EVT_WRITE_OP_ERR
@ OTAS_C_EVT_WRITE_OP_ERR
Definition: otas_c.h:101
otas_c_evt_t
OTA Service Client event.
Definition: otas_c.h:122
OTAS_C_EVT_DISCOVERY_COMPLETE
@ OTAS_C_EVT_DISCOVERY_COMPLETE
Definition: otas_c.h:95
ble_prf_types.h
Profile/Service Common Types.
otas_c_tx_data_send
sdk_err_t otas_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
Send data to peer.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
otas_client_init
sdk_err_t otas_client_init(otas_c_evt_handler_t evt_handler)
Register THS Client event handler.
otas_c_handles_t::otas_tx_handle
uint16_t otas_tx_handle
Definition: otas_c.h:114
otas_c_evt_type_t
otas_c_evt_type_t
OTA Service Client event type.
Definition: otas_c.h:93
OTAS_C_EVT_TX_CPLT
@ OTAS_C_EVT_TX_CPLT
Definition: otas_c.h:100
otas_c_disc_srvc_start
sdk_err_t otas_c_disc_srvc_start(uint8_t conn_idx)
Discovery OTAS on peer.
otas_c_evt_t::p_data
uint8_t * p_data
Definition: otas_c.h:125
otas_c_handles_t::otas_tx_cccd_handle
uint16_t otas_tx_cccd_handle
Definition: otas_c.h:115
otas_c_tx_notify_set
sdk_err_t otas_c_tx_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer OTA tx characteristic notify.
otas_c_evt_t::evt_type
otas_c_evt_type_t evt_type
Definition: otas_c.h:124
otas_c_ctrl_data_send
sdk_err_t otas_c_ctrl_data_send(uint8_t conn_idx, uint32_t data)
Send control data to peer.
otas_c_handles_t::otas_srvc_end_handle
uint16_t otas_srvc_end_handle
Definition: otas_c.h:113
OTAS_C_EVT_PEER_DATA_RECEIVE
@ OTAS_C_EVT_PEER_DATA_RECEIVE
Definition: otas_c.h:99
OTAS_C_EVT_TX_NTF_SET_SUCCESS
@ OTAS_C_EVT_TX_NTF_SET_SUCCESS
Definition: otas_c.h:97
otas_c_evt_handler_t
void(* otas_c_evt_handler_t)(otas_c_evt_t *p_evt)
OTA Service Client event handler type.
Definition: otas_c.h:135