Esempio n. 1
0
        public uint SetPropertyValue(IAdapterProperty Property, IAdapterValue Value, out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;

            // find corresponding attribute
            foreach (var attribute in ((AdapterProperty)Property).Attributes)
            {
                if (attribute.Value.Name == Value.Name)
                {
                    string path   = "devices/" + ((AdapterValue)attribute.Value).Path + "/state";
                    uint   status = this.SetHttpValue(path, attribute.Value.Data, attribute.Value.Name);
                    if (status == 0)
                    {
                        attribute.Value.Data = Value.Data;

                        IAdapterDevice adapterDevice = null;
                        this.devicesDict.TryGetValue(((AdapterValue)Value).Path, out adapterDevice);

                        int SignalHashCode = ((AdapterValue)attribute.Value).SignalHashCode;

                        IAdapterSignal covSignal = null;
                        ((AdapterDevice)adapterDevice).SignalsDict.TryGetValue(SignalHashCode, out covSignal);

                        this.NotifySignalListener(covSignal);
                    }

                    return(ERROR_SUCCESS);
                }
            }
            return(ERROR_INVALID_HANDLE);
        }
Esempio n. 2
0
        public uint NotifyDeviceRemoval(IAdapterDevice Device)
        {
            if (Device == null)
            {
                return(ERROR_INVALID_HANDLE);
            }

            IAdapterSignal deviceRemovalSignal = this.Signals[DEVICE_REMOVAL_SIGNAL_INDEX];

            deviceRemovalSignal.Params[DEVICE_REMOVAL_SIGNAL_PARAM_INDEX].Data = Device;
            this.NotifySignalListener(deviceRemovalSignal);

            return(ERROR_SUCCESS);
        }
Esempio n. 3
0
        public uint NotifyDeviceArrival(IAdapterDevice Device)
        {
            if (Device == null)
            {
                return(ERROR_INVALID_HANDLE);
            }

            IAdapterSignal deviceArrivalSignal = this.Signals[DEVICE_ARRIVAL_SIGNAL_INDEX];
            IAdapterValue  signalParam         = deviceArrivalSignal.Params[DEVICE_ARRIVAL_SIGNAL_PARAM_INDEX];

            signalParam.Data = Device;
            this.NotifySignalListener(deviceArrivalSignal);

            return(ERROR_SUCCESS);
        }
Esempio n. 4
0
        internal void SignalChangeOfAttributeValue(IAdapterDevice device, IAdapterProperty property, IAdapterAttribute attribute)
        {
            // find change of value signal of that end point (end point == bridgeRT device)

            var covSignal = device.Signals.OfType <AdapterSignal>().FirstOrDefault(s => s.Name == Constants.CHANGE_OF_VALUE_SIGNAL);

            if (covSignal == null)
            {
                // no change of value signal
                return;
            }

            // set property and attribute param of COV signal
            // note that
            // - ZCL cluster correspond to BridgeRT property
            // - ZCL attribute correspond to BridgeRT attribute
            var param = covSignal.Params.FirstOrDefault(p => p.Name == Constants.COV__PROPERTY_HANDLE);

            if (param == null)
            {
                // signal doesn't have the expected parameter
                return;
            }
            param.Data = property;

            param = covSignal.Params.FirstOrDefault(p => p.Name == Constants.COV__ATTRIBUTE_HANDLE);
            if (param == null)
            {
                // signal doesn't have the expected parameter
                return;
            }
            param.Data = attribute.Value;

            // signal change of value to BridgeRT
            NotifySignalListener(covSignal);
        }
 public AllJoynMethodData(IAdapterMethod method, IAdapterDevice adapterDevice)
 {
     this.Method = method;
     this.AdapterDevice = adapterDevice;
 }
        public uint NotifyDeviceRemoval(IAdapterDevice Device)
        {
            if (Device == null)
            {
                return ERROR_INVALID_HANDLE;
            }

            IAdapterSignal deviceRemovalSignal = this.Signals[DEVICE_REMOVAL_SIGNAL_INDEX];
            IAdapterValue signalParam = deviceRemovalSignal.Params[DEVICE_REMOVAL_SIGNAL_PARAM_INDEX];
            signalParam.Data = Device;
            this.NotifySignalListener(deviceRemovalSignal);

            return ERROR_SUCCESS;
        }
Esempio n. 7
0
        internal void SignalChangeOfAttributeValue(IAdapterDevice device, IAdapterProperty property, IAdapterAttribute attribute)
        {
            // find change of value signal of that end point (end point == bridgeRT device)

            var covSignal = device.Signals.OfType<AdapterSignal>().FirstOrDefault(s => s.Name == Constants.CHANGE_OF_VALUE_SIGNAL);
            if (covSignal == null)
            {
                // no change of value signal
                return;
            }

            // set property and attribute param of COV signal
            // note that 
            // - ZCL cluster correspond to BridgeRT property 
            // - ZCL attribute correspond to BridgeRT attribute 
            var param = covSignal.Params.FirstOrDefault(p => p.Name == Constants.COV__PROPERTY_HANDLE);
            if (param == null)
            {
                // signal doesn't have the expected parameter
                return;
            }
            param.Data = property;

            param = covSignal.Params.FirstOrDefault(p => p.Name == Constants.COV__ATTRIBUTE_HANDLE);
            if (param == null)
            {
                // signal doesn't have the expected parameter
                return;
            }
            param.Data = attribute.Value;

            // signal change of value to BridgeRT
            NotifySignalListener(covSignal);
        }
Esempio n. 8
0
 public AllJoynMethodData(IAdapterMethod method, IAdapterDevice adapterDevice)
 {
     this.Method        = method;
     this.AdapterDevice = adapterDevice;
 }