public SerialPortTransmitter(FlagsContainer flagsContainer, string comPortName, int speedInBod, bool withParity)
        {
            this.flagsContainer = flagsContainer;
            comPort             = new SerialPort(comPortName, speedInBod, withParity ? Parity.Even : Parity.None, 8, StopBits.One)
            {
                WriteBufferSize = 32
            };
            comPort.Open();

            worker = new Thread(WorkerLoop);
        }
Example #2
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            if (args.Length < 1)
            {
                PrintUsageAndExit();
            }

            var comPortName = args[0];

            var flagsContainer = new FlagsContainer();
            var addFlagHandler = new AddFlagHandler(flagsContainer, "http://*:10000/addFlag/");

            addFlagHandler.Start();

            var transmitter = new SerialPortTransmitter(flagsContainer, comPortName, ComPortSpeed, false);

            transmitter.Start();

            new ManualResetEvent(false).WaitOne();
        }