diff --git a/example/gatt_heart_rate_client.c b/example/gatt_heart_rate_client.c index cb0859bc6..9b37adb6b 100644 --- a/example/gatt_heart_rate_client.c +++ b/example/gatt_heart_rate_client.c @@ -207,6 +207,11 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint state = TC_CONNECTED; break; } + if (body_sensor_location_characteristic.value_handle == 0){ + printf("Sensor Location characteristic not available.\n"); + state = TC_CONNECTED; + break; + } state = TC_W4_HEART_RATE_MEASUREMENT_CHARACTERISTIC; printf("Read Body Sensor Location.\n"); state = TC_W4_SENSOR_LOCATION; @@ -223,6 +228,8 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT: body_sensor_location = gatt_event_characteristic_value_query_result_get_value(packet)[0]; printf("Sensor Location: %u\n", body_sensor_location); + break; + case GATT_EVENT_QUERY_COMPLETE: state = TC_CONNECTED; break; default: