Esempio n. 1
0
        // Setup function
        public void Setup(string comm, ASCOM.Utilities.TraceLogger tr)
        {
            tl = tr;
            // Create Serial Port object
            // Note that for some boards (e.g. Sparkfun Pro Micro) DtrEnable may need to be true.
            _serialTransport = new SerialTransport
            {
                CurrentSerialSettings = { PortName = comm, BaudRate = 115200, DtrEnable = false } // object initializer
            };

            // Initialize the command messenger with the Serial Port transport layer
            _cmdMessenger = new CmdMessenger(_serialTransport)
            {
                BoardType = BoardType.Bit16 // Set if it is communicating with a 16- or 32-bit Arduino board
            };

            // Attach the callbacks to the Command Messenger
            AttachCommandCallBacks();

            // Attach to NewLinesReceived for logging purposes
            //   _cmdMessenger.NewLineReceived += NewLineReceived;

            // Attach to NewLineSent for logging purposes
            //     _cmdMessenger.NewLineSent += NewLineSent;

            // Start listening
            _cmdMessenger.StartListening();
        }
Esempio n. 2
0
 private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (m_tl != null)
     {
         SharedResources.PutTraceLogger();
         m_tl = null;
     }
 }
Esempio n. 3
0
 public static void PutTraceLogger()
 {
     lock (lockObject)
     {
         if (--s_tl_cnt == 0)
         {
             s_tl.Enabled = false;
             s_tl.Dispose();
             s_tl = null;
         }
     }
 }
Esempio n. 4
0
 public void Start(string name, int level)
 {
     try
     {
         if (m_Log == null)
         {
             m_Log = new ASCOM.Utilities.TraceLogger(null, name);
             CleanUpLogs();
         }
         m_Log.Enabled = true;
         m_Level = level;
         m_Log.LogMessage("Log started: " + name, "TID:" + System.Threading.Thread.CurrentThread.ManagedThreadId + " " + DateTime.Now.ToUniversalTime().ToString());
     }
     catch { }
 }
Esempio n. 5
0
        public static ASCOM.Utilities.TraceLogger GetTraceLogger()
        {
            lock (lockObject)
            {
                if (s_tl == null)
                {
                    s_tl = new ASCOM.Utilities.TraceLogger("", "EqPlatformAdapter");

                    using (Settings settings = new Settings())
                    {
                        string s     = settings.Get("traceOn", false.ToString());
                        bool   trace = false;
                        Boolean.TryParse(s, out trace);
                        s_tl.Enabled = trace;
                    }
                }
                ++s_tl_cnt;
                return(s_tl);
            }
        }
Esempio n. 6
0
 public MainForm()
 {
     InitializeComponent();
     expand.Text = "Settings ▼";
     m_tl        = SharedResources.GetTraceLogger();
 }