Mods for SDR# TETRA demod plugin 1.0.14.0 - 2



4.7.2021
Mods for SDR# TETRA demod plugin 1.0.14.0 - 2

dotPeek & Visual Studio 2019
NET 4.6 C#

NetInfoWindow.cs

public void UpdateTextBox(List<Dictionary<GlobalNames, int>> rawData)
{
...

            MmPrimitivesType mmPrimitivesType = (MmPrimitivesType) num1;
            switch (mmPrimitivesType)
            {
              case MmPrimitivesType.D_OTAR:
                if (dictionary.TryGetValue(GlobalNames.Otar_sub_type, out num1))
                {
                  str2 = str2 + " OTAR: " + (object) (D_OtarPduSubType) num1;
                  //modx new
                  if (dictionary.TryGetValue(GlobalNames.SCKN, out num1))
                     str2 = str2 + " SCKN: " + num1.ToString();
                  if (dictionary.TryGetValue(GlobalNames.GSKO_VN, out num1))
                     str2 = str2 + " GSKO_VN: " + num1.ToString();
                  if (dictionary.TryGetValue(GlobalNames.OTAR_Retry_Interval, out num1))
                     str2 = str2 + " OTAR_Retry_Interval: " + num1.ToString();
                  if (dictionary.TryGetValue(GlobalNames.OTAR_retry_interval, out num1))
                     str2 = str2 + " OTAR_retry_interval: " + num1.ToString();
                  if (dictionary.TryGetValue(GlobalNames.Random_Seed_for_OTAR, out num1))
                     str2 = str2 + " Random_Seed_for_OTAR: " + num1.ToString();
                  //end new
                  break;
                }
                break;
              case MmPrimitivesType.D_AUTHENTICATION:
...

            if (dictionary.TryGetValue(GlobalNames.MM_SSI, out num1))
              str2 = str2 + " xSSI: " + num1.ToString();
            // modx
            if (dictionary.TryGetValue(GlobalNames.USSI, out num1))
              str2 = str2 + " USSI: " + num1.ToString();

            if (dictionary.TryGetValue(GlobalNames.SMI, out num1))
               str2 = str2 + " SMI: " + num1.ToString();

            if (dictionary.TryGetValue(GlobalNames.KSG_number, out num1))
              str2 = str2 + " KSG_number: " + num1.ToString();
            //modx new
            if (dictionary.TryGetValue(GlobalNames.Session_key, out num1))
              str2 = str2 + " Session_key: " + num1.ToString();
            if (dictionary.TryGetValue(GlobalNames.Encryption_key_number, out num1))
              str2 = str2 + " Encryption_key_number: " + num1.ToString();
            //end new

TetraDecoder.cs
Show logic channel data as bitstring in burst window

    public unsafe int Process(
      float* inBuffer,
      int length,
      byte* audioOut,
      ref int frame_stealing,
      ref string burstMessage)
    {
    ...
            if (flag5)
            {
              if (NetInfoWindow._noSYNCpdus)
              {
                burstMessage = string.Format(" {0:HH:mm:ss tt}", (object) DateTime.Now) + "   SYNCIN" + string.Format("{0,-51}", (object) "FO + SCH/HD [NULL]") + " (FN:" + string.Format("{0:00}", (object) this._lowerMac.FR) + " - TN:" + (object) this._lowerMac.TS + ") - " + string.Format("{0,-11}", (object) this._parse.DownLinkChannelType) + Environment.NewLine;
                break;
              }
              break;
            }
            if (NetInfoWindow._noSYNCpdus)
            {
              burstMessage = string.Format(" {0:HH:mm:ss tt}", (object) DateTime.Now) + "   SYNCIN" + string.Format("{0,-51}", (object) "FO [BAD CRC] + SCH/HD [NULL]") + " (FN:" + string.Format("{0:00}", (object) this._lowerMac.FR) + " - TN:" + (object) this._lowerMac.TS + ") - " + string.Format("{0,-11}", (object) this._parse.DownLinkChannelType) + Environment.NewLine;
              break;
            }
            break;
          }
          break;
      }
      //modx new
      burstMessage = burstMessage + TetraUtils.BitsToString(_logicChannel.Ptr, 0, _logicChannel.Length - 1) + Environment.NewLine;
      //end new
      this.BurstReceived = flag1;
      this.UpdateData(this._data);

 

or if just some burst types with logic channel bitstring, then add above (bolded) in specific case blocks, e.g.

      switch (trainingSequence.Type)
      {
        case BurstType.NDB1:
          if (TetraPanel.DmoMode)
          {
            if (!this._networkTime.IsSynchronized)
              return num1;
            this._logicChannel = this._lowerMac.ExtractLogicChannelFromBKN1BKN2(this._bkn1BufferPtr, this._bkn2BufferPtr, this._bkn1Buffer.Length);
            if (this._logicChannel.CrcIsOk)
            {
              string empty = string.Empty;
              this._parse.DmoParseMacPDU(this._logicChannel, this._data);
              int num2 = 0;
              if (this._data1.TryGetValue(GlobalNames.Null_PDU_flag, out num2) && num2 == 1)
                burstMessage = string.Format(" {0:HH:mm:ss tt}", (object) DateTime.Now) + "   SCH/F  " + string.Format("{0,-50}", (object) "[NULL]") + " (FN:" + string.Format("{0:00}", (object) this._lowerMac.FR) + " - TN:" + (object) this._lowerMac.TS + ")" + Environment.NewLine;
              this._data[this._data.Count - 1].TryGetValue(GlobalNames.LCH_in_frame_3, out this._dmoLCH);
              break;
            }
            if (this._lowerMac.FR != 18)
            {
              this._logicChannel = this._lowerMac.ExtractVoiceDataFromBKN1BKN2(this._bkn1BufferPtr, this._bkn2BufferPtr, this._bkn1Buffer.Length);
              Utils.Memcpy((void*) audioOut, (void*) this._logicChannel.Ptr, this._logicChannel.Length);
              frame_stealing = 0;
              burstMessage = string.Format(" {0:HH:mm:ss tt}", (object) DateTime.Now) + "   TCH/F  " + string.Format("{0,-43}", (object) " ") + "[VOICE] (FN:" + string.Format("{0:00}", (object) this._lowerMac.FR) + " - TN:" + (object) this._lowerMac.TS + ") - Traffic" + Environment.NewLine;
              burstMessage = burstMessage + TetraUtils.BitsToString(_logicChannel.Ptr, 0, _logicChannel.Length - 1) + Environment.NewLine;
              num1 = this._lowerMac.TS;
              break;
            }
            break;

Comments

  1. Very nice with all the mods. Keep it up! I have upgraded to notnet 8, but now the tetra sound from libtetradec isn't working when I run the tetra plugin. I found an old source for libtetradec, updated the code with the new pack from etsi, and compiled it, but that didn't work. Have you experienced the same issue, or do you have any solutions for this? Everything else is working fine. When I run .NET 4.6 with SDR 1700, the sound works, but the program freezes after a while. Here's the link to the source for libtetradec: https://github.com/curlyboi/libtetradec Best regards David.

    ReplyDelete
  2. I have not found any solution for this phenomenon.

    ReplyDelete

Post a Comment

Popular posts from this blog

Inspecting Alinco DJ-X100E firmware updater

Modifying old SDR# TETRA demod plug-in