diff --git a/test/gatt_service_server/device_information_service_server_test.cpp b/test/gatt_service_server/device_information_service_server_test.cpp index 432ee1c99..4e280581e 100644 --- a/test/gatt_service_server/device_information_service_server_test.cpp +++ b/test/gatt_service_server/device_information_service_server_test.cpp @@ -24,6 +24,7 @@ #include "device_information_service_server_test.h" #include "mock_att_server.h" +#define DEVICE_INFORMATION_CHARACTERISTIC_UUIDS_NUM 10 typedef struct { uint8_t * data; uint16_t len; @@ -39,13 +40,14 @@ const uint16_t device_information_characteristic_uuids[] = { ORG_BLUETOOTH_CHARACTERISTIC_SOFTWARE_REVISION_STRING, ORG_BLUETOOTH_CHARACTERISTIC_SYSTEM_ID, ORG_BLUETOOTH_CHARACTERISTIC_IEEE_11073_20601_REGULATORY_CERTIFICATION_DATA_LIST, - ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID + ORG_BLUETOOTH_CHARACTERISTIC_PNP_ID, + ORG_BLUETOOTH_CHARACTERISTIC_UDI_FOR_MEDICAL_DEVICES }; TEST_GROUP(DEVICE_INFORMATION_SERVICE_SERVER){ att_service_handler_t * service; uint16_t con_handle; - device_information_field_t device_information_fields[9]; + device_information_field_t device_information_fields[DEVICE_INFORMATION_CHARACTERISTIC_UUIDS_NUM]; void setup(void){ // setup database @@ -54,7 +56,7 @@ TEST_GROUP(DEVICE_INFORMATION_SERVICE_SERVER){ device_information_service_server_init(); int i; - for (i=0;i<9;i++){ + for (i=0;i 0); } @@ -111,6 +114,18 @@ TEST(DEVICE_INFORMATION_SERVICE_SERVER, read_values){ CHECK(response_len == 0); } +TEST(DEVICE_INFORMATION_SERVICE_SERVER, read_udi_for_medical_devices){ + uint8_t response[8]; + uint16_t response_len; + + uint8_t udi_index = DEVICE_INFORMATION_CHARACTERISTIC_UUIDS_NUM - 1; + + device_information_service_server_set_udi_for_medical_devices(NULL, NULL, NULL, NULL); + response_len = mock_att_service_read_callback(con_handle, device_information_fields[udi_index].value_handle, 0, response, sizeof(response)); + CHECK(response_len > 0); + +} + int main (int argc, const char * argv[]){ return CommandLineTestRunner::RunAllTests(argc, argv); } diff --git a/test/gatt_service_server/device_information_service_server_test.gatt b/test/gatt_service_server/device_information_service_server_test.gatt index 1f2364f05..3ff658f7c 100644 --- a/test/gatt_service_server/device_information_service_server_test.gatt +++ b/test/gatt_service_server/device_information_service_server_test.gatt @@ -1,2 +1,2 @@ // add Battery Service -#import \ No newline at end of file +#import \ No newline at end of file