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

Configurable UUID

Hello,

I want to change the 16-bit of 128-bit UUID at runtime. is this possible?

let me explain...

1)the first both central and peripheral set 128-bit UUID like this....

6e400000-b5a3-f393-e0a9-e50e24dcca9e

  1. now after connection the central send 16-bit service UUID to peripheral this will overwrite too 0x0000 number and disconnect from central and than after advertise with newer one service UUID like this..

6e400004-b5a3-f393-e0a9-e50e24dcca9e

is this possible?

please correct me if i m wrong..

thank you..

Parents
  • The only way how to change GATT Server objects with Nordic Soft Device is to "restart" it (typically softreset of the chip is faster way). UUIDs are assumed to be static identifiers.

  • but i am not able to read data from pstorage at time of ble_nus_init.

    Here i send the snapshots of this function...

    uint32_t ble_nus_init(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) { uint32_t err_code; ble_uuid_t ble_uuid; ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_nus);
    VERIFY_PARAM_NOT_NULL(p_nus_init);
    
    // Initialize the service structure.
    p_nus->conn_handle             = BLE_CONN_HANDLE_INVALID;
    p_nus->data_handler            = p_nus_init->data_handler;
    p_nus->is_notification_enabled = false;
    
    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    // Add a custom base UUID.
    err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_nus->uuid_type);
    VERIFY_SUCCESS(err_code);
    
    ble_uuid.type = p_nus->uuid_type;
    //ble_uuid.uuid = BLE_UUID_NUS_SERVICE;
    	
    
    	uint8_t *load_uuid;
    	pstorage_test_init();
    	UART_sendCString("pstorage_test_init\r\n");
    	load_uuid = pstorage_test_load();
    	
    	UART_sendCString("pstorage_test_load\r\n");
    
    	tag_uuid = (uint16_t)((load_uuid[0] << 8) | (load_uuid[1] & 0xFF));
    	if(tag_uuid == 0xFFFF)
    	{
    			printf("ble_nus_init tag_uuid = 0\r\n");
    			tag_uuid = 0x0000;
    	}
    	else
    	{
    		
    		printf("Tag UUID is :- %d\r\n",tag_uuid);
    	}
    	ble_uuid.uuid = tag_uuid;
    
    
    // Add the service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &ble_uuid,
                                        &p_nus->service_handle);
    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    VERIFY_SUCCESS(err_code);
    
    // Add the RX Characteristic.
    err_code = rx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);
    
    // Add the TX Characteristic.
    err_code = tx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);
    
    return NRF_SUCCESS;
    

    } id.uuid = tag_uuid;

    i can not get the interrupt from pstorage at time of load the data..

Reply
  • but i am not able to read data from pstorage at time of ble_nus_init.

    Here i send the snapshots of this function...

    uint32_t ble_nus_init(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) { uint32_t err_code; ble_uuid_t ble_uuid; ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_nus);
    VERIFY_PARAM_NOT_NULL(p_nus_init);
    
    // Initialize the service structure.
    p_nus->conn_handle             = BLE_CONN_HANDLE_INVALID;
    p_nus->data_handler            = p_nus_init->data_handler;
    p_nus->is_notification_enabled = false;
    
    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    // Add a custom base UUID.
    err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_nus->uuid_type);
    VERIFY_SUCCESS(err_code);
    
    ble_uuid.type = p_nus->uuid_type;
    //ble_uuid.uuid = BLE_UUID_NUS_SERVICE;
    	
    
    	uint8_t *load_uuid;
    	pstorage_test_init();
    	UART_sendCString("pstorage_test_init\r\n");
    	load_uuid = pstorage_test_load();
    	
    	UART_sendCString("pstorage_test_load\r\n");
    
    	tag_uuid = (uint16_t)((load_uuid[0] << 8) | (load_uuid[1] & 0xFF));
    	if(tag_uuid == 0xFFFF)
    	{
    			printf("ble_nus_init tag_uuid = 0\r\n");
    			tag_uuid = 0x0000;
    	}
    	else
    	{
    		
    		printf("Tag UUID is :- %d\r\n",tag_uuid);
    	}
    	ble_uuid.uuid = tag_uuid;
    
    
    // Add the service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &ble_uuid,
                                        &p_nus->service_handle);
    /**@snippet [Adding proprietary Service to S110 SoftDevice] */
    VERIFY_SUCCESS(err_code);
    
    // Add the RX Characteristic.
    err_code = rx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);
    
    // Add the TX Characteristic.
    err_code = tx_char_add(p_nus, p_nus_init);
    VERIFY_SUCCESS(err_code);
    
    return NRF_SUCCESS;
    

    } id.uuid = tag_uuid;

    i can not get the interrupt from pstorage at time of load the data..

Children
No Data
Related