//! serious system error public virtual void OnError(BM_TELEGRAPH_STATE ErrorState) { if (m_IfDisposed) { return; } Dispose(); //BatteryManageTelegraphEvent.Invoke(ErrorState, m_Command); /* * BeginInvoke * ( * SinglePhaseTelegraphEvent, * this, * ErrorState, * m_Command * ); */ if (null != SinglePhaseTelegraphEvent) { #if __ASYN_TELEGRAPH_REPORT__ BeginInvoke ( SinglePhaseTelegraphEvent, this, ErrorState, m_Command ); #else SinglePhaseTelegraphEvent.Invoke(this, ErrorState, m_Command); #endif } base.OnCancel(); }
//! method for raising time out event protected virtual void OnTimeOut() { //LogWriter.WriteLine("Timeout!"); if (m_IfDisposed) { return; } //Dispose(); base.OnCancel(); /* * if (null == m_Command) * { * if (null != SinglePhaseTelegraphEvent) * { * SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_ERROR, m_Command); * } * //BeginInvoke(SinglePhaseTelegraphEvent, this, BM_TELEGRAPH_STATE.BM_TELE_RT_ERROR, m_Command); * return; * } */ //! raising timeout event //BeginInvoke(SinglePhaseTelegraphEvent,this, BM_TELEGRAPH_STATE.BM_TELE_RT_TIME_OUT, m_Command); if (null != SinglePhaseTelegraphEvent) { SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_TIME_OUT, m_Command); } }
//! method for raising decoding success event protected virtual void OnDecoderSuccess(ESCommand ReceivedCommand) { //! raising event OnTelegrahAccessed(); if (m_IfDisposed) { return; } //BatteryManageTelegraphEvent.Invoke(BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, ReceivedCommand); /* * BeginInvoke * ( * SinglePhaseTelegraphEvent, * this, * BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, * ReceivedCommand * ); */ if (null != SinglePhaseTelegraphEvent) { #if __ASYN_TELEGRAPH_REPORT__ BeginInvoke ( SinglePhaseTelegraphEvent, this, BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, ReceivedCommand ); #else SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, ReceivedCommand); #endif } Dispose(); }
//! method for raising cancelled event public override void OnCancel() { //! raising event OnTelegrahAccessed(); if ((m_IfDisposed) || (this.isCancelled)) { return; } //Dispose(); if (null == m_Command) { /* * BeginInvoke * ( * SinglePhaseTelegraphEvent, * this, * BM_TELEGRAPH_STATE.BM_TELE_RT_ERROR, * m_Command * );*/ if (null != SinglePhaseTelegraphEvent) { #if __ASYN_TELEGRAPH_REPORT__ BeginInvoke ( SinglePhaseTelegraphEvent, this, BM_TELEGRAPH_STATE.BM_TELE_RT_ERROR, m_Command ); #else SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_ERROR, m_Command); #endif } base.OnCancel(); return; } else if ((UInt16)BM_CMD_RT.BM_CMD_RT_NO_RESPONSE != m_Command.TimeOut) { /* * //! raising timeout event * BeginInvoke * ( * SinglePhaseTelegraphEvent, * this, * BM_TELEGRAPH_STATE.BM_TELE_RT_CANCELLED, * m_Command * ); */ if (null != SinglePhaseTelegraphEvent) { #if __ASYN_TELEGRAPH_REPORT__ BeginInvoke ( SinglePhaseTelegraphEvent, this, BM_TELEGRAPH_STATE.BM_TELE_RT_CANCELLED, m_Command ); #else SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_CANCELLED, m_Command); #endif } } else { /* * //! raising success event * BeginInvoke * ( * SinglePhaseTelegraphEvent, * this, * BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, * m_Command * ); */ if (null != SinglePhaseTelegraphEvent) { #if __ASYN_TELEGRAPH_REPORT__ BeginInvoke ( SinglePhaseTelegraphEvent, this, BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, m_Command ); #else SinglePhaseTelegraphEvent.Invoke(this, BM_TELEGRAPH_STATE.BM_TELE_RT_SUCCESS, m_Command); #endif } } base.OnCancel(); }