public uint SetPropertyValue(IAdapterProperty Property, IAdapterValue Value, out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;

            var r = ((AdapterProperty)Property).Attributes.Where(x => x.Value.Name == Value.Name).First() as BridgeRT.IAdapterAttribute;

            if (r == null) { return ERROR_INVALID_HANDLE; }
            else
            {
                r.Value.Data = Value.Data;

                AllJoynSet?.Invoke(this, new AllJoynData(r.Value));
                return ERROR_SUCCESS;
            }
        }
        public uint GetPropertyValue(IAdapterProperty Property, string AttributeName, out IAdapterValue ValuePtr, out IAdapterIoRequest RequestPtr)
        {
            ValuePtr = null;
            RequestPtr = null;

            var r = ((AdapterProperty)Property).Attributes.Where(x => x.Value.Name == AttributeName).First() as BridgeRT.IAdapterAttribute;

            if (r == null) { return ERROR_INVALID_HANDLE; }
            else
            {
                ValuePtr = r.Value;
                return ERROR_SUCCESS;
            }
        }
        public uint SetProperty(
            IAdapterProperty Property,
            out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;

            return ERROR_SUCCESS;
        }
Example #4
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)
                {
                    attribute.Value.Data = Value.Data;
                    return ERROR_SUCCESS;
                }
            }

            return ERROR_INVALID_HANDLE;
        }
Example #5
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);
        }
        internal void AddChangeOfValueSignal(
            IAdapterProperty Property,
            IAdapterValue Attribute)
        {
            try
            {
                AdapterSignal covSignal = new AdapterSignal(Constants.CHANGE_OF_VALUE_SIGNAL);

                // Property Handle
                AdapterValue propertyHandle = new AdapterValue(
                                                    Constants.COV__PROPERTY_HANDLE,
                                                    Property);

                // Attribute Handle
                AdapterValue attrHandle = new AdapterValue(
                                                    Constants.COV__ATTRIBUTE_HANDLE,
                                                    Attribute);

                covSignal.Params.Add(propertyHandle);
                covSignal.Params.Add(attrHandle);

                this.Signals.Add(covSignal);
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #7
0
        public uint GetPropertyValue(
            IAdapterProperty Property,
            string AttributeName,
            out IAdapterValue ValuePtr,
            out IAdapterIoRequest RequestPtr)
        {
            ValuePtr = null;
            RequestPtr = null;

            // find corresponding attribute
            foreach (var attribute in ((AdapterProperty)Property).Attributes)
            {
                if (attribute.Value.Name == AttributeName)
                {
                    ValuePtr = attribute.Value;
                    return ERROR_SUCCESS;
                }
            }

            return ERROR_INVALID_HANDLE;
        }
Example #8
0
        public uint SetPropertyValue(
            IAdapterProperty Property,
            IAdapterValue Value,
            out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;

            IAdapterValue attribute = Property.Attributes.ElementAt<IAdapterValue>(0);
            if (Property.Name == "Pin-5")
            {
                if (Convert.ToInt32(Value.Data) == 1)
                {
                    pinValueData5 = 1;
                    pin5.Write(GpioPinValue.High);
                }
                else
                {
                    pinValueData5 = 0;
                    pin5.Write(GpioPinValue.Low);
                }
            }
            else if (Property.Name == "Pin-6")
            {
                if (Convert.ToInt32(Value.Data) == 1)
                {
                    pinValueData6 = 1;
                    pin6.Write(GpioPinValue.High);
                }
                else
                {
                    pinValueData6 = 0;
                    pin6.Write(GpioPinValue.Low);
                }
            }
            else if (Property.Name == "Pin-12")
            {
                if (Convert.ToInt32(Value.Data) == 1)
                {
                    pinValueData12 = 1;
                    pin12.Write(GpioPinValue.High);
                }
                else
                {
                    pinValueData12 = 0;
                    pin12.Write(GpioPinValue.Low);
                }
            }
            else if (Property.Name == "Pin-16")
            {
                if (Convert.ToInt32(Value.Data) == 1)
                {
                    pinValueData16 = 1;
                    pin16.Write(GpioPinValue.High);
                }
                else
                {
                    pinValueData16 = 0;
                    pin16.Write(GpioPinValue.Low);
                }
            }

            attribute.Data = Value.Data;

            return ERROR_SUCCESS;
        }
Example #9
0
 public uint SetProperty(IAdapterProperty Property, out IAdapterIoRequest RequestPtr)
 {
     return(_adapter.SetProperty(Property, out RequestPtr));
 }
Example #10
0
 public uint SetProperty(IAdapterProperty Property, out IAdapterIoRequest RequestPtr)
 {
     RequestPtr = null;
     return(ERROR_SUCCESS);
 }
Example #11
0
        public uint GetPropertyValue(
            IAdapterProperty Property,
            string AttributeName,
            out IAdapterValue ValuePtr,
            out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;
            IAdapterValue attribute = Property.Attributes.ElementAt<IAdapterValue>(0);
            if (Property.Name == "Pin-5")
            {
                pinValueData5 = (int)pin5.Read();

                attribute.Data = pinValueData5;
            }
            else if (Property.Name == "Pin-6")
            {
                pinValueData6 = (int)pin6.Read();

                attribute.Data = pinValueData6;
            }
            else if (Property.Name == "Pin-12")
            {
                pinValueData12 = (int)pin12.Read();

                attribute.Data = pinValueData12;
            }
            else if (Property.Name == "Pin-16")
            {
                pinValueData16 = (int)pin16.Read();

                attribute.Data = pinValueData16;
            }

            ValuePtr = attribute;

            return ERROR_SUCCESS;
        }
Example #12
0
        override public uint SetPropertyValue(IAdapterProperty Property, IAdapterValue Value, out IAdapterIoRequest RequestPtr)
        {
            RequestPtr = null;

            return(ERROR_SUCCESS);
        }
Example #13
0
 public uint GetPropertyValue(IAdapterProperty Property, string AttributeName, out IAdapterValue ValuePtr, out IAdapterIoRequest RequestPtr)
 {
     return(_adapter.GetPropertyValue(Property, AttributeName, out ValuePtr, out RequestPtr));
 }
Example #14
0
 public uint SetPropertyValue(IAdapterProperty Property, IAdapterValue Value, out IAdapterIoRequest RequestPtr)
 {
     return(_adapter.SetPropertyValue(Property, Value, out RequestPtr));
 }
        public uint GetPropertyValue(
            IAdapterProperty Property,
            string AttributeName,
            out IAdapterValue ValuePtr,
            out IAdapterIoRequest RequestPtr)
        {
            ValuePtr = null;
            RequestPtr = null;

            return ERROR_SUCCESS;
        }
Example #16
0
 virtual public void SendPropertyValue(IAdapterProperty Property, IAdapterValue Value)
 {
 }