1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
19 #include "common/bt_target.h"
20 #include "stack/gatt_api.h"
21 #include "stack/gattdefs.h"
22 #include "bt_app_api.h"
25 /// Maximum Transmission Unit
26 #define ATT_DEFAULT_MTU (23)
28 #define BLE_WECHAT_MAX_DATA_LEN (ATT_DEFAULT_MTU - 3)
31 //define the key serivce uuid
32 #define ATT_SVC_AIRSYNC 0xFEE7
33 //define the airsync Char uuid
34 #define ATT_CHAR_AIRSYNC_WIT 0xFEC7
35 #define ATT_CHAR_AIRSYBC_NTF 0xFEC8
36 #define ATT_CHAR_AIRSYNC_READ 0xFEC9
39 typedef void (tAIRSYNC_CBACK)(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *data);
42 /// WX AirSync Service Attributes Indexes
45 WX_IDX_AIRSYNC_WIT_CHAR,
46 WX_IDX_AIRSYNC_WIT_VAL,
47 WX_IDX_AIRSYNC_NTF_CHAR,
48 WX_IDX_AIRSYNC_NTF_VAL,
49 WX_IDX_AIRSYNC_READ_CHAR,
50 WX_IDX_AIRSYNC_READ_VAL,
51 WX_IDX_AIRSYNC_NTF_CFG,
60 } tAirSync_WRITE_DATA;
76 UINT16 airsync_wirt_hdl;
77 UINT16 airsync_ntf_hdl;
78 UINT16 airsync_read_hdl;
79 UINT16 airsync_cfg_hdl;
81 tAIRSYNC_CBACK *p_cback;
86 /* service engine control block */
88 tAirSync_CLCB clcb; /* connection link*/
92 tAirSync_INST airsync_inst;
96 void AirSync_CreateService(void);
98 tAirSync_CLCB *airsync_env_clcb_alloc (UINT16 conn_id, BD_ADDR remote_bda);
100 UINT16 AirSync_env_find_conn_id_by_bd_adddr(BD_ADDR bda);
102 BOOLEAN AirSync_env_clcb_dealloc(UINT16 conn_id);
104 tGATT_STATUS AirSync_Init(tAIRSYNC_CBACK *call_back);
106 void AirSync_msg_notify(UINT8 len, UINT8 *button_msg);
108 extern tAIRSYNC_CB_ENV airsync_cb_env;
110 #endif ///WX_AIRSYNC_CFG