/// <summary> /// Occurs when the "Encode Single Packet" button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mdcDebugSingle_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = firstOp, Argument = firstArg, UnitID = firstUnitID }; encoder.CreateSingle(pckt); this.Close(); }
/// <summary> /// Occurs when the "Radio Check" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void radioCheckButton_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.RADIO_CHECK, Argument = ArgType.RADIO_CHECK, UnitID = targetID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/// <summary> /// Occurs when the "Status" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void statusButton_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.STATUS_REQUEST, Argument = ArgType.STATUS_REQ, UnitID = targetID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/// <summary> /// Occurs when the "Revive Target" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void reviveButton_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.RADIO_INHIBIT, Argument = ArgType.CANCEL_INHIBIT, UnitID = targetID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/** CONSOLE BUTTON OPERATIONS */ /// <summary> /// Occurs when the "Tool PTT ID" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txToolPTT_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.PTT_ID, Argument = ArgType.NO_ARG, UnitID = myID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/// <summary> /// Occurs when the "Emergency Acknowledge" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void emergAck_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.EMERGENCY_ACK, Argument = ArgType.NO_ARG, UnitID = targetID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); // emergency was acknowledged disable the button now emergAck.Enabled = false; }
/// <summary> /// Occurs when the "Message" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void messageButton_Click(object sender, EventArgs e) { MessageTargetID msgTgtId = new MessageTargetID(); msgTgtId.ShowDialog(); // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.MESSAGE, Argument = (byte)msgTgtId.MessageID, UnitID = msgTgtId.TargetID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/// <summary> /// Occurs when the "Stun Target" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void stunButton_Click(object sender, EventArgs e) { TargetID tgtId = new TargetID(this.targetID); tgtId.ShowDialog(); // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.RADIO_INHIBIT, Argument = ArgType.NO_ARG, UnitID = tgtId.TargetRadioID }; Encoder.CreateSingle(pckt); PlayEncodedPackets(); }
/// <summary> /// Occurs when the "Encode Double Packet" button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mdcDebugDouble_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = firstOp, Argument = firstArg, UnitID = firstUnitID }; MDCPacket pckt2 = new MDCPacket() { Operation = secondOp, Argument = secondArg, UnitID = secondUnitID }; encoder.CreateDouble(pckt, pckt2); this.Close(); }
/// <summary> /// Occurs when the "SelCall" button is pressed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void selectiveCallButton_Click(object sender, EventArgs e) { // generate MDC packet MDCPacket pckt = new MDCPacket() { Operation = OpType.DOUBLE_PACKET_TYPE1, Argument = ArgType.DOUBLE_PACKET_TO, UnitID = targetID }; MDCPacket pckt2 = new MDCPacket() { Operation = OpType.SELECTIVE_CALL_1, Argument = ArgType.CALL_ALERT, UnitID = myID }; Encoder.CreateDouble(pckt, pckt2); PlayEncodedPackets(); }
/// <summary> /// Occurs when the MDC-1200 decoder, decodes a packet. /// </summary> /// <param name="frameCount"></param> /// <param name="first"></param> /// <param name="second"></param> private void Decoder_DecoderCallback(int frameCount, MDCPacket first, MDCPacket second) { string timeString = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); if (recievedPackets.Items.Count > 128) { recievedPackets.Invoke(new __VoidDelegate(delegate() { recievedPackets.Items.Insert(0, timeString + "\tList auto-cleared, more than 128 entries."); recievedPackets.Items.Clear(); }), new object[] { }); } recievedPackets.Invoke(new __UpdateListBox(delegate(string str) { recievedPackets.Items.Insert(0, timeString + "\t" + str); }), new object[] { Decoder.ToString(first) }); if (frameCount == 2) { recievedPackets.Invoke(new __UpdateListBox(delegate(string str) { recievedPackets.Items.Insert(0, timeString + "\t" + str); }), new object[] { Decoder.ToString(second) }); } if (first.Operation == OpType.PTT_ID) { this.targetMDCID.Invoke(new __MDCDelegate(delegate(MDCPacket packet) { this.targetID = packet.UnitID; this.targetMDCID.Text = this.targetID.ToString("X4"); }), new object[] { first }); } if (first.Operation == OpType.EMERGENCY) { this.emergAck.Enabled = true; } }