我们注意到GattService中的所有GATT操作都会带两个参数,一个是clientIf,另一个是address,拿到这两个参数后,都会调用Integer connId = mClientMap.connIdByAddress(clientIf, address);
获取对应的connId,然后之后的操作都是以这个connId为Key。我们看connIdByAddress的实现:
Integer connIdByAddress(int id, String address) {
App entry = getById(id);
if (entry == null) return null;
Iterator<Connection> i = mConnections.iterator();
while (i.hasNext()) {
Connection connection = i.next();
if (connection.address.equalsIgnoreCase(address) && connection.appId == id)
return connection.connId;
}
return