using System;
using System.IO.Ports;
using Microsoft.SPOT;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using CPF;

using System.Text;
using System.Threading;
using HWModules;
using SWModules;

namespace CPFUnitTests
{
    class ElmoTwitterUnitTest
    {
        [TestMethod]
        public void TestSRCommand()
        {
            HWModules.MotherBoard motherboard = HWModules.MotherBoard.Instance;
            motherboard.Enable12V();
            motherboard.Enable5V();

            motherboard.EnableChannelPower(MotherBoard.ChannelNames.PumpMotorControllerElexChannel);

            var lheBoard = HWModules.LheBoard.Instance;
            lheBoard.EnablePumpPower(true);

            var pumpMotor = new ElmoTwitter("PumpMotor", "COM2", 115200, Parity.None, 8, StopBits.One, 5000, 20, false, (byte)';', (byte)';');
            MessageQueue messageQ = MessageQueue.Instance;

            StringBuilder loggerComment = new StringBuilder("\\tElmo SR test");
            StringBuilder tab = new StringBuilder("\t");
            
            int loopCounter = 0;
            //EngrLogger.writeToColumns("Staring increase buoyancy");

            bool run = true;
            pumpMotor.init();
            for (int i = 0; i < 5; i++)
            {
                pumpMotor.getStats();

                Thread.Sleep(3000);
                messageQ.processQ();

                loopCounter++;
            }
        }
    }
}
