/// <summary>
 /// Translates the bytes for a Port30003 message into a cooked message object and causes a message received event to be raised on the background thread.
 /// </summary>
 /// <param name="extractedBytes"></param>
 private void ProcessPort30003MessageBytes(ExtractedBytes extractedBytes)
 {
     try {
         var port30003Message  = Encoding.ASCII.GetString(extractedBytes.Bytes, extractedBytes.Offset, extractedBytes.Length);
         var translatedMessage = _Port30003MessageTranslator.Translate(port30003Message);
         if (translatedMessage != null)
         {
             ++TotalMessages;
             if (_Statistics.Lock != null)
             {
                 lock (_Statistics.Lock) ++_Statistics.BaseStationMessagesReceived;
             }
             _MessageProcessingAndDispatchQueue.Enqueue(new MessageDispatch()
             {
                 Port30003MessageEventArgs = new BaseStationMessageEventArgs(translatedMessage)
             });
         }
     } catch (Exception) {
         ++TotalBadMessages;
         if (_Statistics.Lock != null)
         {
             lock (_Statistics.Lock) ++_Statistics.BaseStationBadFormatMessagesReceived;
         }
         if (!IgnoreBadMessages)
         {
             throw;
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Translates the bytes for a Port30003 message into a cooked message object and causes a message received event to be raised on the background thread.
 /// </summary>
 /// <param name="extractedBytes"></param>
 private void ProcessPort30003MessageBytes(ExtractedBytes extractedBytes)
 {
     try {
         var port30003Message  = Encoding.ASCII.GetString(extractedBytes.Bytes, extractedBytes.Offset, extractedBytes.Length);
         var translatedMessage = _Port30003MessageTranslator.Translate(port30003Message, extractedBytes.SignalLevel);
         if (translatedMessage != null)
         {
             ++TotalMessages;
             if (Statistics != null)
             {
                 Statistics.Lock(r => ++ r.BaseStationMessagesReceived);
             }
             _MessageProcessingAndDispatchQueue.Enqueue(new MessageDispatch()
             {
                 Port30003MessageEventArgs = new BaseStationMessageEventArgs(translatedMessage, isOutOfBand: false, isSatcomFeed: IsSatcomFeed)
             });
         }
     } catch (Exception) {
         ++TotalBadMessages;
         if (Statistics != null)
         {
             Statistics.Lock(r => ++ r.BaseStationBadFormatMessagesReceived);
         }
         if (!IgnoreBadMessages)
         {
             throw;
         }
     }
 }
 public void BaseStationMessageTranslator_Translate_Returns_Unknown_Message_When_Passed_Null_For_The_Message()
 {
     Assert.AreEqual(BaseStationMessageType.Unknown, _Implementation.Translate(null, null).MessageType);
 }