예제 #1
0
    public void Connect()
    {
        if (BtConnector.isDevicePicked)
        {
            if (!BtConnector.isBluetoothEnabled())
            {
                BtConnector.askEnableBluetooth();
            }
            else
            {
                string name = BtConnector.getPickedDeviceName();
                BtConnector.moduleName(name);
                BtConnector.connect();

                Debug.Log("try to connect " + name);
            }
        }
    }
예제 #2
0
    void Update()
    {
        UFoneInterface.AddData(BtConnector.readBuffer());
        UFoneInterface.Update();


        Debug.Log("Picked:" + BtConnector.isDevicePicked + ":" + BtConnector.getPickedDeviceName());
        //if(BtConnector.isConnected())
        //UFoneInterface.SetRawRC(1400,1410,1420,1000,1950,1500,1500,1501);

        //SendData
        byte[] dataToSend = UFoneInterface.GetRawCommand();

        if (dataToSend.Length > 0)
        {
            BtConnector.sendBytes(dataToSend);
            Debug.Log("sendBytes:" + byteToIntStr(dataToSend));
        }
        //GetData
    }