/// <summary> /// Handle sensor notifications from the brick /// </summary> /// <param name="update"></param> private void NotificationHandler(brick.LegoSensorUpdate update) { LegoResponseGetInputValues inputValues = new LegoResponseGetInputValues(update.Body.CommandData); if (inputValues != null && inputValues.Success) { bool firstTime = (_state.TimeStamp == DateTime.MinValue); _state.TimeStamp = inputValues.TimeStamp; if (_state.Intensity != inputValues.ScaledValue || firstTime) { _state.Intensity = inputValues.ScaledValue; // Send notifications to both the generic and native subscribers SendNotification <pxanalogsensor.Replace>(_genericSubMgrPort, SyncGenericState()); SendNotification <Replace>(_subMgrPort, _state); } } }
/// <summary> /// Handle sensor notifications from the brick /// </summary> /// <param name="update"></param> private void NotificationHandler(brick.LegoSensorUpdate update) { LegoResponseGetInputValues inputValues = new LegoResponseGetInputValues(update.Body.CommandData); if (inputValues != null && inputValues.Success) { bool firstTime = (_state.TimeStamp == DateTime.MinValue); _state.TimeStamp = inputValues.TimeStamp; if (_state.Intensity != inputValues.ScaledValue || firstTime) { _state.Intensity = inputValues.ScaledValue; // Send notifications to both the generic and native subscribers SendNotification<pxanalogsensor.Replace>(_genericSubMgrPort, SyncGenericState()); SendNotification<Replace>(_subMgrPort, _state); } } }