Exemple #1
0
 public STAR(int sampleRate, STARReceivedDelegate callback, star_format callback_format, string sourceName)
 {
     this._sampleRate = sampleRate;
     this._sourceName = sourceName;
     _callback        = callback;
     _callback_format = callback_format;
     for (int i = 0; i < NDEC; i++)
     {
         starSamples[i] = new STARSampleItem();
     }
     _buffersAreClear = false;
     ClearAllDecoders();
 }
Exemple #2
0
 public STAR(int sampleRate, STARReceivedDelegate callback, star_format callback_format, string sourceName)
 {
     this._sampleRate = sampleRate;
     this._sourceName = sourceName;
     _callback = callback;
     _callback_format = callback_format;
     for (int i = 0; i < NDEC; i++)
     {
         starSamples[i] = new STARSampleItem();
     }
     _buffersAreClear = false;
     ClearAllDecoders();
 }
Exemple #3
0
        private int _star_decoder_get(star_format format, out uint unitId, out uint tag, out uint status, out uint message)
        {
            unitId  = 0;
            tag     = 0;
            status  = 0;
            message = 0;
            if (valid > 0)
            {
                unitId  = (lastBits0 >> 16) & 0x7ff;
                tag     = (lastBits0 >> 14) & 0x03;
                status  = (lastBits0 >> 10) & 0x0f;
                message = (lastBits0 >> 6) & 0x0f;
                switch (format)
                {
                case star_format.star_format_1:     // t1, t2, and s1 do not contribute to unit ID - original format, IDs to 2047
                {
                    break;
                }

                case star_format.star_format_1_4095:     // t1 = 2048, t2 used for mobile/portable, s1 ignored
                {
                    if ((tag & 0x02) > 0)
                    {
                        unitId += 2048;
                    }
                    status &= 0x07;
                    break;
                }

                case star_format.star_format_1_16383:     // t1 = 8192, t2 = 4096, s1 = 2048 used to allow unit IDs to 16383 -- most typical
                {
                    if ((tag & 0x02) > 0)
                    {
                        unitId += 8192;
                    }
                    if ((tag & 0x01) > 0)
                    {
                        unitId += 4096;
                    }
                    if ((status & 0x08) > 0)
                    {
                        unitId += 2048;
                    }
                    status &= 0x07;
                    tag     = 0;
                    break;
                }

                case star_format.star_format_sys:     // t1,t2 used for system ID, s1 = 2048
                {
                    if ((status & 0x08) > 0)
                    {
                        unitId += 2048;
                    }
                    status &= 0x07;
                    break;
                }

                case star_format.star_format_2:     // t1 = 4096, t2 = mobile/portable, s1 = 2048
                {
                    if ((tag & 0x02) > 0)
                    {
                        unitId += 4096;
                    }
                    tag &= 0x01;
                    if ((status & 0x08) > 0)
                    {
                        unitId += 2048;
                    }
                    status &= 0x07;
                    break;
                }

                case star_format.star_format_3:     // t1 = 4096, t2 = 8192, s1 = 2048
                {
                    if ((tag & 0x02) > 0)
                    {
                        unitId += 4096;
                    }
                    if ((tag & 0x01) > 0)
                    {
                        unitId += 8192;
                    }
                    tag = 0;
                    if ((status & 0x08) > 0)
                    {
                        unitId += 2048;
                    }
                    status &= 0x07;
                    break;
                }

                case star_format.star_format_4:     // t1 = 4096, t2 = 2048, s1 = 8192
                {
                    if ((tag & 0x02) > 0)
                    {
                        unitId += 4096;
                    }
                    if ((tag & 0x01) > 0)
                    {
                        unitId += 2048;
                    }
                    tag = 0;
                    if ((status & 0x08) > 0)
                    {
                        unitId += 8192;
                    }
                    status &= 0x07;
                    break;
                }
                }
            }
            else
            {
                return(-1);
            }
            return(0);
        }
Exemple #4
0
 private int _star_decoder_get(star_format format, out uint unitId, out uint tag, out uint status, out uint message)
 {
     unitId = 0;
     tag = 0;
     status = 0;
     message = 0;
     if (valid > 0)
     {
         unitId = (lastBits0 >> 16) & 0x7ff;
         tag = (lastBits0 >> 14) & 0x03;
         status = (lastBits0 >> 10) & 0x0f;
         message = (lastBits0 >> 6) & 0x0f;
         switch (format)
         {
             case star_format.star_format_1: // t1, t2, and s1 do not contribute to unit ID - original format, IDs to 2047
                 {
                     break;
                 }
             case star_format.star_format_1_4095: // t1 = 2048, t2 used for mobile/portable, s1 ignored
                 {
                     if ((tag & 0x02) > 0)
                         unitId += 2048;
                     status &= 0x07;
                     break;
                 }
             case star_format.star_format_1_16383: // t1 = 8192, t2 = 4096, s1 = 2048 used to allow unit IDs to 16383 -- most typical
                 {
                     if ((tag & 0x02) > 0)
                         unitId += 8192;
                     if ((tag & 0x01) > 0)
                         unitId += 4096;
                     if ((status & 0x08) > 0)
                         unitId += 2048;
                     status &= 0x07;
                     tag = 0;
                     break;
                 }
             case star_format.star_format_sys: // t1,t2 used for system ID, s1 = 2048
                 {
                     if ((status & 0x08) > 0)
                         unitId += 2048;
                     status &= 0x07;
                     break;
                 }
             case star_format.star_format_2: // t1 = 4096, t2 = mobile/portable, s1 = 2048
                 {
                     if ((tag & 0x02) > 0)
                         unitId += 4096;
                     tag &= 0x01;
                     if ((status & 0x08) > 0)
                         unitId += 2048;
                     status &= 0x07;
                     break;
                 }
             case star_format.star_format_3: // t1 = 4096, t2 = 8192, s1 = 2048
                 {
                     if ((tag & 0x02) > 0)
                         unitId += 4096;
                     if ((tag & 0x01) > 0)
                         unitId += 8192;
                     tag = 0;
                     if ((status & 0x08) > 0)
                         unitId += 2048;
                     status &= 0x07;
                     break;
                 }
             case star_format.star_format_4: // t1 = 4096, t2 = 2048, s1 = 8192
                 {
                     if ((tag & 0x02) > 0)
                         unitId += 4096;
                     if ((tag & 0x01) > 0)
                         unitId += 2048;
                     tag = 0;
                     if ((status & 0x08) > 0)
                         unitId += 8192;
                     status &= 0x07;
                     break;
                 }
         }
     }
     else
     {
         return -1;
     }
     return 0;
 }