Пример #1
0
        /// <summary>
        /// Gets a single PDU based on the response bytes.
        /// </summary>
        /// <param name="response">The SMSC response.</param>
        /// <returns>The PDU corresponding to the bytes.</returns>
        private Pdu GetPDU(byte[] response)
        {
            Pdu.CommandIdType commandID = Pdu.DecodeCommandId(response);
            Pdu packet;

            switch (commandID)
            {
            case Pdu.CommandIdType.alert_notification:
                packet = new SmppAlertNotification(response);
                break;

            case Pdu.CommandIdType.bind_receiver_resp:
            case Pdu.CommandIdType.bind_transceiver_resp:
            case Pdu.CommandIdType.bind_transmitter_resp:
                packet = new SmppBindResp(response);
                break;

            case Pdu.CommandIdType.cancel_sm_resp:
                packet = new SmppCancelSmResp(response);
                break;

            case Pdu.CommandIdType.data_sm_resp:
                packet = new SmppDataSmResp(response);
                break;

            case Pdu.CommandIdType.deliver_sm:
                packet = new SmppDeliverSm(response);
                break;

            case Pdu.CommandIdType.enquire_link_resp:
                packet = new SmppEnquireLinkResp(response);
                break;

            case Pdu.CommandIdType.outbind:
                packet = new SmppOutbind(response);
                break;

            case Pdu.CommandIdType.query_sm_resp:
                packet = new SmppQuerySmResp(response);
                break;

            case Pdu.CommandIdType.replace_sm_resp:
                packet = new SmppReplaceSmResp(response);
                break;

            case Pdu.CommandIdType.submit_multi_resp:
                packet = new SmppSubmitMultiResp(response);
                break;

            case Pdu.CommandIdType.submit_sm_resp:
                packet = new SmppSubmitSmResp(response);
                break;

            case Pdu.CommandIdType.unbind_resp:
                packet = new SmppUnbindResp(response);
                break;

            default:
                packet = null;
                break;
            }

            return(packet);
        }
Пример #2
0
        /// <summary>
        /// Gets a single PDU based on the response bytes.
        /// </summary>
        /// <param name="response">The SMSC response.</param>
        /// <returns>The PDU corresponding to the bytes.</returns>
        private Pdu GetPdu(byte[] response)
        {
            var commandId = Pdu.DecodeCommandId(response);

            Pdu packet;

            switch (commandId)
            {
            case CommandId.AlertNotification:
                packet = new SmppAlertNotification(response);
                break;

            case CommandId.BindReceiverResp:
            case CommandId.BindTransceiverResp:
            case CommandId.BindTransmitterResp:
                packet = new SmppBindResp(response);
                break;

            case CommandId.CancelSmResp:
                packet = new SmppCancelSmResp(response);
                break;

            case CommandId.DataSmResp:
                packet = new SmppDataSmResp(response);
                break;

            case CommandId.DeliverSm:
                packet = new SmppDeliverSm(response);
                break;

            case CommandId.EnquireLink:
                packet = new SmppEnquireLink(response);
                break;

            case CommandId.EnquireLinkResp:
                packet = new SmppEnquireLinkResp(response);
                break;

            case CommandId.Outbind:
                packet = new SmppOutbind(response);
                break;

            case CommandId.QuerySmResp:
                packet = new SmppQuerySmResp(response);
                break;

            case CommandId.ReplaceSmResp:
                packet = new SmppReplaceSmResp(response);
                break;

            case CommandId.SubmitMultiResp:
                packet = new SmppSubmitMultiResp(response);
                break;

            case CommandId.SubmitSmResp:
                packet = new SmppSubmitSmResp(response);
                break;

            case CommandId.UnbindResp:
                packet = new SmppUnbindResp(response);
                break;

            case CommandId.GenericNack:
                packet = new SmppGenericNack(response);
                break;

            default:
                packet = null;
                break;
            }

            return(packet);
        }