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

Some IoT SDK Question

my development environment is nRF-DK and IOT SDK

Q1 : IOT SDK Support Gatt Profile? Q2 : IoT SDK Support DFU mode?

Q3 : in ipv6 coap server example, how i broadcast advertising data with manufacture data and scan response data?

  • Q1: The IoT SDK and SoftDevice is just a prototype, so we cannot guarantee that there are no bugs when using custom GATT services. However, there is no reason why it should not work. During connection the client does a normal service discovery of the GATT server, and if the server contains a IP Support Service (IPSS, which is an empty GATT service), the client knows that the server supports the Internet Protocol Support Profile (IPSP). The GATT client will also discover any custom services.

    You can create a service just like you would do in a regular SDK example. For example you can copy the Battery service (ble_bas.h and ble_bas.c) files from SDK 7.1 (IoT SoftDevice is based on version 7.1, which goes with SDK 7.1), into the IoT example project. And initialize the service like this in main.c:

    static void services_init(void)
    {
        uint32_t       err_code;
        ble_bas_init_t bas_init;
    
        // Initialize Battery Service.
        memset(&bas_init, 0, sizeof(bas_init));
    
        // Here the sec level for the Battery Service can be changed/increased.
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);
    
        bas_init.evt_handler          = NULL;
        bas_init.support_notification = true;
        bas_init.p_report_ref         = NULL;
        bas_init.initial_batt_level   = 100;
    
        err_code = ble_bas_init(&m_bas, &bas_init);
        APP_ERROR_CHECK(err_code);
    }
    

    And call services_init(); from the main() function.

    Q2: DFU is not supported out of the box in the SDK, but you should be able to port the code from the regular SDK into the IoT example.

    Q3: You can add manufacturer specific data to the advertising packet like in the regular SDK. Follow this tutorial: devzone.nordicsemi.com/.../

    Here it is described how to add manufacturer specific data to both the advertising packet and the scan response packet. There is an advertising_init() function in the IoT examples main.c files, and you can edit it like in the tutorial.

    Known issues: I tried to add the Battery service and manufacturer data/scan response to the COAP_Server example and I encountered two problems.

    1. In order to be able to connect in Master Control Panel on Android, I had to change the advertising flag from BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED to BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE. This is done in the advertising_init() function.

    2. Service discovery in Master Control Panel on the computer does not work. During service discovery all the attributes are read, and the IoT SoftDevice fails to give a response when reading from CCCD attributes when the CCCD has not yet been written to. This results in a timeout and a disconnect. I believe this is a bug in the IoT SD. In MCP on Android, this is not the case, and you should be able to do a service discovery and read/write to your new service.

  • how to advertising always ? when after BLE_GAP_EVT_CONNECTED..

Related