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)
#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__ */
/*
- * 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.
*/
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 =
{
{
&_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,
* @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.
* @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.
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.
}
/**
+ * 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.
}
/**
+ * 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.
/*
- * 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.
*/
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,
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,
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,
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,
<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"/>
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)
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})
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)
{
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,
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",
}
#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;
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);
}
};
+#ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
class deviceObject
{
private:
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
{
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;
extern "C" int icd_ioty_unregister_resource(OCResourceHandle resource_handle)
{
- FN_CALL;
OCStackResult result;
try {
result = unregisterResource(resource_handle);
extern "C" int icd_ioty_send_response(GVariant *resp)
{
- FN_CALL;
int ret;
int result;
int error_code;
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);
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;
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);
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;
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;
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;
extern "C" int icd_ioty_delete(GVariant *resource, unsigned int signal_number,
const char *sender)
{
- FN_CALL;
OCStackResult ret;
OCResource::Ptr ocResource;
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};
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);
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;
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,
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;
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);
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})
free(resource->uri);
free(resource->host);
+ free(resource->sid);
/* null COULD be allowed */
if (resource->header_options)
return clone;
}
+ clone->sid = resource->sid;
clone->observe_handle = resource->observe_handle;
return clone;
}
+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)
{
struct icl_remote_resource {
char *uri;
char *host;
+ char *sid;
bool is_observable;
bool is_collection;
iotcon_options_h header_options;
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;
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)
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);
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);
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;
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)
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();
#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;
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);
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;
+}
#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
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;
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;
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);
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();
<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" />
#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)
{
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;
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) {
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);
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);
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;
#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()
/* 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);
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;
}
#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)
{
int ret;
char *resource_uri;
char *resource_host;
+ char *resource_sid = NULL;
iotcon_resource_types_h resource_types = NULL;
int resource_interfaces = 0;
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) {