/// <summary>
        ///  Opens connection and request main data from device (e.g. Serial number)
        ///  If there is some data in event buffer - events will be raised
        /// </summary>
        public void Init(bool ignoreLastEvents = true)
        {
            _rawDev.Connection.Open();

            DeviceCategory = _rawDev.CmdRequestEquipmentCategory();
            if (DeviceCategory != CctalkDeviceTypes.BillValidator)
            {
                throw new InvalidOperationException("Connected device is not a notes acceptor. " + DeviceCategory);
            }

            //_rawDev.CmdReset();
            _rawDev.CmdSetMasterInhibitStatus(IsInhibiting);

            SerialNumber = _rawDev.CmdGetSerial();
            PollInterval = _rawDev.CmdRequestPollingPriority();
            Manufacturer = _rawDev.CmdRequestManufacturerId();
            ProductCode  = _rawDev.CmdRequestProductCode();
            _rawDev.CmdModifyBillOpertingMode(0x0);             //enable stacker and escrow

            PollInterval = PollInterval.Add(new TimeSpan(0, 0, 0, 0, 400));

            var evBuf = _rawDev.CmdReadEventBuffer();

            if (!ignoreLastEvents)
            {
                RaiseLastEvents(evBuf);
            }
            _lastEvent = evBuf.Counter;


            IsInitialized = true;
        }
        /// <summary>
        /// Initializes the configuration UI when a subscription is being added or edited.
        /// </summary>
        /// <param name="isSubscription">will always be <c>true</c> for <see cref="Subscription"/>s</param>
        /// <param name="dli">The <see cref="DestinationListItem"/> that the user selected</param>
        /// <param name="db">The <see cref="DestinationBase"/> of the item if it is being edited;<c>null</c> otherwise</param>
        /// <remarks>
        /// When an instance is being edited (<paramref name="dli"/> != null), make sure to repopulate any
        /// inputs with the current values.
        ///
        /// By default, the 'Save' button is disabled and you must call <see cref="DestinationSettingsPanel.OnValidChanged"/>
        /// in order to enable it when appropriate.
        /// </remarks>
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase db)
        {
            this.doValidation = true;

            // set text box values
            this.textBoxUrl.Text     = String.Empty;
            this.textBoxUrl.Enabled  = true;
            this.textBoxName.Text    = String.Empty;
            this.textBoxName.Enabled = true;

            this.comboBoxPoll.DataSource    = PollInterval.GetList();
            this.comboBoxPoll.DisplayMember = "Display";
            this.comboBoxPoll.ValueMember   = "Value";

            this.textBoxUsername.Text    = String.Empty;
            this.textBoxUsername.Enabled = true;
            this.textBoxPassword.Text    = String.Empty;
            this.textBoxPassword.Enabled = true;

            FeedSubscription fs = db as FeedSubscription;

            if (fs != null)
            {
                this.textBoxUrl.Text            = fs.FeedUrl;
                this.textBoxName.Text           = fs.Description;
                this.comboBoxPoll.SelectedValue = fs.PollInterval;
                this.textBoxUsername.Text       = fs.Username;
                this.textBoxPassword.Text       = fs.Password;
            }
            ValidateInputs();

            this.textBoxName.Focus();
        }
