1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __APP_SPP_H__ 5 #define __APP_SPP_H__ 6 7 #include "spp_api.h" 8 #include "sdp_api.h" 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #if defined(__3M_PACK__) 15 #define L2CAP_MTU 980 16 #else 17 #define L2CAP_MTU 672 18 #endif 19 20 #define SPP_RECV_BUFFER_SIZE 3072 21 #define SPP_MAX_DATA_PACKET_SIZE L2CAP_MTU 22 23 #ifdef ENHANCED_STACK 24 #define BTIF_APP_SPP_SERVER_GSOUND_CTL_ID BTIF_APP_SPP_SERVER_ID_1 25 #define BTIF_APP_SPP_SERVER_GSOUND_AUD_ID BTIF_APP_SPP_SERVER_ID_2 26 #define BTIF_APP_SPP_SERVER_TOTAD_ID BTIF_APP_SPP_SERVER_ID_3 27 #define BTIF_APP_SPP_SERVER_BES_OTA_ID BTIF_APP_SPP_SERVER_ID_4 28 #define BTIF_APP_SPP_SERVER_AI_VOICE_ID BTIF_APP_SPP_SERVER_ID_5 29 #define BTIF_APP_SPP_SERVER_GREEN_ID BTIF_APP_SPP_SERVER_ID_6 30 #define BTIF_APP_SPP_SERVER_RED_ID BTIF_APP_SPP_SERVER_ID_7 31 #define BTIF_APP_SPP_SERVER_FP_RFCOMM_ID BTIF_APP_SPP_SERVER_ID_8 32 33 #define BTIF_APP_SPP_CLIENT_AI_VOICE_ID BTIF_APP_SPP_CLIENT_ID_1 34 #define BTIF_APP_SPP_CLIENT_CCMP_ID BTIF_APP_SPP_CLIENT_ID_2 35 #define BTIF_APP_SPP_CLIENT_RED_ID BTIF_APP_SPP_CLIENT_ID_3 36 37 /*--------------------------------------------------------------------------- 38 * rfcomm channel number 39 * should be from 1 to 30 40 */ 41 enum RFCOMM_CHANNEL_NUM { 42 RFCOMM_CHANNEL_GS_CONTROL = RFCOMM_CHANNEL_1, 43 RFCOMM_CHANNEL_GS_AUDIO = RFCOMM_CHANNEL_2, 44 RFCOMM_CHANNEL_TOTA = RFCOMM_CHANNEL_3, 45 RFCOMM_CHANNEL_BES_OTA = RFCOMM_CHANNEL_4, 46 RFCOMM_CHANNEL_AI_VOICE = RFCOMM_CHANNEL_5, 47 RFCOMM_CHANNEL_GREEN = RFCOMM_CHANNEL_6, 48 RFCOMM_CHANNEL_RED = RFCOMM_CHANNEL_7, 49 RFCOMM_CHANNEL_FP = RFCOMM_CHANNEL_8, 50 }; 51 #endif 52 53 struct spp_device *app_create_spp_device(void); 54 #if 0 55 void app_spp_register_connect_callback(struct spp_device *osDev_t, spp_event_callback_t callback); 56 void app_spp_register_disconnect_callback(struct spp_device *osDev_t, spp_event_callback_t callback); 57 void app_spp_register_tx_done(struct spp_device *osDev_t, spp_event_callback_t callback); 58 #endif 59 bt_status_t app_spp_send_data(struct spp_device *osDev_t, uint8_t* ptrData, uint16_t *length); 60 void app_spp_open(struct spp_device *osDev_t, btif_remote_device_t *btDevice, btif_sdp_record_param_t *param, osMutexId mid, uint8_t service_id, spp_callback_t callback); 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif 67 68