コード例 #1
0
ファイル: WriteLog.cs プロジェクト: shvyac/Digi-Rite
        public void CheckDupeAndMult(string fromCall, string digitalMode, XDpack77.Pack77Message.Message rm, out bool dupeout, out short mult)
        {
            int dupe = 0;

            mult = 0;
            iWlDupingEntry.ClearEntry();
            if (DgtlFieldNumber > 0)
            {
                iWlDupingEntry.SetFieldN((short)DgtlFieldNumber, digitalMode);
            }
            if (ReceivedRstFieldNumber > 0) // ClearEntry in WL defaults the RST. clear it out
            {
                iWlDupingEntry.SetFieldN((short)ReceivedRstFieldNumber, "");
            }
            if (GridSquareReceivedFieldNumber > 0)
            {
                XDpack77.Pack77Message.Exchange hisGrid = rm as XDpack77.Pack77Message.Exchange;
                if (hisGrid != null && !String.IsNullOrEmpty(hisGrid.GridSquare))
                {
                    iWlDupingEntry.SetFieldN((short)GridSquareReceivedFieldNumber, hisGrid.GridSquare);
                }
            }
            iWlDupingEntry.Callsign = fromCall;
            dupe = iWlDupingEntry.Dupe();
            if (dupe == 0)
            {
                mult = iWlDupingEntry.IsNewMultiplier((short)-1);
                if (mult <= 0 && GridSquareReceivedFieldNumber > 0)
                {
                    mult = iWlDupingEntry.IsNewMultiplier((short)GridSquareReceivedFieldNumber);
                }
            }
            dupeout = dupe != 0;
        }
コード例 #2
0
 protected override XDpack77.Pack77Message.Exchange ExchangeFromMessage(XDpack77.Pack77Message.Message m)
 {
     if (!messageSelector(m))
     {
         return(null);
     }
     XDpack77.Pack77Message.Exchange exc = m as XDpack77.Pack77Message.Exchange;
     return(exc);
 }
コード例 #3
0
ファイル: QsoQueue.cs プロジェクト: edguy3/Digi-Rite
 protected override XDpack77.Pack77Message.Exchange ExchangeFromMessage(XDpack77.Pack77Message.Message m)
 {   // more restrictive than base class. Insist on a grid square
     XDpack77.Pack77Message.Exchange exc = base.ExchangeFromMessage(m);
     if (exc != null && !String.IsNullOrEmpty(exc.GridSquare) && exc.GridSquare.Length >= 4)
     {
         return(exc);
     }
     return(null);
 }
コード例 #4
0
 protected virtual XDpack77.Pack77Message.Exchange ExchangeFromMessage(XDpack77.Pack77Message.Message m)
 {
     XDpack77.Pack77Message.Exchange exc = m as XDpack77.Pack77Message.Exchange;
     // The Pack77Message Exchange interface can be deceptive.
     // The Standard message CQ can have this interface but a null exc.Exchange with non-null GridSquare
     if (exc != null && !String.IsNullOrEmpty(exc.Exchange))
     {
         return(exc);
     }
     return(null);
 }
コード例 #5
0
        protected override void StartQso(QsoInProgress q)
        {   // q needs to already be in our qsosPanel list
            QsoSequencer qs = new QsoSequencer(new QsoSequencerCbImpl(this, q), false);

            q.Sequencer = qs;
            XDpack77.Pack77Message.Exchange exc = ExchangeFromMessage(q.Message.Pack77Message);
            if (exc != null)
            {
                qs.OnReceivedExchange(false, exc.Exchange != null); // like base class, but don't allow send of ack on initiating
            }
            else
            {
                qs.Initiate();
            }
        }
コード例 #6
0
        protected override void StartQso(QsoInProgress q)
        {   // q needs to already be in our qsosPanel list
            QsoSequencer qs = new QsoSequencer(new QsoSequencerCbImpl(this, q), false);

            q.Sequencer = qs;
            // very first message directed from other to me
            // can be a CQ I chose to answer, or can be an exchange
            XDpack77.Pack77Message.Exchange exc = ExchangeFromMessage(q.Message.Pack77Message);
            if (exc != null)
            {
                qs.OnReceivedExchange(false);
            }
            else
            {
                qs.Initiate();
            }
        }
