/// <summary>
        ///     Handles ScanRMDEvent. Invokes FlashSessionStarted, DownloadStarted, BlockFinished, DownloadEnded,
        ///     FlashSessionEnded, or FirmwareStatusOrErrorReceived.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="prmdData"></param>
        private void OnScanRmdEvent(short eventType, ref string prmdData)
        {
            var xdoc      = XDocument.Parse(prmdData);
            var status    = (StatusCode)ParseStatus(xdoc);
            var scannerId = ParseScannerId(xdoc);

            switch ((RmdEventType)eventType)
            {
            case RmdEventType.SessionStarted:
            {
                FlashSessionStarted?.Invoke(this, new FlashStartEventArgs(scannerId, status, ParseTotalRecords(xdoc)));
                break;
            }

            case RmdEventType.DownloadStarted:
            {
                DownloadStarted?.Invoke(this, new DownloadEventArgs(scannerId, status, ParseComponent(xdoc)));
                break;
            }

            case RmdEventType.BlockFinished:
            {
                BlockFinished?.Invoke(this, new DownloadEventArgs(scannerId, status, ParseComponent(xdoc), ParseProgress(xdoc)));
                break;
            }

            case RmdEventType.DownloadEnded:
            {
                DownloadEnded?.Invoke(this, new DownloadEventArgs(scannerId, status, ParseComponent(xdoc)));
                break;
            }

            case RmdEventType.SessionEnded:
            {
                FlashSessionEnded?.Invoke(this, new FirmwareEventArgs(scannerId, status));
                break;
            }

            case RmdEventType.ErrorOrStatus:
            {
                FirmwareStatusOrErrorReceived?.Invoke(this, new FirmwareEventArgs(scannerId, status));
                break;
            }
            }
        }
Beispiel #2
0
        } // ProcessReceivedData

        private void PayloadReceived(object sender, PayloadStorage.SegmentPayloadReceivedEventArgs e)
        {
            SegmentPayloadReceived?.Invoke(this, e);

            if (_receivedSegments != null)
            {
                if (!_receivedSegments[e.SegmentIdentity.Id])
                {
                    _totalSegments++;
                    _receivedSegments[e.SegmentIdentity.Id] = true;
                    SegmentPayloadReceived?.Invoke(this, e);
                }
                else
                {
                    _loadedSegments++;
                    if (_loadedSegments >= (_totalSegments * _threshold))
                    {
                        EndReceptionLoop = true;
                        DownloadEnded?.Invoke(this, EventArgs.Empty);
                    } // if
                }     // if-else
            }         // if-else
        }             // PayloadReceived
Beispiel #3
0
 private void FfProcess_Exited(object sender, EventArgs e)
 {
     DownloadEnded?.Invoke(this, EventArgs.Empty);
 }
 private void OnDownloadEnded()
 {
     DownloadEnded?.Invoke(this, new DownloadEndArgs {
         Tag = TagName
     });
 }
Beispiel #5
0
 protected virtual void OnDownloadEnded(Downloader d)
 {
     DownloadEnded?.Invoke(this, new DownloaderEventArgs(d));
 }