Inheritance: System.Collections.Queue
Exemplo n.º 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
        }
Exemplo n.º 2
0
        public static void Init(string path, Action flushCallback = null)
        {
            try
            {
                FileLogger.flushCallback = flushCallback;

                queue = new QueueThreadWorker(ProcessItem);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string fullpath;
                int    i = 0;
                do
                {
                    fullpath = path + @"\imBMW" + (i++ == 0 ? "" : i.ToString()) + ".log";
                } while (File.Exists(fullpath));
                writer = new StreamWriter(fullpath);

                Logger.Logged += Logger_Logged;

                Logger.Info("File logger path: " + fullpath);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "file logger init");
            }
        }
Exemplo n.º 3
0
        public static void Init(string path, Action flushCallback = null)
        {
            try
            {
                FileLogger.flushCallback = flushCallback;

                queue = new QueueThreadWorker(ProcessItem);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string fullpath;
                int i = 0;
                do
                {
                    fullpath = path + @"\imBMW" + (i++ == 0 ? "" : i.ToString()) + ".log";
                } while (File.Exists(fullpath));
                writer = new StreamWriter(fullpath);

                Logger.Logged += Logger_Logged;

                Logger.Info("File logger path: " + fullpath);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "file logger init");
            }
        }
Exemplo n.º 4
0
        public static void Create()
        {
            if (queue == null)
            {
                queue = new QueueThreadWorker(ProcessItem, "fileLoggerThread", ThreadPriority.Lowest, true);
            }

            Logger.Logged += Logger_Logged;
        }
Exemplo n.º 5
0
        public iPodViaHeadset(Cpu.Pin headsetControl, Cpu.Pin volumeUp = Cpu.Pin.GPIO_NONE, Cpu.Pin volumeDown = Cpu.Pin.GPIO_NONE)
        {
            Name = "iPod";
            iPod = new OutputPort(headsetControl, false);
            canControlVolume = volumeUp != Cpu.Pin.GPIO_NONE && volumeDown != Cpu.Pin.GPIO_NONE;
            if (canControlVolume)
            {
                iPodVolumeUp = new OutputPort(volumeUp, false);
                iPodVolumeDown = new OutputPort(volumeDown, false);
            }

            iPodCommands = new QueueThreadWorker(ExecuteIPodCommand);
        }
Exemplo n.º 6
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");
        }
Exemplo n.º 7
0
        public static void Init(ISerialPort port)
        {
            messageWriteQueue = new QueueThreadWorker(SendMessage);
            //messageReadQueue = new QueueThreadWorker(ProcessMessage);

            iBus = port;
            iBus.DataReceived += new SerialDataReceivedEventHandler(iBus_DataReceived);

            Inited = true;
        }
Exemplo n.º 8
0
        static Comfort()
        {
            commands = new QueueThreadWorker(ProcessCommand);

            InstrumentClusterElectronics.SpeedRPMChanged += (e) =>
            {
                if (needLockDoors && e.Speed > DoorsLockSpeed)
                {
                    if (AutoLockDoors)
                    {
                        BodyModule.LockDoors();
                    }
                    needLockDoors = false;
                    needUnlockDoors = true;
                }
                if (e.Speed == 0)
                {
                    needLockDoors = true;
                }
            };
            InstrumentClusterElectronics.IgnitionStateChanged += (e) =>
            {
                if (!needComfortClose
                    && e.CurrentIgnitionState != IgnitionState.Off
                    && e.PreviousIgnitionState == IgnitionState.Off)
                {
                    needComfortClose = true;
                }
                if (needUnlockDoors && e.CurrentIgnitionState == IgnitionState.Off)
                {
                    if (AutoUnlockDoors)
                    {
                        BodyModule.UnlockDoors();
                    }
                    needUnlockDoors = false;
                    needLockDoors = true;
                }
            };
            BodyModule.RemoteKeyButtonPressed += (e) =>
            {
                if (e.Button == RemoteKeyButton.Lock && needComfortClose)
                {
                    needComfortClose = false;
                    if (AutoCloseWindows)
                    {
                        commands.Enqueue(Command.FullCloseWindows);
                    }
                    if (AutoCloseSunroof)
                    {
                        BodyModule.CloseSunroof();
                    }
                    if (AutoFoldMirrors)
                    {
                        BodyModule.FoldMirrors();
                    }
                }
                if (e.Button == RemoteKeyButton.Unlock)
                {
                    if (AutoUnfoldMirrors)
                    {
                        BodyModule.UnfoldMirrors();
                    }
                }
            };
        }