Question
I'm developing an application where a Gear device connects to an iPhone using Bluetooth LE, with Gear as Central and iPhone as Peripheral. I'm encountering an issue during the connection process.
Here's my implementation flow:
- Initialize Bluetooth:
bt_initialize();
bt_adapter_get_state(&state);
if (state == BT_ADAPTER_DISABLED) {
return error;
}
- Start scanning:
bt_gatt_set_connection_state_changed_cb(__bt_gatt_connection_state_changed_cb, NULL);
bt_adapter_le_start_scan(__bt_adapter_le_scan_result_cb, NULL);
Logs confirm the service with requested UUID (00001101-0000-1000-8000-00805F9B3400) is found.
- Stop scanning after device discovery:
bt_adapter_le_stop_scan();
- Attempt connection:
bt_gatt_connect(iphone_address, true);
bt_gatt_client_h client_handle = NULL;
bt_gatt_client_create(iphone_address, &client_handle);
The error occurs when trying to create a GATT client:
Fail wc_bt_get_gatt_client_service[9a3f68e0-86ce-11e5-a309-0002a5d5c51b]/[-61]
Error -61 (BT_ERROR_NO_DATA) suggests the service with UUID 9a3f68e0-86ce-11e5-a309-0002a5d5c51b is not found, though this UUID isn't in my code.
Answer
Problem Understanding
The issue occurs when attempting to establish a BLE connection between Gear (Central) and iPhone (Peripheral). The error suggests the system is looking for a service UUID that isn't explicitly requested in the code.
Solution Methods
-
Initial Connection Setup:
- Ensure the Gear is first connected via the official Gear S app (Gear Manager on Android)
- This establishes the necessary baseline connection before your custom app attempts communication
-
Service Discovery:
- After connection, explicitly discover services using:
bt_gatt_client_discover_services(client_handle); -
Error Handling:
- Implement proper error handling for service discovery failures
- Verify all required services are properly advertised by the iPhone peripheral
Code Examples
// After successful connection
if (bt_gatt_client_discover_services(client_handle) == BT_ERROR_NONE) {
// Service discovery successful
// Proceed with characteristic discovery
} else {
// Handle discovery failure
}
Additional Tips
- The mysterious UUID (9a3f68e0-86ce-11e5-a309-0002a5d5c51b) appears to be an internal service required by the Gear system
- Always verify Bluetooth permissions in your Tizen manifest
- Consider connection timeouts and retry mechanisms
- Test with different iOS versions as BLE behavior can vary