This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GLS/SEN/SPE/BI-09-C

Hi.

I am using the nRF52810 for Bluetooth SIG certification.

S112 6.0.0

SDK 15.0.0

I am testing using ICS of QDID 102861 and 49943, but a failure occurred in the GLS/SEN/SPE/BI-09-C items.

Please check the PTS log below:

Test case : GLS/SEN/SPE/BI-09-C started
- Connection setup successfully.
- Tester successfully initiated connection.
- Paring process is done. Access is granted.
- Waiting for encryption change request!
- Encryption change event received.
- Encryption is successfully done.
- LE Security procedures completed successfully.
- Discover Primary Service by Service UUID Request completed successfully.
- The IUT successfully returned the UUID for Glucose
- Discover All Characteristics of Service Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Connection is disconnected successfully.
- Connection setup successfully.
- Tester successfully initiated connection.
- Discover Primary Service by Service UUID Request completed successfully.
- The IUT successfully returned the UUID for Glucose
- Discover All Characteristics of Service Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Discover All Characteristic Descriptors Request completed successfully.
- Connection is using encryption, please disable encryption for this test case.
- Connection terminated successfully.
	 -Final Verdict: FAIL
GLS/SEN/SPE/BI-09-C finished

A popup appears to disable encryption.

How can I modify the program??

I use static passkey. 

