Exemple #1
0
 void OnConnected(BluetoothHelper helper)
 {
     sphere.GetComponent <Renderer>().material.color = Color.green;
     try{
         helper.StartListening();
     }catch (Exception ex) {
         Debug.Log(ex.Message);
     }
 }
Exemple #2
0
 void OnBluetoothConnected(BluetoothHelper helper)
 {
     try{
         helper.StartListening();
         StartCoroutine(blinkLED());
     }catch (Exception ex) {
         x += ex.ToString();
         Debug.Log(ex.Message);
     }
 }
Exemple #3
0
 void OnConnected()
 {
     Toggle_isConnected.isOn = true;
     try {
         bluetoothHelper.StartListening();
         Debug.Log("Connected");
     } catch (Exception ex) {
         Debug.Log(ex.Message);
     }
 }
 void OnBluetoothConnected()
 {
     try
     {
         m_Helper.StartListening();
     }
     catch (Exception ex)
     {
         ShowText(ex.Message);
     }
 }
Exemple #5
0
 void OnConnected(BluetoothHelper helper)
 {
     try
     {
         helper.StartListening();
     }
     catch (Exception ex)
     {
         Debug.Log(ex.Message);
     }
 }
 void OnConnected()
 {
     Toggle_isConnected.isOn = true;
     try {
         bluetoothHelper.StartListening();
         Debug.Log("Connected");
         isDebugOn = false;                  //커넥되면 디버그 창 없애기
         DebugHolder.SetActive(false);       //커넥되면 버튼 다 없애기
     } catch (Exception ex) {
         Debug.Log(ex.Message);
     }
 }
Exemple #7
0
    private void TryToConnect()
    {
        msg.text = "App started ";
        msg.text = "Search for BLE connection: " + connectBLE + " ";

        if (connectBLE == true)
        {
            try
            {
                msg.text += "Trying... ";

                awatingMsg = false;

                BluetoothHelper.BLE = true;  //use Bluetooth Low Energy Technology
                bluetoothHelper     = BluetoothHelper.GetInstance("TEST");

                bluetoothHelper.setTerminatorBasedStream("\n");

                Debug.Log(bluetoothHelper.getDeviceName());
                msg.text += "Device name: " + bluetoothHelper.getDeviceName() + " ";

                bluetoothHelper.OnConnected += () => {
                    msg.text  += "Connected ";
                    awatingMsg = false;
                    bluetoothHelper.StartListening();
                };

                bluetoothHelper.OnConnectionFailed += () => {
                    msg.text += "Connection failed ";
                };

                bluetoothHelper.OnScanEnded += OnScanEnded;

                bluetoothHelper.OnDataReceived += BluetoothHelper_OnDataReceived;

                BluetoothHelperCharacteristic txC = new BluetoothHelperCharacteristic(UUID_TX);
                txC.setService(UUID);

                BluetoothHelperCharacteristic rxC = new BluetoothHelperCharacteristic(UUID_RX);
                rxC.setService(UUID);


                bluetoothHelper.setRxCharacteristic(rxC);
                bluetoothHelper.setTxCharacteristic(txC);

                bluetoothHelper.ScanNearbyDevices();
            }
            catch (Exception ex)
            {
                exception.text += ex + " ";
            }
        }
    }
Exemple #8
0
 void OnConnected()
 {
     try
     {
         bluetoothHelper.StartListening();
         Middletext.text = "Connected";
         IGConsole.Instance.Main.println("Connected");
     }
     catch (Exception ex)
     {
         IGConsole.Instance.Main.println(ex.Message);
     }
 }
Exemple #9
0
 void OnConnected()
 {
     sphere.GetComponent <Renderer>().material.color = Color.green;
     try
     {
         bluetoothHelper.StartListening();
         bluetoothHelper2.ScanNearbyDevices();
     }
     catch (Exception ex)
     {
         Debug.Log(ex.Message);
     }
 }
Exemple #10
0
 void OnConnected(BluetoothHelper helper)
 {
     LogWrite(deviceName + "에 연결되었습니다.");
     try
     {
         helper.StartListening();
     }
     catch (Exception ex)
     {
         Debug.Log(ex.Message);
         LogWrite(ex.Message);
     }
 }
Exemple #11
0
    void OnConnected()
    {
        try
        {
            bluetoothHelper.StartListening();

            //bluetoothHelper2 = BluetoothHelper.GetNewInstance();
            //bluetoothHelper2.OnScanEnded += ScanEnded2;
            //bluetoothHelper2.ScanNearbyDevices();
        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }
    }
Exemple #12
0
 void OnConnected(BluetoothHelper helper)
 {
     sphere.GetComponent <Renderer>().material.color = Color.green;
     try
     {
         helper.StartListening();
         if (helper.getId() == bluetoothHelper.getId()) //1st instance connected, connect the second
         {
             bluetoothHelper2.ScanNearbyDevices();
         }
     }
     catch (Exception ex)
     {
         Debug.Log(ex.Message);
     }
 }
Exemple #13
0
 void OnConnected()
 {
     sphere.GetComponent <Renderer>().material.color = Color.green;
     try
     {
         List <BluetoothHelperService> services = bluetoothHelper.getGattServices();
         foreach (BluetoothHelperService s in services)
         {
             Debug.Log("Service : " + s.getName());
             foreach (BluetoothHelperCharacteristic item in s.getCharacteristics())
             {
                 Debug.Log(item.getName());
             }
         }
         bluetoothHelper.StartListening();
     }
     catch (Exception ex)
     {
         Debug.Log(ex.Message);
     }
 }
Exemple #14
0
 void OnConnected()
 {
     //Listening for incoming msg
     BTHelper.StartListening();
 }
Exemple #15
0
 void OnConnected()
 {
     isConnecting = false;
     helper.StartListening();
 }
Exemple #16
0
    void OnConnected()
    {
        helper.StartListening();

        helper.SendData("Hi arduino!");
    }
Exemple #17
0
 void OnConnected(BluetoothHelper helper)
 {
     isConnecting = false;
     helper.StartListening();
 }
Exemple #18
0
 void OnConnected()
 {
     helper.StartListening();
 }
Exemple #19
0
 /// <summary>
 /// This method is called when the connection process has been successfully finished.
 /// It makes this device listen to the bluetooth module.
 /// </summary>
 void OnConnected()
 {
     bt.StartListening();
     // make microcontroller know that it is connected to this mobile device now
     SendData("openBT");
 }