OVMS3-idf/components/bt/bluedroid/btc/profile/std/include/btc_gap_ble.h
Tian Hao 6cae05d058 component/bt : change gap btc args to union
1. change gap btc args to union to decrease the dram occupied by btc args
2. actually use individual args for every action is the best way(decrease the dram occupy), but for writing code easily and the style, use union
3. gatt server/client should do the same work
2016-11-22 21:50:26 +08:00

70 lines
1.9 KiB
C

#ifndef __BTC_GAP_BLE_H__
#define __BTC_GAP_BLE_H__
#include "esp_bt_defs.h"
#include "esp_gap_ble_api.h"
typedef enum {
BTC_GAP_BLE_ACT_CFG_ADV_DATA = 0,
BTC_GAP_BLE_ACT_SET_SCAN_PARAM,
BTC_GAP_BLE_ACT_START_SCAN,
BTC_GAP_BLE_ACT_STOP_SCAN,
BTC_GAP_BLE_ACT_START_ADV,
BTC_GAP_BLE_ACT_STOP_ADV,
BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM,
BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN,
BTC_GAP_BLE_ACT_SET_RAND_ADDRESS,
BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
BTC_GAP_BLE_ACT_SET_DEV_NAME,
} btc_gap_ble_act_t;
/* btc_ble_gap_args_t */
typedef union {
//BTC_GAP_BLE_ACT_CFG_ADV_DATA = 0,
struct config_adv_data_args {
esp_ble_adv_data_t adv_data;
} cfg_adv_data;
//BTC_GAP_BLE_ACT_SET_SCAN_PARAM,
struct set_scan_params_args {
esp_ble_scan_params_t scan_params;
} set_scan_param;
//BTC_GAP_BLE_ACT_START_SCAN,
struct start_scan_args {
uint32_t duration;
} start_scan;
//BTC_GAP_BLE_ACT_STOP_SCAN, no args
//BTC_GAP_BLE_ACT_START_ADV,
struct start_adv_args {
esp_ble_adv_params_t adv_params;
} start_adv;
//BTC_GAP_BLE_ACT_STOP_ADV, no args
//BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM,
struct conn_update_params_args {
esp_ble_conn_update_params_t conn_params;
} conn_update_params;
//BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN
struct set_pkt_data_len_args {
esp_bd_addr_t remote_device;
uint16_t tx_data_length;
} set_pkt_data_len;
//BTC_GAP_BLE_ACT_SET_RAND_ADDRESS,
struct set_rand_addr_args {
esp_bd_addr_t rand_addr;
} set_rand_addr;
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
struct cfg_local_privacy_args {
bool privacy_enable;
} cfg_local_privacy;
//BTC_GAP_BLE_ACT_SET_DEV_NAME,
struct set_dev_name_args {
#define ESP_GAP_DEVICE_NAME_MAX (32)
char device_name[ESP_GAP_DEVICE_NAME_MAX+1];
} set_dev_name;
} btc_ble_gap_args_t;
void btc_gap_ble_call_handler(btc_msg_t *msg);
void btc_gap_ble_cb_handler(btc_msg_t *msg);
void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
#endif /* __BTC_GAP_BLE_H__ */