public PreferenceSwitcher(IOptions <SwitcherOptions> options, ISitePreferenceRepository repository, IDeviceFactory deviceFactory) { _options = options; _repository = repository; _deviceFactory = deviceFactory; }
public DuploTrainBaseHub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <DuploTrainBaseHub> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoDuplo_DuploTrain, new Port[] { new Port(0, string.Empty, false, expectedDevice: DeviceType.DuploTrainBaseMotor), new Port(1, string.Empty, false, expectedDevice: DeviceType.DuploTrainBaseSpeaker), new Port(17, string.Empty, false, expectedDevice: DeviceType.RgbLight), new Port(18, string.Empty, false, expectedDevice: DeviceType.DuploTrainBaseColorSensor), new Port(19, string.Empty, false, expectedDevice: DeviceType.DuploTrainBaseSpeedometer), new Port(20, string.Empty, false, expectedDevice: DeviceType.Voltage), }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, HubProperty.SystemTypeId, HubProperty.HardwareNetworkId, HubProperty.PrimaryMacAddress, // HubProperty.SecondaryMacAddress, // throws // HubProperty.HardwareNetworkFamily, // throws }) { }
public TwoPortHub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <TwoPortHub> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoSystem_TwoPortHub, new Port[] { new Port(0, nameof(A), true), new Port(1, nameof(B), true), new Port(50, string.Empty, false, expectedDevice: DeviceType.RgbLight), new Port(59, string.Empty, false, expectedDevice: DeviceType.Current), new Port(60, string.Empty, false, expectedDevice: DeviceType.Voltage), }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, HubProperty.SystemTypeId, HubProperty.HardwareNetworkId, HubProperty.PrimaryMacAddress, HubProperty.SecondaryMacAddress, //HubProperty.HardwareNetworkFamily, // support status unknown for TwoPortHub }) { }
internal DeviceManager( IPortableDeviceManager portableDeviceManager, IDeviceFactory deviceFactory) { _portableDeviceManager = portableDeviceManager; _deviceFactory = deviceFactory; }
public TechnicMediumHub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <TechnicMediumHub> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoTechnic_MediumHub, new Port[] { new Port(0, nameof(A), true), new Port(1, nameof(B), true), new Port(2, nameof(C), true), new Port(3, nameof(D), true), new Port(50, string.Empty, false, expectedDevice: DeviceType.RgbLight), new Port(59, string.Empty, false, expectedDevice: DeviceType.Current), new Port(60, string.Empty, false, expectedDevice: DeviceType.Voltage), new Port(61, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubTemperatureSensor), new Port(96, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubTemperatureSensor), new Port(97, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubAccelerometer), new Port(98, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubGyroSensor), new Port(99, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubTiltSensor), new Port(100, string.Empty, false, expectedDevice: DeviceType.TechnicMediumHubGestureSensor), }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, HubProperty.SystemTypeId, HubProperty.HardwareNetworkId, HubProperty.PrimaryMacAddress, HubProperty.SecondaryMacAddress, //HubProperty.HardwareNetworkFamily, // Throws command not recognized error for TechnicMediumHub }) { }
public MoveHub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <MoveHub> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoSystem_MoveHub, new Port[] { new Port(0, "A", false, expectedDevice: DeviceType.MoveHubInternalMotor), new Port(1, "B", false, expectedDevice: DeviceType.MoveHubInternalMotor), // Since ports C and D can be any compatible sensor or motor, we don't set an expected device type here new Port(2, nameof(C), true), new Port(3, nameof(D), true), new Port(16, "AB", false, expectedDevice: DeviceType.MoveHubInternalMotor, true), new Port(50, string.Empty, false, expectedDevice: DeviceType.RgbLight), new Port(58, string.Empty, false, expectedDevice: DeviceType.MoveHubTiltSensor), new Port(59, string.Empty, false, expectedDevice: DeviceType.Current), new Port(60, string.Empty, false, expectedDevice: DeviceType.Voltage), // Note that there is a port with id 70 but is not currently known what this does (suspected to be debug port) }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, HubProperty.SystemTypeId, HubProperty.HardwareNetworkId, HubProperty.PrimaryMacAddress, HubProperty.SecondaryMacAddress, //HubProperty.HardwareNetworkFamily, // Does not appear to work on Move Hub }) { }
/// <summary> /// /// </summary> /// <param name="hd"></param> private void CreateDevices(Hardware hd) { // device // foreach (IDPU dpu in this.DPUs) { IDeviceSourceProvider deviceSourceProvider = dpu.DeviceSourceProvider; deviceSourceProvider.SourceConfigs = this.SourceConfigs; IDeviceSource[] deviceSources = deviceSourceProvider.GetDeviceSources(); foreach (IDeviceSource deviceSource in deviceSources) { IDeviceFactory factory = dpu.DeviceFactory; IDevice device = factory.Create(deviceSource); device.DeviceSource = deviceSource; // find station by device // Guid stationGuid = deviceSource.StationGuid; IStation station = hd.Stations.Find(stationGuid); if (station == null) { string s = string.Format("not find station by guid '{0}'", stationGuid); throw new Exception(s); } station.Devices.Add(device); device.Station = station; ITaskFactory taskFactory = dpu.TaskFactory; taskFactory.Create(device); } } }
public Wrapper([NotNull] IScheduler scheduler, [NotNull] IDeviceFactory deviceFactory, [NotNull] Func <DateTimeOffset, IDateTimeOffset> dateTimeFactory, [NotNull] ISubject <IDevice> received, [NotNull] ISubject <DateTime> stopped, [NotNull] IStatusMapper statusMapper) { Guard.ArgumentNotNull(scheduler, nameof(scheduler)); Guard.ArgumentNotNull(deviceFactory, nameof(deviceFactory)); Guard.ArgumentNotNull(dateTimeFactory, nameof(dateTimeFactory)); Guard.ArgumentNotNull(received, nameof(received)); Guard.ArgumentNotNull(stopped, nameof(stopped)); Guard.ArgumentNotNull(statusMapper, nameof(statusMapper)); _deviceFactory = deviceFactory; _dateTimeFactory = dateTimeFactory; _received = received; _stopped = stopped; _statusMapper = statusMapper; _watcher = new AdvertisementWatcher { ScanningMode = BluetoothLEScanningMode.Active }; }
public TwoPortHandset(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <TwoPortHandset> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoSystem_TwoPortHandset, new Port[] { new Port(0, string.Empty, false, expectedDevice: DeviceType.RemoteControlButton), new Port(1, string.Empty, false, expectedDevice: DeviceType.RemoteControlButton), new Port(52, string.Empty, false, expectedDevice: DeviceType.RgbLight), new Port(59, string.Empty, false, expectedDevice: DeviceType.Voltage), new Port(60, string.Empty, false, expectedDevice: DeviceType.RemoteControlRssi), }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, HubProperty.SystemTypeId, HubProperty.HardwareNetworkId, HubProperty.PrimaryMacAddress, //HubProperty.SecondaryMacAddress, // unsupported on the two port handset HubProperty.HardwareNetworkFamily, }) { }
public MarioHub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <MarioHub> logger, IServiceProvider serviceProvider = default) : base(protocol, deviceFactory, logger, serviceProvider, SystemType.LegoSystem_Mario, new Port[] { new Port(0, string.Empty, false, expectedDevice: DeviceType.MarioHubAccelerometer), new Port(1, string.Empty, false, expectedDevice: DeviceType.MarioHubTagSensor), new Port(2, string.Empty, false, expectedDevice: DeviceType.MarioHubPants), new Port(3, string.Empty, false, expectedDevice: DeviceType.MarioHubDebug), new Port(6, string.Empty, false, expectedDevice: DeviceType.Voltage), }, knownProperties: new HubProperty[] { HubProperty.AdvertisingName, HubProperty.Button, HubProperty.FwVersion, HubProperty.HwVersion, HubProperty.Rssi, HubProperty.BatteryVoltage, HubProperty.BatteryType, HubProperty.ManufacturerName, HubProperty.RadioFirmwareVersion, HubProperty.LegoWirelessProtocolVersion, //HubProperty.SystemTypeId, // reports "2" which does not match 0x43 //HubProperty.HardwareNetworkId, // Throws command not recognized error for MarioHub HubProperty.PrimaryMacAddress, HubProperty.SecondaryMacAddress, //HubProperty.HardwareNetworkFamily, // may throw command not recognized error for MarioHub }) { }
public DeviceConfigurationLoaderImpl(IDeviceFactory deviceFactory) { this.deviceFactory = deviceFactory; this.deviceLoadersByType = new Dictionary<string, Func<SectionData, IDevice>> { { "beaglebone.gpio.pwmmotor", LoadGpioMotor }, { "ghetto_remote.servo", LoadGhettoRemoteServo } }; }
public static IDeviceFactory Aggregate(this IDeviceFactory deviceFactory, IDeviceFactory newDeviceFactory, ILoggerFactory loggerFactory = null) => deviceFactory == null ? throw new ArgumentNullException(nameof(deviceFactory)) : new AggregateDeviceFactory( new ReadOnlyCollection <IDeviceFactory>( new ReadOnlyCollection <IDeviceFactory>( new List <IDeviceFactory> { deviceFactory, newDeviceFactory })), loggerFactory);
public static void Main(string[] args) { DeviceManagerSingleton dm = DeviceManagerSingleton.Instance; IDeviceFactory adcf = AbstractDeviceCreationFactory.Instance; ICollectionManagerFactory icmf = new CollectionManagerFactory(); ICollectionManager obcm = icmf.GetCollectionManager(DeviceSubGroup.OpenbedCollector); ICollectionManager cbcm = icmf.GetCollectionManager(DeviceSubGroup.ClosedbedCollector); }
public DeviceConfigurationLoaderImpl(IDeviceFactory deviceFactory) { this.deviceFactory = deviceFactory; this.deviceLoadersByType = new Dictionary <string, Func <SectionData, IDevice> > { { "beaglebone.gpio.pwmmotor", LoadGpioMotor }, { "ghetto_remote.servo", LoadGhettoRemoteServo } }; }
public void RegisterDeviceFactory(IDeviceFactory deviceFactory) { if (deviceFactory == null) { throw new ArgumentNullException(nameof(deviceFactory)); } _deviceFactories.Add(deviceFactory); }
public static Task <IDevice> TestWriteAndReadFromTrezor(IDeviceFactory deviceFactory, int expectedDataLength = 64, uint?expectedTransferLength = null, bool dispose = true) { //Send the request part of the Message Contract var request = GetTrezorRequest(); var integrationTester = new IntegrationTester( deviceFactory); return(integrationTester.TestAsync(request, AssertTrezorResult, expectedDataLength, expectedTransferLength, dispose)); }
public MainFormService(ITimer timer, IRepository <UIElement> repository, IDeviceFactory deviceFactory, ICommandFactory commandFactory) { _deviceFactory = deviceFactory; _commandFactory = commandFactory; _timer = timer; _timer.Interval = 5; _timer.Tick += TimerTick; _timer.Start(); //UIElements = new List<UIElement>(); }
private void CreateDevices() { this.Devices = this.GetInstalledDevices().Select <DeviceInstallation, IDevice>((DeviceInstallation x) => { IDeviceFactory deviceFactory = this.GetDeviceFactory(x.DeviceName); if (deviceFactory == null) { return(null); } return(deviceFactory.GenerateDevice(x.Key)); }).Where <IDevice>((IDevice x) => x != null).ToList <IDevice>(); }
public void Main() { ElectronicStoreClient e = new ElectronicStoreClient(); IDeviceFactory apple = e.CheckProducts(Manufacturers.APPLE); ILaptop macbookPro = apple.GetLaptop(); ISmartPhone smartPhone = apple.GetSmartPhone(); IDeviceFactory samsung = e.CheckProducts(Manufacturers.SAMSUNG); ILaptop galaxy = samsung.GetLaptop(); ISmartPhone notebook = samsung.GetSmartPhone(); }
/// <summary> /// Handles connecting to and disconnecting from a set of potential devices by their definition /// </summary> public DeviceListener( IDeviceFactory deviceFactory, int?pollMilliseconds = 1000, ILoggerFactory loggerFactory = null) { _logger = (loggerFactory ?? NullLoggerFactory.Instance).CreateLogger <DeviceListener>(); DeviceFactory = deviceFactory ?? throw new ArgumentNullException(nameof(deviceFactory)); _PollTimer = new timer(pollMilliseconds.Value); _PollTimer.Elapsed += PollTimer_Elapsed; }
static void Main(string[] args) { IDeviceFactory factory = GetFactoryByCountry("EN"); IMouse mouse = factory.GetMouse(); IKeyboard keyboard = factory.GetKeyboard(); ITouchpad touchpad = factory.GetTouchpad(); mouse.Click(); keyboard.Print(); keyboard.Println(); touchpad.Track(10, 35); }
public Hub(IPoweredUpProtocol protocol, IDeviceFactory deviceFactory, ILogger <Hub> logger, IServiceProvider serviceProvider, Port[] knownPorts) { Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol)); _deviceFactory = deviceFactory ?? throw new ArgumentNullException(nameof(deviceFactory)); ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); AddKnownPorts(knownPorts ?? throw new ArgumentNullException(nameof(knownPorts))); _logger = logger; SetupOnHubChange(); SetupOnPortChangeObservable(Protocol.UpstreamMessages); SetupHubAlertObservable(Protocol.UpstreamMessages); SetupHubPropertyObservable(Protocol.UpstreamMessages); }
public BulkDeviceTester(ITransportFactory transportFactory, ILogger logger, IConfigurationProvider configProvider, ITelemetryFactory telemetryFactory, IDeviceFactory deviceFactory, IVirtualDeviceStorage virtualDeviceStorage) { _transportFactory = transportFactory; _logger = logger; _configProvider = configProvider; _telemetryFactory = telemetryFactory; _deviceFactory = deviceFactory; _deviceStorage = virtualDeviceStorage; _deviceList = new List <InitialDeviceConfig>(); _devicePollIntervalSeconds = Convert.ToInt32(_configProvider.GetConfigurationSettingValueOrDefault("DevicePollIntervalSeconds", DEFAULT_DEVICE_POLL_INTERVAL_SECONDS.ToString())); }
public BulkDeviceTester(ITransportFactory transportFactory, ILogger logger, IConfigurationProvider configProvider, ITelemetryFactory telemetryFactory, IDeviceFactory deviceFactory, IVirtualDeviceStorage virtualDeviceStorage) { _transportFactory = transportFactory; _logger = logger; _configProvider = configProvider; _telemetryFactory = telemetryFactory; _deviceFactory = deviceFactory; _deviceStorage = virtualDeviceStorage; _deviceList = new List<InitialDeviceConfig>(); _devicePollIntervalSeconds = Convert.ToInt32(_configProvider.GetConfigurationSettingValueOrDefault("DevicePollIntervalSeconds", DEFAULT_DEVICE_POLL_INTERVAL_SECONDS.ToString())); }
public MatchMaker([NotNull] ILogger logger, [NotNull] IOfficialGattServices bluetoothGattServices, [NotNull] IDeviceFactory deviceFactory) { Guard.ArgumentNotNull(logger, nameof(logger)); Guard.ArgumentNotNull(bluetoothGattServices, nameof(bluetoothGattServices)); Guard.ArgumentNotNull(deviceFactory, nameof(deviceFactory)); _logger = logger; _deviceFactory = deviceFactory; }
public DeviceDataStreamer( Func <IDevice, Task> processData, IDeviceFactory deviceFactory, TimeSpan?interval = null, ILoggerFactory loggerFactory = null, Func <IDevice, Task> initializeFunc = null ) { _processData = processData; _deviceFactory = deviceFactory; _interval = interval ?? new TimeSpan(0, 0, 1); _logger = (loggerFactory ?? NullLoggerFactory.Instance).CreateLogger <DeviceDataStreamer>(); _initializeFunc = initializeFunc ?? (d => d.InitializeAsync()); }
static void Main(string[] args) { Console.WriteLine("Input the type of Device Mobile/Laptop/Tablet :"); string deviceType = Console.ReadLine(); ServiceFactory factory = new ServiceFactory(); IDeviceFactory device = factory.GetFactory(deviceType); Console.WriteLine("Base Cost :" + device.GetDeviceCost().GetBaseCost()); Console.WriteLine("Accessories Cost :" + device.GetDeviceCost().GetAccessoriesCost()); Console.WriteLine("Hardware Specifications : " + string.Join(",", device.GetSpecifications().GetHardwareSpecifications())); Console.WriteLine("Software Specifications :" + string.Join(",", device.GetSpecifications().GetSoftwareSpecifications())); Console.ReadLine(); }
public Hub(ILegoWirelessProtocol protocol, IDeviceFactory deviceFactory, ILogger <Hub> logger, IServiceProvider serviceProvider, SystemType knownSystemType, Port[] knownPorts, IEnumerable <HubProperty> knownProperties = default) { Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol)); _deviceFactory = deviceFactory ?? throw new ArgumentNullException(nameof(deviceFactory)); ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _knownSystemType = knownSystemType; AddKnownPorts(knownPorts ?? throw new ArgumentNullException(nameof(knownPorts))); _logger = logger; SetupHubProperties(knownProperties); SetupOnHubChange(); SetupOnPortChangeObservable(Protocol.UpstreamMessages); SetupHubAlertObservable(Protocol.UpstreamMessages); SetupHubPropertyObservable(Protocol.UpstreamMessages); }
public TrezorManagerBroker( EnterPinArgs enterPinArgs, EnterPinArgs enterPassphraseArgs, int?pollInterval, IDeviceFactory deviceFactory, ICoinUtility coinUtility = null, ILoggerFactory loggerFactory = null ) : base( enterPinArgs, enterPassphraseArgs, pollInterval, deviceFactory, coinUtility, loggerFactory) { }
public BulkDeviceTester(ITransportFactory transportFactory, ILogger logger, IConfigurationProvider configProvider, ITelemetryFactory telemetryFactory, IDeviceFactory deviceFactory, IVirtualDeviceStorage virtualDeviceStorage) { _transportFactory = transportFactory; _logger = logger; _configProvider = configProvider; _telemetryFactory = telemetryFactory; _deviceFactory = deviceFactory; _deviceStorage = virtualDeviceStorage; string pollingIntervalString = _configProvider.GetConfigurationSettingValueOrDefault( "DevicePollIntervalSeconds", DEFAULT_DEVICE_POLL_INTERVAL_SECONDS.ToString(CultureInfo.InvariantCulture)); _devicePollIntervalSeconds = Convert.ToInt32(pollingIntervalString, CultureInfo.InvariantCulture); }
public DeskFactory( [NotNull] IDeviceFactory deviceFactory, [NotNull] Func <IDevice, IDeskConnector> deskConnectorFactory, [NotNull] Func <IDeskConnector, IDesk> deskFactory) { Guard.ArgumentNotNull(deskConnectorFactory, nameof(deskConnectorFactory)); Guard.ArgumentNotNull(deviceFactory, nameof(deviceFactory)); Guard.ArgumentNotNull(deskFactory, nameof(deskFactory)); _deviceFactory = deviceFactory; _deskConnectorFactory = deskConnectorFactory; _deskFactory = deskFactory; }
public IDeviceFactory CheckProducts(Manufacturers manufacturer) { IDeviceFactory deviceFactory = null; switch (manufacturer) { case Manufacturers.SAMSUNG: deviceFactory = new SamsungFactory(); break; case Manufacturers.APPLE: deviceFactory = new AppleFactory(); break; } return(deviceFactory); }