protected bool SendCommand(XBeeModule xbeeModule, ZigBeeDevice destination, ZigBeeEndPoint endPoint = null) { bool retVal = false; // send ZigBee command then wait for response if required m_destination = destination; m_endPoint = endPoint; if (m_responseRequired) { byte sequenceNumber = xbeeModule.SendZigBeeCommand(this); retVal = m_responseParsedEv.WaitOne(AdapterHelper.MAX_WAIT_TIMEOUT); if (!retVal) { // no response received in time xbeeModule.RemovePendingZigBeeCmd(sequenceNumber); } } else { xbeeModule.SendZigBeeCommandNoResponse(this); retVal = true; } return(retVal); }
internal void SignalChangeOfAttributeValue(ZigBeeEndPoint endPoint, ZclCluster cluster, ZclAttribute attribute) { // find change of value signal of that end point (end point == bridgeRT device) var covSignal = endPoint.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 = cluster; 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; // signal change of value to BridgeRT NotifySignalListeners(covSignal); }
internal AlarmCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ALARM_COUNT)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ALARM_COUNT, "Alarm Count", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } //TODO: Add Cluster Commands // call parent class "post constructor" PostChildClassConstructor(); }
internal ZigBeeEndPoint(ZigBeeEndPoint Other) { this.m_device = Other.m_device; this.Id = Other.Id; this.DeviceId = Other.DeviceId; this.m_originalProfileId = Other.m_originalProfileId; this.m_commandProfileId = Other.m_commandProfileId; this.Name = Other.Name; this.Vendor = Other.Vendor; this.Model = Other.Model; this.Version = Other.Version; this.FirmwareVersion = Other.FirmwareVersion; this.SerialNumber = Other.SerialNumber; this.Description = Other.Description; this.m_basicCluster = Other.m_basicCluster; this.m_inClusters = Other.m_inClusters; this.m_outClusters = Other.m_outClusters; try { this.Signals = new List <IAdapterSignal>(Other.Signals); } catch (OutOfMemoryException ex) { Debug.WriteLine(ex); throw; } }
internal BasicCluster(ZigBeeEndPoint endPoint) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // Basic cluster attributes var attrib = new ZclAttribute(this, ATTRIBUTE_ZCL_VERSION, "ZclVersion", ZclHelper.UINT8_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_APPLICATION_VERSION, "ApplicationVersion", ZclHelper.UINT8_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_STACK_VERSION, "StackVersion", ZclHelper.UINT8_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_HW_VERSION, "HwVersion", ZclHelper.UINT8_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_MANUFACTURER_NAME, "ManufacturerName", ZclHelper.CHAR_STRING_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_MODEL_IDENTIFIER, "ModelIdentifier", ZclHelper.CHAR_STRING_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_DATE_CODE, "DateCode", ZclHelper.CHAR_STRING_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_POWER_SOURCE, "PowerSource", ZclHelper.ENUMERATION_8_BIT_TYPE, true); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_LOCATION_DESCRIPTION, "LocationDescription", ZclHelper.CHAR_STRING_TYPE); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_PHYSICAL_ENVIRONMENT, "PhysicalEnvironment", ZclHelper.ENUMERATION_8_BIT_TYPE); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_DEVICE_ENABLE, "DeviceEnable", ZclHelper.BOOLEAN_TYPE); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_ALARM_MASK, "AlarmMask", ZclHelper.BITMAP_8_BIT_TYPE); m_attributeList.Add(attrib.Id, attrib); attrib = new ZclAttribute(this, ATTRIBUTE_DISABLE_LOCAL_CONFIG, "DisableLocalConfig", ZclHelper.BITMAP_8_BIT_TYPE); m_attributeList.Add(attrib.Id, attrib); // call parent class "post constructor" PostChildClassConstructor(); }
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); }
public RelativeHumidityCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // Temperature attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_TEMPERATURE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_TEMPERATURE, "MeasuredValue", ZclHelper.UINT16_TYPE, true, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MINMEASURED)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MINMEASURED, "MinMeasuredValue ", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAXMEASURED)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAXMEASURED, "MaxMeasuredValue ", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_TOLERANCE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_TOLERANCE, "Tolerance", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // call parent class "post constructor" PostChildClassConstructor(); }
public LSFHandler(ZigBeeEndPoint endPoint, ZigBeeProfileLibrary.DeviceType type) { m_endPoint = endPoint; LampDetails_Version = 1; LampService_LampServiceVersion = 1; LampState_Version = 1; LampParameters_Version = 1; if (type == ZigBeeProfileLibrary.DeviceType.dimmableLight) { LampDetails_Dimmable = true; } else { LampDetails_Dimmable = false; } // only on/off and dimmable for now LampDetails_Color = false; LampDetails_VariableColorTemp = false; LampDetails_HasEffects = false; LampDetails_IncandescentEquivalent = 60; LampDetails_LampBaseType = (uint)BridgeRT.LSFLampBaseType.BASETYPE_E26; LampDetails_LampBeamAngle = 160; LampDetails_LampType = (uint)BridgeRT.LSFLampType.LAMPTYPE_A19; LampDetails_Make = (uint)BridgeRT.LSFLampMake.MAKE_OEM1; LampDetails_MaxLumens = 620; LampDetails_MaxTemperature = OEM_LS_COLOR_TEMPERATURE_MAX; LampDetails_MaxVoltage = 120; LampDetails_MinTemperature = OEM_LS_COLOR_TEMPERATURE_MIN; LampDetails_MinVoltage = 100; LampDetails_Model = 1; LampDetails_Type = (uint)BridgeRT.LSFDeviceType.TYPE_LAMP; LampDetails_VariableColorTemp = false; LampDetails_Wattage = 9; LampDetails_LampID = m_endPoint.SerialNumber; LampState_ColorTemp = 0; LampState_Hue = 0; LampState_Saturation = 0; // ZigBee light (on/off cluster) has no state change LampState_LampStateChanged = null; }
private void ZclReportAttributeReception(ZclReportAttributes.SOURCE_INFO deviceInfo, UInt16 attributeId, object newValue) { ZigBeeDevice device = null; ZigBeeEndPoint endPoint = null; ZclCluster cluster = null; ZclAttribute attribute = null; // look for corresponding ZigBee device lock (m_deviceMap) { if (!m_deviceMap.TryGetValue(deviceInfo.macAddress, out device)) { // unknown device => do nothing return; } } // look for corresponding end point if (!device.EndPointList.TryGetValue(deviceInfo.endpointId, out endPoint)) { // unknown end point => do nothing return; } // look for corresponding cluster cluster = endPoint.GetCluster(deviceInfo.clusterId); if (cluster == null) { // unknown cluster => do nothing return; } // look for the corresponding attribute if (cluster.InternalAttributeList.TryGetValue(attributeId, out attribute)) { // unknown attribute => do nothing return; } // update value attribute.Value.Data = newValue; // signal value of attribute has changed SignalChangeOfAttributeValue(endPoint, cluster, attribute); }
public bool AddClusterToEndPoint(bool isInCluster, byte endPointId, UInt16 profileId, UInt16 deviceId, UInt16 clusterId, Adapter adapter) { bool newEndPoint = false; // sanity check if (adapter == null && m_adapter == null) { // can't do anything without XBeeModule return(false); } // save away XBeeModule if necessary if (m_adapter == null) { m_adapter = adapter; } // find relevant end point (create if if necessary) ZigBeeEndPoint endPoint = null; if (!m_endPointList.TryGetValue(endPointId, out endPoint)) { endPoint = new ZigBeeEndPoint(endPointId, profileId, deviceId); endPoint.Initialize(this); newEndPoint = true; } // add cluster to end point if (!endPoint.AddCluster(clusterId, isInCluster)) { return(false); } // add new end point to end point list if (newEndPoint) { m_endPointList.Add(endPoint.Id, endPoint); } return(true); }
internal void NotifyBridgeRT(ZigBeeEndPoint endPoint, string signalName, string paramName) { // find device arrival signal in list var deviceArrival = Signals.OfType <AdapterSignal>().FirstOrDefault(s => s.Name == signalName); if (deviceArrival == null) { // no device arrival signal return; } // set parameter value var param = deviceArrival.Params.FirstOrDefault(p => p.Name == paramName); if (param == null) { // signal doesn't have the expected parameter return; } param.Data = endPoint; NotifySignalListeners(deviceArrival); }
internal ColorControlCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // current hue attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_CURRENTHUE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_CURRENTHUE, "CurrentHue", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // current saturation (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_CURRENTSATURATION)) { var attrib = new ZclAttribute(this, ATTRIBUTE_CURRENTSATURATION, "CurrentSaturation", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // remaining time (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_REMAININGTIME)) { var attrib = new ZclAttribute(this, ATTRIBUTE_REMAININGTIME, "RemainingTime", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // current X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_CURRENTX)) { var attrib = new ZclAttribute(this, ATTRIBUTE_CURRENTX, "CurrentX", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // current Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_CURRENTY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_CURRENTY, "CurrentY", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // drift compensation (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_DRIFTCOMPENSATION)) { var attrib = new ZclAttribute(this, ATTRIBUTE_DRIFTCOMPENSATION, "DriftCompensation", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // compensation text (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COMPENSATIONTEXT)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COMPENSATIONTEXT, "CompensationText", ZclHelper.CHAR_STRING_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // color temperature (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORTEMPERATURE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORTEMPERATURE, "ColorTemperature", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // color mode (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORMODE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORMODE, "ColorMode", ZclHelper.ENUMERATION_8_BIT_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // number of primaries (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_NUMBEROFPRIMARIES)) { var attrib = new ZclAttribute(this, ATTRIBUTE_NUMBEROFPRIMARIES, "NumberOfPrimaries", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 1 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY1X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY1X, "Primary1X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 1 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY1Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY1Y, "Primary1Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 1 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY1INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY1INTENSITY, "Primary1Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 2 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY2X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY2X, "Primary2X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 2 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY2Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY2Y, "Primary2Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 2 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY2INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY2INTENSITY, "Primary2Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 3 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY3X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY3X, "Primary3X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 3 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY3Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY3Y, "Primary3Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 3 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY3INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY3INTENSITY, "Primary3Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 4 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY4X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY4X, "Primary4X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 4 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY4Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY4Y, "Primary4Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 4 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY4INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY4INTENSITY, "Primary4Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 5 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY5X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY5X, "Primary5X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 5 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY5Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY5Y, "Primary5Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 5 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY5INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY5INTENSITY, "Primary5Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 6 X (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY6X)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY6X, "Primary6X", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 6 Y (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY6Y)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY6Y, "Primary6Y", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // primary 6 intensity (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_PRIMARY6INTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_PRIMARY6INTENSITY, "Primary6Intensity", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // white point X if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_WHITEPOINTX)) { var attrib = new ZclAttribute(this, ATTRIBUTE_WHITEPOINTX, "WhitePointX", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // white point Y if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_WHITEPOINTY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_WHITEPOINTY, "WhitePointY", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point R X if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTRX)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTRX, "ColorPointRX", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point R Y if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTRY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTRY, "ColorPointRY", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point R intensity if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTRINTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTRINTENSITY, "ColorPointRIntensity", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point G X if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTGX)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTGX, "ColorPointGX", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point G Y if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTGY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTGY, "ColorPointGY", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point G intensity if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTGINTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTGINTENSITY, "ColorPointGIntensity", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point B X if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTBX)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTBX, "ColorPointBX", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point B Y if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTBY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTBY, "ColorPointBY", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // color point B intensity if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_COLORPOINTBINTENSITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_COLORPOINTBINTENSITY, "ColorPointBIntensity", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // move to hue command var command = new ZclCommand(this, COMMAND_MOVETOHUE, "MoveToHue", false); var parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Hue"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "Direction"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move hue command command = new ZclCommand(this, COMMAND_MOVEHUE, "MoveHue", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "MoveMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Rate"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // step hue command command = new ZclCommand(this, COMMAND_STEPHUE, "StepHue", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "StepMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "StepSize"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move to saturation command command = new ZclCommand(this, COMMAND_MOVETOSATURATION, "MoveToSaturation", false); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Saturation"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move saturation command command = new ZclCommand(this, COMMAND_MOVESATURATION, "MoveSaturation", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "MoveMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Rate"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // step saturation command command = new ZclCommand(this, COMMAND_STEPSATURATION, "StepSaturation", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "StepMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "StepSize"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move hue and saturation command command = new ZclCommand(this, COMMAND_MOVETOHUEANDSATURATION, "MoveHueAndSaturation", false); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Hue"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Saturation"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move to color command command = new ZclCommand(this, COMMAND_MOVETOCOLOR, "MoveToColor", false); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "ColorX"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "ColorY"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move color command command = new ZclCommand(this, COMMAND_MOVECOLOR, "MoveColor", false); parameter = new ZclValue(ZclHelper.INT16_TYPE, "RateX"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.INT16_TYPE, "RateY"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // step color command command = new ZclCommand(this, COMMAND_STEPCOLOR, "StepColor", false); parameter = new ZclValue(ZclHelper.INT16_TYPE, "StepX"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.INT16_TYPE, "StepY"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // move to color temperature command command = new ZclCommand(this, COMMAND_MOVETOCOLORTEMPERATURE, "MoveToColorTemperature", false); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "ColorTemperature"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // call parent class "post constructor" PostChildClassConstructor(); }
internal OnOffCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // OnOff attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ONOFF)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ONOFF, "OnOff", ZclHelper.BOOLEAN_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // IMPORTANT NOTE, parameters MUST be added in parameter list of each command // in the order specified in ZCL standard // Off command (no response required) var command = new ZclCommand(this, COMMAND_OFF, "Off", false); m_commandList.Add(command.Id, command); // On command (no response required) command = new ZclCommand(this, COMMAND_ON, "On", false); m_commandList.Add(command.Id, command); // Toggle command (no response required) command = new ZclCommand(this, COMMAND_TOGGLE, "Toggle", false); m_commandList.Add(command.Id, command); // add ZLL profile specific attributes and commands bool areZllAttributesSupported = false; if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_GLOBALSCENECONTROL_ZLL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_GLOBALSCENECONTROL_ZLL, "GlobalSceneControl", ZclHelper.BOOLEAN_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); areZllAttributesSupported = true; } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ONTIME_ZLL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ONTIME_ZLL, "OnTime", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); areZllAttributesSupported = true; } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_OFFWAITTIME_ZLL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_OFFWAITTIME_ZLL, "OnWaitTime", ZclHelper.UINT16_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); areZllAttributesSupported = true; } // add ZLL command if ZLL attributes are supported if (areZllAttributesSupported) { command = new ZclCommand(this, COMMAND_OFFWITHEFFECT_ZLL, "OffWithEffect", false); var parameter = new ZclValue(ZclHelper.UINT8_TYPE, "EffectIdentifier"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "EffectVariant"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); command = new ZclCommand(this, COMMAND_ONWITHRECALLGLOBALSCENE_ZLL, "OnWithRecallGlobalScene", false); m_commandList.Add(command.Id, command); command = new ZclCommand(this, COMMAND_ONWITHTIMEOFF_ZLL, "OnWithTimeOff", false); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "OnOffControl"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "OnTime"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "OffWaitTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); } // call parent class "post constructor" PostChildClassConstructor(); }
public bool GetListOfAttributeIds(XBeeModule xbeeModule, ZigBeeDevice device, ZigBeeEndPoint endPoint, UInt16 clusterId, out List <UInt16> attributeIdList) { m_status = ZclHelper.ZCL_ERROR_SUCCESS; // reset list of attribute Ids attributeIdList = null; m_attributeIdList.Clear(); m_discoveryCompleted = false; // set cluster Id m_clusterId = clusterId; m_responseClusterId = clusterId; // add header and ZCL payload to command payload while (!m_discoveryCompleted) { m_payload = new byte[m_zclHeader.Length + m_zclPayload.Length]; Array.Copy(m_zclHeader, m_payload, m_zclHeader.Length); // update start Id in Zcl payload if necessary if (m_attributeIdList.Count != 0) { UInt16 lastId = m_attributeIdList.Last(); lastId++; byte[] newStartId = AdapterHelper.ToZigBeeFrame(lastId); Array.Copy(newStartId, 0, m_zclPayload, 0, newStartId.Length); } Array.Copy(m_zclPayload, 0, m_payload, m_zclHeader.Length, m_zclPayload.Length); // send command if (!SendCommand(xbeeModule, device, endPoint) || m_status != ZclHelper.ZCL_ERROR_SUCCESS) { return(false); } } // set out value attributeIdList = m_attributeIdList; return(true); }
internal LevelControlCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // current level attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_CURRENTLEVEL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_CURRENTLEVEL, "CurrentLevel", ZclHelper.UINT8_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // remaining time attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_REMAININGTIME)) { var attrib = new ZclAttribute(this, ATTRIBUTE_REMAININGTIME, "RemainingTime", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } // on/off transition time attribute (read/write) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ONOFFTRANSITIONTIME)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ONOFFTRANSITIONTIME, "OnOffTransitionTime", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // on level attribute (read/write) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ONLEVEL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ONLEVEL, "OnLevel", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // IMPORTANT NOTE, parameters MUST be added in parameter list of each command // in the order specified in ZCL standard // move to level command (no response required) var command = new ZclCommand(this, COMMAND_MOVETOLEVEL, "MoveToLevel", false); var parameter = new ZclValue(ZclHelper.UINT8_TYPE, LEVEL_PARAM); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Move command (no response required) command = new ZclCommand(this, COMMAND_MOVE, "Move", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "MoveMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Rate"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Step command (no response required) command = new ZclCommand(this, COMMAND_STEP, "Step", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "StepMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "StepSize"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Stop command (no response required) command = new ZclCommand(this, COMMAND_STOP, "Stop", false); m_commandList.Add(command.Id, command); // move to level with on/off command (no response required) command = new ZclCommand(this, COMMAND_MOVETOLEVEL_WITHONOFF, "MoveToLevelWithOnOff", false); parameter = new ZclValue(ZclHelper.UINT8_TYPE, LEVEL_PARAM); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Move command (no response required) command = new ZclCommand(this, COMMAND_MOVE_WITHONOFF, "MoveWithOnOff", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "MoveMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "Rate"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Step command (no response required) command = new ZclCommand(this, COMMAND_STEP_WITHONOFF, "StepWithOnOff", false); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "StepMode"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT8_TYPE, "StepSize"); command.AddInParam(parameter); parameter = new ZclValue(ZclHelper.UINT16_TYPE, "TransitionTime"); command.AddInParam(parameter); m_commandList.Add(command.Id, command); // Stop command (no response required) command = new ZclCommand(this, COMMAND_STOP_WITHONOFF, "StopWithOnOff", false); m_commandList.Add(command.Id, command); // call parent class "post constructor" PostChildClassConstructor(); }
internal ZclCluster(ZigBeeEndPoint endPoint) { m_endPoint = endPoint; Attributes = new List <IAdapterAttribute>(); }
internal IASZoneCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // Zone State attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ZONESTATE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ZONESTATE, "ZoneState", ZclHelper.ENUMERATION_8_BIT_TYPE, true); m_attributeList.Add(attrib.Id, attrib); } // Zone Type attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ZONETYPE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ZONETYPE, "ZoneType", ZclHelper.ENUMERATION_16_BIT_TYPE, true); m_attributeList.Add(attrib.Id, attrib); } // Zone Status attribute (read only, mandatory and "reportable") // note that ZCL standard indicates that this attribute isn't reportable, however it also specifies a server command: Zone status change notification command to // notify change of zone status => ZclAttribute is then kind of reportable through a server command mechanism (change of value signal should consequently be available // for that attribute) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ZONESTATUS)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ZONESTATUS, "ZoneStatus", ZclHelper.BITMAP_16_BIT_TYPE, true, false, true); m_attributeList.Add(attrib.Id, attrib); } // IAS CIE address attribute (read/write) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_IASCIEADDRESS)) { var attrib = new ZclAttribute(this, ATTRIBUTE_IASCIEADDRESS, "IasCieAddress", ZclHelper.IEEE_ADDRESS_TYPE, false); m_attributeList.Add(attrib.Id, attrib); } // IMPORTANT NOTE, parameters MUST be added in parameter list of each command // in the order specified in ZCL standard // Zone status change notification command // note that this command is server command hence received by ZigBee DSB (as opposed to ZclCommand which are sent by ZigBee DSB) var command = new ZclServerCommand(this, COMMAND_ZONESTATUSCHANGENOTIFICATION); var parameter = new ZclValue(ZclHelper.ENUMERATION_16_BIT_TYPE, PARAM_ZONESTATUS); command.AddParam(parameter); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, PARAM_EXTENDEDSTATUS); command.AddParam(parameter); command.OnReception += ZoneStatusChangeNotification; m_serverCommandList.Add(command); // call parent class "post constructor" PostChildClassConstructor(); }
internal PowerConfigurationCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_VOLTAGE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_VOLTAGE, "Mains Voltage", ZclHelper.UINT16_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_FREQUENCY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_FREQUENCY, "Mains Frequency", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_ALARM_MASK)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_ALARM_MASK, "Mains Alarm Mask", ZclHelper.BITMAP_8_BIT_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_VOLTAGE_MIN_THRESHOLD)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_VOLTAGE_MIN_THRESHOLD, "Mains Voltage Min Threshold", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_VOLTAGE_MAX_THRESHOLD)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_VOLTAGE_MAX_THRESHOLD, "Mains Voltage Max Threshold", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_MAINS_VOLTAGE_DWELL)) { var attrib = new ZclAttribute(this, ATTRIBUTE_MAINS_VOLTAGE_DWELL, "Mains Voltage Dwell Trip Point", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_VOLTAGE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_VOLTAGE, "Battery Voltage", ZclHelper.UINT8_TYPE, true, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_MANUFACTURER)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_MANUFACTURER, "Battery Manufacturer", ZclHelper.CHAR_STRING_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_SIZE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_SIZE, "Battery Size", ZclHelper.ENUMERATION_8_BIT_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_AHR_RATING)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_AHR_RATING, "Battery AHr Rating", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_QUANTITY)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_QUANTITY, "Battery Quantity", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_RATED_VOLTAGE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_RATED_VOLTAGE, "Battery Rated Voltage", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_ALARM_MASK)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_ALARM_MASK, "Battery Alarm Mask", ZclHelper.BITMAP_8_BIT_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_BATTERY_VOLTAGE_MIN_THRESHOLD)) { var attrib = new ZclAttribute(this, ATTRIBUTE_BATTERY_VOLTAGE_MIN_THRESHOLD, "Battery Voltage Min Threshold", ZclHelper.UINT8_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // call parent class "post constructor" PostChildClassConstructor(); }
internal DoorLockCluster(ZigBeeEndPoint endPoint, List <UInt16> supportedAttributes) : base(endPoint) { // set cluster name and cluster Id Name = CLUSTER_NAME; m_Id = CLUSTER_ID; // if supportedAttributes is null assume all attributes supported bool supportAllAttributesBydefault = false; if (supportedAttributes == null) { supportAllAttributesBydefault = true; } // Lock State attribute (read only, mandatory, reportable)) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_LOCKSTATE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_LOCKSTATE, "LockState", ZclHelper.ENUMERATION_8_BIT_TYPE, true, false, true); m_attributeList.Add(attrib.Id, attrib); } // Lock Type attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_LOCKTYPE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_LOCKTYPE, "LockType", ZclHelper.ENUMERATION_8_BIT_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // Actuator Enabled attribute (read only) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_ACTUATORENABLED)) { var attrib = new ZclAttribute(this, ATTRIBUTE_ACTUATORENABLED, "ActuatorEnabled", ZclHelper.BOOLEAN_TYPE, true, false); m_attributeList.Add(attrib.Id, attrib); } // Door State attribute (read only, optional, reportable) if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_DOORSTATE)) { var attrib = new ZclAttribute(this, ATTRIBUTE_DOORSTATE, "DoorState", ZclHelper.ENUMERATION_8_BIT_TYPE, true, true, true); m_attributeList.Add(attrib.Id, attrib); } // Door Open Events attribute if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_DOOROPENEVENTS)) { var attrib = new ZclAttribute(this, ATTRIBUTE_DOOROPENEVENTS, "DoorOpenEvents", ZclHelper.UINT32_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // Door Close Events attribute if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_DOORCLOSEDEVENTS)) { var attrib = new ZclAttribute(this, ATTRIBUTE_DOORCLOSEDEVENTS, "DoorCloseEvents", ZclHelper.UINT32_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // Open Period attribute if (supportAllAttributesBydefault || supportedAttributes.Contains(ATTRIBUTE_OPENPERIOD)) { var attrib = new ZclAttribute(this, ATTRIBUTE_OPENPERIOD, "OpenPeriod", ZclHelper.UINT16_TYPE, false, true); m_attributeList.Add(attrib.Id, attrib); } // IMPORTANT NOTE, parameters MUST be added in parameter list of each command // in the order specified in ZCL standard // Lock door command var command = new ZclCommand(this, COMMAND_LOCKDOOR, "LockDoor", true); var parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "Status"); command.AddOutParam(parameter); m_commandList.Add(command.Id, command); // Unlock door command command = new ZclCommand(this, COMMAND_UNLOCKDOOR, "UnlockDoor", true); parameter = new ZclValue(ZclHelper.ENUMERATION_8_BIT_TYPE, "Status"); command.AddOutParam(parameter); m_commandList.Add(command.Id, command); // call parent class "post constructor" PostChildClassConstructor(); }