コード例 #7
0
ファイル: QsoQueue.cs プロジェクト: edguy3/Digi-Rite
        protected override void StartQso(QsoInProgress q)
        {   // q needs to already be in our qsosPanel list
            QsoSequencer qs = new QsoSequencer(new QsoSequencerCbImpl(this, q));

            q.Sequencer = qs;
            // very first message directed from other to me
            // can be a CQ I chose to answer, or can be an exchange
            XDpack77.Pack77Message.Exchange exc = q.Message.Pack77Message as XDpack77.Pack77Message.Exchange;
            if (null != ExchangeFromMessage(q.Message.Pack77Message))
            {
                qs.OnReceivedExchange(gridSquareAck);
            }
            else
            {
                qs.Initiate(gridSquareAck && exc != null && exc.GridSquare != null && exc.GridSquare.Length >= 4);
            }
        }
コード例 #8
0
        public void OnReceived(bool directlyToMe, XDpack77.Pack77Message.Message msg)
        {
            deferredToEndOfReceive = null;
            XDpack77.Pack77Message.Exchange exc = msg as XDpack77.Pack77Message.Exchange;
            if (!amLeaderSet)
            {
                amLeader = directlyToMe;
            }
            amLeaderSet = true;
            XDpack77.Pack77Message.Roger roger = msg as XDpack77.Pack77Message.Roger;
            bool ack = (null != roger) && (roger.Roger);

            if (null != exc && (!haveGrid || directlyToMe))
            {
                string gs   = exc.GridSquare;
                int    rp   = exc.SignaldB;
                var    qslm = msg as XDpack77.Pack77Message.StandardMessage;
                if (!String.IsNullOrEmpty(gs))
                {   // received a grid
                    haveGrid = true;
                    ExchangeSent es;
                    if (ack)
                    {
                        haveAckOfGrid = true;
                    }
                    if (amLeader || ack)
                    {
                        es = () => cb.SendExchange(ExchangeTypes.DB_REPORT, haveReport, () => { haveSentReport = true; });
                    }
                    else
                    {
                        es = () => cb.SendExchange(ExchangeTypes.GRID_SQUARE, directlyToMe && haveGrid, () => { haveSentGrid = true; });
                    }
                    lastSent = es;
                    es();
                    return;
                }
                else if (rp > XDpack77.Pack77Message.Message.NO_DB)
                {   // received a dB report
                    haveReport = true;
                    lastSent   = null;
                    if (ack && haveSentReport)
                    {
                        haveAckOfReport = true;
                    }
                    if (haveAckOfReport)
                    {
                        ExchangeSent es = () => cb.SendAck(() =>
                        {
                            if (!haveLoggedReport)
                            {
                                haveLoggedReport = true;
                                if (haveGrid)
                                {
                                    haveLoggedGrid = true;
                                }
                                cb.LogQso();
                            }
                        });
                        lastSent = es;
                        es();
                    }
                    else
                    {
                        ExchangeSent es = () => cb.SendExchange(ExchangeTypes.DB_REPORT, true, () => { haveSentReport = true; });
                        lastSent = es;
                        es();
                    }
                    return;
                }
                else if (null == msg as XDpack77.Pack77Message.StandardMessage)
                {   // message has an exchange, but for some contest we don't know about
                    if (!haveReceivedWrongExchange)
                    {
                        haveReceivedWrongExchange = true;
                        cb.LogQso();
                    }
                    cb.SendAck(null); // send a 73, log it, and get going
                    lastSent = null;
                    return;
                }
            }
            if (!haveReceivedWrongExchange && !haveGrid && !haveReport)
            {
                ExchangeSent es = null;
                if (haveSentGrid)
                {
                    es = () => cb.SendExchange(ExchangeTypes.DB_REPORT, false, () => { haveSentReport = true; });
                }
                else
                {
                    es = () => cb.SendExchange(ExchangeTypes.GRID_SQUARE, false, () => { haveSentGrid = true; });
                }
                lastSent = es;
                es();
                return;
            }
            XDpack77.Pack77Message.QSL qsl = msg as XDpack77.Pack77Message.QSL;
            if ((qsl != null) && String.Equals(qsl.CallQSLed, "ALL") || directlyToMe)
            {
                // what we need to do
                Action toDoOnAck = () =>
                {
                    if (!haveLoggedGrid && (haveReport || (directlyToMe && haveGrid)))
                    {
                        haveLoggedGrid = true;
                        if (haveReport)
                        {
                            haveLoggedReport = true;
                        }
                        lastSent = null;
                        cb.LogQso();
                        ackOfAckGrid = qsl.QslText; // see if they repeat exact message
                        AckMoreAcks  = MAXIMUM_ACK_OF_ACK;
                        cb.SendOnLoggedAck(() =>
                                           { onLoggedAckEnabled = true; });
                        return;
                    }
                    if (AckMoreAcks > 0 && directlyToMe && String.Equals(qsl.QslText, ackOfAckGrid))
                    {   // only repeat this if they send exact same message
                        lastSent     = null;
                        AckMoreAcks -= 1;
                        if (onLoggedAckEnabled)
                        {
                            cb.SendOnLoggedAck(null);
                        }
                        else
                        {
                            cb.SendAck(null);
                        }
                        return;
                    }
                };
                // do it now? or see if multi-streaming partner sends a message directlyToMe
                if (directlyToMe)
                {
                    toDoOnAck();
                }
                else
                {
                    deferredToEndOfReceive = toDoOnAck;
                }
                return;
            }
            OnReceivedNothing(); // didn't get what I wanted
        }
