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 } } }
const int MAX_RECEIVED_LOOKBACK = 10000; // number of entries in the history listbox public void OnReceived(XDpack77.Pack77Message.ReceivedMessage m) { while (listBoxReceived.Items.Count > MAX_RECEIVED_LOOKBACK) { listBoxReceived.Items.RemoveAt(0); } listBoxReceived.Items.Add(new DisplayReceivedMessage(m)); int visibleItems = listBoxReceived.ClientSize.Height / listBoxReceived.ItemHeight; listBoxReceived.TopIndex = Math.Max(listBoxReceived.Items.Count - visibleItems + 1, 0); if (null != iwaterfall) { var call = m.Pack77Message as XDpack77.Pack77Message.ToFromCall; if (null != call) { int tag = 1; var tgString = m.TimeTag; if (!String.IsNullOrEmpty(tgString)) { Int32.TryParse(tgString, out tag); } if (null != annotations) { annotations.AddAnnotation(tag, (int)m.Hz, call.FromCall, 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 } } }
public void OnReceived(XDpack77.Pack77Message.ReceivedMessage m) { while (listBoxReceived.Items.Count > MAX_RECEIVED_LOOKBACK) { listBoxReceived.Items.RemoveAt(0); } listBoxReceived.Items.Add(new DisplayReceivedMessage(m)); int visibleItems = listBoxReceived.ClientSize.Height / listBoxReceived.ItemHeight; listBoxReceived.TopIndex = Math.Max(listBoxReceived.Items.Count - visibleItems + 1, 0); mostRecentMessageTimeTag = m.TimeTag; }
public DisplayReceivedMessage(XDpack77.Pack77Message.ReceivedMessage rm) { m = rm; }
public RecentMessage(XDpack77.Pack77Message.ReceivedMessage m, bool dupe, bool mult) { msg = m; this.dupe = dupe; this.mult = mult; }