Add notification handling framework
authorSuresh Kumar N <suresh.n@samsung.com>
Mon, 16 Jan 2017 13:39:41 +0000 (19:09 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:10:25 +0000 (18:10 +0900)
Change-Id: I348e88ae18b423b259aff0db70bffa48b0f49125
Signed-off-by: Suresh Kumar N <suresh.n@samsung.com>
47 files changed:
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_custom.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_mfglib_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_service.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_alarm.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_basic.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_color_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_door_lock.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_fan_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_global_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_group.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_ias_zone.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_identify.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_level_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_on_off.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_poll_control.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_scene.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zcl_thermostat.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zdo_bind.h
zigbee-daemon/zigbee-interface/include/zigbee_service_dbus_interface_zdo_dev_control.h
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_custom.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_mfglib_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_alarm.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_basic.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_color_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_door_lock.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_fan_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_group.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_ias_zone.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_identify.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_level_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_on_off.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_thermostat.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_bind.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c
zigbee-daemon/zigbee-lib/include/zblib_driver.h
zigbee-daemon/zigbee-lib/include/zblib_plugin.h
zigbee-daemon/zigbee-lib/include/zblib_service.h
zigbee-daemon/zigbee-lib/include/zblib_service_interface.h
zigbee-daemon/zigbee-lib/src/zblib_driver.c
zigbee-daemon/zigbee-lib/src/zblib_plugin.c
zigbee-daemon/zigbee-lib/src/zblib_service.c
zigbee-daemon/zigbee-lib/src/zblib_service_interface.c

index a2a03c8..a2d903f 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_custom_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_custom_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_CUSTOM_H__ */
index 183accb..374002d 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_mfglib_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_mfglib_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_MFGLIB_CONTROL_H__ */
index 08adeec..cd8f01a 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_service_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_SERVICE_H__ */
index 77f1581..eca2cda 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_alarm_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_alarm_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_ALARM_H__ */
index dd196ca..9c32a74 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_basic_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_basic_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_BASIC_H__ */
index 60e2b1a..f1cb6f5 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_color_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_color_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_COLOR_CONTROL_H__ */
index 770591c..67d63bb 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_door_lock_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_door_lock_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_DOOR_LOCK_H__ */
index 3ff4e7e..de5137b 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_fan_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_fan_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_FAN_CONTROL_H__ */
index 0d1f6c2..6f02579 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_global_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_GLOBAL_CONTROL_H__ */
index 90418e3..844dfa6 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_group_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_group_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_GROUP_H__ */
index 6ea9af9..62fd9e8 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_ias_zone_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_ias_zone_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_IAS_ZONE_H__ */
index 4308d5c..a97ccae 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_identify_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_identify_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_IDENTIFYL_H__ */
index 98e9306..e769ced 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_level_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_level_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_LEVEL_CONTROL_H__ */
index c08a9a4..e6d5b8f 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_on_off_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_on_off_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_ON_OFF_H__ */
index 2ad3544..dae4329 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_poll_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_poll_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_POLL_CONTROL_H__ */
index c9da388..cf45e18 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_scene_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_scene_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_SCENE_H__ */
index ce99040..7fd5b2f 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zcl_thermostat_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zcl_thermostat_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZCL_THERMOSTAT_H__ */
index 1019acb..76fc549 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zdo_bind_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zdo_bind_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZDO_BIND_H__ */
index 4e35141..1c08679 100644 (file)
@@ -21,5 +21,7 @@
 
 gboolean zigbee_service_dbus_interface_zdo_dev_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object);
+void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
 
 #endif /* __ZIGBEE_SERVICE_DBUS_INTERFACE_ZDO_DEV_CONTROL_H__ */
index 33381a9..a2d379e 100644 (file)
@@ -114,6 +114,148 @@ static void zigbee_service_dbus_interface_initialize_interfaces(ZigBeeServiceInt
        Z_LOGD("ret: %d", ret);
 }
 
