@@ -1612,6 +1612,8 @@ int
16121612ble_gatts_peer_cl_sup_feat_get (uint16_t conn_handle , uint8_t * out_supported_feat , uint8_t len )
16131613{
16141614 struct ble_hs_conn * conn ;
1615+ struct ble_store_key_cl_sup_feat feat_key ;
1616+ struct ble_store_value_cl_sup_feat feat_val ;
16151617 int rc = 0 ;
16161618
16171619 if (out_supported_feat == NULL ) {
@@ -1629,8 +1631,16 @@ ble_gatts_peer_cl_sup_feat_get(uint16_t conn_handle, uint8_t *out_supported_feat
16291631 len = BLE_GATT_CHR_CLI_SUP_FEAT_SZ ;
16301632 }
16311633
1632- memcpy (out_supported_feat , conn -> bhc_gatt_svr .peer_cl_sup_feat ,
1633- sizeof (uint8_t ) * len );
1634+ if (conn -> bhc_sec_state .bonded ) {
1635+ feat_key .peer_addr = conn -> bhc_peer_addr ;
1636+ feat_key .idx = 0 ;
1637+ ble_store_read_peer_cl_sup_feat (& feat_key , & feat_val );
1638+ memcpy (out_supported_feat , feat_val .peer_cl_sup_feat ,
1639+ sizeof (uint8_t ) * len );
1640+ } else {
1641+ memcpy (out_supported_feat , conn -> bhc_gatt_svr .peer_cl_sup_feat ,
1642+ sizeof (uint8_t ) * len );
1643+ }
16341644
16351645done :
16361646 ble_hs_unlock ();
@@ -1641,6 +1651,7 @@ int
16411651ble_gatts_peer_cl_sup_feat_update (uint16_t conn_handle , struct os_mbuf * om )
16421652{
16431653 struct ble_hs_conn * conn ;
1654+ struct ble_store_value_cl_sup_feat store_feat ;
16441655 uint8_t feat [BLE_GATT_CHR_CLI_SUP_FEAT_SZ ] = {};
16451656 uint16_t len ;
16461657 int rc = 0 ;
@@ -1686,6 +1697,14 @@ ble_gatts_peer_cl_sup_feat_update(uint16_t conn_handle, struct os_mbuf *om)
16861697
16871698 memcpy (conn -> bhc_gatt_svr .peer_cl_sup_feat , feat , BLE_GATT_CHR_CLI_SUP_FEAT_SZ );
16881699
1700+ if (conn -> bhc_sec_state .bonded ) {
1701+ store_feat .peer_addr = conn -> bhc_peer_addr ;
1702+ memcpy (store_feat .peer_cl_sup_feat ,
1703+ feat ,
1704+ BLE_GATT_CHR_CLI_SUP_FEAT_SZ );
1705+ ble_store_write_peer_cl_sup_feat (& store_feat );
1706+ }
1707+
16891708done :
16901709 ble_hs_unlock ();
16911710 return rc ;
0 commit comments