示例#1
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService, 
                IPi2GpioService pi2GpioService, 
                SynonymService synonymService,
                IDeviceService deviceService,
                II2CBusService i2CBusService, 
                ISchedulerService schedulerService, 
                RemoteSocketService remoteSocketService, 
                IApiService apiService,
                IContainer containerService)
            {
                if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService));
                if (pi2GpioService == null) throw new ArgumentNullException(nameof(pi2GpioService));
                if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
                if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));
                if (i2CBusService == null) throw new ArgumentNullException(nameof(i2CBusService));
                if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
                if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService));
                if (apiService == null) throw new ArgumentNullException(nameof(apiService));
                if (containerService == null) throw new ArgumentNullException(nameof(containerService));

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService = pi2GpioService;
                _synonymService = synonymService;
                _deviceService = deviceService;
                _i2CBusService = i2CBusService;
                _schedulerService = schedulerService;
                _remoteSocketService = remoteSocketService;
                _apiService = apiService;
                _containerService = containerService;
            }
示例#2
0
        public override void Execute(I2CSlaveAddress address, II2CBusService i2CBusService)
        {
            i2CBusService.Write(address, GenerateRegisterSensorPackage(), false);
            i2CBusService.Read(address, _buffer, false);

            ParseResponse();
        }
示例#3
0
        public HSPE16InputOnly(string id, I2CSlaveAddress address, II2CBusService i2CBusService, ILogger log)
            : base(id, new MAX7311Driver(address, i2CBusService), log)
        {
            byte[] setupAsInputs = { 0x06, 0xFF, 0xFF };
            i2CBusService.Write(address, setupAsInputs);

            FetchState();
        }
        public HSPE16InputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService i2cBus)
            : base(id, new MAX7311Driver(address, i2cBus))
        {
            byte[] setupAsInputs = { 0x06, 0xFF, 0xFF };
            i2cBus.Execute(address, b => b.Write(setupAsInputs));

            FetchState();
        }
示例#5
0
 public HSREL5(DeviceId id, I2CSlaveAddress i2CAddress, II2CBusService bus)
     : base(id, new PCF8574Driver(i2CAddress, bus))
 {
     // Ensure that all relays are off by default. The first 5 ports are hardware inverted! The other ports are not inverted but the
     // connected relays are inverted.
     SetState(new byte[] { 0xFF });
     CommitChanges(true);
 }
        public CCToolsBoardService(IDeviceService deviceService, II2CBusService i2CBusServiceService)
        {
            if (i2CBusServiceService == null) throw new ArgumentNullException(nameof(i2CBusServiceService));
            if (deviceService == null) throw new ArgumentNullException(nameof(deviceService));

            _deviceService = deviceService;
            _i2CBusService = i2CBusServiceService;
        }
示例#7
0
        public HSPE16InputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService i2cBus)
            : base(id, new MAX7311Driver(address, i2cBus))
        {
            byte[] setupAsInputs = { 0x06, 0xFF, 0xFF };
            i2cBus.Execute(address, b => b.Write(setupAsInputs));

            FetchState();
        }
示例#8
0
 public HSREL5(string id, I2CSlaveAddress i2CAddress, II2CBusService i2CBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogger log)
     : base(id, new PCF8574Driver(i2CAddress, i2CBusService), deviceMessageBrokerService, log)
 {
     // Ensure that all relays are off by default. The first 5 ports are hardware inverted! The other ports are not inverted but the
     // connected relays are inverted.
     SetState(new byte[] { 0xFF });
     CommitChanges(true);
 }
示例#9
0
 public HSREL5(DeviceId id, I2CSlaveAddress i2CAddress, II2CBusService bus)
     : base(id, new PCF8574Driver(i2CAddress, bus))
 {
     // Ensure that all relays are off by default. The first 5 ports are hardware inverted! The other ports are not inverted but the
     // connected relays are inverted.
     SetState(new byte[] { 0xFF });
     CommitChanges(true);
 }