Parents
  • What is that test case? Is it just a conformance test of the GLS profile?

    It seems the test only works for unencrypted links, i suggest you turn off encryption.


  • Hi, haakonsh

    Check this in the items below.

    TSPC_GLS_2_22

    TSPC_GLS_3_1

    GLS/SEN/SPE/BI-09-C : RACP write without Authentication

    I don't understand well about turning the encrytion off.

    I tried the test by setting the Security parameter as follows:

    But it also failed.

    #define SEC_PARAM_BOND					1
    #define SEC_PARAM_MITM					0											
    #define SEC_PARAM_IO_CAPABILITIES		BLE_GAP_IO_CAPS_NONE						
    #define SEC_PARAM_LESC					0											
    #define SEC_PARAM_KEYPRESS				0											
    #define SEC_PARAM_OOB					0											
    #define SEC_PARAM_MIN_KEY_SIZE			7											
    #define SEC_PARAM_MAX_KEY_SIZE			16	

    And I tried changing the settings below but it also failed.

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&SecMode);
    Err_code = sd_ble_gap_device_name_set(&SecMode,
    									(const uint8_t *)DEVICE_NAME,
    									 sizeof(DEVICE_NAME));

    What settings should I change to turn off encryption?

  • It could be the read/write permissions of the individual characteristics. 

    In the examples/ble_peripheral/ble_app_gls/main.c on line 433, the permissions for the GLS characteristics is set to JustWorks. Try setting all the permissions for the GLS characteristics in services_init()to SEC_OPEN. 

    If this is an actual product you're making you need to make sure to use the appropriate security levels when you deploy. 

  • Because I use SDK 15.0.0, the source code is a bit wrong.

    However, it was modified in ble_gls.c as indicated.

    static uint32_t glucose_measurement_char_add(ble_gls_t * p_gls)
    {
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_md_t cccd_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;
        ble_gls_rec_t       initial_gls_rec_value;
        uint8_t             encoded_gls_meas[MAX_GLM_LEN];
    
        memset(&cccd_md, 0, sizeof(cccd_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
        //BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);	
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    	
        cccd_md.vloc = BLE_GATTS_VLOC_STACK;
    
        memset(&char_md, 0, sizeof(char_md));
    
        char_md.char_props.notify = 1;
        char_md.p_char_user_desc  = NULL;
        char_md.p_char_pf         = NULL;
        char_md.p_user_desc_md    = NULL;
        char_md.p_cccd_md         = &cccd_md;
        char_md.p_sccd_md         = NULL;
    
        BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_MEASUREMENT_CHAR);
        memset(&attr_md, 0, sizeof(attr_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
    
        attr_md.vloc    = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth = 0;
        attr_md.wr_auth = 0;
        attr_md.vlen    = 1;
    
        memset(&attr_char_value, 0, sizeof(attr_char_value));
        memset(&initial_gls_rec_value, 0, sizeof(initial_gls_rec_value));
    
        attr_char_value.p_uuid    = &ble_uuid;
        attr_char_value.p_attr_md = &attr_md;
        attr_char_value.init_len  = gls_meas_encode(&initial_gls_rec_value.meas, encoded_gls_meas);
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = MAX_GLM_LEN;
        attr_char_value.p_value   = encoded_gls_meas;
    
        return sd_ble_gatts_characteristic_add(p_gls->service_handle,
                                               &char_md,
                                               &attr_char_value,
                                               &p_gls->glm_handles);
    }
    
    static uint32_t glucose_context_char_add(ble_gls_t * p_gls)
    {
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_md_t cccd_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;
        ble_gls_rec_t       initial_gls_rec_value;
        uint8_t             encoded_gls_meas[MAX_GLM_LEN];
        uint8_t             num_recs;
        memset(&cccd_md, 0, sizeof(cccd_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
        //BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    
    	cccd_md.vloc = BLE_GATTS_VLOC_STACK;
    
        memset(&char_md, 0, sizeof(char_md));
    
        char_md.char_props.notify = 1;
        char_md.p_char_user_desc  = NULL;
        char_md.p_char_pf         = NULL;
        char_md.p_user_desc_md    = NULL;
        char_md.p_cccd_md         = &cccd_md;
        char_md.p_sccd_md         = NULL;
    
        BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_MEASUREMENT_CONTEXT_CHAR);
        memset(&attr_md, 0, sizeof(attr_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
    
        attr_md.vloc    = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth = 0;
        attr_md.wr_auth = 0;
        attr_md.vlen    = 1;
    
        memset(&attr_char_value, 0, sizeof(attr_char_value));
        memset(&initial_gls_rec_value, 0, sizeof(initial_gls_rec_value));
    
        num_recs = ble_gls_db_num_records_get();
        if (num_recs > 0)
        {
            uint32_t err_code = ble_gls_db_record_get(num_recs - 1, &initial_gls_rec_value);
            if (err_code != NRF_SUCCESS)
            {
                return err_code;
            }
        }
    
        attr_char_value.p_uuid    = &ble_uuid;
        attr_char_value.p_attr_md = &attr_md;
        attr_char_value.init_len  = gls_meas_encode(&initial_gls_rec_value.meas, encoded_gls_meas);
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = MAX_GLM_LEN;
        attr_char_value.p_value   = encoded_gls_meas;
    
        return sd_ble_gatts_characteristic_add(p_gls->service_handle,
                                               &char_md,
                                               &attr_char_value,
                                               &p_gls->glm_context_handles);
    }
    
    static uint32_t glucose_feature_char_add(ble_gls_t * p_gls)
    {
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;
        uint8_t             encoded_initial_feature[2];
    
        memset(&char_md, 0, sizeof(char_md));
    
        char_md.char_props.read  = 1;
        char_md.p_char_user_desc = NULL;
        char_md.p_char_pf        = NULL;
        char_md.p_user_desc_md   = NULL;
        char_md.p_cccd_md        = NULL;
        char_md.p_sccd_md        = NULL;
    
        BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_FEATURE_CHAR);
    
        memset(&attr_md, 0, sizeof(attr_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
    
        attr_md.vloc    = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth = 0;
        attr_md.wr_auth = 0;
        attr_md.vlen    = 0;
    
        memset(&attr_char_value, 0, sizeof(attr_char_value));
    
        encoded_initial_feature[0] = (uint8_t)(p_gls->feature);
        encoded_initial_feature[1] = (uint8_t)((p_gls->feature) >> 8);
    
        attr_char_value.p_uuid    = &ble_uuid;
        attr_char_value.p_attr_md = &attr_md;
        attr_char_value.init_len  = sizeof (uint16_t);
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = sizeof (uint16_t);
        attr_char_value.p_value   = encoded_initial_feature;
    
        return sd_ble_gatts_characteristic_add(p_gls->service_handle,
                                               &char_md,
                                               &attr_char_value,
                                               &p_gls->glf_handles);
    }
    
    
    static uint32_t record_access_control_point_char_add(ble_gls_t * p_gls)
    {
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_md_t cccd_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;
    
        memset(&cccd_md, 0, sizeof(cccd_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
        //BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
        cccd_md.vloc = BLE_GATTS_VLOC_STACK;
    
        memset(&char_md, 0, sizeof(char_md));
    
        char_md.char_props.indicate = 1;
        char_md.char_props.write    = 1;
        char_md.p_char_user_desc    = NULL;
        char_md.p_char_pf           = NULL;
        char_md.p_user_desc_md      = NULL;
        char_md.p_cccd_md           = &cccd_md;
        char_md.p_sccd_md           = NULL;
    
        BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_RECORD_ACCESS_CONTROL_POINT_CHAR);
    
        memset(&attr_md, 0, sizeof(attr_md));
    
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.write_perm);
    
        attr_md.vloc    = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth = 0;
        attr_md.wr_auth = 1;
        attr_md.vlen    = 1;
    
        memset(&attr_char_value, 0, sizeof(attr_char_value));
    
        attr_char_value.p_uuid    = &ble_uuid;
        attr_char_value.p_attr_md = &attr_md;
        attr_char_value.init_len  = 0;
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = BLE_GATT_ATT_MTU_DEFAULT;
        ///attr_char_value.max_len   = BLE_L2CAP_MTU_DEF;
        attr_char_value.p_value   = 0;
    
        return sd_ble_gatts_characteristic_add(p_gls->service_handle,
                                               &char_md,
                                               &attr_char_value,
                                               &p_gls->racp_handles);
    }
    
    

    However, the test still failed.

    It was tested using PCA 100400e and the latest SDK. But the result was also a failure.

    // Here the sec level for the Glucose Service can be changed/increased.
    gls_init.gl_meas_cccd_wr_sec = SEC_OPEN;
    gls_init.gl_feature_rd_sec   = SEC_OPEN;
    gls_init.racp_cccd_wr_sec    = SEC_OPEN;
    gls_init.racp_wr_sec         = SEC_OPEN;

    Are there any other parts that need to be modified?

  • BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);

    Try setting open access to all attributes of all characteristics in the GLS service. 

    You should also ask BT SIG why they don't support encryption in their tests. It seems kinda weird to do conformance tests on a GLS service without any encryption since there should be no devices deployed with an open GLS service. 

  • Hi.

    I tested all the characetistic and attributes of GLS by changing them to BLE_GAP_CONN_SEC_MODE_SET_OPEN, but the test also failed.

    A look at the Bluetooth SIG's GLS test suite is described below.

    I know QDID 49943 has passed the GLS test. Can you check the related source code?

  • Do you still get the same error message? 

    I'm going on vacation for a week, but I'll assign your case to another Tech Supporter.

    BR,

    HĂĄkon HoldhusI

Reply Children
Related