Пример #1
0
        /// <summary>
        /// </summary>
        /// <param name="port">COM port name</param>
        /// <param name="contactsPath">Path to contacts VCF file</param>
        public BluetoothOVC3860(string port, string contactsPath = null)
        {
            Name = "Bluetooth";

            queue = new QueueThreadWorker(ProcessSendCommand);

            this.port = new SerialInterruptPort(new SerialPortConfiguration(port, BaudRate.Baudrate115200), Cpu.Pin.GPIO_NONE, 0, 16, 10);
            this.port.DataReceived += port_DataReceived;

            if (contactsPath != null)
            {
                if (File.Exists(contactsPath))
                {
                    this.contactsPath = contactsPath;
                }
                else
                {
                    Logger.Info("No contacts file " + contactsPath);
                }
            }

            HomeScreen.Instance.PhoneScreen = CreatePhoneScreen();

            //SendCommand("MH"); // disable auto conn
            VolumeUp(); // TODO make loop: volume up
        }
Пример #2
0
        public BluetoothWT32(string port, string pin = "0000")
        {
            Name = "Bluetooth";

            this.pin = pin;

            SPPLink = Link.Unset;

            queue = new QueueThreadWorker(ProcessSendCommand);

            this.port = new SerialInterruptPort(new SerialPortConfiguration(port, BaudRate.Baudrate115200, Parity.None, 8, StopBits.One, true), Cpu.Pin.GPIO_NONE, 0, 60, 0);
            this.port.NewLine = "\n";
            this.port.DataReceived += port_DataReceived;

            BTCommandReceived += (s, link, data) =>
            {
                if (link == Link.Control) { ProcessBTNotification(Encoding.UTF8.GetString(data)); }
            };

            IsMuxMode = true;
            //Thread.Sleep(1000); IsMuxMode = false; throw new Exception("WOW");
            SendCommand("RESET");
        }