public TurnOnOffDevice(string vendorName, string model, string version,
                               string serialNumber, string description, ITurnOnOffModule module)
            : base(module.Name, vendorName, model, version, serialNumber, description)
        {
            Module = module;
            AdapterBusObject busObject = new AdapterBusObject("Guybrush");

            Interface = new AdapterInterface("com.guybrush.devices.onoffcontrol");
            var attr = new AdapterAttribute("Status", module.Status)
            {
                COVBehavior = SignalBehavior.Always, Access = E_ACCESS_TYPE.ACCESS_READ
            };

            attr.Annotations.Add("com.guybrush.devices.onoffcontrol.status", "The device status");
            Interface.Properties.Add(attr);

            List <IAdapterValue> inputs = new List <IAdapterValue>(1);

            inputs.Add(new AdapterValue("TargetStatus", false));

            AdapterMethod method = new AdapterMethod("Switch", "Switches devices on or off.", ChangeStatus, inputs);

            Interface.Methods.Add(method);

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

            Module.ValueChanged += Module_ValueChanged;
        }
Exemplo n.º 2
0
        public void RegisterTurnOnOffDevice(string vendorName, string model, string version,
                                            string serialNumber, string description, ITurnOnOffModule module)
        {
            var device = new TurnOnOffDevice(vendorName, model, version, serialNumber, description, module);

            AllJoynDsbServiceManager.Current.AddDevice(device);
            _devices.Add(device);
            module.ValueChanged += _conditionManager.TurnOnOffModule_ValueChanged;
            Devices.Add(module);
        }
 internal void AddModule(ITurnOnOffModule module)
 {
     Modules.Add(module);
 }