DA14531 - add features to prox reporter example

i need to add features like

  • it should bond with only one device (to store the MAC ID 1st time)
  • it should pair with that device (when the mac ID matches)
  • no other device should not be connected in between or bonded with the device

how can i do these things to the prox reporter example

  • Hi Stanly,

    Thank you for posting your question online.

    it should bond with only one device (to store the MAC ID 1st time)

    Please refer on the DA1453x Tutorial BLE Security — DA1453x&DA1458x Tutorial BLE security (renesas.com)
    Please also check the ble_app_security example.

    • it should pair with that device (when the mac ID matches)
    • no other device should not be connected in between or bonded with the device

    You can either use Directed Advertising (set the Bluetooth Address a.k.a. MAC ID of the Central device so it is the only device that can see the Advertising packets) or Whitelist the device that you want to be able to send a connection request.
    Please refer on the following:
    1) DA1453x / DA1458x Tutorial BLE Advertising — DA145XX Tutorial BLE Advertising (renesas.com) and here: 4. User Guides — DA14585/DA14531 SW Platform Reference Manual (renesas.com) for the Directed Advertising concept
    2) 4. User Guides — DA14585/DA14531 SW Platform Reference Manual (renesas.com) for the Whitelist concept

    Best Regards,
    OV_Renesas

  • static int gapc_connection_req_ind_handler(ke_msg_id_t const msgid,
                                               struct gapc_connection_req_ind const *param,
                                               ke_task_id_t const dest_id,
                                               ke_task_id_t const src_id)
    {
    
        // Define the allowed Bluetooth address
        char ALLOWED_BLUETOOTH_ADDRESS[18] = "73:DD:BA:A6:3C:9E";
    
        // Get the Bluetooth address of the connecting device
        char address[18];
        sprintf(address, "%02X:%02X:%02X:%02X:%02X:%02X",
                param->peer_addr.addr[5], param->peer_addr.addr[4], param->peer_addr.addr[3],
                param->peer_addr.addr[2], param->peer_addr.addr[1], param->peer_addr.addr[0]);
    
        bool allowed = false;
    
        // Check if the connecting address matches the allowed address
        if (strcmp(address, ALLOWED_BLUETOOTH_ADDRESS) == 0) {
            allowed = true;
        }
    		
        // Connection Index
        if ((ke_state_get(dest_id) == APP_CONNECTABLE)&&allowed)
        {
            uint8_t conidx = KE_IDX_GET(src_id);
            ASSERT_WARNING(conidx < APP_EASY_MAX_ACTIVE_CONNECTION);
            app_env[conidx].conidx = conidx;
    				
            if (conidx != GAP_INVALID_CONIDX )
            {
                app_env[conidx].connection_active = true;
                ke_state_set(TASK_APP, APP_CONNECTED);
                // Retrieve the connection info from the parameters
                app_env[conidx].conhdl = param->conhdl;
                app_env[conidx].peer_addr_type = param->peer_addr_type;
                memcpy(app_env[conidx].peer_addr.addr, param->peer_addr.addr, BD_ADDR_LEN);
    
                #if (BLE_APP_SEC)
                    // send connection confirmation
                    app_easy_gap_confirm(conidx, (enum gap_auth) app_sec_env[conidx].auth, 1);
                #else
                    app_easy_gap_confirm(conidx, GAP_AUTH_REQ_NO_MITM_NO_BOND, 1);
                #endif
            } 
            CALLBACK_ARGS_2(user_app_callbacks.app_on_connection, conidx, param)
        }
    
        else
        {
            // APP_CONNECTABLE state is used to wait the GAP_LE_CREATE_CONN_REQ_CMP_EVT message
            ASSERT_ERROR(0);
        }
    
        return (KE_MSG_CONSUMED);
    }

    i have tried to add the function to allow the particular device to connect but it has some errors like

    param->peer_addr.addr (this thing changes when the device is reset) if i fix that random address it connects and disconnect properly but when another device tries to connect it 

    the device stops working and holds at ASSERT_ERROR (0).

    how can i get the MAC Address of the device tries to connect

    and if other device try to connect it should reject it and start the process again

  • Hi Stanly,

    Thank you for the reply and apologies for the delay.
    I can see that you have made some modifications on the gapc_connection_req_ind_handler which is part of the SDK files.
    We highly recommend you do NOT modify the SDK files unless absolutely necessary. We can not support SDK customizations.
    You should able to create your application on the user folders:


    i have tried to add the function to allow the particular device to connect

    If you are not using Whitelisting or Directed advertising, then the only think you can do is to check on the connection handler:

        .app_on_connection                  = user_app_connection,

    Check the Central BDA upon connection and reject any connections that is not from your central.
    Another approach would be to implement Passkey Security so any device that does not know the Passkey will not be able to connect.

    Best Regards,
    OV_Renesas

  • prox_reporter_531.hex 

    can i get the power profile of the hex file (in pairing and advertising)

    and please help me in how to turn off all sleep mode in the prox reporter in the SDK 6

    and how to remove the unwanted services which provided in prox reporter after pairing 

     Advertising data length - maximum 28 bytes, 3 bytes are reserved 

  • Hi Stanly,

    Thank you for the reply.
    Please find below the video showcasing the Hex you provided during advertise and connection. There was no security request sent so no Pairing/Bonding procedure was initiated.

    and please help me in how to turn off all sleep mode in the prox reporter in the SDK 6

    Please refer on the: DA1453x & DA1458x Sleep Modes Tutorial — DA1453x & DA1458x Tutorial Sleep Modes (renesas.com)
    On the user_proxr.h file you can undefine the Deep Sleep and Hibernation Sleep macros so they will not take effect in your project.

    and how to remove the unwanted services which provided in prox reporter after pairing 

    Please refer on 3. BLE Development Environment and First Application — DA14585/DA14531 SW Platform Reference Manual (renesas.com)

    Please go through the documentation. Everything is explained in the Documents.

    Best Regards,
    OV_Renesas