Exemple #1
0
    private void TryConnect()
    {
        BtBridge.Connect(0xB827EB651B47);

        /* Send */
        {
            string author    = "Mahesh Chand";
            byte[] sendData  = Encoding.ASCII.GetBytes(author);
            int    bytesSend = BtBridge.Send(sendData);
        }

        /* Receive */
        {
            IntPtr data = BtBridge.Recv();

            int    bytesRead = BtBridge.RecvLen();
            byte[] trueData  = new byte[bytesRead];
            Marshal.Copy(data, trueData, 0, bytesRead);

            string hex = BitConverter.ToString(trueData);

            print("bytesRead: " + bytesRead);
            print("Data: " + hex);
        }

        BtBridge.Close();
    }
        void Awake()
        {
            if (is_multiple_singleton_in_scene())
            {
                Debug.LogWarning("Multiple BluetoothAdapter/BtConnector gameobjects in the scene. " +
                                 "Note: you don't need to add a BtConnector/BluetoothAdapter to your scene in this version");

                Destroy(this);
                return;
            }
            mono_BluetoothAdapter = this;

            DontDestroyOnLoad(this);

            BtBridge.set_unity_game_object_name(this.gameObject.name);             //AWAKE: CHANGE THE NAME OF ITS OBJECT
        }
 void Awake()
 {
     mono_BluetoothAdapter = this;
     BtBridge.set_unity_game_object_name(this.gameObject.name);             //AWAKE: CHANGE THE NAME OF ITS OBJECT
 }
Exemple #4
0
 void Awake()
 {
     BtBridge.set_unity_game_object_name(this.gameObject.name);             //AWAKE: CHANGE THE NAME OF ITS OBJECT
 }