//api expects input of all address to connect to, seperated by comma
    //example format: XX:XX:XX:XX:XX:XX,YY:YY:YY:YY:YY:YY
    public void connectEnflux(List <string> devices)
    {
        StringBuilder apiArg = new StringBuilder();

        for (int device = 0; device < devices.Count; device++)
        {
            apiArg.Append(devices[device]);
            if (device < (devices.Count - 1))
            {
                apiArg.Append(",");
            }
        }

        if (operatingState == ConnectionState.ATTACHED ||
            operatingState == ConnectionState.DISCONNECTED)
        {
            StringBuilder returnBuffer = new StringBuilder(EnfluxVRSuit.MESSAGESIZE);

            if (EnfluxVRSuit.connect(apiArg, devices.Count, returnBuffer) < 1)
            {
                connectedDevices = devices;
                operatingState   = ConnectionState.CONNECTED;
                Debug.Log("Devices connecting");
            }
            else
            {
                Debug.Log(returnBuffer);
            }
        }
        else
        {
            Debug.Log("Unable to connect to devices, program is in wrong state "
                      + Enum.GetName(typeof(ConnectionState), operatingState));
        }
    }
Exemplo n.º 2
0
    //api expects input of all address to connect to, seperated by comma
    //example format: XX:XX:XX:XX:XX:XX,YY:YY:YY:YY:YY:YY
    public void connectEnflux(List <string> devices)
    {
        StringBuilder apiArg = new StringBuilder();

        for (int device = 0; device < devices.Count; device++)
        {
            apiArg.Append(devices[device]);
            if (device < (devices.Count - 1))
            {
                apiArg.Append(",");
            }
        }

        Debug.Log(devices.Count);

        if (operatingState == ConnectionState.ATTACHED ||
            operatingState == ConnectionState.DISCONNECTED)
        {
            if (EnfluxVRSuit.connect(apiArg, devices.Count) < 1)
            {
                connectedDevices = devices;
                operatingState   = ConnectionState.CONNECTED;
                scanUpdater.StopScanning();
                Debug.Log("Devices connected");
            }
            else
            {
                Debug.Log("Problem connecting");
            }
        }
        else
        {
            Debug.Log("Unable to connect to devices, program is in wrong state "
                      + Enum.GetName(typeof(ConnectionState), operatingState));
        }
    }