예제 #1
0
 public RadioInfo GetRadioInfoFromSignalingItem(RadioSignalingItem sigItem)
 {
     if (sigItem == null || string.IsNullOrWhiteSpace(sigItem.UnitId) || sigItem.SourceType == SignalingSourceType.StreamingTag)
         return null;
     string radioLookupKey = RadioInfo.GenerateLookupKey(sigItem.SignalingFormat, sigItem.UnitId);
     if (_radios.ContainsKey(radioLookupKey))
         return _radios[radioLookupKey];
     return null;
 }
예제 #2
0
        public RadioInfo GetRadioInfoFromSignalingItem(RadioSignalingItem sigItem)
        {
            if (sigItem == null || string.IsNullOrWhiteSpace(sigItem.UnitId) || sigItem.SourceType == SignalingSourceType.StreamingTag)
            {
                return(null);
            }
            string radioLookupKey = RadioInfo.GenerateLookupKey(sigItem.SignalingFormat, sigItem.UnitId);

            if (_radios.ContainsKey(radioLookupKey))
            {
                return(_radios[radioLookupKey]);
            }
            return(null);
        }
예제 #3
0
        public void PerformLookupsOnRadioSignalItem(RadioSignalingItem sigItem)
        {
            if (sigItem == null || string.IsNullOrWhiteSpace(sigItem.UnitId) || sigItem.SourceType == SignalingSourceType.StreamingTag)
            {
                return;
            }
            RadioInfo rInfo = GetRadioInfoFromSignalingItem(sigItem);

            if (rInfo == null && _autoSaveContacts)
            {
                //should we save it?
                rInfo = new RadioInfo(Guid.Empty, Guid.Empty, sigItem.SignalingFormat, sigItem.UnitId, sigItem.UnitId, string.Empty, string.Empty, RadioTypeCode.Unknown, sigItem.SourceName, false);
                _radios[rInfo.SignalingLookupKey] = rInfo;
                MarkChangesMade();
            }
            if (rInfo != null)
            {
                sigItem.AssignedPersonnel = rInfo.PersonnelName;
                sigItem.AssignedRole      = rInfo.RoleName;
                sigItem.RadioName         = rInfo.RadioName;
                sigItem.RadioType         = rInfo.RadioType;
                bool bAgencySet = false;
                if (rInfo.UnitKeyId != Guid.Empty && _units.ContainsKey(rInfo.UnitKeyId))
                {
                    UnitInfo uInfo = _units[rInfo.UnitKeyId];
                    sigItem.UnitName = uInfo.UnitName;
                    if (uInfo.AgencyKeyId != Guid.Empty && _agencies.ContainsKey(uInfo.AgencyKeyId))
                    {
                        sigItem.AgencyName = _agencies[uInfo.AgencyKeyId].AgencyName;
                        bAgencySet         = true;
                    }
                }
                if (!bAgencySet && rInfo.AgencyKeyId != Guid.Empty)
                {
                    if (_agencies.ContainsKey(rInfo.AgencyKeyId))
                    {
                        sigItem.AgencyName = _agencies[rInfo.AgencyKeyId].AgencyName;
                    }
                }
            }
            if (string.IsNullOrWhiteSpace(sigItem.UnitName))
            {
                sigItem.UnitName = sigItem.UnitId;
            }
            if (string.IsNullOrWhiteSpace(sigItem.RadioName))
            {
                sigItem.RadioName = sigItem.UnitId;
            }
        }
예제 #4
0
        public void LogRadioSignal(RadioSignalingItem signalItem)
        {
            if (signalItem == null)
            {
                return;
            }
            string outLine = string.Format("{0} - {1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}", signalItem.Timestamp.ToShortDateString(), signalItem.Timestamp.ToLongTimeString(), DisplayFormatterUtils.SignalingSourceTypeToDisplayStr(signalItem.SourceType), signalItem.SourceName, DisplayFormatterUtils.SignalCodeToDisplayStr(signalItem.Code), signalItem.SignalingFormat, signalItem.UnitId, signalItem.AgencyName, signalItem.UnitName, signalItem.RadioName, DisplayFormatterUtils.RadioTypeCodeToDisplayStr(signalItem.RadioType), signalItem.AssignedPersonnel, signalItem.AssignedRole, signalItem.Description, signalItem.RecordingFileName);

            if (_shouldIncludeLatLon)
            {
                outLine += string.Format("|{0}|{1}", signalItem.Latitude, signalItem.Longitude);
            }
            if (_shouldDoConsoleOutput)
            {
                Console.WriteLine(outLine);
            }
            _logQueue.Enqueue(outLine);
        }
예제 #5
0
 public RadioSignalItemModel(RadioSignalingItem signalItem)
 {
     if (signalItem == null)
         throw new ArgumentNullException();
     this._signalItem = signalItem;
     if (signalItem.Code == SignalCode.Emergency)
     {
         _emergencyState = Common.EmergencyState.EmergencyActive;
     }
     else if (signalItem.Code == SignalCode.EmergencyAck)
     {
         _emergencyState = Common.EmergencyState.EmergencyCleared;
     }
     else
     {
         _emergencyState = Common.EmergencyState.NonEmergency;
     }
 }
