/// <summary> /// Handle state change actions /// </summary> /// <param name="pollResponse">Poll response from device</param> private void HandleState(Rs232ResponseMessage pollResponse) { // Report on any state change if (_apexState.LastState == pollResponse.State) { return; } var args = new StateChangeArgs(_apexState.LastState, pollResponse.State); StateChanged(args); Logger?.Info("{0} Entering state: {1}", GetType().Name, pollResponse.State); _apexState.LastState = pollResponse.State; }
/// <summary> /// Raise the state change event /// </summary> protected void StateChanged(StateChangeArgs args) { OnStateChanged?.Invoke(this, args); }