+static void zigbee_service_dbus_interface_noti_cb(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       ZblibDriverType_e driver_type;
+       guint notification_id;
+
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       /* Extract driver_type */
+       driver_type = ((noti_id & 0xFF000000) >> 24);
+
+       /* Extract notification_id */
+       notification_id = (noti_id & 0x000000FF);
+
+       Z_LOGI("Driver type: [%d] Notification ID: [%d]", driver_type, notification_id);
+
+       switch (driver_type) {
+       case ZBLIB_DRIVER_TYPE_ZCL_ALARM: {
+               zigbee_service_dbus_interface_zcl_alarm_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_CUSTOM: {
+               zigbee_service_dbus_interface_custom_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_DOOR_LOCK: {
+               zigbee_service_dbus_interface_zcl_door_lock_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_FAN_CONTROL: {
+               zigbee_service_dbus_interface_zcl_fan_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_LEVEL_CONTROL: {
+               zigbee_service_dbus_interface_zcl_level_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_MFGLIB_CONTROL: {
+               zigbee_service_dbus_interface_mfglib_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_ON_OFF: {
+               zigbee_service_dbus_interface_zcl_on_off_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_SERVICE: {
+               zigbee_service_dbus_interface_service_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_THERMOSTAT: {
+               zigbee_service_dbus_interface_zcl_thermostat_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_BASIC: {
+               zigbee_service_dbus_interface_zcl_basic_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_GLOBAL_CONTROL: {
+               zigbee_service_dbus_interface_zcl_global_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_IAS_ZONE: {
+               zigbee_service_dbus_interface_zcl_ias_zone_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_IDENTIFY: {
+               zigbee_service_dbus_interface_zcl_identify_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_COLOR_CONTROL: {
+               zigbee_service_dbus_interface_zcl_color_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_GROUP: {
+               zigbee_service_dbus_interface_zcl_group_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_POLL_CONTROL: {
+               zigbee_service_dbus_interface_zcl_poll_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZCL_SCENE: {
+               zigbee_service_dbus_interface_zcl_scene_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL: {
+               zigbee_service_dbus_interface_zdo_dev_control_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_ZDO_BIND: {
+               zigbee_service_dbus_interface_zdo_bind_notification(service_interface,
+                       notification_id, noti_data, noti_data_len, noti_cb_data);
+       }
+       break;
+
+       case ZBLIB_DRIVER_TYPE_NONE: /* Fall through */
+       default: {
+               Z_LOGE("Unhandled driver type: [%d]", driver_type);
+       }
+       break;
+       }
+}
+
 static void zigbee_on_name_lost(GDBusConnection *connection,
        const gchar *name, gpointer user_data)
 {
@@ -264,6 +406,17 @@ gboolean zigbee_service_dbus_interface_init(ZigBeeService *service)
        }
 
        /*
+        * Set Service interface notification callback
+        */
+       ret = zblib_service_interface_set_noti_cb(service_interface,
+               zigbee_service_dbus_interface_noti_cb, NULL);
+       if (FALSE == ret) {
+               Z_LOGE("Set service interface notification callback failed!");
+
+               goto EXIT;
+       }
+
+       /*
         * Add Service interface object to 'service'
         */
        ret = zblib_service_add_service_interface(service,
index b054372..1e8416e 100644 (file)
@@ -261,6 +261,20 @@ static gboolean on_custom_send_to_local(ZigbeeCustom *custom_object,
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_custom_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_custom_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 4586110..be74db7 100644 (file)
@@ -1245,6 +1245,20 @@ static gboolean on_mfglib_control_get_rssi(ZigbeeMfglib_control *mfglib_control_
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_mfglib_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_mfglib_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index af23c3f..55a2d0a 100644 (file)
@@ -1000,6 +1000,20 @@ static gboolean on_service_get_node_type(ZigbeeService *service_object,
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_service_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index b1e852d..a2cc3cd 100644 (file)
@@ -434,6 +434,20 @@ static gboolean on_alarm_get_alarm(ZigbeeZcl_alarm *alarm_object,
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_alarm_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_alarm_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index e189ac7..25c8998 100644 (file)
@@ -85,6 +85,20 @@ static gboolean on_zclbasic_control_reset_factory_default(ZigbeeZcl_basic *zclba
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_basic_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_basic_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 2fe16b4..1b35239 100644 (file)
@@ -791,6 +791,20 @@ static gboolean on_zcl_color_move_color_temperature(ZigbeeZcl_color_control *zcl
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_color_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_color_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 75c650b..e920d74 100644 (file)
@@ -324,6 +324,20 @@ static gboolean on_door_lock_get_lock_state(ZigbeeZcl_door_lock *door_lock_objec
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_door_lock_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_door_lock_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 8904c6d..693d479 100644 (file)
@@ -314,6 +314,20 @@ static gboolean on_fan_control_get_fan_mode_sequence(
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_fan_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_fan_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index d19736f..a152345 100644 (file)
@@ -972,6 +972,20 @@ static gboolean on_zclglobal_control_discover_commands_generated(ZigbeeZcl_globa
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_global_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 6c3b36f..07ec59c 100644 (file)
@@ -455,6 +455,20 @@ static gboolean on_zcl_group_add_group_if_identifying(ZigbeeZcl_group *zcl_group
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_group_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_group_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 921a407..fc33af0 100644 (file)
@@ -89,6 +89,20 @@ static gboolean on_zclias_control_enroll_response(ZigbeeZcl_ias_zone *zclias_con
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_ias_zone_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_ias_zone_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 05a4c7f..8afeadf 100644 (file)
@@ -152,6 +152,20 @@ static gboolean on_zclidentify_control_query(ZigbeeZcl_identify *zclidentify_con
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_identify_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_identify_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 466e811..3b785dc 100644 (file)
@@ -506,6 +506,20 @@ static gboolean on_level_control_stop(ZigbeeZcl_level_control *level_control_obj
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_level_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_level_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 8c9d6dc..ce4603f 100644 (file)
@@ -152,6 +152,20 @@ static gboolean on_on_off_get_on_off_state(ZigbeeZcl_on_off *on_off_object,
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_on_off_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_on_off_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 85d618c..2665911 100644 (file)
@@ -288,6 +288,20 @@ static gboolean on_zcl_poll_control_set_short_poll_interval(ZigbeeZcl_poll_contr
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_poll_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_poll_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 1c42d98..946d549 100644 (file)
@@ -527,6 +527,20 @@ static gboolean on_zcl_scene_get_scene_membership(ZigbeeZcl_scene *zcl_scene_obj
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_scene_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_scene_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 9b449a6..75cae67 100644 (file)
@@ -402,6 +402,20 @@ static gboolean on_thermostat_setpoint_raise_lower(ZigbeeZcl_thermostat *thermos
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zcl_thermostat_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zcl_thermostat_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 41eca1f..d099772 100644 (file)
@@ -200,6 +200,20 @@ static gboolean on_zdo_bind_unbind_req(ZigbeeZdo_bind *zdo_bind_object,
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zdo_bind_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zdo_bind_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index b54d394..b252ec8 100644 (file)
@@ -1187,6 +1187,20 @@ static gboolean on_zdodev_control_nwk_disc_req(ZigbeeZdo_dev_control *zdodev_con
        return TRUE;
 }
 
+void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+       if (NULL == service_interface) {
+               Z_LOGE("service_interface is NULL");
+               return;
+       }
+
+       NOT_USED(noti_id);
+       NOT_USED(noti_data);
+       NOT_USED(noti_data_len);
+       NOT_USED(noti_cb_data);
+}
+
 gboolean zigbee_service_dbus_interface_zdo_dev_control_init(ZigBeeServiceInterface *service_interface,
        ZigbeeObjectSkeleton *zigbee_object)
 {
index 603b8a4..504d576 100644 (file)
@@ -47,8 +47,11 @@ gpointer zblib_driver_ref_request_data(ZigBeeDriver *driver,
        guint request_id);
 
 gboolean zblib_driver_dispatch_request(ZigBeeDriver *driver, guint request_id);
-
 void zblib_driver_send_response(ZigBeeDriver *driver,
        guint request_id, gpointer resp_data, guint resp_data_len);
 
+void zblib_driver_send_notification(ZigBeeDriver *driver,
+       guint noti_id, gpointer noti_data, guint noti_data_len);
+
+
 #endif /* __ZIGBEE_LIB_DRIVER_H__ */
index 5d2a3c3..bf12e14 100644 (file)
@@ -49,4 +49,7 @@ gboolean zblib_plugin_dispatch_request(ZigBeePlugin *plugin,
 void zblib_plugin_send_response(ZigBeePlugin *plugin,
        guint request_id, gpointer resp_data, guint resp_data_len);
 
+void zblib_plugin_send_notification(ZigBeePlugin *plugin,
+       guint noti_id, gpointer noti_data, guint noti_data_len);
+
 #endif /* __ZIGBEE_LIB_PLUGIN_H__ */
index 2457d26..6034098 100644 (file)
@@ -50,4 +50,7 @@ gboolean zblib_service_dispatch_request(ZigBeeService *service,
 void zblib_service_send_response(ZigBeeService *service,
        guint request_id, gpointer resp_data, guint resp_data_len);
 
+void zblib_service_send_notification(ZigBeeService *service,
+       guint noti_id, gpointer noti_data, guint noti_data_len);
+
 #endif /* __ZIGBEE_LIB_SERVICE_H__ */
index 985e1bc..96cdb9f 100644 (file)
 typedef void (*ZblibServiceInterfaceResponseCb_t)(ZigBeeServiceInterface *service_interface,
        guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data);
 
+/**< ZigBee Service interface notification callback function pointer */
+typedef void (*ZblibServiceInterfaceNotificationCb_t)(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data);
+
 /**< Service interface APIs */
 ZigBeeServiceInterface *zblib_service_interface_new(ZigBeeService *service,
        const gchar *object_name);
@@ -52,4 +56,9 @@ gboolean zblib_service_interface_dispatch_request(ZigBeeServiceInterface *servic
 void zblib_service_interface_send_response(ZigBeeServiceInterface *service_interface,
        guint request_id, gpointer resp_data, guint resp_data_len);
 
+gboolean zblib_service_interface_set_noti_cb(ZigBeeServiceInterface *service_interface,
+       ZblibServiceInterfaceNotificationCb_t noti_cb, gpointer noti_cb_data);
+void zblib_service_interface_send_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len);
+
 #endif /* __ZIGBEE_LIB_SERVICE_INTERFACE_H__ */
index 3461caf..1389aaf 100644 (file)
@@ -180,3 +180,24 @@ void zblib_driver_send_response(ZigBeeDriver *driver,
        zblib_plugin_send_response(plugin,
                request_id, resp_data, resp_data_len);
 }
+
+void zblib_driver_send_notification(ZigBeeDriver *driver,
+       guint noti_id, gpointer noti_data, guint noti_data_len)
+{
+       guint driver_noti_id;
+       ZigBeePlugin *plugin = NULL;
+       ZblibDriverType_e driver_type;
+
+       zblib_check_null_ret("driver", driver);
+
+       driver_type = driver->driver_type;
+
+       plugin = driver->plugin;
+       zblib_check_null_ret("plugin", plugin);
+
+       driver_noti_id = (driver_type << 24) | noti_id;
+
+       /* Send notification to plugin */
+       zblib_plugin_send_notification(plugin,
+               driver_noti_id, noti_data, noti_data_len);
+}
index d16fa75..8aa1fd6 100644 (file)
@@ -189,3 +189,18 @@ void zblib_plugin_send_response(ZigBeePlugin *plugin,
        zblib_service_send_response(service,
                request_id, resp_data, resp_data_len);
 }
+
+void zblib_plugin_send_notification(ZigBeePlugin *plugin,
+       guint noti_id, gpointer noti_data, guint noti_data_len)
+{
+       ZigBeeService *service = NULL;
+
+       zblib_check_null_ret("plugin", plugin);
+
+       service = plugin->service;
+       zblib_check_null_ret("service", service);
+
+       /* Send notification to service */
+       zblib_service_send_notification(service,
+               noti_id, noti_data, noti_data_len);
+}
\ No newline at end of file
index 657bc57..2217049 100644 (file)
@@ -444,3 +444,26 @@ void zblib_service_send_response(ZigBeeService *service,
        zblib_service_interface_send_response(service_interface,
                request_id, resp_data, resp_data_len);
 }
+
+void zblib_service_send_notification(ZigBeeService *service,
+       guint noti_id, gpointer noti_data, guint noti_data_len)
+{
+       GSList *interface_objs = NULL;
+       ZigBeeServiceInterface *service_interface = NULL;
+
+       zblib_check_null_ret("service", service);
+
+       interface_objs = service->interface_objs;
+       zblib_check_null_ret("interface_objs", interface_objs);
+
+       while (interface_objs) {
+               service_interface = (ZigBeeServiceInterface *)interface_objs->data;
+
+               /* Send notification to service interface */
+               zblib_service_interface_send_notification(service_interface,
+                       noti_id, noti_data, noti_data_len);
+
+               /* Move to next service interface */
+               interface_objs = g_slist_next(interface_objs);
+       }
+}
index 6b1c221..9c074fc 100644 (file)
@@ -28,6 +28,9 @@ struct zblib_service_interface_type {
 
        gpointer user_data; /**< ZigBee servcie interface data */
 
+       ZblibServiceInterfaceNotificationCb_t noti_cb; /**< Notification callback */
+       gpointer noti_cb_data; /**< Notification callback data */
+
        ZigBeeService *service; /**< ZigBee Service */
 };
 
@@ -176,3 +179,30 @@ void zblib_service_interface_send_response(ZigBeeServiceInterface *service_inter
        /* Free request */
        zblib_request_free(service_interface, request_id);
 }
+
+gboolean zblib_service_interface_set_noti_cb(ZigBeeServiceInterface *service_interface,
+       ZblibServiceInterfaceNotificationCb_t noti_cb, gpointer noti_cb_data)
+{
+       zblib_check_null_ret_error("service_interface", service_interface, FALSE);
+
+       service_interface->noti_cb = noti_cb;
+       service_interface->noti_cb_data = noti_cb_data;
+
+       return TRUE;
+}
+
+void zblib_service_interface_send_notification(ZigBeeServiceInterface *service_interface,
+       guint noti_id, gpointer noti_data, guint noti_data_len)
+{
+       ZblibServiceInterfaceNotificationCb_t noti_cb;
+
+       zblib_check_null_ret("service_interface", service_interface);
+
+       /* Fetch response callback and response callback data from request_id  */
+       noti_cb = service_interface->noti_cb;
+       zblib_check_null_ret("noti_cb", noti_cb);
+
+       /* Invoke send response function */
+       noti_cb(service_interface,
+               noti_id, noti_data, noti_data_len, service_interface->noti_cb_data);
+}