public void UduinoConnecting(string name) { BLEDeviceButton_Interface currentDeviceBtn = null; if (devicesButtons.TryGetValue(name, out currentDeviceBtn)) { currentDeviceBtn.Connecting(); } Debug.Log("connecting to " + name); }
public void BLEDisconected(string name) { BLEDeviceButton_Interface currentDeviceBtn = null; if (devicesButtons.TryGetValue(name, out currentDeviceBtn)) { DisplayDebugPanel(false); currentDeviceBtn.Disconnected(); } }
public void AddDevicesButtons(string name, string uuid) { if (interfaceType == AndroidInterface.None) { return; } GameObject deviceBtn = GameObject.Instantiate(getDeviceButtonPrefab(), getPanel()); deviceBtn.transform.name = uuid; deviceBtn.transform.Find("DeviceName").transform.GetComponent <Text>().text = name; Button btn = deviceBtn.GetComponent <Button>(); BLEDeviceButton_Interface deviceInterface = new BLEDeviceButton_Interface(btn); devicesButtons.Add(name, deviceInterface); // Add connect event btn.onClick.AddListener(() => bleCommunication.ConnectPeripheral(uuid, name)); // Add disconnect event deviceInterface.disconnect.GetComponent <Button>().onClick.AddListener(() => this.DisconnectDevice()); }