예제 #1
0
        public void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
        {
            WriteLog("Connection status changed to: " + e.ToString(), false);
            switch (e.ConnectionStatus)
            {
            case HidUtility.UsbConnectionStatus.Connected:
                ConnectedTimestamp = DateTime.Now;
                break;

            case HidUtility.UsbConnectionStatus.Disconnected:
                break;

            case HidUtility.UsbConnectionStatus.NotWorking:
                break;
            }
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("ConnectionStatusTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("UptimeTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("ActivityLogTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("UserInterfaceActive"));
                PropertyChanged(this, new PropertyChangedEventArgs("UserInterfaceColor"));
                PropertyChanged(this, new PropertyChangedEventArgs("LedToggleActive"));
                PropertyChanged(this, new PropertyChangedEventArgs("PushbuttonContentTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("AdcValue"));
            }
        }
예제 #2
0
        public void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
        {
            WriteLog("Connection status changed to: " + e.ToString(), false);
            switch (e.ConnectionStatus)
            {
            case HidUtility.UsbConnectionStatus.Connected:
                ConnectedTimestamp = DateTime.Now;
                break;

            case HidUtility.UsbConnectionStatus.Disconnected:
                break;

            case HidUtility.UsbConnectionStatus.NotWorking:
                break;
            }
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("ConnectionStatusTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("UptimeTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("ActivityLogTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("UserInterfaceColor"));
                PropertyChanged(this, new PropertyChangedEventArgs("UserInterfaceEnabled"));
                PropertyChanged(this, new PropertyChangedEventArgs("DisplayTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("PositionTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("TemperatureInternalTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("TemperatureExternalTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("FanTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("BrakeTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("FirmwareVersionTxt"));
                PropertyChanged(this, new PropertyChangedEventArgs("DeviceConfigurationTxt"));
            }
        }
예제 #3
0
 // Connection status of our selected device has changed
 // Update the user interface
 void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
 {
     // Write log entry
     WriteLog("Connection status changed to: " + e.ToString(), false);
     // Update user interface
     switch (e.ConnectionStatus)
     {
         case HidUtility.UsbConnectionStatus.Connected:
             StatusText.Text = string.Format("Device Found (Connection status = {0})", e.ConnectionStatus.ToString());
             SetUserInterfaceStatus(true);
             ConnectedTimestamp = DateTime.Now;
             break;
         case HidUtility.UsbConnectionStatus.Disconnected:
             StatusText.Text = string.Format("Device Not Detected (Connection status = {0})", e.ConnectionStatus.ToString());
             AnalogBar.Value = 0;
             SetUserInterfaceStatus(false);
             
             break;
         case HidUtility.UsbConnectionStatus.NotWorking:
             StatusText.Text = string.Format("Device attached but not working (Connection status = {0})", e.ConnectionStatus.ToString());
             AnalogBar.Value = 0;
             SetUserInterfaceStatus(false);
             break;
     }
     UpdateStatistics();
     UpdatePushbutton();
     UpdateAdcBar();
 }
예제 #4
0
 // Connection status of our selected device has changed
 // Reset variables
 void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
 {
     Console.WriteLine(string.Format("Connection status changed to: {0}", e.ConnectionStatus.ToString()));
     LastCommand        = 0x81;
     WaitingForDevice   = false;
     PushbuttonPressed  = false;
     ToggleLedPending   = false;
     AdcValue           = 0;
     ConnectedTimestamp = DateTime.Now;
     TxCount            = 0;
     RxCount            = 0;
 }
예제 #5
0
        /*
         * HidUtility callback functions
         */

        public void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
        {
            if (e.ConnectionStatus != HidUtility.UsbConnectionStatus.Connected)
            {
                // Reset variables
                TxCount          = 0;
                TxFailedCount    = 0;
                RxCount          = 0;
                RxFailedCount    = 0;
                LedTogglePending = false;
                LastCommand      = 0x81;
            }
        }
예제 #6
0
        /*
         * HidUtility callback functions
         */

        public void ConnectionStatusChangedHandler(object sender, HidUtility.ConnectionStatusEventArgs e)
        {
            if (e.ConnectionStatus != HidUtility.UsbConnectionStatus.Connected)
            {
                // Reset variables
                _NewDataAvailable = false;
                TxCount           = 0;
                TxFailedCount     = 0;
                RxCount           = 0;
                RxFailedCount     = 0;
                PendingCommands   = new List <UsbCommand>();
                PacketsToRequest  = new List <byte>();
                PacketsToRequest.Add(0x10);
                PacketsToRequest.Add(0x11);
                PacketsToRequest.Add(0x12);
                PacketsToRequest.Add(0x13);
                WaitingForDevice = false;
            }
        }