@@ -134,14 +134,14 @@ uint8_t attsCsfIsClientChangeAware(dmConnId_t connId, uint16_t handle)
134134/*!
135135 * \brief Update client change-aware state based on protocol event.
136136 *
137- * \param connId Connection handle .
137+ * \param connId Connection ID .
138138 * \param opcode ATT PDU type.
139139 * \param pPacket Data packet from L2CAP.
140140 *
141141 * \return \ref ATT_SUCCESS if client is change-aware, else \ref ATT_ERR_DATABASE_OUT_OF_SYNC.
142142 */
143143/*************************************************************************************************/
144- uint8_t attsCsfActClientState (uint16_t handle , uint8_t opcode , uint8_t * pPacket )
144+ uint8_t attsCsfActClientState (dmConnId_t connId , uint8_t opcode , uint8_t * pPacket )
145145{
146146 uint8_t err = ATT_SUCCESS ;
147147 attsCsfRec_t * pRec ;
@@ -152,7 +152,7 @@ uint8_t attsCsfActClientState(uint16_t handle, uint8_t opcode, uint8_t *pPacket)
152152 return err ;
153153 }
154154
155- pRec = & attsCsfCb .attsCsfTable [handle ];
155+ pRec = & attsCsfCb .attsCsfTable [connId - 1 ];
156156
157157 /* If the client is change-unaware */
158158 if (pRec -> changeAwareState == ATTS_CLIENT_CHANGE_UNAWARE )
@@ -167,7 +167,7 @@ uint8_t attsCsfActClientState(uint16_t handle, uint8_t opcode, uint8_t *pPacket)
167167 /* Move client change-aware state to pending */
168168 pRec -> changeAwareState = ATTS_CLIENT_CHANGE_PENDING_AWARE ;
169169
170- ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , handle + 1 ,
170+ ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , connId ,
171171 ATTS_CLIENT_CHANGE_PENDING_AWARE );
172172 }
173173
@@ -189,12 +189,12 @@ uint8_t attsCsfActClientState(uint16_t handle, uint8_t opcode, uint8_t *pPacket)
189189 /* Move client change-aware state to aware */
190190 pRec -> changeAwareState = ATTS_CLIENT_CHANGE_AWARE ;
191191
192- ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , handle + 1 , ATTS_CLIENT_CHANGE_AWARE );
192+ ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , connId , ATTS_CLIENT_CHANGE_AWARE );
193193
194194 /* Callback to application to store updated awareness, if bonded. */
195195 if (attsCsfCb .writeCback != NULL )
196196 {
197- attsCsfCb .writeCback (handle + 1 , pRec -> changeAwareState , & pRec -> csf );
197+ attsCsfCb .writeCback (connId , pRec -> changeAwareState , & pRec -> csf );
198198 }
199199 }
200200 else
@@ -227,15 +227,15 @@ uint8_t attsCsfActClientState(uint16_t handle, uint8_t opcode, uint8_t *pPacket)
227227 */
228228 pRec -> changeAwareState = ATTS_CLIENT_CHANGE_AWARE_DB_READ_PENDING ;
229229
230- ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , handle + 1 ,
230+ ATT_TRACE_INFO2 ("ConnId %d change aware state is %d" , connId ,
231231 ATTS_CLIENT_CHANGE_AWARE_DB_READ_PENDING );
232232 }
233233 }
234234 }
235235
236236 if (err == ATT_ERR_DATABASE_OUT_OF_SYNC )
237237 {
238- ATT_TRACE_INFO2 ("ConnId %d out of sync, PDU with opcode 0x%02x ignored!" , handle + 1 , opcode );
238+ ATT_TRACE_INFO2 ("ConnId %d out of sync, PDU with opcode 0x%02x ignored!" , connId , opcode );
239239 }
240240
241241 return err ;
0 commit comments