public void SetMode(DistanceColorSensorMods mode) { if (_mode == mode) { LoggerHelper.Instance.Debug("DistanceColorSensor::SetMode no mode change"); return; } if (_mode != DistanceColorSensorMods.NOT_SET) { if (!Subscribe((byte)_mode, false)) { LoggerHelper.Instance.Debug("DistanceColorSensor::SetNotifications - failed to unsubscribe from notifications exception"); throw new Exception("Failed to unsubscribe from notifications"); } } _mode = mode; if (!Subscribe((byte)_mode, false)) { LoggerHelper.Instance.Debug("DistanceColorSensor::SetNotifications - failed to subscribe to notifications exception"); throw new Exception("Failed to subscribe to notifications"); } LoggerHelper.Instance.Debug($"DistanceColorSensor::SetNotificationMode mode = {mode}"); }
internal DistanceColorSensor(IConnection connection, Ports port) { _connection = connection; _port = port; _mode = DistanceColorSensorMods.NOT_SET; LoggerHelper.Instance.Debug("DistanceColorSensor constructor called"); }