arduino-esp32/tools/sdk/include/bluedroid/btc_gatts.h

154 lines
4.1 KiB
C
Raw Normal View History

// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __BTC_GATTS_H__
#define __BTC_GATTS_H__
Update IDF to aaf1239 (#1539) * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * Initial add of @stickbreaker i2c * Add log_n * fix warnings when log is off * i2c code clean up and reorganization * add flags to interrupt allocator * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * fix errors with latest IDF * fix debug optimization (#1365) incorrect optimization for debugging tick markers. * Fix some missing BT header * Change BTSerial log calls * Update BLE lib * Arduino-ESP32 release management scripted (#1515) * Calculate an absolute path for a custom partitions table (#1452) * * Arduino-ESP32 release management scripted (ready-to-merge) * * secure env for espressif/arduino-esp32 * * build tests enabled * gitter webhook enabled * * gitter room link fixed * better comment * * filepaths fixed * BT Serial adjustments * * don't run sketch builds & tests for tagged builds * Return false from WiFi.hostByName() if hostname is not resolved * Free BT Memory when BT is not used * WIFI_MODE_NULL is not supported anymore * Select some key examples to build with PlatformIO to save some time * Update BLE lib * Fixed BLE lib * Major WiFi overhaul - auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus * Add cmake tests to travis * Add initial AsyncUDP * Add NetBIOS lib and fix CMake includes * Add Initial WebServer * Fix WebServer and examples * travis not quiting on build fail * Try different travis build * Update IDF to aaf1239 * Fix WPS Example * fix script permission and add some fail tests to sketch builder * Add missing space in WiFiClient::write(Stream &stream)
2018-06-27 09:01:06 +02:00
#include "btc/btc_task.h"
#include "esp_bt_defs.h"
#include "esp_gatt_defs.h"
#include "esp_gatts_api.h"
typedef enum {
BTC_GATTS_ACT_APP_REGISTER = 0,
BTC_GATTS_ACT_APP_UNREGISTER,
BTC_GATTS_ACT_CREATE_SERVICE,
BTC_GATTS_ACT_CREATE_ATTR_TAB,
BTC_GATTS_ACT_DELETE_SERVICE,
BTC_GATTS_ACT_START_SERVICE,
BTC_GATTS_ACT_STOP_SERVICE,
BTC_GATTS_ACT_ADD_INCLUDE_SERVICE,
BTC_GATTS_ACT_ADD_CHAR,
BTC_GATTS_ACT_ADD_CHAR_DESCR,
BTC_GATTS_ACT_SEND_INDICATE,
BTC_GATTS_ACT_SEND_RESPONSE,
BTC_GATTS_ACT_SET_ATTR_VALUE,
BTC_GATTS_ACT_OPEN,
BTC_GATTS_ACT_CLOSE,
} btc_gatts_act_t;
/* btc_ble_gatts_args_t */
typedef union {
//BTC_GATTS_ACT_APP_REGISTER = 0,
struct app_reg_args {
uint16_t app_id;
} app_reg;
//BTC_GATTS_ACT_APP_UNREGISTER,
struct app_unreg_args {
esp_gatt_if_t gatts_if;
} app_unreg;
//BTC_GATTS_ACT_CREATE_SERVICE,
struct create_srvc_args {
esp_gatt_if_t gatts_if;
esp_gatt_srvc_id_t service_id;
uint16_t num_handle;
} create_srvc;
//BTC_GATTS_ACT_CREATE_ATTR_TAB
struct create_attr_tab_args{
esp_gatt_if_t gatts_if;
uint8_t srvc_inst_id;
uint8_t max_nb_attr;
esp_gatts_attr_db_t *gatts_attr_db;
}create_attr_tab;
//BTC_GATTS_ACT_DELETE_SERVICE,
struct delete_srvc_args {
uint16_t service_handle;
} delete_srvc;
//BTC_GATTS_ACT_START_SERVICE,
struct start_srvc_args {
uint16_t service_handle;
} start_srvc;
//BTC_GATTS_ACT_STOP_SERVICE,
struct stop_srvc_args {
uint16_t service_handle;
} stop_srvc;
//BTC_GATTS_ACT_ADD_INCLUDE_SERVICE,
struct add_incl_srvc_args {
uint16_t service_handle;
uint16_t included_service_handle;
} add_incl_srvc;
//BTC_GATTS_ACT_ADD_CHAR,
struct add_char_args {
uint16_t service_handle;
esp_bt_uuid_t char_uuid;
esp_gatt_perm_t perm;
esp_gatt_char_prop_t property;
esp_attr_control_t attr_control;
esp_attr_value_t char_val;
} add_char;
//BTC_GATTS_ACT_ADD_CHAR_DESCR,
struct add_descr_args {
uint16_t service_handle;
esp_bt_uuid_t descr_uuid;
esp_gatt_perm_t perm;
esp_attr_control_t attr_control;
esp_attr_value_t descr_val;
} add_descr;
//BTC_GATTS_ACT_SEND_INDICATE,
struct send_indicate_args {
uint16_t conn_id;
uint16_t attr_handle;
bool need_confirm;
uint16_t value_len;
uint8_t *value;
} send_ind;
//BTC_GATTS_ACT_SEND_RESPONSE,
struct send_rsp_args {
uint16_t conn_id;
uint32_t trans_id;
esp_gatt_status_t status;
esp_gatt_rsp_t *rsp;
} send_rsp;
//BTC_GATTS_SET_ATTR_VALUE
struct set_attr_val_args {
uint16_t handle;
uint16_t length;
uint8_t *value;
} set_attr_val;
//BTC_GATTS_ACT_OPEN,
struct open_args {
esp_gatt_if_t gatts_if;
esp_bd_addr_t remote_bda;
bool is_direct;
} open;
//BTC_GATTS_ACT_CLOSE,
struct close_args {
uint16_t conn_id;
} close;
} btc_ble_gatts_args_t;
void btc_gatts_call_handler(btc_msg_t *msg);
void btc_gatts_cb_handler(btc_msg_t *msg);
void btc_gatts_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
2017-09-12 08:40:52 +02:00
esp_gatt_status_t btc_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, uint8_t **value);
#endif /* __BTC_GATTS_H__ */