Example #1
0
        internal ZclCommand(ZclCluster cluster, byte id, String name, bool specificResponseRequired)
        {
            m_cluster      = cluster;
            m_Id           = id;
            m_zigBeeStatus = ZclHelper.ZCL_ERROR_SUCCESS;

            // as far as ZigBeeCommand class is concerned a response will always be required
            // ZCL will use the Default Response if ZclCommand require no specific response
            m_responseRequired = true;
            if (specificResponseRequired)
            {
                m_useDefaultResponse = false;
            }
            else
            {
                m_useDefaultResponse = true;
            }

            this.Name        = m_cluster.Name + "_" + name;
            this.Description = null;
            this.HResult     = ZclHelper.ZigBeeStatusToHResult(m_zigBeeStatus);

            m_isZdoCommand = false;
            ZclHelper.SetClusterSpecificHeader(ref m_zclHeader, 0);
            int offset = ZclHelper.GetCommandIdOffset(ref m_zclHeader, 0);

            m_zclHeader[offset] = m_Id;

            m_zclInParamList = new List <ZclValue>();
            InputParams      = new List <IAdapterValue>();
            OutputParams     = new List <IAdapterValue>();
        }
Example #2
0
        internal ZclCluster GetCluster(UInt16 clusterId)
        {
            ZclCluster cluster = null;

            // 1st check in in cluster list then in out cluster list (if necessary)
            if (!m_inClusters.TryGetValue(clusterId, out cluster))
            {
                m_outClusters.TryGetValue(clusterId, out cluster);
            }

            return(cluster);
        }
Example #3
0
        public ZclCluster CreateClusterInstance(ZigBeeEndPoint endPoint, UInt16 clusterId, List <UInt16> supportedAttributes)
        {
            // create instance of cluster depending on its Id,
            // e.g.: create OnOffCluster instance if id correspond to OnOff cluster
            ZclCluster cluster = null;

            if (IsClusterSupported(clusterId))
            {
                switch (clusterId)
                {
                case PowerConfigurationCluster.CLUSTER_ID:
                    cluster = new PowerConfigurationCluster(endPoint, supportedAttributes);
                    break;

                case OnOffCluster.CLUSTER_ID:
                    cluster = new OnOffCluster(endPoint, supportedAttributes);
                    break;

                case LevelControlCluster.CLUSTER_ID:
                    cluster = new LevelControlCluster(endPoint, supportedAttributes);
                    break;

                case AlarmCluster.CLUSTER_ID:
                    cluster = new AlarmCluster(endPoint, supportedAttributes);
                    break;

                case DoorLockCluster.CLUSTER_ID:
                    cluster = new DoorLockCluster(endPoint, supportedAttributes);
                    break;

                case ColorControlCluster.CLUSTER_ID:
                    cluster = new ColorControlCluster(endPoint, supportedAttributes);
                    break;

                case TemperatureCluster.CLUSTER_ID:
                    cluster = new TemperatureCluster(endPoint, supportedAttributes);
                    break;

                case RelativeHumidityCluster.CLUSTER_ID:
                    cluster = new RelativeHumidityCluster(endPoint, supportedAttributes);
                    break;

                case IASZoneCluster.CLUSTER_ID:
                    cluster = new IASZoneCluster(endPoint, supportedAttributes);
                    break;
                }
            }
            return(cluster);
        }
Example #4
0
        internal ZclAttribute(ZclCluster cluster, UInt16 id, String name, byte zigBeeType, bool isReadOnly = false, bool isOptional = false, bool isReportable = false)
        {
            // save parent cluster
            m_cluster = cluster;

            // attribute specific
            m_Id         = id;
            m_isReadOnly = isReadOnly;
            m_isOptional = isOptional;
            m_zigBeeType = zigBeeType;

            // ZigBee command specific
            m_isZdoCommand = false;
            int offset = ZclHelper.GetCommandIdOffset(ref m_zclHeader, 0);

            m_zclHeader[offset] = COMMAND_ID_READ_ATTRIBUTE;

            // BridgeRT specific
            Value       = new ZclValue(zigBeeType, name);
            Annotations = new Dictionary <string, string>();
            if (isReadOnly)
            {
                Access = E_ACCESS_TYPE.ACCESS_READ;
            }
            else
            {
                Access = E_ACCESS_TYPE.ACCESS_READWRITE;
            }
            if (isReportable)
            {
                COVBehavior = SignalBehavior.Always;
            }
            else
            {
                COVBehavior = SignalBehavior.Unspecified;
            }
        }
Example #5
0
 public ZclServerCommand(ZclCluster cluster, byte commandId)
 {
     m_cluster   = cluster;
     m_commandId = commandId;
 }