migration to iotivity ver 0.9.1
authorMinchul Lee <slotus.lee@samsung.com>
Sat, 4 Jul 2015 07:06:34 +0000 (16:06 +0900)
committeryoungman <yman.jung@samsung.com>
Tue, 3 Nov 2015 11:06:25 +0000 (20:06 +0900)
Change-Id: I3f50fcdda41c9c69fa7275c848d8eca2c020e898
Signed-off-by: Minchul Lee <slotus.lee@samsung.com>
26 files changed:
CMakeLists.txt
common/ic-common.h
common/ic-dbus.c
common/ic-dbus.h
common/ic-dbus.xml
daemon/CMakeLists.txt
daemon/icd-dbus.c
daemon/icd-ioty.cpp
daemon/icd-ioty.h
lib/CMakeLists.txt
lib/icl-client.c
lib/icl-client.h
lib/icl-dbus-type.c
lib/icl-dbus-type.h
lib/icl-dbus.c
lib/icl-dbus.h
lib/icl-device.c
lib/include/iotcon-constant.h
lib/include/iotcon-struct.h
lib/include/iotcon.h
packaging/iotcon.manifest
test/crud-test-client.c
test/crud-test-server.c
test/device-test-client.c
test/device-test-server.c
test/repr-test-client.c

index 30865d0..34514c7 100644 (file)
@@ -13,6 +13,12 @@ SET(CLIENT ${PROJECT_NAME})
 SET(DAEMON "${PROJECT_NAME}-daemon")
 SET(DBUS_INTERFACE "org.tizen.${PROJECT_NAME}.dbus")
 
+SET(OCLIB "oc")
+SET(OCLOGGER "oc_logger")
+SET(OCLOGGER_CORE "oc_logger_core")
+SET(CA "connectivity_abstraction")
+SET(OCTBSTACK "octbstack")
+
 ADD_SUBDIRECTORY(common)
 ADD_SUBDIRECTORY(lib)
 ADD_SUBDIRECTORY(daemon)
index 867fe55..489ff21 100644 (file)
@@ -35,6 +35,7 @@
 #define IC_DBUS_SIGNAL_DELETE "DELETE"
 #define IC_DBUS_SIGNAL_OBSERVE "OBSERVE"
 #define IC_DBUS_SIGNAL_DEVICE "DEVICE"
+#define IC_DBUS_SIGNAL_PLATFORM "PLATFORM"
 #define IC_DBUS_SIGNAL_PRESENCE "PRESENCE"
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_COMMON_H__ */
index 29e33eb..b9f266d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
+ * Generated by gdbus-codegen 2.44.1. DO NOT EDIT.
  *
  * The license of this code is the same as for the source it was derived from.
  */
@@ -1321,6 +1321,112 @@ static const _ExtendedGDBusMethodInfo _ic_dbus_method_info_get_device_info =
   FALSE
 };
 
