2015年4月21日 星期二

BLE "insufficient authentication" issue

For TI CC254x, if BLE is not paired with encryption. Although attribute sets GATT_PERMIT_AUTHEN_READ_WRITE, the stack still responses ATT_ERR_INSUFFICIENT_ENCRYPT. In order to solve this problem, need to manual handle error code without stack. Simple way is:
1. set all  characteristics to GATT_PERMIT_READ_WRITE
2. in ReadAttrCB / WriteAttrCB to check link encryption status then manual feed back ATT_ERR_INSUFFICIENT_AUTHEN.
someReadAttrCB()
{
  bStatus_t status = SUCCESS;
<-- -->
  // Require security for all characteristics
  if ( linkDB_Encrypted( connHandle ) == FALSE )
  {
    return ATT_ERR_INSUFFICIENT_AUTHEN;
  }
<-- -->


The issue is about 
" from 
When the iOS device forgets the CC2540, then when it tries to write to a characteristic with permissions of GATT_PERMIT_AUTHEN_READ_WRITE theCC2540 returns an ATT_ERR_INSUFFICIENT_ENCRYPT since it still thinks it's paired with the iOS device - instead of an ATT_ERR_INSUFFICIENT_AUTHEN which it returns when it's not paired.
"
 or when do bluetooth certification, some cases need to show ATT_ERR_INSUFFICIENT_AUTHEN.


For my test, iOS still doesn't work.
may use ATT_ERR_INSUFFICIENT_AUTHOR instead. It works.
The suggested solution works for me but I have to return ATT_ERR_INSUFFICIENT_AUTHOR instead of ATT_ERR_INSUFFICIENT_AUTHEN.
3.9 Pairing The accessory should not request pairing until an ATT request is rejected using the Insufficient Authentication error code. See the Bluetooth 4.0 specification, Volume 3, Part F, Section 4 for details. If, for security reasons, the accessory requires a bonded relationship with the Central, the Peripheral should reject the ATT request using the Insufficient Authentication error code, as appropriate. As a result, the Apple product may proceed with the necessary security procedures. Similarly, if the iOS device acts as a Central and a GATT server, it may reject an ATT request using the Insufficient Authentication error code. The accessory should initiate the security procedure for pairing in response. Pairing may require user authorization depending on Apple product. Once an accessory is paired with an Apple product, it shall retain the distributed keys of both central and peripheral for future use. If the pairing is no longer required, the accessory shall delete both sets of keys.  (from Apple) https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf

http://e2e.ti.com/support/wireless_connectivity/f/538/p/453316/1633279#1633279

Reference link:
https://e2e.ti.com/support/wireless_connectivity/f/538/p/259197/907091#907091&nbsp;
https://e2e.ti.com/support/wireless_connectivity/f/538/p/232666/1003797
https://e2e.ti.com/support/wireless_connectivity/f/538/p/245279/857934#857934
http://connectivity198.rssing.com/chan-4845084/all_p147.html


2015年4月15日 星期三

2014年8月1日 星期五

AFNetworking

Chinese

http://www.15yan.com/story/9LCNBXwndDA/
http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial
https://github.com/AFNetworking/AFNetworking

2014年5月31日 星期六

Set your PC wireless as AP (Chinese)

http://blog.xuite.net/yh96301/blog/52994182-Windows+7%E7%AD%86%E8%A8%98%E5%9E%8B%E9%9B%BB%E8%85%A6%E8%A8%AD%E5%AE%9A%E7%82%BA%E7%84%A1%E7%B7%9A%E5%9F%BA%E5%9C%B0%E5%8F%B0

2014年4月18日 星期五

Android 4.4 Bluetooth pairing

1. Set the chip default pin code as "1234"
2. Use Android BLE App to connect BLE sensor, then show pairing request.
3. Need to key "001234" to do bonding but not "1234"

For iOS, just key "1234" is Okay.