示例#10
0
        public HSPE16InputOnly(string id, I2CSlaveAddress address, II2CBusService i2cBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogger log)
            : base(id, new MAX7311Driver(address, i2cBusService), deviceMessageBrokerService, log)
        {
            byte[] setupAsInputs = { 0x06, 0xFF, 0xFF };
            i2cBusService.Execute(address, b => b.Write(setupAsInputs));

            FetchState();
        }
示例#11
0
            public Configuration(
                CCToolsBoardService ccToolsBoardService,
                IPi2GpioService pi2GpioService,
                SynonymService synonymService,
                IDeviceService deviceService,
                II2CBusService i2CBusService,
                ISchedulerService schedulerService,
                RemoteSocketService remoteSocketService,
                IApiService apiService,
                IContainer containerService)
            {
                if (ccToolsBoardService == null)
                {
                    throw new ArgumentNullException(nameof(ccToolsBoardService));
                }
                if (pi2GpioService == null)
                {
                    throw new ArgumentNullException(nameof(pi2GpioService));
                }
                if (synonymService == null)
                {
                    throw new ArgumentNullException(nameof(synonymService));
                }
                if (deviceService == null)
                {
                    throw new ArgumentNullException(nameof(deviceService));
                }
                if (i2CBusService == null)
                {
                    throw new ArgumentNullException(nameof(i2CBusService));
                }
                if (schedulerService == null)
                {
                    throw new ArgumentNullException(nameof(schedulerService));
                }
                if (remoteSocketService == null)
                {
                    throw new ArgumentNullException(nameof(remoteSocketService));
                }
                if (apiService == null)
                {
                    throw new ArgumentNullException(nameof(apiService));
                }
                if (containerService == null)
                {
                    throw new ArgumentNullException(nameof(containerService));
                }

                _ccToolsBoardService = ccToolsBoardService;
                _pi2GpioService      = pi2GpioService;
                _synonymService      = synonymService;
                _deviceService       = deviceService;
                _i2CBusService       = i2CBusService;
                _schedulerService    = schedulerService;
                _remoteSocketService = remoteSocketService;
                _apiService          = apiService;
                _containerService    = containerService;
            }
        public I2CHardwareBridge(I2CSlaveAddress address, II2CBusService i2CBus, ISchedulerService schedulerService)
        {
            if (i2CBus == null) throw new ArgumentNullException(nameof(i2CBus));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));

            _address = address;
            _i2CBus = i2CBus;

            DHT22Accessor = new DHT22Accessor(this, schedulerService);
        }
示例#13
0
        public I2CHardwareBridge(string id, I2CSlaveAddress address, II2CBusService i2CBusService, ISchedulerService schedulerService)
        {
            if (schedulerService == null)
            {
                throw new ArgumentNullException(nameof(schedulerService));
            }
            _address       = address;
            _i2CBusService = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));

            Id            = id ?? throw new ArgumentNullException(nameof(id));
            DHT22Accessor = new DHT22Accessor(this, schedulerService);
        }
示例#14
0
        public PCF8574Driver(I2CSlaveAddress address, II2CBusService i2CBus)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }
            if (i2CBus == null)
            {
                throw new ArgumentNullException(nameof(i2CBus));
            }

            _address = address;
            _i2CBus  = i2CBus;
        }
示例#15
0
        public NDOF13033(II2CBusService i2cService, byte gyroAddress = 0x6B, byte accelerometerAddress = 0x1D)
        {
            GyroAddress = gyroAddress;
            AccelerometerAddress = accelerometerAddress;

            GyroI2c = i2cService.OpenDevice(gyroAddress);
            AccelI2C = i2cService.OpenDevice(accelerometerAddress);

            var gyroCheck = GyroI2c.ReadByte(NDOF13033.WHO_AM_I_G);
            var accelCheck = AccelI2C.ReadByte(NDOF13033.WHO_AM_I_XM);

            if (gyroCheck != 0xD4) throw new NDOF13033DeviceException("Gyro Failed Who_Am_I Test. Got: 0x" + gyroCheck.ToString("X2") + ", Expected: 0xD4");
            if (accelCheck != 0x49) throw new NDOF13033DeviceException("Accelerometer Failed Who_Am_I Test. Got: 0x" + accelCheck.ToString("X2") + ", Expected: 0x49");
        }
