• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
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
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 #ifndef APP_TWS_H
16 #define APP_TWS_H
17 #include <stdint.h>
18 #include "cs_target_config.h"
19 
20 #if APP_SUPPORT_TWS == 1
21 #include "cs_adp_api.h"
22 
23 #define TWS_SERVER_PORT         0x01
24 #define TWS_CLIENT_PORT         0x02
25 
26 typedef enum {
27     TWS_OTA_PARAM     = 71,
28     TWS_MIN_APP_PARAM = 72,
29     TWS_KEY_PARAM,
30     TWS_LINK_CONTROL_PARAM,
31     TWS_MSS_PARAM,
32     TWS_POWERD_PARAM,
33     TWS_SET_VOLUME_PARAM,
34     TWS_MAX_APP_PARAM ,
35 }APP_TWS_USER_PARAM;
36 
37 typedef enum {
38     STATE_IDLE,
39     STATE_ADV_EN,
40     STATE_SCAN_EN,
41 }APP_TWS_BLE_STATE;
42 
43 typedef enum {
44     STATE_PD_IDLE,
45     STATE_PD_PENDING,
46 }APP_TWS_POWER_DOWN_STATE;
47 
48 typedef enum {
49     WEAR_OFF,
50     WEAR_ON,
51 }APP_TWS_WEAR_STATE;
52 
53 #define APP_TWS_LEN_5            5
54 #define APP_TWS_LEN_3            3
55 #define APP_TWS_LEN_2            2
56 
57 void app_connect_tws_test(void);
58 void app_tws_default_connect(void);
59 BOOL app_tws_key_handle(uint32_t key);
60 void app_tws_msg_handle(CS_EVENT *event);
61 void app_tws_init(void);
62 BOOL app_tws_send_data(uint8_t* ptrData, uint16_t length);
63 void app_tws_set_ble_state(APP_TWS_BLE_STATE state);
64 APP_TWS_BLE_STATE app_tws_get_ble_state(void);
65 void app_bt_disconnect_tws(void);
66 void app_tws_begin_mss(void);
67 void app_tws_power_down(void);
68 void app_tws_volume_sync_handle(uint8_t mode,uint8_t volume);
69 void app_tws_wearing_state_handle(uint32_t state);
70 #endif
71 #endif
72