Esempio n. 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)
                {
                    onUsed(Conversation.Origin.TO_OTHER); // make it show up in the conversation history
                }
            }
        }
Esempio n. 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);
        }
Esempio n. 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
                }
            }
        }
Esempio n. 4
0
        protected override void StartQso(QsoInProgress q)
        {
            Qso2MessageSequencer qs = new Qso2MessageSequencer(new QsoSequencerImpl(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);
        }
Esempio n. 5
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;
                }
            }
        }
Esempio n. 6
0
        protected override void StartQso(QsoInProgress q)
        {   // q needs to already be in our qsosPanel list
            QsoSequencer qs = new QsoSequencer(new QsoSequencerImpl(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);
            }
        }
Esempio n. 7
0
 public SortedQueuedToSendListItem(string s, QsoInProgress q, QsosPanel qp, QsoSequencer.MessageSent ms) : base(s, q, ms)
 {
     this.qp = qp;
 }
Esempio n. 8
0
 public QsoSequencerImpl(QsoQueue queue, QsoInProgress q)
 {
     qsoQueue = queue; qso = q;
 }
Esempio n. 9
0
 private string ackMessage(QsoInProgress q, bool ofAnAck)
 {
     return(callbacks.GetAckMessage(q, ofAnAck));
 }
Esempio n. 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);
 }
Esempio n. 11
0
 private string exchangeMessage(QsoInProgress q, bool withAck)
 {
     return(callbacks.GetExchangeMessage(q, withAck));
 }
Esempio n. 12
0
 private void sendExchange(QsoInProgress q, bool withAck, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(exchangeMessage(q, withAck), q, ms);
 }
Esempio n. 13
0
 protected abstract void StartQso(QsoInProgress qp);
Esempio n. 14
0
 public QueuedToSendListItem(string s, QsoInProgress q, QsoSequencer.MessageSent ms = null)
 {
     this.s             = s;
     this.q             = q;
     this.messageSentCb = ms;
 }
Esempio n. 15
0
 public QsoSequencerImpl(Qso2MessageExchange queue, QsoInProgress q)
 {
     qsoQueue = queue; qso = q;
 }
Esempio n. 16
0
 public void SendExchange(QsoInProgress q, ExchangeTypes exc, bool withAck, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(callbacks.GetExchangeMessage(q, withAck, exc), q, ms);
 }
Esempio n. 17
0
 public void SendAck(QsoInProgress q, QsoSequencer.MessageSent ms)
 {
     callbacks.SendMessage(callbacks.GetAckMessage(q, false), q, ms);
 }