Example #1
0
    public void UduinoConnecting(string name)
    {
        BLEDeviceButton_Interface currentDeviceBtn = null;

        if (devicesButtons.TryGetValue(name, out currentDeviceBtn))
        {
            currentDeviceBtn.Connecting();
        }
        Debug.Log("connecting to " + name);
    }
Example #2
0
    public void BLEDisconected(string name)
    {
        BLEDeviceButton_Interface currentDeviceBtn = null;

        if (devicesButtons.TryGetValue(name, out currentDeviceBtn))
        {
            DisplayDebugPanel(false);
            currentDeviceBtn.Disconnected();
        }
    }
Example #3
0
    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());
    }