예제 #1
0
        public void CanDecodeDeliverSm_01()
        {
            var hexBytes = "000000dd0000000500000000019182410001013334363439323836383039000501657669636572746961000400000000000000008569643a323533303932393134353232363637333732207375623a30303120646c7672643a303031207375626d697420646174653a3133303932393136353220646f6e6520646174653a3133303932393136353220737461743a44454c49565244206572723a3030303020746578743a1b3c657669534d531b3e0a534d532064652050727565042300030300000427000102001e001332353330393239313435323236363733373200";
            var packet = StringToByteArray(hexBytes);
            var pdu = new SmppDeliverSm(packet);

            Assert.AreEqual("253092914522667372", pdu.ReceiptedMessageId);
        }
예제 #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.alert_notification:
                    packet = new SmppAlertNotification(response);
                    break;
                case CommandId.bind_receiver_resp:
                case CommandId.bind_transceiver_resp:
                case CommandId.bind_transmitter_resp:
                    packet = new SmppBindResp(response);
                    break;
                case CommandId.cancel_sm_resp:
                    packet = new SmppCancelSmResp(response);
                    break;
                case CommandId.data_sm_resp:
                    packet = new SmppDataSmResp(response);
                    break;
                case CommandId.deliver_sm:
                    packet = new SmppDeliverSm(response);
                    break;
                case CommandId.enquire_link_resp:
                    packet = new SmppEnquireLinkResp(response);
                    break;
                case CommandId.outbind:
                    packet = new SmppOutbind(response);
                    break;
                case CommandId.query_sm_resp:
                    packet = new SmppQuerySmResp(response);
                    break;
                case CommandId.replace_sm_resp:
                    packet = new SmppReplaceSmResp(response);
                    break;
                case CommandId.submit_multi_resp:
                    packet = new SmppSubmitMultiResp(response);
                    break;
                case CommandId.submit_sm_resp:
                    packet = new SmppSubmitSmResp(response);
                    break;
                case CommandId.unbind_resp:
                    packet = new SmppUnbindResp(response);
                    break;
                case CommandId.generic_nack:
                    packet = new SmppGenericNack(response);
                    break;
                default:
                    packet = null;
                    break;
            }

            return packet;
        }
예제 #3
0
 /// <summary>
 /// Creates a DeliverSmEventArgs.
 /// </summary>
 /// <param name="packet">The PDU that was received.</param>
 internal DeliverSmEventArgs(SmppDeliverSm packet)
     : base(packet)
 {
     _response = packet;
 }