I am working with two Philips Hue bridges with my app. It's all good when both the bridges are UP and running but when I remove one of the bridge by removing the power source, my app still lists both the bridges on doing the bridge search again. I search for the bridge as mentioned in the official documentation:
public void doBridgeSearch() {
PHBridgeSearchManager sm = (PHBridgeSearchManager)
phHueSDK.getSDKService(PHHueSDK.SEARCH_BRIDGE);
// Start the UPNP Searching of local bridges.
sm.search(true, true);
}
and the listener
private PHSDKListener listener = new PHSDKListener() {
@Override
public void onCacheUpdated(List<Integer> list, PHBridge phBridge) {
Log.d(TAG, "onCacheUpdated");
}
@Override
public void onBridgeConnected(PHBridge phBridge, String username) {
Log.d(TAG, "onBridgeConnected "+username);
}
@Override
public void onAuthenticationRequired(PHAccessPoint phAccessPoint) {
Log.d(TAG, "onAuthenticationRequired");
phHueSDK.startPushlinkAuthentication(phAccessPoint);
}
@Override
public void onAccessPointsFound(List<PHAccessPoint> list) {
Log.d(TAG, "onAccessPointsFound");
if(list != null && list.size() > 0) {
phHueSDK.getAccessPointsFound().clear();
phHueSDK.getAccessPointsFound().addAll(list);
Log.d(TAG, "no of bridge available "+list.size());
connect(phHueSDK.getAccessPointsFound().get(0));
}
}
}
In the call back onAccessPointsFound() the list size is 2 even when only one bridge is running. How to get only the available bridges at that time?