示例#16
0
        public CCToolsBoardService(IDeviceService deviceService, II2CBusService i2CBusServiceService)
        {
            if (i2CBusServiceService == null)
            {
                throw new ArgumentNullException(nameof(i2CBusServiceService));
            }
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }

            _deviceService = deviceService;
            _i2CBusService = i2CBusServiceService;
        }
示例#17
0
        public I2CHardwareBridge(I2CSlaveAddress address, II2CBusService i2CBus, ISchedulerService schedulerService)
        {
            if (i2CBus == null)
            {
                throw new ArgumentNullException(nameof(i2CBus));
            }
            if (schedulerService == null)
            {
                throw new ArgumentNullException(nameof(schedulerService));
            }

            _address = address;
            _i2CBus  = i2CBus;

            DHT22Accessor = new DHT22Accessor(this, schedulerService);
        }
示例#18
0
        public override void Execute(I2CSlaveAddress address, II2CBusService i2CBusService)
        {
            i2CBusService.Write(address, GenerateClearSignalCachePackage(), false);

            var offset = 0;

            while (offset < _signal.Length)
            {
                var buffer = _signal.Skip(offset).Take(30).ToArray();
                offset += buffer.Length;

                i2CBusService.Write(address, GenerateFillSignalCachePackage(buffer), false);
            }

            i2CBusService.Write(address, GenerateSendCachedSignalPackage(), false);
        }
示例#19
0
        public CCToolsDeviceService(
            IDeviceRegistryService deviceRegistryService,
            II2CBusService i2CBusService,
            IInterruptMonitorService interruptMonitorService,
            IScriptingService scriptingService,
            ILogService log)
        {
            if (scriptingService == null)
            {
                throw new ArgumentNullException(nameof(scriptingService));
            }
            _deviceRegistryService = deviceRegistryService ?? throw new ArgumentNullException(nameof(deviceRegistryService));
            _i2CBusService         = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));
            _log = log?.CreatePublisher(nameof(CCToolsDeviceService)) ?? throw new ArgumentNullException(nameof(log));

            deviceRegistryService.RegisterDeviceFactory(new CCToolsDeviceFactory(this, interruptMonitorService));
        }
示例#20
0
        public OutpostDeviceService(
            IDeviceRegistryService deviceRegistryService,
            IDeviceMessageBrokerService deviceMessageBroker,
            II2CBusService i2CBusService,
            ISchedulerService schedulerService,
            ILogService logService)
        {
            if (deviceRegistryService == null)
            {
                throw new ArgumentNullException(nameof(deviceRegistryService));
            }
            _i2CBusService       = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));
            _schedulerService    = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService));
            _deviceMessageBroker = deviceMessageBroker ?? throw new ArgumentNullException(nameof(deviceMessageBroker));
            _logService          = logService ?? throw new ArgumentNullException(nameof(logService));

            deviceRegistryService.RegisterDeviceFactory(new OutpostDeviceFactory(this));
        }
示例#21
0
 public Configuration(
     CCToolsDeviceService ccToolsBoardService,
     IGpioService pi2GpioService,
     IDeviceRegistryService deviceService,
     II2CBusService i2CBusService,
     ISchedulerService schedulerService,
     RemoteSocketService remoteSocketService,
     IContainer containerService,
     ILogService logService)
 {
     _ccToolsBoardService = ccToolsBoardService ?? throw new ArgumentNullException(nameof(ccToolsBoardService));
     _pi2GpioService      = pi2GpioService ?? throw new ArgumentNullException(nameof(pi2GpioService));
     _deviceService       = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
     _i2CBusService       = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));
     _schedulerService    = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService));
     _remoteSocketService = remoteSocketService ?? throw new ArgumentNullException(nameof(remoteSocketService));
     _containerService    = containerService ?? throw new ArgumentNullException(nameof(containerService));
     _logService          = logService ?? throw new ArgumentNullException(nameof(logService));
 }
示例#22
0
        public CCToolsDeviceService(IDeviceRegistryService deviceService, II2CBusService i2CBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogService log)
        {
            if (i2CBusService == null)
            {
                throw new ArgumentNullException(nameof(i2CBusService));
            }
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            if (deviceService == null)
            {
                throw new ArgumentNullException(nameof(deviceService));
            }

            _deviceService = deviceService;
            _i2CBusService = i2CBusService;
            _deviceMessageBrokerService = deviceMessageBrokerService;
            _log = log.CreatePublisher(nameof(CCToolsDeviceService));
        }
