我们使用6621C/P时,要开启1801服务,可以如下修改,以下以simple工程为例 在app_task.c文件 gapm_cmp_evt_handler 函数中 case (GAPM_RESET): 分支下 // 增加1801服务 cmd->att_cfg |= GAPM_MASK_ATT_SVC_CHG_EN; // Reset completed case (GAPM_RESET): { if (param->status == GAP_ERR_NO_ERROR) { #if (NVDS_SUPPORT) nvds_tag_len_t len = 6; #endif //(NVDS_SUPPORT) #if (BLE_APP_HID) app_hid_start_mouse(); #endif //(BLE_APP_HID) // Set Device configuration struct gapm_set_dev_config_cmd *cmd = KE_MSG_ALLOC(GAPM_SET_DEV_CONFIG_CMD, TASK_GAPM, TASK_APP, gapm_set_dev_config_cmd); // Set the operation cmd->operation = GAPM_SET_DEV_CONFIG; // Set the device role - Peripheral cmd->role = GAP_ROLE_PERIPHERAL; #if (BLE_APP_SEC_CON) // The Max MTU is increased to support the Public Key exchange // HOWEVER, with secure connections enabled you cannot sniff the // LEAP and LEAS protocols cmd->max_mtu = 160; cmd->pairing_mode = GAPM_PAIRING_SEC_CON | GAPM_PAIRING_LEGACY; #else // !(BLE_APP_SEC_CON) // Do not support secure connections cmd->pairing_mode = GAPM_PAIRING_LEGACY; #endif //(BLE_APP_SEC_CON) // Set Data length parameters cmd->sugg_max_tx_octets = BLE_MIN_OCTETS; cmd->sugg_max_tx_time = BLE_MIN_TIME; #if (BLE_APP_HID) // Enable Slave Preferred Connection Parameters present cmd->att_cfg = GAPM_MASK_ATT_SLV_PREF_CON_PAR_EN; #endif //(BLE_APP_HID) // Host privacy enabled by default cmd->privacy_cfg = 0; #if (NVDS_SUPPORT) if (nvds_get(NVDS_TAG_BD_ADDRESS, &len, &cmd->addr.addr[0]) != NVDS_OK) { memcpy(cmd->addr.addr, &co_default_bdaddr, sizeof(co_default_bdaddr)); } #endif //(NVDS_SUPPORT) // Host privacy enabled by default #if (BLE_APP_PRIVACY) cmd->privacy_cfg |= GAPM_PRIV_CFG_PRIV_EN_BIT; cmd->renew_dur = 0x0384; // 15min #endif #if (BLE_APP_AM0) cmd->audio_cfg = GAPM_MASK_AUDIO_AM0_SUP; cmd->att_cfg |= GAPM_MASK_ATT_SVC_CHG_EN; #endif //(BLE_APP_AM0) // 增加1801服务 cmd->att_cfg |= GAPM_MASK_ATT_SVC_CHG_EN; #if ((NVDS_SUPPORT) && (BLE_APP_SEC)) if ((app_sec_get_bond_status() == true) && (nvds_get(NVDS_TAG_LOC_IRK, &key_len, app_env.loc_irk) == NVDS_OK)) { memcpy(cmd->irk.key, app_env.loc_irk, 16); } else #endif //(NVDS_SUPPORT) { memset((void *)&cmd->irk.key[0], 0x00, KEY_LEN); } // Send message ke_msg_send(cmd); } else { ASSERT_ERR(0); } } break; |