#define __TIZEN_NETWORK_ZIGBEE_HA_H__
/**
- * @brief HA profile id
+ * @brief Zigbee profile id
*
* @since_tizen 3.0
*/
-#define ZB_HA_PROFILE_ID 0x0104
+typedef enum {
+ ZB_PROFILE_HOME_AUTOMATION = 0x0104,
+} zb_profile_id_e;
/**
* @brief Devices specified the HA profile
#include <zdo/zb-zdo-svc-disc.h>
#include <zdo/zb-zdo-bind-mgr.h>
+
+/**
+ * @brief Return readabble Zigbee profile id
+ * @details Return Zigbee profile id
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] profile_id ZigBee profile id
+ *
+ * @return pointer of profile id string
+ *
+ */
+const char* zb_get_profile_id_string(int profile_id);
+
+/**
+ * @brief Return readabble Zigbee device id
+ * @details Return Zigbee device id
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_id ZigBee device id
+ *
+ * @return pointer of device id string
+ *
+ */
+const char* zb_get_device_id_string(int device_id);
+
/**
* @brief Create simple descriptor
* @details Create simple descriptor handle
#include <error.h>
#include <stdlib.h>
+#include <zb-ha.h>
#include <zb-type.h>
#include <zb-error.h>
#include <zdo/zb-zdo-type.h>
#include "zbl-dbus.h"
#include "zb-common.h"
+#define CASE_TO_STR(x) case x: return #x;
+
+API const char* zb_get_profile_id_string(int profile_id)
+{
+ switch(profile_id) {
+ CASE_TO_STR(ZB_PROFILE_HOME_AUTOMATION)
+ default:
+ return "ZB_UNKNOWN_PROFILE";
+ }
+}
+
+API const char* zb_get_device_id_string(int device_id)
+{
+ switch (device_id) {
+ /* General devices */
+ CASE_TO_STR(ZB_HA_ON_OFF_SWITCH)
+ CASE_TO_STR(ZB_HA_LEVEL_CONTROL_SWITCH)
+ CASE_TO_STR(ZB_HA_ON_OFF_OUTPUT)
+ CASE_TO_STR(ZB_HA_LEVEL_CONTROLLABLE_OUTPUT)
+ CASE_TO_STR(ZB_HA_SCENE_SELECOTOR)
+ CASE_TO_STR(ZB_HA_CONFIGURATION_TOOL)
+ CASE_TO_STR(ZB_HA_REMOTE_CONTROL)
+ CASE_TO_STR(ZB_HA_COMBINED_INTERFACE)
+ CASE_TO_STR(ZB_HA_RANGE_EXTENDER)
+ CASE_TO_STR(ZB_HA_MAINS_POWER_OUTLET)
+ CASE_TO_STR(ZB_HA_DOOR_LOCK)
+ CASE_TO_STR(ZB_HA_DOOR_LOCK_CONTROLLER)
+ CASE_TO_STR(ZB_HA_SIMPLE_SENSOR)
+ CASE_TO_STR(ZB_HA_CONSUMPTION_AWARENESS_DEVICE)
+ CASE_TO_STR(ZB_HA_HOME_GATEWAY)
+ CASE_TO_STR(ZB_HA_SMART_PLUG)
+ CASE_TO_STR(ZB_HA_WHITE_GOODS)
+ CASE_TO_STR(ZB_HA_METER_INTERFACE)
+ /* Lighting devices */
+ CASE_TO_STR(ZB_HA_ON_OFF_LIGHT)
+ CASE_TO_STR(ZB_HA_DIMMABLE_LIGHT)
+ CASE_TO_STR(ZB_HA_COLOR_DIMMABLE_LIGHT)
+ CASE_TO_STR(ZB_HA_ON_OFF_LIGHT_SWITCH)
+ CASE_TO_STR(ZB_HA_DIMMER_SWITCH)
+ CASE_TO_STR(ZB_HA_COLOR_DIMMER_SWITCH)
+ CASE_TO_STR(ZB_HA_LIGHT_SENSOR)
+ CASE_TO_STR(ZB_HA_OCUPANCY_SENSOR)
+ /* Closures devices */
+ CASE_TO_STR(ZB_HA_SHADE)
+ CASE_TO_STR(ZB_HA_SHADE_CONTROLLER)
+ CASE_TO_STR(ZB_HA_WINDOW_COVERING_DEVICE)
+ CASE_TO_STR(ZB_HA_WINDOW_COVERING_CONTROLLER)
+ /* HVAC devices */
+ CASE_TO_STR(ZB_HA_HEATING_COLLING_UNIT)
+ CASE_TO_STR(ZB_HA_THERMOSTAT)
+ CASE_TO_STR(ZB_HA_TEMPERATURE_SENSOR)
+ CASE_TO_STR(ZB_HA_PUMP)
+ CASE_TO_STR(ZB_HA_PUMP_CONTROLLER)
+ CASE_TO_STR(ZB_HA_PRESSURE_SENSOR)
+ CASE_TO_STR(ZB_HA_FLOW_SENSOR)
+ CASE_TO_STR(ZB_HA_MINI_SPLIT_AC)
+ /* Intruder Alarms system */
+ CASE_TO_STR(ZB_HA_ISA_CONTROL_AND_INDICATING_EQUIPMENT)
+ CASE_TO_STR(ZB_HA_ISA_ANCILLARY_CONTROL_EQUIPMENT)
+ CASE_TO_STR(ZB_HA_ISA_ZONE)
+ default:
+ return "ZB_HA_UNKNOWN_DEVICE";
+ }
+}
+
API int zb_simple_desc_create(zb_zdo_simple_desc_h *handle)
{
RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
static void zigbee_simple_desc_rsp(nwk_addr addr16, unsigned char len,
const zb_zdo_simple_desc_h handle, void *user_data)
{
- int ret;
+ int i, ret;
unsigned char param_u8;
unsigned short param_u16;
unsigned short *in_clusters;
if (ZIGBEE_ERROR_NONE != ret)
msg("zb_simple_desc_get_profile_id() Fail(0x%X)", ret);
else
- msg(" profile_id = 0x%x", param_u16);
+ msg(" profile_id = 0x%x (%s)", param_u16, zb_get_profile_id_string(param_u16));
ret = zb_simple_desc_get_device_id(handle, ¶m_u16);
if (ZIGBEE_ERROR_NONE != ret)
msg("zb_simple_desc_get_device_id() Fail(0x%X)", ret);
else
- msg(" device_id = 0x%x", param_u16);
+ msg(" device_id = 0x%x (%s)", param_u16, zb_get_device_id_string(param_u16));
ret = zb_simple_desc_get_device_ver(handle, ¶m_u16);
if (ZIGBEE_ERROR_NONE != ret)
if (ZIGBEE_ERROR_NONE != ret) {
msg("zb_simple_desc_get_in_clusters() Fail(0x%X)", ret);
} else {
- msg(" %04X %04X %04X %04X %04X %04X %04X",
- in_clusters[0], in_clusters[1], in_clusters[2], in_clusters[3],
- in_clusters[4], in_clusters[5], in_clusters[6]);
+ for (i = 0; i < param_u8; i++)
+ msg(" %04X (%s)", in_clusters[i], zb_get_cluster_name(in_clusters[i]));
}
ret = zb_simple_desc_get_num_of_out_clusters(handle, ¶m_u8);
ret = zb_simple_desc_get_out_clusters(handle, &out_clusters);
if (ZIGBEE_ERROR_NONE != ret)
msg("zb_simple_desc_get_out_clusters() Fail(0x%X)", ret);
- else
- msg(" %04X ", out_clusters[0]);
+ else {
+ for (i = 0; i < param_u8; i++)
+ msg(" %04X (%s)", out_clusters[i], zb_get_cluster_name(out_clusters[i]));
+ }
}
static void zigbee_match_desc_rsp(unsigned char status, nwk_addr addr16,