コード例 #9
0
 public void OnReceived(bool directlyToMe, XDpack77.Pack77Message.Message msg)
 {
     XDpack77.Pack77Message.Exchange exc = msg as XDpack77.Pack77Message.Exchange;
     if (!amLeaderSet)
     {
         amLeader = directlyToMe;
     }
     amLeaderSet = true;
     if (null != exc)
     {
         string gs = exc.GridSquare;
         int    rp = exc.SignaldB;
         if (!String.IsNullOrEmpty(gs))
         {   // received a grid
             haveGrid = true;
             ExchangeSent es;
             if (amLeader)
             {
                 es = () => cb.SendExchange(ExchangeTypes.DB_REPORT, false, () => { haveSentReport = true; });
             }
             else
             {
                 es = () => cb.SendExchange(ExchangeTypes.GRID_SQUARE, false, null);
             }
             lastSent = es;
             es();
             return;
         }
         else if (rp > XDpack77.Pack77Message.Message.NO_DB)
         {   // received a dB report
             XDpack77.Pack77Message.Roger roger = msg as XDpack77.Pack77Message.Roger;
             bool ack = (null != roger) && (roger.Roger);
             haveReport = true;
             lastSent   = null;
             if (amLeader && ack && haveSentReport)
             {
                 cb.SendAck(null);
                 if (!haveLoggedReport)
                 {
                     haveLoggedReport = true;
                     if (haveGrid)
                     {
                         haveLoggedGrid = true;
                     }
                     cb.LogQso();
                 }
             }
             else
             {
                 ExchangeSent es = () => cb.SendExchange(ExchangeTypes.DB_REPORT, true, () => { haveSentReport = true; });
                 lastSent = es;
                 es();
             }
             return;
         }
     }
     XDpack77.Pack77Message.QSL qsl = msg as XDpack77.Pack77Message.QSL;
     if ((qsl != null) && String.Equals(qsl.CallQSLed, "ALL") || directlyToMe)
     {
         if (!haveGrid && !haveReport)
         {
             ExchangeSent es = () => cb.SendExchange(amLeader ? ExchangeTypes.DB_REPORT : ExchangeTypes.GRID_SQUARE, false, null);
             lastSent = es;
             es();
             return;
         }
         if (!haveLoggedGrid && (haveReport || (directlyToMe && haveGrid)))
         {
             haveLoggedGrid = true;
             if (haveReport)
             {
                 haveLoggedReport = true;
             }
             lastSent = null;
             if (!amLeader)
             {
                 cb.SendAck(null);
             }
             cb.LogQso();
             return;
         }
         OnReceivedNothing(); // didn't get what I wanted
     }
 }