cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Bluetooth

user_2195381
New Contributor II

I want to set a peripheral device cannott allow be paired with center(Smart phone)

in my progarm, I call

    lesmp_setPairingParam(

        LESMP_IO_CAP_DISP_ONLY,

        LESMP_OOB_AUTH_DATA_NOT_PRESENT,

        LESMP_AUTH_FLAG_NO_BONDING,

        LESMP_MAX_KEY_SIZE,

        LESMP_KEY_DISTRIBUTION_ENC_KEY

        | LESMP_KEY_DISTRIBUTION_ID_KEY

        | LESMP_KEY_DISTRIBUTION_SIGN_KEY,

        LESMP_KEY_DISTRIBUTION_ENC_KEY

        | LESMP_KEY_DISTRIBUTION_ID_KEY

        | LESMP_KEY_DISTRIBUTION_SIGN_KEY

    );  

but device can be paired with center.

How should I set the parameter of  lesmp_setPairingParam to refuse to be paired with center ?

or

Which API I should call to  to refuse to be paired with center ?

0 Likes
1 Solution
Anonymous
Not applicable

void hello_sensor_create(void)

{

  ...

  lel2cap_regConnLessHandler(6, hello_client_l2cap_smp_data_handler);

  ...

}

void hello_client_l2cap_smp_data_handler(UINT8 *l2capHdr)

{

  // if (*(l2capHdr + 4) == LESMP_CODE_PAIRING_RSP )

  if (*(l2capHdr + 4) == LESMP_CODE_PAIRING_REQ )

  {

  // lesmpapi_pairingFailed();

  lesmp_sendPairingFailed(LESMP_PAIRING_FAILED_REASON_OOB_NOT_AVAIL);

  return;

  }

  lesmp_l2capHandler(l2capHdr);

}

reference:

~\bleapp\lestack\smp\lesmp_const.h

~\bleapp\lestack\smp\lesmpapi.h

~\bleapp\lestack\smp\lesmp.h

~\bleapp\lestack\l2cap\lel2cap.h

Core_V4.0.pdf, p1958, p1959, p2009-Fig5.10

View solution in original post

5 Replies
BoonT_56
Employee

not sure i get your question... Does "undirected and not connectable" advertisement able to meet your requirement?

0 Likes
user_2195381
New Contributor II

I want to set a slave device that is no support pairing.

I cannot sure "undirected and not connectable" advertisement be able to meet it.

ref. Core_v4.1

BLUETOOTH SPECIFICATION Version 4.1 [Vol 3] page 660 of 668)

5.3.5.1 Pairing Not Supported by Slave

If the slave device does not support pairing or pairing cannot be performed the

slave can reject the request from the master

0 Likes
Anonymous
Not applicable

void hello_sensor_create(void)

{

  ...

  lel2cap_regConnLessHandler(6, hello_client_l2cap_smp_data_handler);

  ...

}

void hello_client_l2cap_smp_data_handler(UINT8 *l2capHdr)

{

  // if (*(l2capHdr + 4) == LESMP_CODE_PAIRING_RSP )

  if (*(l2capHdr + 4) == LESMP_CODE_PAIRING_REQ )

  {

  // lesmpapi_pairingFailed();

  lesmp_sendPairingFailed(LESMP_PAIRING_FAILED_REASON_OOB_NOT_AVAIL);

  return;

  }

  lesmp_l2capHandler(l2capHdr);

}

reference:

~\bleapp\lestack\smp\lesmp_const.h

~\bleapp\lestack\smp\lesmpapi.h

~\bleapp\lestack\smp\lesmp.h

~\bleapp\lestack\l2cap\lel2cap.h

Core_V4.0.pdf, p1958, p1959, p2009-Fig5.10

View solution in original post

Anonymous
Not applicable

But any one can answer what's different between lesmpapi_pairingFailed() and lesmp_sendPairingFailed(int) ?

They should be used in different stage?

0 Likes
user_2195381
New Contributor II

change from LESMP_PAIRING_FAILED_REASON_OOB_NOT_AVAIL to LESMP_PAIRING_FAILED_REASON_PAIRING_NOT_SUPPORTED

0 Likes