예제 #1
0
        public override void MessageForMycall(RecentMessage recentMessage,
                                              bool directlyToMe, string callQsled,
                                              short band, bool autoStart, IsConversationMessage onUsed)
        {
            XDpack77.Pack77Message.ReceivedMessage rm = recentMessage.Message;
            var           inProgList = qsosPanel.QsosInProgressDictionary;
            QsoInProgress inProgress = null;
            bool          used       = false;

            if (inProgList.TryGetValue(QsoInProgress.GetKey(rm, band), out inProgress))
            {
                used = inProgress.AddMessageOnMatch(rm, directlyToMe, callQsled);
            }
            if (used)
            {
                // we have an ongoing QSO for this message
                onUsed(Conversation.Origin.TO_ME);
                ((Qso2MessageSequencer)(inProgress.Sequencer)).OnReceived(directlyToMe, rm.Pack77Message);
            }
            else if (autoStart && directlyToMe)
            {
                onUsed(Conversation.Origin.TO_ME);
                // wasn't one we already had. but we autostart with any call
                InitiateQso(recentMessage, band, false);
            }
            else if (null != inProgress)
            {
                if ((null != inProgress.Sequencer) && !inProgress.Sequencer.IsFinished && !inProgress.InLoggedInactiveState)
                {
                    onUsed(Conversation.Origin.TO_OTHER); // make it show up in the conversation history
                }
            }
        }
예제 #2
0
        public bool InitiateQso(RecentMessage rm, short band, bool onHisFrequency, System.Action onUsed = null)
        {
            var           inProgList = qsosPanel.QsosInProgressDictionary;
            QsoInProgress q          = null;

            if (inProgList.TryGetValue(QsoInProgress.GetKey(rm.Message, band), out q))
            {
                if (!q.Active)
                {
                    q.Active = true;
                    StartQso(q);
                }
                return(false); // we're already trying to work this guy
            }
            if (null != onUsed)
            {
                onUsed();
            }
            QsoInProgress newStn = new QsoInProgress(rm, band);

            if (onHisFrequency)
            {
                newStn.TransmitFrequency = rm.Message.Hz;
            }
            qsosPanel.Add(newStn);
            StartQso(newStn);// transmit to him.
            return(true);
        }
예제 #3
0
        // call here every for every incoming message that might be relevant to us
        public override void MessageForMycall(RecentMessage recentMessage,
                                              bool directlyToMe, string callQsled, short band,
                                              bool autoStart, IsConversationMessage onUsed)
        {
            XDpack77.Pack77Message.ReceivedMessage rm = recentMessage.Message;
            var           inProgList = qsosPanel.QsosInProgressDictionary;
            QsoInProgress inProgress = null;
            bool          used       = false;

            if (inProgList.TryGetValue(QsoInProgress.GetKey(rm, band), out inProgress))
            {
                used = inProgress.AddMessageOnMatch(rm, directlyToMe, callQsled);
            }
            if (used)
            {
                // we have an ongoing QSO for this message
                QsoSequencer sequencer = inProgress.Sequencer as QsoSequencer;
                onUsed(directlyToMe ? Conversation.Origin.TO_ME : Conversation.Origin.TO_OTHER);
                // What's in the message? an exchange and/or an acknowledgement?
                bool hasExchange = ExchangeFromMessage(rm.Pack77Message) != null;
                XDpack77.Pack77Message.Roger roger = rm.Pack77Message as XDpack77.Pack77Message.Roger;
                bool ack = false;
                if (roger != null)
                {
                    ack = roger.Roger;    // if the message has a roger bit, use it
                }
                if (!hasExchange && !ack) // but if no exchange, allow QSL to also set ack
                {                         // if the message can QSO prior, see if can apply to us
                    if ((String.Equals("ALL", callQsled) && inProgress.CanAcceptAckNotToMe) ||
                        String.Equals(myCall, callQsled) ||
                        String.Equals(myBaseCall, callQsled))
                    {
                        ack = true;
                    }
                }

                if (hasExchange)
                {
                    sequencer.OnReceivedExchange(ack);
                }
                else if (ack)
                {
                    sequencer.OnReceivedAck();
                }
            }
            else if (autoStart && directlyToMe)
            {
                onUsed(Conversation.Origin.TO_ME);
                // wasn't one we already had. but we autostart with any call
                InitiateQso(recentMessage, band, false);
            }
            else if (null != inProgress)
            {
                if ((null != inProgress.Sequencer) && !inProgress.Sequencer.IsFinished)
                {
                    onUsed(Conversation.Origin.TO_OTHER); // make it show up in the conversation history
                }
            }
        }
예제 #4
0
        private void logQso(QsoInProgress q)
        {
            callbacks.LogQso(q);
            var screenItems = qsosPanel.QsosInProgress;

            foreach (QsoInProgress qnext in screenItems)
            {
                if (qnext.Sequencer == null)
                {
                    StartQso(qnext);
                    return;
                }
            }
        }
예제 #5
0
        protected override void StartQso(QsoInProgress q)
        {
            Qso2MessageSequencer qs = new Qso2MessageSequencer(new QsoSequencerCbImpl(this, q));

            q.Sequencer = qs;
            bool directlyToMe = false;

            XDpack77.Pack77Message.ToFromCall toFromCall = q.Message.Pack77Message as XDpack77.Pack77Message.ToFromCall;
            if (null != toFromCall)
            {
                directlyToMe = isMe(toFromCall.ToCall);
            }
            qs.OnReceived(directlyToMe, q.Message.Pack77Message);
        }
예제 #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;
            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();
            }
        }
예제 #7
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();
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
 private string ackMessage(QsoInProgress q, bool ofAnAck)
 {
     return(callbacks.GetAckMessage(q, ofAnAck));
 }
예제 #10
0
 private void sendAck(QsoInProgress q, bool ofAnAck, QsoSequencer.MessageSent ms) /* ofAnAck can be used to send CQ*/
 {
     callbacks.SendMessage(ackMessage(q, ofAnAck), q, ms);
 }
예제 #11
0
 private string exchangeMessage(QsoInProgress q, bool withAck)
 {
     return(callbacks.GetExchangeMessage(q, withAck));
 }
예제 #12
0
 private void sendExchange(QsoInProgress q, bool withAck, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(exchangeMessage(q, withAck), q, ms);
 }
예제 #13
0
 public QueuedToSendListItem(string s, QsoInProgress q, QsoSequencer.MessageSent ms = null)
 {
     this.s             = s;
     this.q             = q;
     this.messageSentCb = ms;
 }
예제 #14
0
 protected abstract void StartQso(QsoInProgress qp);
예제 #15
0
 public void SendAck(QsoInProgress q, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(callbacks.GetAckMessage(q, false), q, ms);
 }
예제 #16
0
 public void SendExchange(QsoInProgress q, ExchangeTypes exc, bool withAck, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(callbacks.GetExchangeMessage(q, withAck, exc), q, ms);
 }
예제 #17
0
 public QsoSequencerCbImpl(Qso2MessageExchange queue, QsoInProgress q)
 {
     qsoQueue = queue; qso = q;
 }
예제 #18
0
 public QsoSequencerCbImpl(QsoQueue queue, QsoInProgress q)
 {
     qsoQueue = queue; qso = q;
 }
예제 #19
0
 public SortedQueuedToSendListItem(string s, QsoInProgress q, QsosPanel qp, QsoSequencer.MessageSent ms) : base(s, q, ms)
 {
     this.qp = qp;
 }