Exemple #1
0
 /// <summary>
 /// Creates a new instance of <see cref="ConnectionStateChangedEventArgs"/>
 /// </summary>
 /// <param name="newState">The current <see cref="SmppClient"/> connection state</param>
 /// <param name="oldState">The previous <see cref="SmppClient"/> connection state</param>
 public ConnectionStateChangedEventArgs(
     SmppConnectionState newState,
     SmppConnectionState oldState)
 {
     mNewState = newState;
     mOldState = oldState;
 }
 /// <summary>
 /// Creates a new instance of <see cref="ConnectionStateChangedEventArgs"/>
 /// </summary>
 /// <param name="newState">The current <see cref="SmppClient"/> connection state</param>
 /// <param name="oldState">The previous <see cref="SmppClient"/> connection state</param>
 public ConnectionStateChangedEventArgs(
     SmppConnectionState newState,
     SmppConnectionState oldState)
 {
     mNewState = newState;
     mOldState = oldState;
 }
Exemple #3
0
 /// <summary>
 /// Creates a new instance of <see cref="ConnnectionStateChangedEventArgs"/>
 /// </summary>
 /// <param name="newState">The current <see cref="SmppClient"/> state</param>
 /// <param name="oldState">The previous <see cref="SmppClient"/> state</param>
 /// <param name="reconnectInteval">Reconnect inteval</param>
 public ConnectionStateChangedEventArgs(
     SmppConnectionState newState,
     SmppConnectionState oldState,
     int reconnectInteval)
     : this(newState, oldState)
 {
     mReconnectInteval = reconnectInteval;
 }
Exemple #4
0
        private void ChangeState(SmppConnectionState newState)
        {
            var oldState = _vState;

            _vState             = newState;
            _vProperties.SmscId = newState == SmppConnectionState.Connected ? _vTrans.SmscId : "";
            RaiseConnectionStateChangeEvent(newState, oldState);
        }
 /// <summary>
 /// Creates a new instance of <see cref="ConnnectionStateChangedEventArgs"/>
 /// </summary>
 /// <param name="newState">The current <see cref="SmppClient"/> state</param>
 /// <param name="oldState">The previous <see cref="SmppClient"/> state</param>
 /// <param name="reconnectInteval">Reconnect inteval</param>
 public ConnectionStateChangedEventArgs(
     SmppConnectionState newState,
     SmppConnectionState oldState,
     int reconnectInteval)
     : this(newState, oldState)
 {
     mReconnectInteval = reconnectInteval;
 }
Exemple #6
0
        private void ChangeState(SmppConnectionState newState)
        {
            SmppConnectionState oldState = SmppConnectionState.Closed;

            oldState           = vState;
            vState             = newState;
            vProperties.SmscID = newState == SmppConnectionState.Connected ? vTrans.SmscID : "";
            RaiseConnectionStateChangeEvent(newState, oldState);
        }
Exemple #7
0
 public SmppClient()
 {
     vProperties         = new SmppConnectionProperties();
     vConnSyncRoot       = new object();
     vAutoReconnectDelay = 10000;
     vTimeOut            = 5000;
     //--
     vTimer = new System.Threading.Timer(AutoReconnectTimerEventHandler, null, Timeout.Infinite, vAutoReconnectDelay);
     //--
     vName              = "";
     vState             = SmppConnectionState.Closed;
     vKeepAliveInterval = 30000;
     //--
     vSendMessageCallBack += SendMessage;
 }
Exemple #8
0
        private void RaiseConnectionStateChangeEvent(SmppConnectionState newState, SmppConnectionState oldState)
        {
            if (ConnectionStateChanged == null)
            {
                return;
            }
            ConnectionStateChangedEventArgs e = new ConnectionStateChangedEventArgs(newState, oldState, vAutoReconnectDelay);

            ConnectionStateChanged(this, e);
            if (e.ReconnectInteval < 5000)
            {
                e.ReconnectInteval = 5000;
            }
            Interlocked.Exchange(ref vAutoReconnectDelay, e.ReconnectInteval);
        }
Exemple #9
0
 public SmppClient()
 {
     _vProperties         = new SmppConnectionProperties();
     _vConnSyncRoot       = new object();
     _vAutoReconnectDelay = 10000;
     _vTimeOut            = 5000;
     //--
     _vTimer = new Timer(AutoReconnectTimerEventHandler, null, Timeout.Infinite, _vAutoReconnectDelay);
     //--
     Name                = "";
     _vState             = SmppConnectionState.Closed;
     _vKeepAliveInterval = 30000;
     //--
     _vSendMessageCallBack += SendMessage;
 }
Exemple #10
0
        private void CloseSession()
        {
            var oldState = _vState;

            if (_vState == SmppConnectionState.Closed)
            {
                return;
            }
            _vState = SmppConnectionState.Closed;

            RaiseConnectionStateChangeEvent(SmppConnectionState.Closed, oldState);
            if (_vTrans != null)
            {
                _vTrans.EndSession();
            }
            if (_vRecv != null)
            {
                _vRecv.EndSession();
            }
            _vTrans = null;
            _vRecv  = null;
        }
Exemple #11
0
        private void CloseSession()
        {
            SmppConnectionState oldState = SmppConnectionState.Closed;

            oldState = vState;
            if (vState == SmppConnectionState.Closed)
            {
                return;
            }
            vState = SmppConnectionState.Closed;

            RaiseConnectionStateChangeEvent(SmppConnectionState.Closed, oldState);
            if (vTrans != null)
            {
                vTrans.EndSession();
            }
            if (vRecv != null)
            {
                vRecv.EndSession();
            }
            vTrans = null;
            vRecv  = null;
        }