Ejemplo n.º 1
0
        public void SendPdu(SmppPdu pdu)
        {
            if (tcpClient == null || !tcpClient.Connected)
            {
                throw new Exception("Not connected");
            }
            tcpClient.GetStream().Write(pdu.GetData(), 0, (int)pdu.Length);
#if DEBUG
            Console.WriteLine("Sending: " + pdu);
            Console.WriteLine();
#endif
        }
Ejemplo n.º 2
0
 void SmppConnection_OnSmppPduReceived(SmppClient sender, SmppPdu pdu)
 {
     switch (pdu.CommandId)
     {
         case SmppPdu.SmppCommandType.bind_transmitter:
             OnBindTransmitterReceived(this, (SmppPduBindTransmitter)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.bind_transmitter_resp:
             OnBindTransmitterRespReceived(this, (SmppPduBindTransmitterResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.bind_receiver:
             OnBindReceiverReceived(this, (SmppPduBindReceiver)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.bind_receiver_resp:
             OnBindReceiverRespReceived(this, (SmppPduBindReceiverResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.bind_transceiver:
             OnBindTransceiverReceived(this, (SmppPduBindTransceiver)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.bind_transceiver_resp:
             OnBindTransceiverRespReceived(this, (SmppPduBindTransceiverResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.unbind:
             OnUnbindReceived(this, (SmppPduUnbind)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.unbind_resp:
             OnUnbindRespReceived(this, (SmppPduUnbindResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.generic_nack:
             OnGenerickNackReceived(this, (SmppPduGenerickNack)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.submit_sm:
             OnSubmitSmReceived(this, (SmppPduSubmitSm)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.submit_sm_resp:
             OnSubmitSmRespReceived(this, (SmppPduSubmitSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.deliver_sm:
             OnDeliverSmReceived(this, (SmppPduDeliverSm)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.deliver_sm_resp:
             OnDeliverSmRespReceived(this, (SmppPduDeliverSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.data_sm:
             OnDataSmReceived(this, (SmppPduDataSm)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.data_sm_resp:
             OnDataSmRespReceived(this, (SmppPduDataSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.query_sm:
             OnQuerySmReceived(this, (SmppPduQuerySm)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.query_sm_resp:
             OnQuerySmRespReceived(this, (SmppPduQuerySmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.cancel_sm:
             OnCancelSmReceived(this, (SmppPduCancelSm)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.cancel_sm_resp:
             OnCancelSmRespReceived(this, (SmppPduCancelSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.enquire_link:
             OnEnquireLinkReceived(this, (SmppPduEnquireLink)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.enquire_link_resp:
             OnEnquireLinkRespReceived(this, (SmppPduEnquireLinkResp)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
         case SmppPdu.SmppCommandType.alert_notification:
             OnAlertNotificationReceived(this, (SmppPduAlertNotification)SmppPdu.CreateFromBytes(pdu.GetData()));
             break;
     }
 }
Ejemplo n.º 3
0
        public void SendPdu(SmppPdu pdu)
        {
            if (tcpClient == null || !tcpClient.Connected) throw new Exception("Not connected");
            tcpClient.GetStream().Write(pdu.GetData(), 0, (int)pdu.Length);
#if DEBUG
            Console.WriteLine("Sending: " + pdu);
            Console.WriteLine();
#endif
        }
Ejemplo n.º 4
0
        void SmppConnection_OnSmppPduReceived(SmppClient sender, SmppPdu pdu)
        {
            switch (pdu.CommandId)
            {
            case SmppPdu.SmppCommandType.bind_transmitter:
                OnBindTransmitterReceived(this, (SmppPduBindTransmitter)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.bind_transmitter_resp:
                OnBindTransmitterRespReceived(this, (SmppPduBindTransmitterResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.bind_receiver:
                OnBindReceiverReceived(this, (SmppPduBindReceiver)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.bind_receiver_resp:
                OnBindReceiverRespReceived(this, (SmppPduBindReceiverResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.bind_transceiver:
                OnBindTransceiverReceived(this, (SmppPduBindTransceiver)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.bind_transceiver_resp:
                OnBindTransceiverRespReceived(this, (SmppPduBindTransceiverResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.unbind:
                OnUnbindReceived(this, (SmppPduUnbind)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.unbind_resp:
                OnUnbindRespReceived(this, (SmppPduUnbindResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.generic_nack:
                OnGenerickNackReceived(this, (SmppPduGenerickNack)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.submit_sm:
                OnSubmitSmReceived(this, (SmppPduSubmitSm)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.submit_sm_resp:
                OnSubmitSmRespReceived(this, (SmppPduSubmitSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.deliver_sm:
                OnDeliverSmReceived(this, (SmppPduDeliverSm)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.deliver_sm_resp:
                OnDeliverSmRespReceived(this, (SmppPduDeliverSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.data_sm:
                OnDataSmReceived(this, (SmppPduDataSm)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.data_sm_resp:
                OnDataSmRespReceived(this, (SmppPduDataSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.query_sm:
                OnQuerySmReceived(this, (SmppPduQuerySm)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.query_sm_resp:
                OnQuerySmRespReceived(this, (SmppPduQuerySmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.cancel_sm:
                OnCancelSmReceived(this, (SmppPduCancelSm)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.cancel_sm_resp:
                OnCancelSmRespReceived(this, (SmppPduCancelSmResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.enquire_link:
                OnEnquireLinkReceived(this, (SmppPduEnquireLink)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.enquire_link_resp:
                OnEnquireLinkRespReceived(this, (SmppPduEnquireLinkResp)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;

            case SmppPdu.SmppCommandType.alert_notification:
                OnAlertNotificationReceived(this, (SmppPduAlertNotification)SmppPdu.CreateFromBytes(pdu.GetData()));
                break;
            }
        }