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