void ProcessBridges(JSON response, Action <List <HueBridgeInfo> > bridgesCallback) { Debug.LogFormat("Bridges: {0}", response); var list = new List <HueBridgeInfo>(); var responseList = response.getJsonArray("rootArray"); foreach (var item in responseList) { var bridgeInfo = new HueBridgeInfo(item.getString("id", ""), item.getString("internalipaddress", "")); if (item.hasKey("macaddress")) { bridgeInfo.macAdress = item.getString("macaddress", ""); } if (item.hasKey("name")) { bridgeInfo.name = item.getString("name", ""); } list.Add(bridgeInfo); } bridgesCallback(list); }
public void RestoreHueState(StoredHueInfo savedState) { if (savedState == null) { return; } bridges = savedState.allBridges; currentBridge = savedState.current; }
public void DiscoverBridges(Action onFinished, Action <List <HueErrorInfo> > errorCallback) { StartCoroutine(GetBridgesEnumerator( (bridges) => { this.bridges = bridges; if (bridges.Count > 0) { currentBridge = bridges[0]; } if (onFinished != null) { onFinished(); } }, errorCallback )); }
public StoredHueInfo(HueBridgeInfo current, List <HueBridgeInfo> allBridges) { this.current = current; this.allBridges = allBridges; }