// 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 } } }
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); } }