Exemplo n.º 1
0
        /// <summary> Constructor For ESMS mode </summary>
        /// <param name="connectionId"></param>
        /// <param name="shortLongCode"></param>
        /// <param name="connectionMode"></param>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="logKey"></param>
        /// <param name="defaultEncoding"></param>
        /// <param name="connectionEventHandler"></param>
        /// <param name="receivedMessageHandler"></param>
        /// <param name="receivedGenericNackHandler"></param>
        /// <param name="submitMessageHandler"></param>
        /// <param name="queryMessageHandler"></param>
        /// <param name="logEventHandler"></param>
        /// <param name="pduDetailsEventHandler"></param>
        public ESMEConnection(int connectionId, string shortLongCode, ConnectionModes connectionMode,
                              string host, int port, string userName, string password, string logKey,
                              DataCodings defaultEncoding,
                              CONNECTION_EVENT_HANDLER connectionEventHandler,
                              RECEIVED_MESSAGE_HANDLER receivedMessageHandler,
                              RECEIVED_GENERICNACK_HANDLER receivedGenericNackHandler,
                              SUBMIT_MESSAGE_HANDLER submitMessageHandler,
                              QUERY_MESSAGE_HANDLER queryMessageHandler,
                              LOG_EVENT_HANDLER logEventHandler,
                              PDU_DETAILS_EVENT_HANDLER pduDetailsEventHandler)
        {
            // Properties
            ConnectionId   = connectionId;
            ShortLongCode  = shortLongCode;
            ConnectionMode = connectionMode;
            Host           = host;
            Port           = port;
            UserName       = userName;
            Password       = password;
            LogKey         = string.Format("{0}-{1}-{2}", logKey, ConnectionMode, ConnectionId);

            // Bind user events
            ConnectionEventHandler     = connectionEventHandler;
            ReceivedMessageHandler     = receivedMessageHandler;
            ReceivedGenericNackHandler = receivedGenericNackHandler;
            SubmitMessageHandler       = submitMessageHandler;
            QueryMessageHandler        = queryMessageHandler;
            LogEventHandler            = logEventHandler;
            PduDetailsEventHandler     = pduDetailsEventHandler;

            // Create the connection to the server
            Client = new SmppClient(defaultEncoding);

            // Bind Internal ESME required events
            Client.ConnectEvent           += new SmppClient.ConnectedEventHandler(ClientEventConnect);
            Client.DeliverSmEvent         += new SmppClient.DeliverSmEventHandler(ClientEventDeliverSm);
            Client.DisconnectEvent        += new SmppClient.DisconnectEventHandler(ClientEventDisconnect);
            Client.EnquireLinkSmEvent     += new SmppClient.EnquireLinkSmEventHandler(ClientEventEnquireLinkSm);
            Client.EnquireLinkSmRespEvent += new SmppClient.EnquireLinkSmRespEventHandler(ClientEventEnquireLinkSmResp);
            Client.ErrorEvent             += new SmppClient.ErrorEventHandler(ClientEventError);
            Client.GenericNackSmEvent     += new SmppClient.GenericNackSmEventHandler(ClientEventGenericNackSm);
            Client.QuerySmRespEvent       += new SmppClient.QuerySmRespEventHandler(ClientEventQuerySmResp);
            Client.SubmitSmRespEvent      += new SmppClient.SubmitSmRespEventHandler(ClientEventSubmitSmResp);
            Client.UnBindSmEvent          += new SmppClient.UnBindSmEventHandler(ClientEventUnBindSm);
            Client.PduDetailsEvent        += new SmppClient.PduDetailsEventHandler(ClientEventPduDetails);

            // Start a thread to get this connection
            ConnectionThread = new Thread(new ThreadStart(PerformConnectClient));
            ConnectionThread.Start();
        }
Exemplo n.º 2
0
        /// <summary> Contructor </summary>
        /// <param name="logKey"></param>
        /// <param name="shortLongCode"></param>
        /// <param name="connectionEventHandler"></param>
        /// <param name="receivedMessageHandler"></param>
        /// <param name="receivedGenericNackHandler"></param>
        /// <param name="submitMessageHandler"></param>
        /// <param name="queryMessageHandler"></param>
        /// <param name="logEventHandler"></param>
        /// <param name="pduDetailsEventHandler"></param>
        public ESMEManager(string logKey, string shortLongCode,
                           CONNECTION_EVENT_HANDLER connectionEventHandler, RECEIVED_MESSAGE_HANDLER receivedMessageHandler,
                           RECEIVED_GENERICNACK_HANDLER receivedGenericNackHandler, SUBMIT_MESSAGE_HANDLER submitMessageHandler,
                           QUERY_MESSAGE_HANDLER queryMessageHandler, LOG_EVENT_HANDLER logEventHandler,
                           PDU_DETAILS_EVENT_HANDLER pduDetailsEventHandler)
        {
            LogKey        = logKey;
            ShortLongCode = shortLongCode;

            ConnectionEventHandler     = connectionEventHandler;
            ReceivedMessageHandler     = receivedMessageHandler;
            ReceivedGenericNackHandler = receivedGenericNackHandler;
            SubmitMessageHandler       = submitMessageHandler;
            QueryMessageHandler        = queryMessageHandler;
            LogEventHandler            = logEventHandler;
            PduDetailsEventHandler     = pduDetailsEventHandler;
        }