Exemplo n.º 3
0
        // Converts the object to string
        public override string ToString()
        {
            string str;

            str = "Leap Indicator: ";
            switch (LeapIndicator)
            {
            case _LeapIndicator.NoWarning:
                str += "No warning";
                break;

            case _LeapIndicator.LastMinute61:
                str += "Last minute has 61 seconds";
                break;

            case _LeapIndicator.LastMinute59:
                str += "Last minute has 59 seconds";
                break;

            case _LeapIndicator.Alarm:
                str += "Alarm Condition (clock not synchronized)";
                break;
            }
            str += "\r\nVersion number: " + VersionNumber.ToString() + "\r\n";
            str += "Mode: ";
            switch (Mode)
            {
            case _Mode.Unknown:
                str += "Unknown";
                break;

            case _Mode.SymmetricActive:
                str += "Symmetric Active";
                break;

            case _Mode.SymmetricPassive:
                str += "Symmetric Pasive";
                break;

            case _Mode.Client:
                str += "Client";
                break;

            case _Mode.Server:
                str += "Server";
                break;

            case _Mode.Broadcast:
                str += "Broadcast";
                break;
            }
            str += "\r\nStratum: ";
            switch (Stratum)
            {
            case _Stratum.Unspecified:
            case _Stratum.Reserved:
                str += "Unspecified";
                break;

            case _Stratum.PrimaryReference:
                str += "Primary Reference";
                break;

            case _Stratum.SecondaryReference:
                str += "Secondary Reference";
                break;
            }
            str += "\r\nLocal time: " + TransmitTimestamp.ToString();
            str += "\r\nPrecision: " + Precision.ToString() + " ms";
            str += "\r\nPoll Interval: " + PollInterval.ToString() + " s";
            str += "\r\nReference ID: " + ReferenceID.ToString();
            str += "\r\nRoot Dispersion: " + RootDispersion.ToString() + " ms";
            str += "\r\nRound Trip Delay: " + RoundTripDelay.ToString() + " ms";
            str += "\r\nLocal Clock Offset: " + LocalClockOffset.ToString() + " ms";
            str += "\r\n";

            return(str);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            string str;

            str = "Leap Indicator: ";
            switch (LeapIndicator)
            {
            case LeapIndicator.NoWarning:
                str += "No warning";
                break;

            case LeapIndicator.LastMinute61:
                str += "Last minute has 61 seconds";
                break;

            case LeapIndicator.LastMinute59:
                str += "Last minute has 59 seconds";
                break;

            case LeapIndicator.Alarm:
                str += "Alarm Condition (clock not synchronized)";
                break;
            }
            str += "\r\nVersion number: " + VersionNumber.ToString() + "\r\n";
            str += "Mode: ";
            switch (Mode)
            {
            case NtpMode.Unknown:
                str += "Unknown";
                break;

            case NtpMode.SymmetricActive:
                str += "Symmetric Active";
                break;

            case NtpMode.SymmetricPassive:
                str += "Symmetric Pasive";
                break;

            case NtpMode.Client:
                str += "Client";
                break;

            case NtpMode.Server:
                str += "Server";
                break;

            case NtpMode.Broadcast:
                str += "Broadcast";
                break;
            }
            str += "\r\nStratum: ";
            switch (Stratum)
            {
            case NtpStratum.Unspecified:
            case NtpStratum.Reserved:
                str += "Unspecified";
                break;

            case NtpStratum.PrimaryReference:
                str += "Primary Reference";
                break;

            case NtpStratum.SecondaryReference:
                str += "Secondary Reference";
                break;
            }
            str += "\r\nOriginate (Send request): " + OriginateTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nRecieve (Server recieved): " + ReceiveTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nTransmit (Server reply): " + TransmitTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nReception (Request recieved): " + ReceptionTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nServer transmit time (Local zone): " + TransmitTimestamp.ToString("dd/MM/yyyy HH:mm:ss.fff");
            str += "\r\nPrecision: " + Precision.ToString() + " ms";
            str += "\r\nPoll Interval: " + PollInterval.ToString() + " s";
            str += "\r\nReference ID: " + ReferenceID.ToString();
            str += "\r\nRoot Dispersion: " + RootDispersion.ToString() + " ms";
            str += "\r\nRound Trip Delay: " + RoundTripDelay.TotalMilliseconds.ToString() + " ms";
            str += "\r\nLocal Clock Offset: " + LocalClockOffset.TotalMilliseconds.ToString() + " ms";
            str += "\r\n";

            return(str);
        }
 private void StartProcessing()
 {
     ProcessingThread = new Thread(new ThreadStart(() =>
     {
         while (true && !StopRequested)
         {
             Trace.WriteLine("Cleaning up blob containers.", "Information");
             Cleanup();
             if (!StopRequested)
             {
                 Thread.Sleep(PollInterval);
             }
         }
     }));
     Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0}.{1} starting processing with '{2}' poll interval.", GetType().Name, MethodBase.GetCurrentMethod().Name, PollInterval.ToString()), "Information");
     ProcessingThread.Start();
 }