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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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__ */
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)
{
}
/*
+ * 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,
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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__ */
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__ */
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__ */
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);
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__ */
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);
+}
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
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);
+ }
+}
gpointer user_data; /**< ZigBee servcie interface data */
+ ZblibServiceInterfaceNotificationCb_t noti_cb; /**< Notification callback */
+ gpointer noti_cb_data; /**< Notification callback data */
+
ZigBeeService *service; /**< ZigBee Service */
};
/* 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);
+}