Implement in peripheral obligated static PIN for pairing.

12 posts / 0 new
Last post
Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Implement in peripheral obligated static PIN for pairing.

I use LBCA2HNZYZ with SDK from Dialog version 3.0.6. Application based on " reporter_fh" example.

I have to implement PIN feature while BLE connection.
The device doesn't have display and keyboard. Device is "peripheral (slave)".
For pairing it need to require the static PIN code from "central (master)" side. The central is IPAD with iOS SDK.
When I try to pairing with the device from Android Phone, I get a pop up window with keyboard to enter pin. Correct pin allows to pairing. iOS connects with the device without any code.
How can I require PIN obligatory?
Can you please tell me what is wrong?

Thanks in advance.

Device:
MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

You mean that the iOS completes the pairing without asking you the PIN and before entering the number you can see the services and the characteristics? can you write them? If your characteristics dont have authorization then nobody forces the host to require pairing in order to read them. Also bare in mind that service discovery isn't part of the security. Meaning that the host is able to see the supported services and characteristics without require authentication, all the services and characteristcis are available during the service discovery (not their values). If you want the host not to be able to see your services you can enable them after a successful pairing/bonding to the peripheral. Now i suppose that seeing the services/characteristics on iphone and not seeing them on android its a matter of UI.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Hi. I am not very big expert

Hi. I am not very big expert in Bluetooth Low Energy protocol, so may be somebody can help me with few questions:

1. Is there ability to ask pin code every time when the same IPAD(iOS) connects to the same device?
2. What are definitions I need to do for obligatory asking pin code when pairing with the device?
3. Do I need to do PROXIMITY PROFILE ATTRIBUTES DEFINITION with authorization required or identification?
4. In connect establishment process, the function app_send_pairing_rsp_func() doesn't called. How can I obligate the central to ask the connection parameters?
In the project I defined: app_sec_env.auth = (GAP_AUTH_REQ_MITM_BOND);

Thanks!

MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi vadym,

Hi vadym,

In BLE when a device is paired when disconnected doesn't go through the pairing procedure again, if the host was previously connected to the device it will require to validate the keys that are exchanged during the pairing procedure. So if your device is properly paired the only way a pairing procedure to be repeated is to be unpaired. You have to set your service or the specific characteristics to require authorization in order the host to be able to read and write the characteristics only after the pairing sequence, the host will be able to see the services and the characteristics but he wont be able to read them or write to them before pairing. Your host have to issue a pairing request command when he sees that the characteristics need authorization in order to be read.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Hi.

Hi.

If I understand right, I need to define the connection security option in function:
void app_send_pairing_rsp_func(struct gapc_bond_req_ind *param)
and also set service or specific characteristic to require authorization.
When I try to connect from IPAD I doesn't enter to the function "app_send_pairing_rsp_func". Obviously, the IPAD already paired to the device.
In our application now there isn't option for unpairing.
What API for Core BLE (iOS) we need to use for unpairing the device and clear the validations keys?
I see the device in " Bluetooth devices" (Settings->Bluetooth) but I can't to do anything.

Thanks.

MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

During connection establishment do you invoke the app_security_start() in the app_connection_func? You can find the the implementation of the function and an example of the pairing procedure in the SmartTag reference design. To complete the pairing procedure without invoking the app_send_pairing respose_func is a bit weird.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Hi.

Hi.

Thanks for all answers! It really helpful!
Now I have the next situation.
When the device connects with central first time, the request pin code popup window appears on iPAD. And first time it connects properly.
After the Central disconnection from the Device (not forget bonding), it can't connect again. IPAD give a message "Connection Alert. The peripheral disconnected while being interrogated”. I try to use function from SmartTag reference design:
void app_store_bond_data( void );
空白app_clear_bond_data( void );
int app_check_bond_data( struct rand_nb *rand_nb, uint16_t ediv );
void app_load_bond_data( void );

This hasn't improved the situation.
Can anybody give me a tip for this?
谢谢!

MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

When a device is paired is doesn't go through the pairing procedure again, the host has to send and ecryption request in order to establish a secure link with peer device. In smarttag when your device is bonded and goes through the pairing procedure again will find data in the flash and will reject the connection.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Hi dear support.

Hi dear support.

I am trying to use example from smart tag, but no so successful...

当IOS试图连接键和disconn之后ecting I enter to the gapc_encrypt_req_ind_handler() function and it calls to app_connect_confirm(). After it enters to the app_send_pairing_rsp_func().If I understand right it should not happen.
After that, the devices disconnect.

With Android it connects right after bonding and when android central forgets bond information, the device rejects the connection.
1. What is defined wrong for IOS?
2. What is example for evaluation board I can to see for the same situation, when I want to connect with peripheral with static pin code (the device defined with Display).

谢谢!

MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

In Smart Tag when the device pairs with the iOS when it disconnects in order to connect again the iOS should send the encryption request since they are bonded. In your case, when reconnecting, the device is sending a pairing request again and the device commands the peripheral to go through the pairing procedure again ? (yeap this should not happen since the devices are bonded - please check if the device is bonded in the settings tab in your android phone). There is no special definition for operating in iOS and android. Smart Tag should work on both android and iOS without any modifications.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 6 days ago
加入:2015-08-13 08:28
Hi.

Hi.

It starts to work.
The problem was with IOS 7. With IOS 9 it works properly.

Does anybody know if I can use hard coded ALPHANUMERIC PIN code that more than 6 digits?

Thanks.

MT_dialog
Offline
Last seen:4 days 17 hours ago
工作人员
加入:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

I believe that the PIN code is 6 digits (from 000000 to 999999) by bluetooth spec.

Thanks MT_dialog