I am writing a program where I require to connect to a Bluetooth LE device and read a 128 bit value beneath a 16 bit service 0xfeed . Could you point me to sample code or help me with information on the functions I need to call to accomplish this task.
You opened a private ticket about this and Steve gave you answer there so I'll just copy it here for the benefit of the community.
The general process for this is as follows :
1. Scan for advertising devices by calling cmd_le_gap_discover().
2. Connect to a device based on some criteria, usually an advertised service.
3. Discover the service(s) to get the handle(s) cmd_gatt_discover_primary_services().
4. Discover characteristics by calling cmd_gatt_discover_characteristics().
5. Read the desired characteristic by calling cmd_gatt_read_characteristic_value.
If you want to take a little bit of a shortcut and you don't really need to know the service handle(s), you can call read the characteristic using it's UUID by calling cmd_gatt_read_characteristic_by_uuid().
We have a knowledgebase article here http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/BLE-Central-and-GATT-client-example-working-with-an-Android-app/ta-p/204153
That implements most of these steps except for the fact that the central device requests notifications instead of performing a read. So I think this would be a good starting point for you.
I am facing some problems when trying to discover gap services using the BGLib functions. I get an error code 0x101 (Invalid GATT connection handle) when trying to discover gap services using gecko_cmd_gatt_discover_primary_services . I am able to connect to the ble device with gecko_cmd_le_gap_open. The function call gecko_cmd_le_gap_open succeeds wiith result = 0 and I use a copy of the connection handle from the struct gecko_msg_le_gap_open_rsp_t as input parameter for gecko_cmd_gatt_discover_primary_services . Do you have some suggestions on how to debug this problem and what could be causing this error.
Please continue this discussion on the ticket as I see that my colleague has already answered this question.
In general please don't ask the same question in both the forum and via private ticket.