private FaHDeviceProperties ChannelProperties(SensorActorInterfaceType ActorSensorIndex, ref int ChanIndex, ref int ChanProp) { foreach (var chan in Channels) { if (chan != null) { foreach (var prop in chan.Properties) { if (prop != null) { if (prop.channelType == ChannelType.chanInputActorGroupMessage) { if (prop.ActorSensorIndex == ActorSensorIndex) { ChanIndex = chan.ChannelIndex; ChanProp = prop.PropertyIndex; return(prop); } } } } } } return(null); }
public bool ButtonClick(SensorActorInterfaceType ActorSensorIndex, byte value) { KNXAddress knxAddress = GetGroupValueForChannelType(ActorSensorIndex, value); if (knxAddress != null) { OnGroupWriteEvent?.Invoke(this, knxAddress, new byte[] { value }); } return(false); }
private KNXAddress GetGroupValueForChannelType(SensorActorInterfaceType sensorActorInterfaceType, UInt16 Value) { if (Channels != null) { int chanID = 0; foreach (var chan in Channels) { if (chan != null) { int propID = 0; foreach (var prop in chan.Properties) { if (prop != null && prop.ChannelAdresses != null) { if (prop.ActorSensorIndex == sensorActorInterfaceType) { var chanaddr = prop.ChannelAdresses[1]; if (chanaddr != null && chanaddr.GroupValueAddress.Count != 0) { return(chanaddr.GroupValueAddress.First().GetAsReversed()); } else { if (chan.Properties[5] != null) { if (chan.Properties[5].PropertyData[1] != null) { //Get Scene information for button Index (1 or 2) --> Value 0\1 bool mIndice; byte[] propData; if (ReadPropertyValue(chan.ChannelIndex, 5, Value + 1, out propData, out mIndice)) { if (propData[1] < 0x40) { //Found get Scene info //Console.WriteLine(propData[1]); //Console.Write(chan.Properties[5].PropertyData[1].data[Value]); //TOdo Fix send scene OnGroupWriteSceneEvent?.Invoke(this, this.FaHSceneGroupValueAddress.GetAsReversed(), new byte[] { propData[1] }); } } } } Console.WriteLine(); } } } propID++; } } chanID++; } } return(null); }
public void SetActorChannelValue(SensorActorInterfaceType actorInterfaceType, byte data) { byte[] datan = new byte[2] { 1, data }; int ChanIndex = 0; int PropIndex = 0; var ts = ChannelProperties(actorInterfaceType, ref ChanIndex, ref PropIndex); WritePropertyValue(ChanIndex, PropIndex, 1, datan); }
public bool GetChannelOnState(SensorActorInterfaceType actorInterfaceType) { int r1 = 0; int r2 = 0; try { var ts = ChannelProperties(actorInterfaceType, ref r1, ref r2); if (ts != null) { return(0 != ts.PropertyData[1].data[1]); } } catch { } return(false); }
public FaHDeviceProperties.ChannelType GetChannelPropertyType(int ChannelIndex, int Property, out SensorActorInterfaceType ActorSensorIndex) { ActorSensorIndex = Channels[ChannelIndex].Properties[Property].ActorSensorIndex; return(Channels[ChannelIndex].Properties[Property].channelType); }
public void WriteChannelPropertyType(int ChannelIndex, int Property, FaHDeviceProperties.ChannelType channelType, SensorActorInterfaceType ActorSensorIndex) { Channels[ChannelIndex].Properties[Property].channelType = channelType; Channels[ChannelIndex].Properties[Property].ActorSensorIndex = ActorSensorIndex; }