Example #1
0
        /// <summary>
        /// This method sends a data_sm packet synchronously over to the peer.
        /// </summary>
        /// <param name="pdu">data_sm packet</param>
        /// <returns>data_sm response</returns>
        public data_sm_resp SendData(data_sm pdu)
        {
            data_sm_resp   response = null;
            PduSyncronizer sync     = AddWaitingPdu(pdu);

            if (sync != null)
            {
                if (IsBound && SendPdu(pdu))
                {
                    if (sync.WaitForResponse())
                    {
                        response = sync.PduResponse as data_sm_resp;
                        if (response == null)
                        {
                            response = new data_sm_resp(pdu.SequenceNumber, sync.PduResponse.Status);
                        }
                    }
                    else
                    {
                        response = new data_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RINVEXPIRY);
                    }
                }
                else
                {
                    response = new data_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RDELIVERYFAILURE);
                }
                FindAndRemoveWaitingPdu(pdu.SequenceNumber);
            }
            else
            {
                response = new data_sm_resp(pdu.SequenceNumber, StatusCodes.ESME_RMSGQFUL);
            }

            return(response);
        }
        /// <summary>
        /// This processes the data_sm event.
        /// </summary>
        /// <param name="pdu">Protocol Data Unit</param>
        public override void Process(data_sm pdu)
        {
            SmppEventArgs ea = new SmppEventArgs(session_, pdu, new data_sm_resp(pdu.SequenceNumber));

            if (!session_.FireEvent(EventType.DataSm, ea))
            {
                ea.ResponsePDU.Status = StatusCodes.ESME_RDELIVERYFAILURE;
            }
            session_.SendPdu(ea.ResponsePDU);
        }
Example #3
0
 /// <summary>
 /// This processes the data_sm PDU
 /// </summary>
 /// <param name="pdu">Protocol Data Unit being processed</param>
 public virtual void Process(data_sm pdu)
 {
     throw new InvalidSmppStateException("Session is not in the proper state for a data_sm operation.");
 }
Example #4
0
        /// <summary>
        /// This method invokes the SendData method asynchronously
        /// </summary>
        /// <param name="pdu">data_sm PDU to send</param>
        /// <param name="ac">Asynch callback</param>
        /// <returns>IAsyncResult interface for monitoring</returns>
        public IAsyncResult BeginSendData(data_sm pdu, AsyncCallback ac)
        {
            AsynchCall acr = new AsynchCall(ac, this);

            return(acr.BeginInvoke(new SendDataDelegate(SendData), new object[] { pdu }));
        }