예제 #6
0
 public RadioSignalItemModel(RadioSignalingItem signalItem)
 {
     if (signalItem == null)
     {
         throw new ArgumentNullException();
     }
     this._signalItem = signalItem;
     if (signalItem.Code == SignalCode.Emergency)
     {
         _emergencyState = Common.EmergencyState.EmergencyActive;
     }
     else if (signalItem.Code == SignalCode.EmergencyAck)
     {
         _emergencyState = Common.EmergencyState.EmergencyCleared;
     }
     else
     {
         _emergencyState = Common.EmergencyState.NonEmergency;
     }
 }
예제 #7
0
 public void PerformLookupsOnRadioSignalItem(RadioSignalingItem sigItem)
 {
     if (sigItem == null || string.IsNullOrWhiteSpace(sigItem.UnitId) || sigItem.SourceType == SignalingSourceType.StreamingTag)
         return;
     RadioInfo rInfo = GetRadioInfoFromSignalingItem(sigItem);
     if (rInfo == null && _autoSaveContacts)
     {
         //should we save it?
         rInfo = new RadioInfo(Guid.Empty, Guid.Empty, sigItem.SignalingFormat, sigItem.UnitId, sigItem.UnitId, string.Empty, string.Empty, RadioTypeCode.Unknown, sigItem.SourceName, false);
         _radios[rInfo.SignalingLookupKey] = rInfo;
         MarkChangesMade();
     }
     if (rInfo != null)
     {
         sigItem.AssignedPersonnel = rInfo.PersonnelName;
         sigItem.AssignedRole = rInfo.RoleName;
         sigItem.RadioName = rInfo.RadioName;
         sigItem.RadioType = rInfo.RadioType;
         bool bAgencySet = false;
         if (rInfo.UnitKeyId != Guid.Empty && _units.ContainsKey(rInfo.UnitKeyId))
         {
             UnitInfo uInfo = _units[rInfo.UnitKeyId];
             sigItem.UnitName = uInfo.UnitName;
             if (uInfo.AgencyKeyId != Guid.Empty && _agencies.ContainsKey(uInfo.AgencyKeyId))
             {
                 sigItem.AgencyName = _agencies[uInfo.AgencyKeyId].AgencyName;
                 bAgencySet = true;
             }
         }
         if (!bAgencySet && rInfo.AgencyKeyId != Guid.Empty)
         {
             if (_agencies.ContainsKey(rInfo.AgencyKeyId))
             {
                 sigItem.AgencyName = _agencies[rInfo.AgencyKeyId].AgencyName;
             }
         }
     }
     if (string.IsNullOrWhiteSpace(sigItem.UnitName)) { sigItem.UnitName = sigItem.UnitId; }
     if (string.IsNullOrWhiteSpace(sigItem.RadioName)) { sigItem.RadioName = sigItem.UnitId; }
 }
예제 #8
0
 public void LogRadioSignal(RadioSignalingItem signalItem)
 {
     if (signalItem == null)
         return;
     string outLine = string.Format("{0} - {1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}", signalItem.Timestamp.ToShortDateString(), signalItem.Timestamp.ToLongTimeString(), DisplayFormatterUtils.SignalingSourceTypeToDisplayStr(signalItem.SourceType), signalItem.SourceName, DisplayFormatterUtils.SignalCodeToDisplayStr(signalItem.Code), signalItem.SignalingFormat, signalItem.UnitId, signalItem.AgencyName, signalItem.UnitName, signalItem.RadioName, DisplayFormatterUtils.RadioTypeCodeToDisplayStr(signalItem.RadioType), signalItem.AssignedPersonnel, signalItem.AssignedRole, signalItem.Description, signalItem.RecordingFileName);
     if (_shouldIncludeLatLon)
     {
         outLine += string.Format("|{0}|{1}", signalItem.Latitude, signalItem.Longitude);
     }
     if (_shouldDoConsoleOutput)
     {
         Console.WriteLine(outLine);
     }
     _logQueue.Enqueue(outLine);
 }
예제 #9
0
        public void HandleRadioSignal(RadioSignalingItem sigItem, EmergencyState emerState= EmergencyState.NonEmergency)
        {
            if (!_firegroundEnabled)
                return;
            if (sigItem == null)
                return;
            RadioInfo rInfo = RadioInfoLookupHelper.Instance.GetRadioInfoFromSignalingItem(sigItem);

            if (rInfo == null || rInfo.ExcludeFromRollCall)
                return;

            RollCallItem rci = GetItemFromLookupKey(rInfo.SignalingLookupKey);
            if (rci == null)
            {
                rci = new RollCallItem(rInfo, emerState);
            }
            else
            {
                rci.EmergencyState = emerState;
            }
            if (_rollCallActive)
            {
                AddToGoodList(rci);
            }
            else
            {
                AddToWaitingList(rci);
            }
        }
예제 #10
0
 public EmergencyRadioSignalItemModel(RadioSignalingItem signalItem)
     : base(signalItem)
 {
     _startedDT = null;
     _endedDT = null;
 }