Skip to content

Commit

Permalink
Modified spp vfs example
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongweichao committed Dec 5, 2022
1 parent 6bce9b7 commit 07621fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ static void esp_spp_cb(uint16_t e, void *p)
ESP_LOGI(SPP_TAG, "ESP_SPP_INIT_EVT");
/* Enable SPP VFS mode */
esp_spp_vfs_register();
esp_spp_start_srv(sec_mask, role_slave, 0, SPP_SERVER_NAME);
} else {
ESP_LOGE(SPP_TAG, "ESP_SPP_INIT_EVT status:%d", param->init.status);
}
Expand Down Expand Up @@ -137,6 +136,14 @@ static void esp_spp_cb(uint16_t e, void *p)
spp_wr_task_start_up(spp_read_handle, param->srv_open.fd);
}
break;
case ESP_SPP_VFS_REGISTER_EVT:
if (param->vfs_register.status == ESP_SPP_SUCCESS) {
ESP_LOGI(SPP_TAG, "ESP_SPP_VFS_REGISTER_EVT");
esp_spp_start_srv(sec_mask, role_slave, 0, SPP_SERVER_NAME);
} else {
ESP_LOGE(SPP_TAG, "ESP_SPP_VFS_REGISTER_EVT status:%d", param->vfs_register.status);
}
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ static void esp_spp_cb(uint16_t e, void *p)
ESP_LOGI(SPP_TAG, "ESP_SPP_INIT_EVT");
/* Enable SPP VFS mode */
esp_spp_vfs_register();
esp_bt_dev_set_device_name(EXAMPLE_DEVICE_NAME);
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
esp_bt_gap_start_discovery(inq_mode, inq_len, inq_num_rsps);
} else {
ESP_LOGE(SPP_TAG, "ESP_SPP_INIT_EVT status:%d", param->init.status);
}
Expand Down Expand Up @@ -193,6 +190,16 @@ static void esp_spp_cb(uint16_t e, void *p)
case ESP_SPP_SRV_OPEN_EVT:
ESP_LOGI(SPP_TAG, "ESP_SPP_SRV_OPEN_EVT");
break;
case ESP_SPP_VFS_REGISTER_EVT:
if (param->vfs_register.status == ESP_SPP_SUCCESS) {
ESP_LOGI(SPP_TAG, "ESP_SPP_VFS_REGISTER_EVT");
esp_bt_dev_set_device_name(EXAMPLE_DEVICE_NAME);
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
esp_bt_gap_start_discovery(inq_mode, inq_len, inq_num_rsps);
} else {
ESP_LOGE(SPP_TAG, "ESP_SPP_VFS_REGISTER_EVT status:%d", param->vfs_register.status);
}
break;
default:
break;
}
Expand Down

0 comments on commit 07621fd

Please sign in to comment.