| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System.Collections.Generic;
- using System.Xml;
- namespace System.Net.HomeMatic {
- public abstract class HMChannelList : HMBase {
- private List<int> _channels_ise = new List<int>();
- public HMChannelList(HMApi Api):base(Api) {
- }
- public int ChannelCount {
- get { return this._channels_ise.Count; }
- }
- public HMChannelList(HMApi Api, XmlNode Data) : base(Api, Data) {
- if(Data.HasChildNodes) {
- int c = Data.ChildNodes.Count;
- for(int i=0;i< c;i++) {
- if(Data.ChildNodes[i].Name == "channel") {
- int ise = this.Attr_Int32(Data.ChildNodes[i], "ise_id");
- if (ise > 0)
- this._channels_ise.Add(ise);
- }
- }
- }
- }
- public HMChannel[] Channels {
- get {
- List<HMChannel> res = new List<HMChannel>();
- foreach (int id in this._channels_ise) {
- if (id > 0) {
- HMChannel ch = Api.GetChannel(id);
- if (ch != null)
- res.Add(ch);
- }
- }
- return res.ToArray();
- }
- }
- public HMDataPoint[] DataPoints {
- get {
- List<HMDataPoint> res = new List<HMDataPoint>();
- foreach (int id in this._channels_ise) {
- if (id > 0) {
- HMChannel ch = Api.GetChannel(id);
- if (ch != null) {
- HMDataPoint[] itms = Api.GetDataPointList(ch);
- if (itms.Length > 0)
- res.AddRange(itms);
- }
- }
- }
- return res.ToArray();
- }
- }
- public HMDevice[] Devices {
- get {
- List<HMDevice> res = new List<HMDevice>();
- foreach (int id in this._channels_ise) {
- if (id > 0) {
- HMChannel ch = Api.GetChannel(id);
- if (ch != null) {
- if (ch.Device != null && !res.Contains(ch.Device))
- res.Add(ch.Device);
- }
- }
- }
- return res.ToArray();
- }
- }
- }
- }
|