public AgencyInfoModel(RadioLog.Common.AgencyInfo agency) { if (agency == null) throw new ArgumentNullException(); this._agencyId = agency.AgencyId; this._agencyName = agency.AgencyName; }
public UnitInfoModel(RadioLog.Common.UnitInfo unit) { if (unit == null) throw new ArgumentNullException(); this._unitId = unit.UnitKeyId; this._agencyId = unit.AgencyKeyId; this._unitName = unit.UnitName; }
public StreamSourceEditorDialog(RadioLog.Common.SignalSource src) { if (src == null) throw new ArgumentNullException(); InitializeComponent(); _src = src; RadioLog.WPFCommon.BrushSelectionHolder[] colors = RadioLog.WPFCommon.ColorHelper.GetBrushSelectionItems(); System.Collections.ObjectModel.ObservableCollection<RadioLog.WPFCommon.BrushSelectionHolder> colorList = new System.Collections.ObjectModel.ObservableCollection<WPFCommon.BrushSelectionHolder>(colors); colorList.Insert(0, new WPFCommon.BrushSelectionHolder("Default", null)); cbSourceColor.ItemsSource = colorList; if (string.IsNullOrEmpty(_src.SourceColor)) cbSourceColor.SelectedIndex = 0; else cbSourceColor.SelectedValue = _src.SourceColor; tbSourceName.Text = _src.SourceName; tbStreamURL.Text = _src.SourceLocation; sRecordingKickTime.Value = _src.RecordingKickTime; tsRecordingEnabled.IsChecked = _src.RecordAudio; tsPriority.IsChecked = _src.IsPriority; cbDecodeMDC1200.IsChecked = _src.DecodeMDC1200; cbDecodeGEStar.IsChecked = _src.DecodeGEStar; cbDecodeFleetSync.IsChecked = _src.DecodeFleetSync; cbRemoveNoise.IsChecked = _src.RemoveNoise; sDisplayOrder.Value = _src.DisplayOrder; LoadDeviceLists(); cbNoiseFloor.ItemsSource = _noiseFloorList; cbNoiseFloor.SelectedValue = _src.NoiseFloor; sCustomNoiseFloor.Value = _src.CustomNoiseFloor; cbWaveOutDev.ItemsSource = _waveOutList; if (_waveOutList.Count > 0 && !string.IsNullOrWhiteSpace(_src.WaveOutDeviceName)) { cbWaveOutDev.SelectedItem = (_waveOutList.FirstOrDefault(l => l.DeviceName == _src.WaveOutDeviceName)); } if (string.IsNullOrWhiteSpace(_src.WaveOutDeviceName) || cbWaveOutDev.SelectedIndex < 0) { cbWaveOutDev.SelectedIndex = 0; } switch (_src.RecordingType) { case Common.SignalRecordingType.Fixed: cbRecordingStyle.SelectedIndex = 1; break; default: cbRecordingStyle.SelectedIndex = 0; break; } UpdateForSelectedRecordingStyle(); DisplayQRCode(_src.SourceLocation); }
private Constellation getConstellation(RadioLog.Common.SafeBitArray message, int index) { int constellation = 0; for (int x = 0; x < 4; x++) { if (message[index + x]) { constellation += (1 << (3 - x)); } } return Constellation.fromValue(constellation); }
public static RadioLog.Common.SafeBitArray interleave(RadioLog.Common.SafeBitArray message, int start, int end) { RadioLog.Common.SafeBitArray original = message.CloneFromIndexToIndex(start, end); /* Clear block bits in source message */ message.ClearRange(start, end); /* Iterate only the set bits in the original message and apply * the deinterleave -- we don't have to evaluate the 0 bits */ for (int i = original.nextSetBit(0); i >= 0 && i < INTERLEAVE.Length; i = original.nextSetBit(i + 1)) { message.SetBit(start + INTERLEAVE[i]); } return message; }
public void decode(RadioLog.Common.SafeBitArray message, int start, int end) { /* load each of the nodes with deinterleaved constellations */ for (int index = 0; index < 49; index++) { Constellation c = getConstellation(message, index * 4); mConstellationNodes[index].setConstellation(c); } /* test to see if constellations are correct - otherwise correct them */ ConstellationNode firstNode = mConstellationNodes[0]; if (!firstNode.startsWith(Dibit.D0) || !firstNode.isCorrect()) { firstNode.correctTo(Dibit.D0); } /* clear constellations from original message */ message.ClearRange(start, end - start); /* replace with decoded values from the nodes */ for (int index = 0; index < 49; index++) { ConstellationNode node = mConstellationNodes[index]; if (node.firstBit()) { message.SetBit(start + (index * 2)); } if (node.secondBit()) { message.SetBit(start + (index * 2) + 1); } } }
private void ProcessSTAR(Decoders.STAR decoder, RadioLog.Common.SignalCode sigCode, uint unitID, uint tag, uint status, uint message) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "STAR: {0} on stream {1}", unitID, _sourceName); _silenceHelper.ClearSilenceStats(); if (_sigDelegate != null) { string desc; if (!string.IsNullOrWhiteSpace(LastValidStreamTitle)) { desc = string.Format("Unit: {0}, Tag: {1}, Status: {2}, Message: {3}, Stream Title: {4}", unitID, tag, status, message, LastValidStreamTitle); } else { desc = string.Format("Unit: {0}, Tag: {1}, Status: {2}, Message: {3}", unitID, tag, status, message); } RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, RadioLog.Common.SignalingNames.STAR, sigCode, unitID.ToString(), desc, DateTime.Now, _recorder.CurrentFileName); _sigDelegate(sigItem); } }
private void ProcessMDC1200(Decoders.MDC1200 decoder, RadioLog.Common.SignalCode sigCode, int frameCount, byte op, byte arg, ushort unitID, byte extra0, byte extra1, byte extra2, byte extra3, string opMsg) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "MDC: {0} on stream {1}", opMsg, _sourceName); _silenceHelper.ClearSilenceStats(); if (_sigDelegate != null) { string desc = opMsg; if (!string.IsNullOrWhiteSpace(LastValidStreamTitle)) { desc += ", Stream Title=" + LastValidStreamTitle; } RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, RadioLog.Common.SignalingNames.MDC, sigCode, string.Format("{0:X4}", unitID), desc, DateTime.Now, _recorder.CurrentFileName); _sigDelegate(sigItem); } }
public P25Message(RadioLog.Common.SafeBitArray message, Decoders.P25.Reference.DataUnitID duid) : base() { mMessage = message; mDUID = duid; }
/** * Determines the errant bit positions and returns them in an array of * integer bit positions. * * Note: currently only detects single-bit errors * * @param msg to be checked for errors * @return - array of integer positions of bits that need flipped */ public static int[] findBitErrors( RadioLog.Common.SafeBitArray msg ) { int[] retVal = null; int checksum = getChecksum( msg ); //Remove the initial fill value (1) checksum ^= 1; //Iterate set message bits, removing their respective checksum value //from the transmitted checksum, to arrive at the remainder for (int i = msg.nextSetBit( 0 ); i >= 0 && i < 48; i = msg.nextSetBit( i+1 ) ) { checksum ^= sCHECKSUMS[ i ]; } //If at this point the checksum is 0, then we have a parity bit error if( checksum == 0 ) { retVal = new int[ 1 ]; retVal[ 0 ] = 63; } //Otherwise, try to lookup the syndrome for a single bit error else { for( int x = 0; x < 63; x++ ) { if( checksum == sCHECKSUMS[ x ] ) { //return this bit position retVal = new int[ 1 ]; retVal[ 0 ] = x; } } } return retVal; }
public TSBKMessage(int system, RadioLog.Common.SafeBitArray message) : base(message, Reference.DataUnitID.TSBK1) { // }
public static TSBKMessage getMessage(int system, RadioLog.Common.SafeBitArray buffer) { int opcode = buffer.getInt(TSBKMessage.OPCODE); int vendor = buffer.getInt(TSBKMessage.VENDOR_ID); switch (vendor) { case 0: //STANDARD { return new TSBKMessage(system, buffer); } case 144: //MOTOROLA { return new TSBKMessage(system, buffer); } default: { return new TSBKMessage(system, buffer); } } }
private static void MDCDelegate(Decoders.MDC1200 decoder, RadioLog.Common.SignalCode sigCode, int frameCount, byte op, byte arg, ushort unitID, byte extra0, byte extra1, byte extra2, byte extra3, string opMsg) { // }
public PDUMessage(RadioLog.Common.SafeBitArray message, Decoders.P25.Reference.DataUnitID duid) : base(message, duid) { }
public RadioInfoModel(RadioLog.Common.RadioInfo radio) { if (radio == null) throw new ArgumentNullException(); this._unitId = radio.UnitKeyId; this._agencyId = radio.AgencyKeyId; this._radioName = radio.RadioName; this._signalingFormat = radio.SignalingFormat; this._signalingUnitId = radio.SignalingUnitId; this._roleName = radio.RoleName; this._personnelName = radio.PersonnelName; this._radioTypeCode = radio.RadioType; this._firstHeardSourceName = radio.FirstHeardSourceName; this._excludeFromRollCall = radio.ExcludeFromRollCall; }
/** * Returns the integer value of the 15 bit crc checksum */ public static int getChecksum( RadioLog.Common.SafeBitArray msg ) { int retVal = 0; for( int x = 0; x < 15; x++ ) { if( msg[ x + 48 ] ) { retVal += 1<<( 14 - x ); } } return retVal; }
protected void ProcessRadioSignalingItem(RadioLog.Common.RadioSignalingItem sigItem) { if (sigItem == null || _sigDelegate == null) return; _sigDelegate(sigItem); }
/** * Determines if message bits 0 - 47 pass the Fleetsync CRC checksum * contained in bits 48 - 63, using a lookup table of CRC checksum values * derived from the CRC-15 value, and verifies the message has even parity */ public static CRC check( RadioLog.Common.SafeBitArray msg ) { CRC crc = CRC.UNKNOWN; int calculated = 1; //Starting value //Check even parity if( msg.Cardinality() % 2 == 0 ) { //Iterate bits that are set and XOR running checksum with lookup value for (int i = msg.nextSetBit( 0 ); i >= 0 && i < 48; i = msg.nextSetBit( i+1 ) ) { calculated ^= sCHECKSUMS[ i ]; } if( calculated == getChecksum( msg ) ) { crc = CRC.PASSED; } else { crc = CRC.FAILED_CRC; } } else { crc = CRC.FAILED_PARITY; } return crc; }
private void ProcessRootDecoder(RadioLog.Common.SignalCode sigCode, string format, string unitId, string desc) { Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "{0}: {1} on stream {2}", format, sigCode, _sourceName); _silenceHelper.ClearSilenceStats(); if (_sigDelegate != null) { if (!string.IsNullOrWhiteSpace(LastValidStreamTitle)) { desc += ", Stream Title=" + LastValidStreamTitle; } RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, format, sigCode, unitId, desc, DateTime.Now, _recorder.CurrentFileName); _sigDelegate(sigItem); } }
public FleetsyncMessage(RadioLog.Common.SafeBitArray message) { mMessage = message; checkParity(); }
public static System.Windows.Media.Brush GetStatusBrush(RadioLog.Common.SignalingSourceStatus stat, string colorName) { SetupBrushes(); switch (stat) { case Common.SignalingSourceStatus.AudioActive: return GetHighlighBrushFromColorName(colorName); case Common.SignalingSourceStatus.Disabled: return _disabledBrush; case Common.SignalingSourceStatus.Disconnected: return _disconnectedBrush; case Common.SignalingSourceStatus.FeedNotActive: return _disconnectedBrush; case Common.SignalingSourceStatus.Muted: return _disconnectedBrush; default: return _normalBrush; } }