+static const _ExtendedGDBusArgInfo _ic_dbus_method_info_register_platform_info_IN_ARG_platform_info =
+{
+  {
+    -1,
+    (gchar *) "platform_info",
+    (gchar *) "(sssssssssss)",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _ic_dbus_method_info_register_platform_info_IN_ARG_pointers[] =
+{
+  &_ic_dbus_method_info_register_platform_info_IN_ARG_platform_info,
+  NULL
+};
+
+static const _ExtendedGDBusArgInfo _ic_dbus_method_info_register_platform_info_OUT_ARG_ret =
+{
+  {
+    -1,
+    (gchar *) "ret",
+    (gchar *) "i",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _ic_dbus_method_info_register_platform_info_OUT_ARG_pointers[] =
+{
+  &_ic_dbus_method_info_register_platform_info_OUT_ARG_ret,
+  NULL
+};
+
+static const _ExtendedGDBusMethodInfo _ic_dbus_method_info_register_platform_info =
+{
+  {
+    -1,
+    (gchar *) "registerPlatformInfo",
+    (GDBusArgInfo **) &_ic_dbus_method_info_register_platform_info_IN_ARG_pointers,
+    (GDBusArgInfo **) &_ic_dbus_method_info_register_platform_info_OUT_ARG_pointers,
+    NULL
+  },
+  "handle-register-platform-info",
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo _ic_dbus_method_info_get_platform_info_IN_ARG_host_address =
+{
+  {
+    -1,
+    (gchar *) "host_address",
+    (gchar *) "s",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo _ic_dbus_method_info_get_platform_info_IN_ARG_signal_number =
+{
+  {
+    -1,
+    (gchar *) "signal_number",
+    (gchar *) "u",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _ic_dbus_method_info_get_platform_info_IN_ARG_pointers[] =
+{
+  &_ic_dbus_method_info_get_platform_info_IN_ARG_host_address,
+  &_ic_dbus_method_info_get_platform_info_IN_ARG_signal_number,
+  NULL
+};
+
+static const _ExtendedGDBusArgInfo _ic_dbus_method_info_get_platform_info_OUT_ARG_ret =
+{
+  {
+    -1,
+    (gchar *) "ret",
+    (gchar *) "i",
+    NULL
+  },
+  FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _ic_dbus_method_info_get_platform_info_OUT_ARG_pointers[] =
+{
+  &_ic_dbus_method_info_get_platform_info_OUT_ARG_ret,
+  NULL
+};
+
+static const _ExtendedGDBusMethodInfo _ic_dbus_method_info_get_platform_info =
+{
+  {
+    -1,
+    (gchar *) "getPlatformInfo",
+    (GDBusArgInfo **) &_ic_dbus_method_info_get_platform_info_IN_ARG_pointers,
+    (GDBusArgInfo **) &_ic_dbus_method_info_get_platform_info_OUT_ARG_pointers,
+    NULL
+  },
+  "handle-get-platform-info",
+  FALSE
+};
+
 static const _ExtendedGDBusArgInfo _ic_dbus_method_info_subscribe_presence_IN_ARG_host_address =
 {
   {
@@ -1536,6 +1642,8 @@ static const _ExtendedGDBusMethodInfo * const _ic_dbus_method_info_pointers[] =
   &_ic_dbus_method_info_observer_stop,
   &_ic_dbus_method_info_register_device_info,
   &_ic_dbus_method_info_get_device_info,
+  &_ic_dbus_method_info_register_platform_info,
+  &_ic_dbus_method_info_get_platform_info,
   &_ic_dbus_method_info_subscribe_presence,
   &_ic_dbus_method_info_unsubscribe_presence,
   &_ic_dbus_method_info_start_presence,
@@ -1604,6 +1712,7 @@ ic_dbus_override_properties (GObjectClass *klass, guint property_id_begin)
  * @handle_find_resource: Handler for the #icDbus::handle-find-resource signal.
  * @handle_get: Handler for the #icDbus::handle-get signal.
  * @handle_get_device_info: Handler for the #icDbus::handle-get-device-info signal.
+ * @handle_get_platform_info: Handler for the #icDbus::handle-get-platform-info signal.
  * @handle_notify_all: Handler for the #icDbus::handle-notify-all signal.
  * @handle_notify_list_of_observers: Handler for the #icDbus::handle-notify-list-of-observers signal.
  * @handle_observer_start: Handler for the #icDbus::handle-observer-start signal.
@@ -1611,6 +1720,7 @@ ic_dbus_override_properties (GObjectClass *klass, guint property_id_begin)
  * @handle_post: Handler for the #icDbus::handle-post signal.
  * @handle_put: Handler for the #icDbus::handle-put signal.
  * @handle_register_device_info: Handler for the #icDbus::handle-register-device-info signal.
+ * @handle_register_platform_info: Handler for the #icDbus::handle-register-platform-info signal.
  * @handle_register_resource: Handler for the #icDbus::handle-register-resource signal.
  * @handle_send_response: Handler for the #icDbus::handle-send-response signal.
  * @handle_start_presence: Handler for the #icDbus::handle-start-presence signal.
@@ -2070,6 +2180,53 @@ ic_dbus_default_init (icDbusIface *iface)
     G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT);
 
   /**
+   * icDbus::handle-register-platform-info:
+   * @object: A #icDbus.
+   * @invocation: A #GDBusMethodInvocation.
+   * @arg_platform_info: Argument passed by remote caller.
+   *
+   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-tizen-iotcon-dbus.registerPlatformInfo">registerPlatformInfo()</link> D-Bus method.
+   *
+   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call ic_dbus_complete_register_platform_info() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+   *
+   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
+   */
+  g_signal_new ("handle-register-platform-info",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (icDbusIface, handle_register_platform_info),
+    g_signal_accumulator_true_handled,
+    NULL,
+    g_cclosure_marshal_generic,
+    G_TYPE_BOOLEAN,
+    2,
+    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
+
+  /**
+   * icDbus::handle-get-platform-info:
+   * @object: A #icDbus.
+   * @invocation: A #GDBusMethodInvocation.
+   * @arg_host_address: Argument passed by remote caller.
+   * @arg_signal_number: Argument passed by remote caller.
+   *
+   * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-tizen-iotcon-dbus.getPlatformInfo">getPlatformInfo()</link> D-Bus method.
+   *
+   * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call ic_dbus_complete_get_platform_info() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+   *
+   * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
+   */
+  g_signal_new ("handle-get-platform-info",
+    G_TYPE_FROM_INTERFACE (iface),
+    G_SIGNAL_RUN_LAST,
+    G_STRUCT_OFFSET (icDbusIface, handle_get_platform_info),
+    g_signal_accumulator_true_handled,
+    NULL,
+    g_cclosure_marshal_generic,
+    G_TYPE_BOOLEAN,
+    3,
+    G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_UINT);
+
+  /**
    * icDbus::handle-subscribe-presence:
    * @object: A #icDbus.
    * @invocation: A #GDBusMethodInvocation.
@@ -4193,6 +4350,220 @@ _out:
 }
 
 /**
+ * ic_dbus_call_register_platform_info:
+ * @proxy: A #icDbusProxy.
+ * @arg_platform_info: Argument to pass with the method invocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously invokes the <link linkend="gdbus-method-org-tizen-iotcon-dbus.registerPlatformInfo">registerPlatformInfo()</link> D-Bus method on @proxy.
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call ic_dbus_call_register_platform_info_finish() to get the result of the operation.
+ *
+ * See ic_dbus_call_register_platform_info_sync() for the synchronous, blocking version of this method.
+ */
+void
+ic_dbus_call_register_platform_info (
+    icDbus *proxy,
+    GVariant *arg_platform_info,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
+{
+  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
+    "registerPlatformInfo",
+    g_variant_new ("(@(sssssssssss))",
+                   arg_platform_info),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    callback,
+    user_data);
+}
+
+/**
+ * ic_dbus_call_register_platform_info_finish:
+ * @proxy: A #icDbusProxy.
+ * @out_ret: (out): Return location for return parameter or %NULL to ignore.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to ic_dbus_call_register_platform_info().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with ic_dbus_call_register_platform_info().
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+ic_dbus_call_register_platform_info_finish (
+    icDbus *proxy,
+    gint *out_ret,
+    GAsyncResult *res,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "(i)",
+                 out_ret);
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
+ * ic_dbus_call_register_platform_info_sync:
+ * @proxy: A #icDbusProxy.
+ * @arg_platform_info: Argument to pass with the method invocation.
+ * @out_ret: (out): Return location for return parameter or %NULL to ignore.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously invokes the <link linkend="gdbus-method-org-tizen-iotcon-dbus.registerPlatformInfo">registerPlatformInfo()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ *
+ * See ic_dbus_call_register_platform_info() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+ic_dbus_call_register_platform_info_sync (
+    icDbus *proxy,
+    GVariant *arg_platform_info,
+    gint *out_ret,
+    GCancellable *cancellable,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
+    "registerPlatformInfo",
+    g_variant_new ("(@(sssssssssss))",
+                   arg_platform_info),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "(i)",
+                 out_ret);
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
+ * ic_dbus_call_get_platform_info:
+ * @proxy: A #icDbusProxy.
+ * @arg_host_address: Argument to pass with the method invocation.
+ * @arg_signal_number: Argument to pass with the method invocation.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously invokes the <link linkend="gdbus-method-org-tizen-iotcon-dbus.getPlatformInfo">getPlatformInfo()</link> D-Bus method on @proxy.
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call ic_dbus_call_get_platform_info_finish() to get the result of the operation.
+ *
+ * See ic_dbus_call_get_platform_info_sync() for the synchronous, blocking version of this method.
+ */
+void
+ic_dbus_call_get_platform_info (
+    icDbus *proxy,
+    const gchar *arg_host_address,
+    guint arg_signal_number,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
+{
+  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
+    "getPlatformInfo",
+    g_variant_new ("(su)",
+                   arg_host_address,
+                   arg_signal_number),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    callback,
+    user_data);
+}
+
+/**
+ * ic_dbus_call_get_platform_info_finish:
+ * @proxy: A #icDbusProxy.
+ * @out_ret: (out): Return location for return parameter or %NULL to ignore.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to ic_dbus_call_get_platform_info().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with ic_dbus_call_get_platform_info().
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+ic_dbus_call_get_platform_info_finish (
+    icDbus *proxy,
+    gint *out_ret,
+    GAsyncResult *res,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "(i)",
+                 out_ret);
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
+ * ic_dbus_call_get_platform_info_sync:
+ * @proxy: A #icDbusProxy.
+ * @arg_host_address: Argument to pass with the method invocation.
+ * @arg_signal_number: Argument to pass with the method invocation.
+ * @out_ret: (out): Return location for return parameter or %NULL to ignore.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously invokes the <link linkend="gdbus-method-org-tizen-iotcon-dbus.getPlatformInfo">getPlatformInfo()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ *
+ * See ic_dbus_call_get_platform_info() for the asynchronous version of this method.
+ *
+ * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
+ */
+gboolean
+ic_dbus_call_get_platform_info_sync (
+    icDbus *proxy,
+    const gchar *arg_host_address,
+    guint arg_signal_number,
+    gint *out_ret,
+    GCancellable *cancellable,
+    GError **error)
+{
+  GVariant *_ret;
+  _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
+    "getPlatformInfo",
+    g_variant_new ("(su)",
+                   arg_host_address,
+                   arg_signal_number),
+    G_DBUS_CALL_FLAGS_NONE,
+    -1,
+    cancellable,
+    error);
+  if (_ret == NULL)
+    goto _out;
+  g_variant_get (_ret,
+                 "(i)",
+                 out_ret);
+  g_variant_unref (_ret);
+_out:
+  return _ret != NULL;
+}
+
+/**
  * ic_dbus_call_subscribe_presence:
  * @proxy: A #icDbusProxy.
  * @arg_host_address: Argument to pass with the method invocation.
@@ -4996,6 +5367,48 @@ ic_dbus_complete_get_device_info (
 }
 
 /**
+ * ic_dbus_complete_register_platform_info:
+ * @object: A #icDbus.
+ * @invocation: (transfer full): A #GDBusMethodInvocation.
+ * @ret: Parameter to return.
+ *
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-tizen-iotcon-dbus.registerPlatformInfo">registerPlatformInfo()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
+ *
+ * This method will free @invocation, you cannot use it afterwards.
+ */
+void
+ic_dbus_complete_register_platform_info (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    gint ret)
+{
+  g_dbus_method_invocation_return_value (invocation,
+    g_variant_new ("(i)",
+                   ret));
+}
+
+/**
+ * ic_dbus_complete_get_platform_info:
+ * @object: A #icDbus.
+ * @invocation: (transfer full): A #GDBusMethodInvocation.
+ * @ret: Parameter to return.
+ *
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-tizen-iotcon-dbus.getPlatformInfo">getPlatformInfo()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
+ *
+ * This method will free @invocation, you cannot use it afterwards.
+ */
+void
+ic_dbus_complete_get_platform_info (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    gint ret)
+{
+  g_dbus_method_invocation_return_value (invocation,
+    g_variant_new ("(i)",
+                   ret));
+}
+
+/**
  * ic_dbus_complete_subscribe_presence:
  * @object: A #icDbus.
  * @invocation: (transfer full): A #GDBusMethodInvocation.
index 3286945..4a70ad1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
+ * Generated by gdbus-codegen 2.44.1. DO NOT EDIT.
  *
  * The license of this code is the same as for the source it was derived from.
  */
@@ -72,6 +72,12 @@ struct _icDbusIface
     const gchar *arg_host_address,
     guint arg_signal_number);
 
+  gboolean (*handle_get_platform_info) (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    const gchar *arg_host_address,
+    guint arg_signal_number);
+
   gboolean (*handle_notify_all) (
     icDbus *object,
     GDBusMethodInvocation *invocation,
@@ -118,6 +124,11 @@ struct _icDbusIface
     GDBusMethodInvocation *invocation,
     GVariant *arg_device_info);
 
+  gboolean (*handle_register_platform_info) (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    GVariant *arg_platform_info);
+
   gboolean (*handle_register_resource) (
     icDbus *object,
     GDBusMethodInvocation *invocation,
@@ -264,6 +275,16 @@ void ic_dbus_complete_get_device_info (
     GDBusMethodInvocation *invocation,
     gint ret);
 
+void ic_dbus_complete_register_platform_info (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    gint ret);
+
+void ic_dbus_complete_get_platform_info (
+    icDbus *object,
+    GDBusMethodInvocation *invocation,
+    gint ret);
+
 void ic_dbus_complete_subscribe_presence (
     icDbus *object,
     GDBusMethodInvocation *invocation,
@@ -699,6 +720,48 @@ gboolean ic_dbus_call_get_device_info_sync (
     GCancellable *cancellable,
     GError **error);
 
+void ic_dbus_call_register_platform_info (
+    icDbus *proxy,
+    GVariant *arg_platform_info,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data);
+
+gboolean ic_dbus_call_register_platform_info_finish (
+    icDbus *proxy,
+    gint *out_ret,
+    GAsyncResult *res,
+    GError **error);
+
+gboolean ic_dbus_call_register_platform_info_sync (
+    icDbus *proxy,
+    GVariant *arg_platform_info,
+    gint *out_ret,
+    GCancellable *cancellable,
+    GError **error);
+
+void ic_dbus_call_get_platform_info (
+    icDbus *proxy,
+    const gchar *arg_host_address,
+    guint arg_signal_number,
+    GCancellable *cancellable,
+    GAsyncReadyCallback callback,
+    gpointer user_data);
+
+gboolean ic_dbus_call_get_platform_info_finish (
+    icDbus *proxy,
+    gint *out_ret,
+    GAsyncResult *res,
+    GError **error);
+
+gboolean ic_dbus_call_get_platform_info_sync (
+    icDbus *proxy,
+    const gchar *arg_host_address,
+    guint arg_signal_number,
+    gint *out_ret,
+    GCancellable *cancellable,
+    GError **error);
+
 void ic_dbus_call_subscribe_presence (
     icDbus *proxy,
     const gchar *arg_host_address,
index f18a0e4..3423294 100644 (file)
                        <arg type="u" name="signal_number" direction="in"/>
                        <arg type="i" name="ret" direction="out"/>
                </method>
+               <method name="registerPlatformInfo">
+                       <arg type="(sssssssssss)" name="platform_info" direction="in"/>
+                       <arg type="i" name="ret" direction="out"/>
+               </method>
+               <method name="getPlatformInfo">
+                       <arg type="s" name="host_address" direction="in"/>
+                       <arg type="u" name="signal_number" direction="in"/>
+                       <arg type="i" name="ret" direction="out"/>
+               </method>
                <method name="subscribePresence">
                        <arg type="s" name="host_address" direction="in"/>
                        <arg type="s" name="type" direction="in"/>
index 26b18f8..11597d8 100644 (file)
@@ -1,12 +1,6 @@
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/include)
 
-SET(OCLIB "oc")
-SET(OCLOGGER "oc_logger")
-SET(OCLOGGER_CORE "oc_logger_core")
-SET(COAP "coap")
-SET(OCTBSTACK "octbstack")
-
 FILE(GLOB DAEMON_SRCS *.c *.cpp ${CMAKE_SOURCE_DIR}/common/*.c)
 
 pkg_check_modules(daemon_pkgs REQUIRED gio-2.0 dlog gio-unix-2.0)
@@ -18,8 +12,14 @@ ADD_DEFINITIONS("-DIOTCON_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
 ADD_EXECUTABLE(${DAEMON} ${DAEMON_SRCS})
 ADD_DEPENDENCIES(${DAEMON} GENERATED_DBUS_CODE)
 
-TARGET_LINK_LIBRARIES(${DAEMON} ${daemon_pkgs_LIBRARIES} ${OCLIB} ${OCLOGGER}
-       ${OCLOGGER_CORE} ${COAP} ${OCTBSTACK})
+TARGET_LINK_LIBRARIES(${DAEMON}
+       ${daemon_pkgs_LIBRARIES}
+       ${OCLIB}
+       ${OCLOGGER}
+       ${OCLOGGER_CORE}
+       ${CA}
+       ${OCTBSTACK}
+)
 
 INSTALL(TARGETS ${DAEMON} DESTINATION ${BIN_INSTALL_DIR})
 
index 6d20d39..02bf53d 100644 (file)
@@ -634,7 +634,7 @@ static gboolean _dbus_handle_send_response(icDbus *object,
        return TRUE;
 }
 
-
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 static gboolean _dbus_handle_register_device_info(icDbus *object,
                GDBusMethodInvocation *invocation, GVariant *device_info)
 {
@@ -667,6 +667,40 @@ static gboolean _dbus_handle_get_device_info(icDbus *object,
 
        return TRUE;
 }
+#endif
+
+static gboolean _dbus_handle_register_platform_info(icDbus *object,
+               GDBusMethodInvocation *invocation, GVariant *platform_info)
+{
+       int ret;
+
+       ret = icd_ioty_register_platform_info(platform_info);
+       if (IOTCON_ERROR_NONE != ret)
+               ERR("icd_ioty_register_platform_info() Fail(%d)", ret);
+
+       ic_dbus_complete_register_platform_info(object, invocation, ret);
+
+       return TRUE;
+}
+
+
+static gboolean _dbus_handle_get_platform_info(icDbus *object,
+               GDBusMethodInvocation *invocation,
+               const gchar *host_address,
+               guint signal_number)
+{
+       int ret;
+       const gchar *sender;
+
+       sender = g_dbus_method_invocation_get_sender(invocation);
+       ret = icd_ioty_get_platform_info(host_address, signal_number, sender);
+       if (IOTCON_ERROR_NONE != ret)
+               ERR("icd_ioty_get_platform_info() Fail(%d)", ret);
+
+       ic_dbus_complete_get_platform_info(object, invocation, ret);
+
+       return TRUE;
+}
 
 
 static gboolean _dbus_handle_start_presence(icDbus *object,
@@ -785,10 +819,16 @@ static void _dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name,
                        G_CALLBACK(_dbus_handle_notify_all), NULL);
        g_signal_connect(dbus_object, "handle-send-response",
                        G_CALLBACK(_dbus_handle_send_response), NULL);
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
        g_signal_connect(dbus_object, "handle-register-device-info",
                        G_CALLBACK(_dbus_handle_register_device_info), NULL);
        g_signal_connect(dbus_object, "handle-get-device-info",
                        G_CALLBACK(_dbus_handle_get_device_info), NULL);
+#endif
+       g_signal_connect(dbus_object, "handle-register-platform-info",
+                       G_CALLBACK(_dbus_handle_register_platform_info), NULL);
+       g_signal_connect(dbus_object, "handle-get-platform-info",
+                       G_CALLBACK(_dbus_handle_get_platform_info), NULL);
        g_signal_connect(dbus_object, "handle-start-presence",
                        G_CALLBACK(_dbus_handle_start_presence), NULL);
        g_signal_connect(dbus_object, "handle-stop-presence",
index 877486f..a35bf75 100644 (file)
@@ -31,9 +31,6 @@ extern "C" {
 }
 
 #define ICD_COAP "coap://"
-#define ICD_UNICAST_RESOURCE_DISCOVERY "/oc/core"
-#define ICD_MULTICAST_RESOURCE_DISCOVERY "/oc/core"
-#define ICD_DEVICE_DISCOVERY "/oc/core/d"
 
 using namespace std;
 using namespace OC;
@@ -348,9 +345,10 @@ namespace icdIotivityHandler {
                        resource_host = resource->host();
                        resource_host.erase(0, strlen(ICD_COAP));
 
-                       value = g_variant_new("(ssiasi)",
+                       value = g_variant_new("(sssiasi)",
                                        resource->uri().c_str(),
                                        resource_host.c_str(),
+                                       resource->sid().c_str(),
                                        resource->isObservable(),
                                        builder,
                                        ifaces);
@@ -362,6 +360,7 @@ namespace icdIotivityHandler {
                }
        };
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
        class deviceObject
        {
        private:
@@ -426,6 +425,69 @@ namespace icdIotivityHandler {
                        icd_dbus_emit_signal(signal_name, m_sender.c_str(), value);
                }
        };
+#endif
+
+       class platformObject
+       {
+       private:
+               unsigned int m_signalNumber;
+               string m_sender;
+
+       public:
+               platformObject(unsigned int signalNumber, const char *sender)
+               {
+                       m_signalNumber = signalNumber;
+                       m_sender = sender;
+               }
+
+               void receivedPlatformInfo(const OCRepresentation& ocRep)
+               {
+                       FN_CALL;
+                       GVariant *value;
+                       char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0};
+
+                       string platformId;;
+                       string manufacturerName;
+                       string manufacturerUrl;
+                       string modelNumber;
+                       string dateOfManufacture;
+                       string platformVersion;
+                       string osVersion;
+                       string hardwardVersion;
+                       string firmwareVersion;
+                       string supportUrl;
+                       string systemTime;
+
+                       ocRep.getValue("pi", platformId);
+                       ocRep.getValue("mnmn", manufacturerName);
+                       ocRep.getValue("mnml", manufacturerUrl);
+                       ocRep.getValue("mnmo", modelNumber);
+                       ocRep.getValue("mndt", dateOfManufacture);
+                       ocRep.getValue("mnpv", platformVersion);
+                       ocRep.getValue("mnos", osVersion);
+                       ocRep.getValue("mnhw", hardwardVersion);
+                       ocRep.getValue("mnfv", firmwareVersion);
+                       ocRep.getValue("mnsl", supportUrl);
+                       ocRep.getValue("st", systemTime);
+
+                       value = g_variant_new("(sssssssssss)",
+                                       platformId.c_str(),
+                                       manufacturerName.c_str(),
+                                       manufacturerUrl.c_str(),
+                                       modelNumber.c_str(),
+                                       dateOfManufacture.c_str(),
+                                       platformVersion.c_str(),
+                                       osVersion.c_str(),
+                                       hardwardVersion.c_str(),
+                                       firmwareVersion.c_str(),
+                                       supportUrl.c_str(),
+                                       systemTime.c_str());
+
+                       snprintf(signal_name, sizeof(signal_name), "%s_%u", IC_DBUS_SIGNAL_PLATFORM,
+                                       m_signalNumber);
+                       icd_dbus_emit_signal(signal_name, m_sender.c_str(), value);
+               }
+       };
 
        class presenceObject
        {
@@ -598,7 +660,6 @@ static OCEntityHandlerResult _icd_ioty_request_handler(
 extern "C" OCResourceHandle icd_ioty_register_resource(const char *uri,
                const char* const* res_types, int ifaces, uint8_t properties)
 {
-       FN_CALL;
        OCStackResult ret = OC_STACK_OK;
        string resUri;
        string resType;
@@ -655,7 +716,6 @@ extern "C" OCResourceHandle icd_ioty_register_resource(const char *uri,
 
 extern "C" int icd_ioty_unregister_resource(OCResourceHandle resource_handle)
 {
-       FN_CALL;
        OCStackResult result;
        try {
                result = unregisterResource(resource_handle);
@@ -881,7 +941,6 @@ extern "C" int icd_ioty_notify_all(int resHandle)
 
 extern "C" int icd_ioty_send_response(GVariant *resp)
 {
-       FN_CALL;
        int ret;
        int result;
        int error_code;
@@ -967,19 +1026,19 @@ extern "C" int icd_ioty_send_response(GVariant *resp)
 extern "C" int icd_ioty_find_resource(const char *host_address, const char *resource_type,
                unsigned int signal_number, const char *sender)
 {
-       FN_CALL;
+       OCConnectivityType conn_type = OC_IPV4;
        OCStackResult ret;
-       ostringstream resource_name;
+       ostringstream requestHost;
 
-       resource_name << ICD_COAP;
-
-       if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address))
-               resource_name << host_address << ICD_MULTICAST_RESOURCE_DISCOVERY;
-       else
-               resource_name << host_address << ICD_UNICAST_RESOURCE_DISCOVERY;
+       if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address)) {
+               requestHost << OC_MULTICAST_DISCOVERY_URI;
+               conn_type = OC_ALL;
+       } else {
+               requestHost << ICD_COAP << host_address << OC_MULTICAST_DISCOVERY_URI;
+       }
 
-       if (IC_STR_EQUAL != strcmp(resource_type, IC_STR_NULL))
-               resource_name << "?rt=" << resource_type;
+       if (IC_STR_EQUAL != strcmp(IC_STR_NULL, resource_type))
+               requestHost << "?rt=" << resource_type;
 
        shared_ptr<icdIotivityHandler::findObject> object
                = make_shared<icdIotivityHandler::findObject>(signal_number, sender);
@@ -987,7 +1046,7 @@ extern "C" int icd_ioty_find_resource(const char *host_address, const char *reso
                        object, placeholders::_1);
 
        try {
-               ret = findResource("", resource_name.str(), findCallback);
+               ret = findResource("", requestHost.str(), conn_type, findCallback);
        } catch (OCException& e) {
                ERR("findResource() Fail(%s)", e.reason().c_str());
                return IOTCON_ERROR_IOTIVITY;
@@ -1050,7 +1109,10 @@ static OCResource::Ptr _icd_ioty_create_oc_resource(GVariant *client)
                        resource_ifs.push_back(GROUP_INTERFACE);
        }
 
-       OCResource::Ptr ocResource = constructResourceObject(resource_host, uri,
+       /* TODO : OC_ALL has wrong behaviour in iotivity version 0.9.1.
+        * Therefore, OC_IPV4 SHOULD be changed to OC_ALL later.
+        */
+       OCResource::Ptr ocResource = constructResourceObject(resource_host, uri, OC_IPV4,
                        is_observable, resource_types, resource_ifs);
 
        ocResource->setHeaderOptions(header_options);
@@ -1062,7 +1124,6 @@ static OCResource::Ptr _icd_ioty_create_oc_resource(GVariant *client)
 extern "C" int icd_ioty_get(GVariant *resource, GVariant *query,
                unsigned int signal_number, const char *sender)
 {
-       FN_CALL;
        OCStackResult ret;
        OCResource::Ptr ocResource;
        QueryParamsMap queryParams;
@@ -1099,7 +1160,6 @@ extern "C" int icd_ioty_get(GVariant *resource, GVariant *query,
 extern "C" int icd_ioty_put(GVariant *resource, const char *repr, GVariant *query,
                unsigned int signal_number, const char *sender)
 {
-       FN_CALL;
        int ret;
        OCStackResult ocRet;
        OCResource::Ptr ocResource;
@@ -1145,7 +1205,6 @@ extern "C" int icd_ioty_put(GVariant *resource, const char *repr, GVariant *quer
 extern "C" int icd_ioty_post(GVariant *resource, const char *repr, GVariant *query,
                unsigned int signal_number, const char *sender)
 {
-       FN_CALL;
        int ret;
        OCStackResult ocRet;
        OCResource::Ptr ocResource;
@@ -1191,7 +1250,6 @@ extern "C" int icd_ioty_post(GVariant *resource, const char *repr, GVariant *que
 extern "C" int icd_ioty_delete(GVariant *resource, unsigned int signal_number,
                const char *sender)
 {
-       FN_CALL;
        OCStackResult ret;
        OCResource::Ptr ocResource;
 
@@ -1295,10 +1353,9 @@ extern "C" int icd_ioty_observer_stop(void *observe_h)
        return IOTCON_ERROR_NONE;
 }
 
-
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 extern "C" int icd_ioty_register_device_info(GVariant *value)
 {
-       FN_CALL;
        OCStackResult ret;
 
        OCDeviceInfo info = {0};
@@ -1336,9 +1393,14 @@ extern "C" int icd_ioty_register_device_info(GVariant *value)
 extern "C" int icd_ioty_get_device_info(const char *host_address,
                unsigned int signal_number, const char *sender)
 {
-       FN_CALL;
        OCStackResult ret;
-       string resHost = string(ICD_COAP) + host_address + string(ICD_DEVICE_DISCOVERY);
+       ostringstream requestHost;
+       std::string deviceDiscoveryURI = "/oic/d";
+
+       if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address))
+               requestHost << host_address << ":" << OC_MULTICAST_PORT << deviceDiscoveryURI;
+       else
+               requestHost << ICD_COAP << host_address << deviceDiscoveryURI;
 
        shared_ptr<icdIotivityHandler::deviceObject> object
                = make_shared<icdIotivityHandler::deviceObject>(signal_number, sender);
@@ -1348,7 +1410,10 @@ extern "C" int icd_ioty_get_device_info(const char *host_address,
                        placeholders::_1);
 
        try {
-               ret = getDeviceInfo("", resHost, findDeviceCallback);
+               /* TODO : OC_ALL has wrong behaviour in iotivity version 0.9.1.
+                * Therefore, OC_IPV4 SHOULD be changed to OC_ALL later.
+                */
+               ret = getDeviceInfo("", requestHost, OC_IPV4, findDeviceCallback);
        } catch (OCException& e) {
                ERR("getDeviceInfo() Fail(%s)", e.reason().c_str());
                return IOTCON_ERROR_IOTIVITY;
@@ -1361,6 +1426,78 @@ extern "C" int icd_ioty_get_device_info(const char *host_address,
 
        return IOTCON_ERROR_NONE;
 }
+#endif
+
+extern "C" int icd_ioty_register_platform_info(GVariant *value)
+{
+       OCStackResult ret;
+       OCPlatformInfo info = {0};
+
+       g_variant_get(value, "(&s&s&s&s&s&s&s&s&s&s&s)",
+                       &info.platformID,
+                       &info.manufacturerName,
+                       &info.manufacturerUrl,
+                       &info.modelNumber,
+                       &info.dateOfManufacture,
+                       &info.platformVersion,
+                       &info.operatingSystemVersion,
+                       &info.hardwareVersion,
+                       &info.firmwareVersion,
+                       &info.supportUrl,
+                       &info.systemTime);
+
+       try {
+               ret = registerPlatformInfo(info);
+       } catch (OCException& e) {
+               ERR("registerPlatformInfo() Fail(%s)", e.reason().c_str());
+               return IOTCON_ERROR_IOTIVITY;
+       }
+
+       if (OC_STACK_OK != ret) {
+               ERR("registerPlatformInfo() Fail(%d)", ret);
+               return IOTCON_ERROR_IOTIVITY;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
+
+
+extern "C" int icd_ioty_get_platform_info(const char *host_address,
+               unsigned int signal_number, const char *sender)
+{
+       OCStackResult ret;
+       ostringstream requestHost;
+       std::string platformDiscoveryURI = "/oic/p";
+
+       if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address))
+               requestHost << host_address << ":" << OC_MULTICAST_PORT << platformDiscoveryURI;
+       else
+               requestHost << ICD_COAP << host_address << platformDiscoveryURI;
+
+       shared_ptr<icdIotivityHandler::platformObject> object
+               = make_shared<icdIotivityHandler::platformObject>(signal_number, sender);
+       FindPlatformCallback findPlatformCallback = bind(
+                       &icdIotivityHandler::platformObject::receivedPlatformInfo,
+                       object,
+                       placeholders::_1);
+
+       try {
+               /* TODO : OC_ALL has wrong behaviour in iotivity version 0.9.1.
+                * Therefore, OC_IPV4 SHOULD be changed to OC_ALL later.
+                */
+               ret = getPlatformInfo("", requestHost.str(), OC_IPV4, findPlatformCallback);
+       } catch (OCException& e) {
+               ERR("getPlatformInfo() Fail(%s)", e.reason().c_str());
+               return IOTCON_ERROR_IOTIVITY;
+       }
+
+       if (OC_STACK_OK != ret) {
+               ERR("getPlatformInfo() Fail(%d)", ret);
+               return IOTCON_ERROR_IOTIVITY;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
 
 
 extern "C" iotcon_presence_h icd_ioty_subscribe_presence(const char *host_address,
@@ -1379,7 +1516,11 @@ extern "C" iotcon_presence_h icd_ioty_subscribe_presence(const char *host_addres
        host = string(ICD_COAP) + string(host_address);
 
        try {
-               ret = subscribePresence(presence_handle, host, resource_type, subscribeCallback);
+               /* TODO : OC_ALL has wrong behaviour in iotivity version 0.9.1.
+                * Therefore, OC_IPV4 SHOULD be changed to OC_ALL later.
+                */
+               ret = subscribePresence(presence_handle, host, resource_type, OC_IPV4,
+                               subscribeCallback);
        } catch (OCException& e) {
                ERR("subscribePresence() Fail(%s)", e.reason().c_str());
                return NULL;
index 28b1fd1..0b82df6 100644 (file)
@@ -60,10 +60,17 @@ int icd_ioty_observer_start(GVariant *resource, int observe_type, GVariant *quer
 
 int icd_ioty_observer_stop(void *observe_h);
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 int icd_ioty_register_device_info(GVariant *value);
 
 int icd_ioty_get_device_info(const char *host_address, unsigned int signal_number,
                const char *sender);
+#endif
+
+int icd_ioty_register_platform_info(GVariant *value);
+
+int icd_ioty_get_platform_info(const char *host_address, unsigned int signal_number,
+               const char *sender);
 
 iotcon_presence_h icd_ioty_subscribe_presence(const char *host_address,
                const char *resource_type, unsigned int signal_number, const char *sender);
index a4a37ab..ae3d0fa 100644 (file)
@@ -12,8 +12,15 @@ ADD_DEFINITIONS("-DIOTCON_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
 
 ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
 ADD_DEPENDENCIES(${CLIENT} GENERATED_DBUS_CODE)
-TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES}
-       oc octbstack coap oc_logger_core oc_logger pthread)
+TARGET_LINK_LIBRARIES(${CLIENT}
+       ${client_pkgs_LIBRARIES}
+       ${OCLIB}
+       ${OCLOGGER}
+       ${OCLOGGER_CORE}
+       ${CA}
+       ${OCTBSTACK}
+       pthread
+)
 SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
 INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
 
index 62b566a..4d69c5e 100644 (file)
@@ -86,6 +86,7 @@ API void iotcon_client_free(iotcon_client_h resource)
 
        free(resource->uri);
        free(resource->host);
+       free(resource->sid);
 
        /* null COULD be allowed */
        if (resource->header_options)
@@ -111,6 +112,7 @@ API iotcon_client_h iotcon_client_clone(iotcon_client_h resource)
                return clone;
        }
 
+       clone->sid = resource->sid;
        clone->observe_handle = resource->observe_handle;
 
        return clone;
@@ -141,6 +143,17 @@ API int iotcon_client_get_host(iotcon_client_h resource, char **host)
 }
 
 
+API int iotcon_client_get_server_id(iotcon_client_h resource, char **sid)
+{
+       RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == sid, IOTCON_ERROR_INVALID_PARAMETER);
+
+       *sid = resource->sid;
+
+       return IOTCON_ERROR_NONE;
+}
+
+
 /* The content of the resource should not be freed by user. */
 API int iotcon_client_get_types(iotcon_client_h resource, iotcon_resource_types_h *types)
 {
index 35e7c8e..bee3e6f 100644 (file)
@@ -22,6 +22,7 @@
 struct icl_remote_resource {
        char *uri;
        char *host;
+       char *sid;
        bool is_observable;
        bool is_collection;
        iotcon_options_h header_options;
index 270abb9..39eb609 100644 (file)
@@ -144,7 +144,7 @@ GVariant* icl_dbus_client_to_gvariant(struct icl_remote_resource *resource)
        return value;
 }
 
-
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 GVariant* icl_dbus_device_info_to_gvariant(iotcon_device_info_s *device_info)
 {
        GVariant *value;
@@ -165,6 +165,27 @@ GVariant* icl_dbus_device_info_to_gvariant(iotcon_device_info_s *device_info)
 
        return value;
 }
+#endif
+
+GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_s *platform_info)
+{
+       GVariant *value;
+
+       value = g_variant_new("(sssssssssss)",
+                       ic_utils_dbus_encode_str(platform_info->platform_id),
+                       ic_utils_dbus_encode_str(platform_info->manuf_name),
+                       ic_utils_dbus_encode_str(platform_info->manuf_url),
+                       ic_utils_dbus_encode_str(platform_info->model_number),
+                       ic_utils_dbus_encode_str(platform_info->date_of_manufacture),
+                       ic_utils_dbus_encode_str(platform_info->platform_ver),
+                       ic_utils_dbus_encode_str(platform_info->os_ver),
+                       ic_utils_dbus_encode_str(platform_info->hardware_ver),
+                       ic_utils_dbus_encode_str(platform_info->firmware_ver),
+                       ic_utils_dbus_encode_str(platform_info->support_url),
+                       ic_utils_dbus_encode_str(platform_info->system_time));
+
+       return value;
+}
 
 
 GVariant* icl_dbus_query_to_gvariant(iotcon_query_h query)
index 9017f59..47c747b 100644 (file)
@@ -24,7 +24,10 @@ const char** icl_dbus_resource_types_to_array(iotcon_resource_types_h types);
 GVariant* icl_dbus_notimsg_to_gvariant(struct icl_notify_msg *msg);
 GVariant* icl_dbus_response_to_gvariant(struct icl_resource_response *response);
 GVariant* icl_dbus_client_to_gvariant(struct icl_remote_resource *resource);
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 GVariant* icl_dbus_device_info_to_gvariant(iotcon_device_info_s *device_info);
+#endif
+GVariant* icl_dbus_platform_info_to_gvariant(iotcon_platform_info_s *platform_info);
 GVariant* icl_dbus_query_to_gvariant(iotcon_query_h query);
 GVariant* icl_dbus_observers_to_gvariant(iotcon_observers_h observers);
 
index c4af821..3cd01a7 100644 (file)
@@ -493,9 +493,10 @@ static void _icl_dbus_found_resource(GDBusConnection *connection,
 
        struct icl_remote_resource resource = {0};
 
-       g_variant_get(parameters, "(&s&siasi)",
+       g_variant_get(parameters, "(&s&s&siasi)",
                        &resource.uri,
                        &resource.host,
+                       &resource.sid,
                        &resource.is_observable,
                        &types,
                        &resource.ifaces);
@@ -993,7 +994,7 @@ int icl_dbus_observer_stop(icl_handle_container_s *observe)
        return ret;
 }
 
-
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 int icl_dbus_register_device_info(iotcon_device_info_s info)
 {
        int ret;
@@ -1095,6 +1096,108 @@ int icl_dbus_get_device_info(const char *host_address, iotcon_device_info_cb cb,
 
        return ret;
 }
+#endif
+
+int icl_dbus_register_platform_info(iotcon_platform_info_s info)
+{
+       int ret;
+       GError *error = NULL;
+       GVariant *arg_info;
+
+       RETV_IF(NULL == icl_dbus_object, IOTCON_ERROR_DBUS);
+
+       arg_info = icl_dbus_platform_info_to_gvariant(&info);
+       ic_dbus_call_register_platform_info_sync(icl_dbus_object, arg_info, &ret,
+                       NULL, &error);
+       if (error) {
+               ERR("ic_dbus_call_register_platform_info_sync() Fail(%s)", error->message);
+               g_error_free(error);
+               g_variant_unref(arg_info);
+               return IOTCON_ERROR_DBUS;
+       }
+
+       return ret;
+}
+
+
+static void _icl_dbus_received_platform_info(GDBusConnection *connection,
+               const gchar *sender_name,
+               const gchar *object_path,
+               const gchar *interface_name,
+               const gchar *signal_name,
+               GVariant *parameters,
+               gpointer user_data)
+{
+       icl_cb_container_s *cb_container = user_data;
+       iotcon_platform_info_cb cb = cb_container->cb;
+
+       iotcon_platform_info_s info = {0};
+
+       g_variant_get(parameters, "(&s&s&s&s&s&s&s&s&s&s&s)",
+                       &info.platform_id,
+                       &info.manuf_name,
+                       &info.manuf_url,
+                       &info.model_number,
+                       &info.date_of_manufacture,
+                       &info.platform_ver,
+                       &info.os_ver,
+                       &info.hardware_ver,
+                       &info.firmware_ver,
+                       &info.support_url,
+                       &info.system_time);
+
+       info.platform_id = ic_utils_dbus_decode_str(info.platform_id);
+       info.manuf_name = ic_utils_dbus_decode_str(info.manuf_name);
+       info.manuf_url = ic_utils_dbus_decode_str(info.manuf_url);
+       info.model_number = ic_utils_dbus_decode_str(info.model_number);
+       info.date_of_manufacture = ic_utils_dbus_decode_str(info.date_of_manufacture);
+       info.platform_ver = ic_utils_dbus_decode_str(info.platform_ver);
+       info.os_ver = ic_utils_dbus_decode_str(info.os_ver);
+       info.hardware_ver = ic_utils_dbus_decode_str(info.hardware_ver);
+       info.firmware_ver = ic_utils_dbus_decode_str(info.firmware_ver);
+       info.support_url = ic_utils_dbus_decode_str(info.support_url);
+       info.system_time = ic_utils_dbus_decode_str(info.system_time);
+
+       if (cb)
+               cb(info, cb_container->user_data);
+}
+
+
+int icl_dbus_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
+               void *user_data)
+{
+       int ret;
+       GError *error = NULL;
+       unsigned int sub_id;
+       int signal_number;
+       char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0};
+
+       RETV_IF(NULL == icl_dbus_object, IOTCON_ERROR_DBUS);
+
+       signal_number = _icl_dbus_generate_signal_number();
+
+       ic_dbus_call_get_platform_info_sync(icl_dbus_object, host_address,
+                       signal_number, &ret, NULL, &error);
+       if (error) {
+               ERR("ic_dbus_call_get_platform_info_sync() Fail(%s)", error->message);
+               g_error_free(error);
+               return IOTCON_ERROR_DBUS;
+       }
+
+       snprintf(signal_name, sizeof(signal_name), "%s_%u", IC_DBUS_SIGNAL_PLATFORM,
+                       signal_number);
+
+       sub_id = _icl_dbus_subscribe_signal(signal_name, cb, user_data,
+                       _icl_dbus_received_platform_info);
+       if (0 == sub_id) {
+               ERR("_icl_dbus_subscribe_signal() Fail");
+               return IOTCON_ERROR_DBUS;
+       }
+       icl_dbus_sub_ids = g_list_append(icl_dbus_sub_ids, GUINT_TO_POINTER(sub_id));
+
+       return ret;
+}
+
 
 
 int icl_dbus_start_presence(unsigned int time_to_live)
index 9592ce8..a832478 100644 (file)
@@ -60,9 +60,15 @@ int icl_dbus_observer_start(iotcon_client_h resource,
                void *user_data);
 int icl_dbus_observer_stop(icl_handle_container_s *observe);
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 int icl_dbus_register_device_info(iotcon_device_info_s info);
 int icl_dbus_get_device_info(const char *host_address, iotcon_device_info_cb cb,
                void *user_data);
+#endif
+
+int icl_dbus_register_platform_info(iotcon_platform_info_s info);
+int icl_dbus_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
+               void *user_data);
 
 int icl_dbus_start_presence(unsigned int time_to_live);
 int icl_dbus_stop_presence();
index d589003..b128075 100644 (file)
 #include "icl-ioty.h"
 #include "icl-dbus.h"
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 /* The length of manufacturer_name should be less than and equal to 16.
  * The length of manufacturer_url should be less than and equal to 32. */
-API int iotcon_register_device_info(iotcon_device_info_s device_info)
+int iotcon_register_device_info(iotcon_device_info_s device_info)
 {
        int ret;
 
@@ -48,11 +49,9 @@ API int iotcon_register_device_info(iotcon_device_info_s device_info)
        return ret;
 }
 
-
-API int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb cb,
+int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb cb,
                void *user_data)
 {
-       FN_CALL;
        int ret = IOTCON_ERROR_NONE;
 
        RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
@@ -66,3 +65,32 @@ API int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb c
 
        return IOTCON_ERROR_NONE;
 }
+#endif
+
+API int iotcon_register_platform_info(iotcon_platform_info_s platform_info)
+{
+       int ret;
+
+       ret = icl_dbus_register_platform_info(platform_info);
+       if (IOTCON_ERROR_NONE != ret)
+               ERR("ic_ioty_register_platform_info() Fail(%d)", ret);
+
+       return ret;
+}
+
+
+API int iotcon_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
+               void *user_data)
+{
+       int ret = IOTCON_ERROR_NONE;
+
+       RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
+
+       ret = icl_dbus_get_platform_info(host_address, cb, user_data);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("ic_ioty_get_platform_info() Fail(%d)", ret);
+               return ret;
+       }
+
+       return IOTCON_ERROR_NONE;
+}
index 08d121b..4513349 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef __IOT_CONNECTIVITY_MANAGER_CONSTANT_H__
 #define __IOT_CONNECTIVITY_MANAGER_CONSTANT_H__
 
-#define IOTCON_MULTICAST_ADDRESS "224.0.1.187"
+#define IOTCON_MULTICAST_ADDRESS "224.0.1.187" /**< Multicast IP Address */
 
 /**
  * @brief HeaderOption range from 2048 to 3000
index 9c5ef6c..c4406e2 100644 (file)
@@ -28,6 +28,7 @@ typedef struct icl_notify_msg* iotcon_notimsg_h;
 
 typedef void* iotcon_presence_h;
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 typedef struct _device_info {
        char *name;
        char *host_name;
@@ -42,6 +43,21 @@ typedef struct _device_info {
        char *firmware_ver;
        char *support_url;
 } iotcon_device_info_s;
+#endif
+
+typedef struct _platform_info {
+       char *platform_id;
+       char *manuf_name;
+       char *manuf_url;
+       char *model_number;
+       char *date_of_manufacture;
+       char *platform_ver;
+       char *os_ver;
+       char *hardware_ver;
+       char *firmware_ver;
+       char *support_url;
+       char *system_time;
+} iotcon_platform_info_s;
 
 
 typedef struct icl_options* iotcon_options_h;
@@ -108,6 +124,7 @@ int iotcon_resource_is_observable(iotcon_resource_h resource, bool *observable);
 typedef struct icl_remote_resource* iotcon_client_h;
 int iotcon_client_get_uri(iotcon_client_h resource, char **uri);
 int iotcon_client_get_host(iotcon_client_h resource, char **host);
+int iotcon_client_get_server_id(iotcon_client_h resource, char **sid);
 int iotcon_client_get_types(iotcon_client_h resource, iotcon_resource_types_h *types);
 int iotcon_client_get_interfaces(iotcon_client_h resource, int *ifaces);
 int iotcon_client_is_observable(iotcon_client_h resource, bool *observable);
index bf2ebb0..3456a55 100644 (file)
@@ -66,10 +66,17 @@ int iotcon_bind_request_handler(iotcon_resource_h resource, iotcon_request_handl
 int iotcon_bind_resource(iotcon_resource_h parent, iotcon_resource_h child);
 int iotcon_unbind_resource(iotcon_resource_h parent, iotcon_resource_h child);
 
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
 int iotcon_register_device_info(iotcon_device_info_s device_info);
 typedef void (*iotcon_device_info_cb)(iotcon_device_info_s info, void *user_data);
 int iotcon_get_device_info(const char *host_address, iotcon_device_info_cb cb,
                void *user_data);
+#endif
+
+int iotcon_register_platform_info(iotcon_platform_info_s platform_info);
+typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_s info, void *user_data);
+int iotcon_get_platform_info(const char *host_address, iotcon_platform_info_cb cb,
+               void *user_data);
 
 int iotcon_start_presence(unsigned int time_to_live);
 int iotcon_stop_presence();
index 8edd8d6..9df4ef5 100644 (file)
@@ -3,12 +3,14 @@
                <domain name="iotcon" />
                <permit>
                        <smack permit="_" type="rw" />
+                       <smack permit="net-config" type="rwx"/>
                        <smack permit="dbus" type="rwx" />
                        <smack permit="system::use_internet" type="rw" />
                        <smack permit="connman::get" type="rw" />
                        <smack permit="libiotcon" type="rwx" />
                </permit>
                <request>
+                       <smack request="net-config" type="rwx"/>
                        <smack request="connman::get" type="rw" />
                        <smack request="dbus" type="rwx" />
                        <smack request="libiotcon" type="rwxt" />
index e122211..3cf8f41 100644 (file)
 #include <iotcon.h>
 #include "test.h"
 
-const char* const door_uri = "/a/door";
+static const char* const door_uri = "/a/door";
+static char *door_resource_sid;
 
-iotcon_client_h door_resource = NULL;
+static iotcon_client_h door_resource = NULL;
 
 void _print_repr_info(iotcon_repr_h repr)
 {
@@ -164,6 +165,7 @@ static void _found_resource(iotcon_client_h resource, void *user_data)
        int ret;
        char *resource_uri = NULL;
        char *resource_host = NULL;
+       char *resource_sid = NULL;
        iotcon_resource_types_h resource_types = NULL;
        int resource_interfaces = 0;
 
@@ -179,6 +181,22 @@ static void _found_resource(iotcon_client_h resource, void *user_data)
                return;
        }
 
+       /* get the resource unique id.
+        * this is unique per-server independent on how it was discovered. */
+       ret = iotcon_client_get_server_id(resource, &resource_sid);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_client_get_server_id() Fail(%d)", ret);
+               return;
+       }
+       DBG("[%s] resource server id : %s", resource_uri, resource_sid);
+
+       if (door_resource_sid && TEST_STR_EQUAL == strcmp(door_resource_sid, resource_sid)) {
+               DBG("sid \"%s\" already found. skip !", resource_sid);
+               return;
+       }
+
+       door_resource_sid = strdup(resource_sid);
+
        /* get the resource host address */
        ret = iotcon_client_get_host(resource, &resource_host);
        if (IOTCON_ERROR_NONE != ret) {
@@ -222,7 +240,6 @@ static void _found_resource(iotcon_client_h resource, void *user_data)
                door_resource = iotcon_client_clone(resource);
 
                iotcon_query_h query = iotcon_query_new();
-               iotcon_query_insert(query, "key", "value");
 
                /* send GET Request */
                iotcon_get(resource, query, _on_get, NULL);
index 6996159..672aa59 100644 (file)
@@ -32,10 +32,10 @@ typedef struct _door_resource_s {
 static door_resource_s my_door;
 static bool resource_created = false;
 
-iotcon_resource_h door_handle;
-iotcon_resource_h new_door_handle;
+static iotcon_resource_h door_handle;
+static iotcon_resource_h new_door_handle;
 
-iotcon_observers_h observers = NULL;
+static iotcon_observers_h observers = NULL;
 
 static void _request_handler(iotcon_request_h request, void *user_data);
 
@@ -185,6 +185,7 @@ static gboolean _notifier(gpointer user_data)
        iotcon_notimsg_h msg = iotcon_notimsg_new(repr, IOTCON_INTERFACE_DEFAULT);
        iotcon_notify_list_of_observers(user_data, msg, observers);
 
+       iotcon_notimsg_free(msg);
        iotcon_repr_free(repr);
 
        return TRUE;
index a1fb97d..959a110 100644 (file)
@@ -2,20 +2,19 @@
 #include <iotcon.h>
 #include "test.h"
 
-static void _get_device_info(iotcon_device_info_s info, void *user_data)
+static void _get_platform_info(iotcon_platform_info_s info, void *user_data)
 {
-       INFO("name : %s", info.name);
-       INFO("host_name : %s", info.host_name);
-       INFO("uuid : %s", info.uuid);
-       INFO("content_type : %s", info.content_type);
-       INFO("version : %s", info.version);
+       INFO("platform_id : %s", info.platform_id);
        INFO("manuf_name : %s", info.manuf_name);
        INFO("manuf_url : %s", info.manuf_url);
        INFO("model_number : %s", info.model_number);
        INFO("date_of_manufacture : %s", info.date_of_manufacture);
        INFO("platform_ver : %s", info.platform_ver);
+       INFO("os_ver : %s", info.os_ver);
+       INFO("hardware_ver : %s", info.hardware_ver);
        INFO("firmware_ver : %s", info.firmware_ver);
        INFO("support_url : %s", info.support_url);
+       INFO("system_time : %s", info.system_time);
 }
 
 int main()
@@ -27,7 +26,7 @@ int main()
        /* iotcon initialize */
        iotcon_initialize();
 
-       iotcon_get_device_info(IOTCON_MULTICAST_ADDRESS, _get_device_info, NULL);
+       iotcon_get_platform_info(IOTCON_MULTICAST_ADDRESS, _get_platform_info, NULL);
 
        g_main_loop_run(loop);
 
index e4fe610..f5197db 100644 (file)
@@ -7,29 +7,28 @@ int main()
        int ret;
        GMainLoop *loop;
 
-       iotcon_device_info_s device_info = {0};
-
-       device_info.name = "device_name";
-       device_info.host_name = "host_name";
-       device_info.uuid = "device_uuid";
-       device_info.content_type = "content_type";
-       device_info.version = "version";
-       device_info.manuf_name = "manuf_name";
-       device_info.manuf_url = "manuf_url";
-       device_info.model_number = "model_number";
-       device_info.date_of_manufacture = "date_of_manufacture";
-       device_info.platform_ver = "platform_version";
-       device_info.firmware_ver = "firmware_version";
-       device_info.support_url = "support_url";
+       iotcon_platform_info_s platform_info = {0};
+
+       platform_info.platform_id = "platform_id";
+       platform_info.manuf_name = "manuf_name";
+       platform_info.manuf_url = "manuf_url";
+       platform_info.model_number = "model_number";
+       platform_info.date_of_manufacture = "date_of_manufacture";
+       platform_info.platform_ver = "platform_ver";
+       platform_info.os_ver = "os_ver";
+       platform_info.hardware_ver = "hardware_ver";
+       platform_info.firmware_ver = "firmware_ver";
+       platform_info.support_url = "support_url";
+       platform_info.system_time = "system_time";
 
        loop = g_main_loop_new(NULL, FALSE);
 
        /* iotcon initialize */
        iotcon_initialize();
 
-       ret = iotcon_register_device_info(device_info);
+       ret = iotcon_register_platform_info(platform_info);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_register_device_info() Fail(%d)", ret);
+               ERR("iotcon_register_platform_info() Fail(%d)", ret);
                return -1;
        }
 
index 10b73fe..8938c44 100644 (file)
 #include <iotcon.h>
 #include "test.h"
 
-const char* const room_uri = "/a/room";
+static const char* const room_uri = "/a/room";
+static char *room_resource_sid;
 
-iotcon_client_h room_resource = NULL;
+static iotcon_client_h room_resource = NULL;
 
 static int _get_int_list_fn(int pos, const int value, void *user_data)
 {
@@ -134,6 +135,7 @@ static void _found_resource(iotcon_client_h resource, void *user_data)
        int ret;
        char *resource_uri;
        char *resource_host;
+       char *resource_sid = NULL;
        iotcon_resource_types_h resource_types = NULL;
        int resource_interfaces = 0;
 
@@ -149,6 +151,21 @@ static void _found_resource(iotcon_client_h resource, void *user_data)
                return;
        }
 
+       /* get the resource server id */
+       ret = iotcon_client_get_server_id(resource, &resource_sid);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_client_get_server_id() Fail(%d)", ret);
+               return;
+       }
+       DBG("[%s] resource server id : %s", resource_uri, resource_sid);
+
+       if (room_resource_sid && TEST_STR_EQUAL == strcmp(room_resource_sid, resource_sid)) {
+               DBG("sid \"%s\" already found. skip !", resource_sid);
+               return;
+       }
+
+       room_resource_sid = strdup(resource_sid);
+
        /* get the resource host address */
        ret = iotcon_client_get_host(resource, &resource_host);
        if (IOTCON_ERROR_NONE != ret) {