Пример #1
0
        public ReaderDevice(string vendorName, string model, string version,
                            string serialNumber, string description, IReaderModule module)
            : base(module.Name, vendorName, model, version, serialNumber, description)
        {
            Module = module;
            AdapterBusObject busObject = new AdapterBusObject("Guybrush");

            Interface = new AdapterInterface("com.guybrush.devices.reader");

            var attrValue = new AdapterAttribute("Value", module.Value)
            {
                COVBehavior = SignalBehavior.Always, Access = E_ACCESS_TYPE.ACCESS_READ
            };

            attrValue.Annotations.Add("com.guybrush.devices.reader.value", "The device value");
            Interface.Properties.Add(attrValue);

            var attrUnit = new AdapterAttribute("Unit", module.Unit)
            {
                COVBehavior = SignalBehavior.Always, Access = E_ACCESS_TYPE.ACCESS_READ
            };

            attrUnit.Annotations.Add("com.guybrush.devices.reader.unit", "The device unit");
            Interface.Properties.Add(attrUnit);

            busObject.Interfaces.Add(Interface);
            BusObjects.Add(busObject);
            CreateEmitSignalChangedSignal();

            Module.ValueChanged += Module_ValueChanged;
            Module.UnitChanged  += Module_UnitChanged;
        }
Пример #2
0
        public void RegisterReadingDevice(string vendorName, string model, string version,
                                          string serialNumber, string description, IReaderModule module)
        {
            var device = new ReaderDevice(vendorName, model, version, serialNumber, description, module);

            AllJoynDsbServiceManager.Current.AddDevice(device);
            _readers.Add(device);
            module.ValueChanged += _conditionManager.ReaderModule_ValueChanged;
            Readers.Add(module);
        }