Ejemplo n.º 1
0
        public void Print(byte[] data)
        {
            var btAdapter = BluetoothUtil.GetBTAdapter();

            BluetoothIsEnabled();
            var device = BluetoothUtil.GetDevice(btAdapter);
            var socket = BluetoothUtil.GetSocket(device);

            BluetoothUtil.SendData(data, socket);
        }
Ejemplo n.º 2
0
        private bool BluetoothIsEnabled()
        {
            var btAdapter = BluetoothUtil.GetBTAdapter();

            if (btAdapter == null)
            {
                return(false);
            }
            if (!btAdapter.IsEnabled)
            {
                btAdapter.Enable();
            }
            while (!btAdapter.IsEnabled)
            {
                System.Threading.Thread.Sleep(30);
            }
            return(true);
        }