Exemplo n.º 3
0
        /// <summary> Contructor </summary>
        /// <param name="logKey"></param>
        /// <param name="shortLongCode"></param>
        /// <param name="connectionEventHandler"></param>
        /// <param name="receivedMessageHandler"></param>
        /// <param name="receivedGenericNackHandler"></param>
        /// <param name="submitMessageHandler"></param>
        /// <param name="queryMessageHandler"></param>
        /// <param name="logEventHandler"></param>
        /// <param name="pduDetailsEventHandler"></param>
        public ESMEManager(string logKey, string shortLongCode,
                                     CONNECTION_EVENT_HANDLER connectionEventHandler, RECEIVED_MESSAGE_HANDLER receivedMessageHandler,
                                     RECEIVED_GENERICNACK_HANDLER receivedGenericNackHandler, SUBMIT_MESSAGE_HANDLER submitMessageHandler,
                                     QUERY_MESSAGE_HANDLER queryMessageHandler, LOG_EVENT_HANDLER logEventHandler,
                                     PDU_DETAILS_EVENT_HANDLER pduDetailsEventHandler)
        {
            LogKey = logKey;
            ShortLongCode = shortLongCode;

            ConnectionEventHandler = connectionEventHandler;
            ReceivedMessageHandler = receivedMessageHandler;
            ReceivedGenericNackHandler = receivedGenericNackHandler;
            SubmitMessageHandler = submitMessageHandler;
            QueryMessageHandler = queryMessageHandler;
            LogEventHandler = logEventHandler;
            PduDetailsEventHandler = pduDetailsEventHandler;
        }
Exemplo n.º 4
0
        /// <summary> Constructor For ESMS mode </summary>
        /// <param name="connectionId"></param>
        /// <param name="shortLongCode"></param>
        /// <param name="connectionMode"></param>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <param name="logKey"></param>
        /// <param name="defaultEncoding"></param>
        /// <param name="connectionEventHandler"></param>
        /// <param name="receivedMessageHandler"></param>
        /// <param name="receivedGenericNackHandler"></param>
        /// <param name="submitMessageHandler"></param>
        /// <param name="queryMessageHandler"></param>
        /// <param name="logEventHandler"></param>
        /// <param name="pduDetailsEventHandler"></param>
        public ESMEConnection(int connectionId, string shortLongCode, ConnectionModes connectionMode,
                              string host, int port, string userName, string password, string logKey,
                              DataCodings defaultEncoding,
                              CONNECTION_EVENT_HANDLER connectionEventHandler,
                              RECEIVED_MESSAGE_HANDLER receivedMessageHandler,
                              RECEIVED_GENERICNACK_HANDLER receivedGenericNackHandler,
                              SUBMIT_MESSAGE_HANDLER submitMessageHandler,
                              QUERY_MESSAGE_HANDLER queryMessageHandler,
                              LOG_EVENT_HANDLER logEventHandler,
                              PDU_DETAILS_EVENT_HANDLER pduDetailsEventHandler)
        {
            // Properties
            ConnectionId = connectionId;
            ShortLongCode = shortLongCode;
            ConnectionMode = connectionMode;
            Host = host;
            Port = port;
            UserName = userName;
            Password = password;
            LogKey = string.Format("{0}-{1}-{2}", logKey, ConnectionMode, ConnectionId);

            // Bind user events
            ConnectionEventHandler = connectionEventHandler;
            ReceivedMessageHandler = receivedMessageHandler;
            ReceivedGenericNackHandler = receivedGenericNackHandler;
            SubmitMessageHandler = submitMessageHandler;
            QueryMessageHandler = queryMessageHandler;
            LogEventHandler = logEventHandler;
            PduDetailsEventHandler = pduDetailsEventHandler;

            // Create the connection to the server
            Client = new SmppClient(defaultEncoding);

            // Bind Internal ESME required events
            Client.ConnectEvent += new SmppClient.ConnectedEventHandler(ClientEventConnect);
            Client.DeliverSmEvent += new SmppClient.DeliverSmEventHandler(ClientEventDeliverSm);
            Client.DisconnectEvent += new SmppClient.DisconnectEventHandler(ClientEventDisconnect);
            Client.EnquireLinkSmEvent += new SmppClient.EnquireLinkSmEventHandler(ClientEventEnquireLinkSm);
            Client.EnquireLinkSmRespEvent += new SmppClient.EnquireLinkSmRespEventHandler(ClientEventEnquireLinkSmResp);
            Client.ErrorEvent += new SmppClient.ErrorEventHandler(ClientEventError);
            Client.GenericNackSmEvent += new SmppClient.GenericNackSmEventHandler(ClientEventGenericNackSm);
            Client.QuerySmRespEvent += new SmppClient.QuerySmRespEventHandler(ClientEventQuerySmResp);
            Client.SubmitSmRespEvent += new SmppClient.SubmitSmRespEventHandler(ClientEventSubmitSmResp);
            Client.UnBindSmEvent += new SmppClient.UnBindSmEventHandler(ClientEventUnBindSm);
            Client.PduDetailsEvent += new SmppClient.PduDetailsEventHandler(ClientEventPduDetails);

            // Start a thread to get this connection
            ConnectionThread = new Thread(new ThreadStart(PerformConnectClient));
            ConnectionThread.Start();
        }