示例#23
0
 public HSPE8OutputOnly(string id, I2CSlaveAddress address, II2CBusService i2CBusService, ILogger log)
     : base(id, new PCF8574Driver(address, i2CBusService), log)
 {
     FetchState();
 }
示例#24
0
 public abstract void Execute(I2CSlaveAddress address, II2CBusService i2CBusService);
示例#25
0
 public PCA9555Driver(I2CSlaveAddress address, II2CBusService i2CBus)
     : base(address, i2CBus)
 {
 }
示例#26
0
 public HSPE16OutputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService i2cBus)
     : base(id, new MAX7311Driver(address, i2cBus))
 {
     CommitChanges(true);
 }
示例#27
0
 public PCA9555ADriver(I2CSlaveAddress address, II2CBusService i2CBus)
     : base(address, i2CBus)
 {
 }
示例#28
0
 public HSREL8(string id, I2CSlaveAddress i2CAddress, II2CBusService i2CBusService, ILogger log)
     : base(id, new MAX7311Driver(i2CAddress, i2CBusService), log)
 {
     SetState(new byte[] { 0x00, 255 });
     CommitChanges(true);
 }
示例#29
0
 public MAX7311Driver(I2CSlaveAddress address, II2CBusService i2CBus)
 {
     _address = address;
     _i2CBus  = i2CBus ?? throw new ArgumentNullException(nameof(i2CBus));
 }
示例#30
0
 public HSREL8(DeviceId id, I2CSlaveAddress i2CAddress, II2CBusService i2CBus)
     : base(id, new MAX7311Driver(i2CAddress, i2CBus))
 {
     SetState(new byte[] { 0x00, 255 });
     CommitChanges(true);
 }
示例#31
0
 public HSPE16OutputOnly(string id, I2CSlaveAddress address, II2CBusService i2cBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogger log)
     : base(id, new MAX7311Driver(address, i2cBusService), deviceMessageBrokerService, log)
 {
     CommitChanges(true);
 }
示例#32
0
 public I2CBusScriptProxy(II2CBusService i2CBusService)
 {
     _i2CBusService = i2CBusService ?? throw new ArgumentNullException(nameof(i2CBusService));
 }
 public HSPE16OutputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService i2cBus)
     : base(id, new MAX7311Driver(address, i2cBus))
 {
     CommitChanges(true);
 }
 public PCF8574ADriver(I2CSlaveAddress address, II2CBusService i2CBus)
     : base(address, i2CBus)
 {
 }
示例#35
0
 public HSRT16(string id, I2CSlaveAddress address, II2CBusService i2CBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogger log)
     : base(id, new MAX7311Driver(address, i2CBusService), deviceMessageBrokerService, log)
 {
     SetState(new byte[] { 0x00, 0x00 });
     CommitChanges(true);
 }
示例#36
0
 public HSRT16(DeviceId id, I2CSlaveAddress address, II2CBusService i2CBus)
     : base(id, new MAX7311Driver(address, i2CBus))
 {
     SetState(new byte[] { 0x00, 0x00 });
     CommitChanges(true);
 }
 public HSPE8InputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService bus)
     : base(id, new PCF8574Driver(address, bus))
 {
     FetchState();
 }
示例#38
0
 public HSPE8InputOnly(string id, I2CSlaveAddress address, II2CBusService i2CBusService, IDeviceMessageBrokerService deviceMessageBrokerService, ILogger log)
     : base(id, new PCF8574Driver(address, i2CBusService), deviceMessageBrokerService, log)
 {
     FetchState();
 }
示例#39
0
 public HSPE8InputOnly(DeviceId id, I2CSlaveAddress address, II2CBusService bus)
     : base(id, new PCF8574Driver(address, bus))
 {
     FetchState();
 }
示例#40
0
 public override void Execute(I2CSlaveAddress address, II2CBusService i2CBusService)
 {
     i2CBusService.Write(address, ToPackage(), false);
 }