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

PASSKEY

 I’ve downloaded     nRF5_SDK_11.0.0_89a8197 and starting with examples from \examples\ble_peripheral\???\pca10040\s132\arm5_no_packs\

 I would like the other device to request a passkey (constant) at pairing (the passkey on my side is constant - no display needed)

After   gap_params_init();I’ve added the following code:

 

{

 static ble_opt_t optS;

   static uint8_t passw[]="123456";           

 optS.gap_opt.passkey.p_passkey=passw;

   err_code =sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &optS);

}

 

err_code returned :  0  

 

Still the module will pair and communicate without requesting a passkey.

I've tried to find an answer in Q&A . in some answers there was a reference to fields : io_caps,mitm. cant make out what does it mean. 

(these fields belong to structs relevant to services, not pairing)

 

Thanks for any help

   Yona

Parents
  • Hi Yona,

    You can change the permission/security level on the BLE characteristics to require MITM pairing. The central does not need to pair with the device if security level is set to "open".

    E..g, change BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm) to BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM (&attr_md.read_perm) if you want to limit read access to a certain characteristic. 

     

  • thank you for the answer.

    making this change - finally  "produces"  the  events:

    BLE_GAP_EVT_SEC_PARAMS_REQUEST,   BLE_GAP_EVT_AUTH_STATUS

    how should I deal with them ?

    (as the cellphone application does not know that passkey is needed- so reading the characteristic results in a  BLE disconnection)

    Yona

  • No worries, thanks for letting me know. 

    Vidar

  • Hi again.

    new issue:

    the guys writing the application on the cell phone are bringing this up.

    I might have 1-20 BLE devices in a given location. all of them would be seen by the cellphone application.

    each of my BLE devices has a different TYPE (say up to 10 types ).

    the TYPE of a given device might change (not very often)  .

    the application "would like" to search all devices ,sort only my devices, show a list of them, each with an icon. the icon is the TYPE of the device.

    my suggestion was to use appearance.

    so every time my TYPE changed- I'll use sd_ble_gap_appearance_set to change it.

    their complaint is that in order for them to know all TYPES, they need to READ the appearance characteristic for each of my devices, and that would take them too long.

    their suggestion is to have a service that its uuid will be a function of the device's TYPE.

    in that way- I'll will have one (an empty) service that its uuid will a function of the TYPE. 

    in that way- all that's needed from them is to scan services , sort those that belong to me , and understand (from the uuid ) there TYPES.AVOIDING the need to actually preform  a READ into these services (characteristics).

    the thing is- I don't see a function for service delete,characteristic delete, change of uuid.

    How can I solve this? what would you do?

    thanks

    yona

  • Hi,

    It's not possible to update Services and characteristics on the fly. You need to disable then enable the softdevice and re-initialize the new BLE services. However, you can update your advertisement payload using ble_advdata_set() regardless of what services/characteristics you have. Also, the appearance may be included in the advertisement packet: ble_advdata_t::include_appearance

     

  • I tried to advertise manufacturer data. even coping a full function from Nordic help. for some reason- didn't work .

    the application(cellphone) guy didn't like the appearance because he would have to preform a READ to get that info.

    then I realized that the advertised Service isn't a real functional service. so advertising in is actually

    "for free".

    the app guy  didn't object so that's how we solved that.

    so now a new issue.hope you still have some more patience left for my questions.

    when trying to make the passkey work- you recommended to use ble_app_hrs example project .

    (I'm using nRF5_SDK_11.0.0_89a8197 packege).

    I've noticed but  didn't pay attention to it then:    the SW  RESETS every some time (~ 4 minutes) due to an error :   NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN returned by function sd_power_system_off   (called from sleep_mode_enter).

    if I remove this function all together then the SW will not reset- BUT the BLE goes dead after the same time (~4 minutes).

    meanwhile the SW is still running and the application timers are still on ( timers resulting from app_timer_create).

    coming out of this situation - by resetting the HW/SW .

    what would you say ?

    thanks again

    Yona

  • one more thing:

    I've tried  using  nRF5_SDK_15xxxxx package  with ble_app_hrs example project.

    its way too heavy . too many elements to remove (and than it gives some internal error).

    so I still need your help regarding the resets/BLE dying .

    I'd prefer not to call  sd_power_system_off if I can avoid it

    Thanks

    Yona

Reply Children
Related