public void SetDao(ZigBeeEndpointDao dao) { EndpointId = dao.EndpointId; //if (dao.ProfileId != null) //{ ProfileId = dao.ProfileId; //} if (dao.InputClusterIds != null) { foreach (ZclClusterDao clusterDao in dao.InputClusters) { ZclCluster cluster = GetClusterClass(clusterDao.ClusterId); cluster.SetDao(clusterDao); _inputClusters.TryAdd(clusterDao.ClusterId, cluster); } } if (dao.OutputClusterIds != null) { foreach (ZclClusterDao clusterDao in dao.OutputClusters) { ZclCluster cluster = GetClusterClass(clusterDao.ClusterId); cluster.SetDao(clusterDao); _outputClusters.TryAdd(clusterDao.ClusterId, cluster); } } }
/// <summary> /// Gets a <see cref="ZigBeeEndpointDao"> used for serialisation of the <see cref="ZigBeeEndpoint"> /// /// <returns>the <see cref="ZigBeeEndpointDao"></returns> /// </summary> public ZigBeeEndpointDao GetDao() { ZigBeeEndpointDao dao = new ZigBeeEndpointDao { EndpointId = EndpointId, ProfileId = ProfileId }; List <ZclClusterDao> clusters; clusters = new List <ZclClusterDao>(); foreach (ZclCluster cluster in _inputClusters.Values) { clusters.Add(cluster.GetDao()); } dao.SetInputClusters(clusters); clusters = new List <ZclClusterDao>(); foreach (ZclCluster cluster in _outputClusters.Values) { clusters.Add(cluster.GetDao()); } dao.SetOutputClusters(clusters); return(dao); }