INCLUDE(FindPkgConfig)
-SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden")
+SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden -fPIE")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--hash-style=both")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fvisibility=hidden")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--hash-style=both -pie")
SET(CLIENT ${PROJECT_NAME})
SET(DAEMON "${PROJECT_NAME}-daemon")
SET(DBUS_INTERFACE "org.tizen.${PROJECT_NAME}")
ADD_SUBDIRECTORY(lib)
-#ADD_SUBDIRECTORY(daemon)
+ADD_SUBDIRECTORY(daemon)
ADD_SUBDIRECTORY(test)
#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_COMMON_H__
#include "iotcon-errors.h"
-#include "ic-log.h"
-#ifdef API
-#undef API
+#ifndef IOTCON_DBUS_INTERFACE
+#define IOTCON_DBUS_INTERFACE "org.tizen.IoTCon"
+#warning "IOTCON_DBUS_INTERFACE is redefined"
#endif
-#define API __attribute__((visibility("default")))
+
+#define IOTCON_DBUS_OBJPATH "/org/tizen/IoTCon/GDBus"
+
+#define IOTCON_DBUS_METHOD1 "subscribe"
+#define IOTCON_DBUS_METHOD2 "subscribe"
+#define IOTCON_DBUS_METHOD3 "subscribe"
#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_COMMON_H__ */
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/include)
SET(OCLIB "oc")
SET(OCLOGGER "oc_logger")
INCLUDE_DIRECTORIES(${daemon_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${daemon_pkgs_LIBRARY_DIRS})
-ADD_DEFINITIONS("-DENOTICE_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
+ADD_DEFINITIONS("-DIOTCON_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
ADD_EXECUTABLE(${DAEMON} ${DAEMON_SRCS})
TARGET_LINK_LIBRARIES(${DAEMON} ${daemon_pkgs_LIBRARIES} ${OCLIB} ${OCLOGGER}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <stdlib.h>
+#include <gio/gio.h>
+
+#include "icd.h"
+#include "icd-dbus.h"
+
+static GDBusConnection *icd_dbus_conn;
+
+int icd_dbus_publish(const char *key, const char *data)
+{
+ gboolean ret;
+ GError *error = NULL;
+ int res = 0;
+ char *path = NULL;
+
+ ret = g_dbus_connection_emit_signal(icd_dbus_conn,
+ NULL, /* destination bus name */
+ "/",
+ IOTCON_DBUS_INTERFACE,
+ key,
+ g_variant_new("(s)", data),
+ &error);
+ if (FALSE == ret)
+ {
+ ERR("g_dbus_connection_emit_signal() Fail(%s)", error->message);
+ g_error_free(error);
+ return -1;
+ }
+
+ if (FALSE == g_dbus_connection_flush_sync(icd_dbus_conn, NULL, &error))
+ {
+ ERR("g_dbus_connection_flush_sync() Fail(%s)", error->message);
+ g_error_free(error);
+ }
+
+ if (path)
+ free(path);
+
+ return 0;
+}
+
+static void _dbus_handle_method_call(GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ const gchar *key = NULL;
+
+ if (0 == g_strcmp0(method_name, IOTCON_DBUS_METHOD1)) {
+ g_variant_get(parameters, "(&s)", &key);
+ if (NULL == key) {
+ ERR("key is NULL");
+ // TODO: handle error
+ }
+
+ //icd_handler_subscribe(key);
+
+ // TODO: handle disconnect without unsubscribe
+
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ }
+ else if (0 == g_strcmp0(method_name, IOTCON_DBUS_METHOD2)) {
+ g_variant_get(parameters, "(&s)", &key);
+ if (NULL == key) {
+ ERR("key is NULL");
+ // TODO: handle error
+ }
+
+ //icd_handler_unsubscribe(key);
+
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ }
+ else if (0 == g_strcmp0(method_name, IOTCON_DBUS_METHOD3)) {
+ const gchar *data = NULL;
+
+ g_variant_get(parameters, "(&s&s)", &key, &data);
+ if (NULL == key) {
+ ERR("key is NULL");
+ // TODO: handle error
+ }
+
+ //icd_handler_publish(key, data);
+
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ }
+ else {
+ g_dbus_method_invocation_return_error(invocation,
+ G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD,
+ "Method %s is not implemented on interface %s", method_name, interface_name);
+ }
+}
+
+
+static const GDBusInterfaceVTable interface_vtable =
+{
+ _dbus_handle_method_call,
+ NULL,
+ NULL
+};
+
+
+static void _dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name,
+ gpointer user_data)
+{
+ guint registration_id;
+ GError *error = NULL;
+ GDBusNodeInfo *introspection_data = user_data;
+
+ FN_CALL;
+
+ icd_dbus_conn = conn;
+
+ registration_id = g_dbus_connection_register_object(conn,
+ IOTCON_DBUS_OBJPATH,
+ introspection_data->interfaces[0],
+ &interface_vtable,
+ NULL,/* user_data */
+ NULL,/* user_data_free_func */
+ &error);
+ if (0 == registration_id)
+ {
+ ERR("g_dbus_connection_register_object() Fail(%s)", error->message);
+ g_error_free(error);
+ }
+}
+
+static void _dbus_on_name_lost(GDBusConnection *connection, const gchar *name,
+ gpointer user_data)
+{
+ DBG("Lost the name %s", name);
+}
+
+static void _dbus_on_name_acquired(GDBusConnection *connection, const gchar *name,
+ gpointer user_data)
+{
+ DBG("Acquired the name %s", name);
+}
+
+unsigned int icd_dbus_init()
+{
+ guint id;
+ GError *error = NULL;
+ GDBusNodeInfo *introspection_data = NULL;
+
+ const gchar introspection_xml[] =
+ "<node>"
+ " <interface name='"IOTCON_DBUS_INTERFACE"'>"
+ " <method name='"IOTCON_DBUS_METHOD1"'>"
+ " <arg type='s' name='key' direction='in'/>"
+ " </method>"
+ " <method name='"IOTCON_DBUS_METHOD2"'>"
+ " <arg type='s' name='key' direction='in'/>"
+ " </method>"
+ " <method name='"IOTCON_DBUS_METHOD3"'>"
+ " <arg type='s' name='key' direction='in'/>"
+ " <arg type='s' name='data' direction='in'/>"
+ " </method>"
+ " </interface>"
+ "</node>";
+
+ introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, &error);
+ if (NULL == introspection_data)
+ {
+ ERR("g_dbus_node_info_new_for_xml() Fail(%s)", error->message);
+ g_error_free(error);
+ return -1;
+ }
+
+ id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+ IOTCON_DBUS_INTERFACE,
+ G_BUS_NAME_OWNER_FLAGS_REPLACE,
+ _dbus_on_bus_acquired,
+ _dbus_on_name_acquired,
+ _dbus_on_name_lost,
+ introspection_data,
+ (GDestroyNotify)g_dbus_node_info_unref);
+ if (0 == id)
+ {
+ ERR("g_bus_own_name() Fail");
+ return 0;
+ }
+
+ return id;
+}
+
+void icd_dbus_deinit(unsigned int id)
+{
+ g_bus_unown_name(id);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_DAEMON_DBUS_H__
+#define __IOT_CONNECTIVITY_MANAGER_DAEMON_DBUS_H__
+
+int icd_dbus_publish(const char *key, const char *data);
+unsigned int icd_dbus_init();
+void icd_dbus_deinit(unsigned int id);
+
+
+#endif //__IOT_CONNECTIVITY_MANAGER_DAEMON_DBUS_H__
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <gio/gio.h>
+
+#include "icd.h"
+#include "icd-dbus.h"
+
+
+int main(int argc, char **argv)
+{
+ guint id;
+ GMainLoop *loop;
+
+#if !GLIB_CHECK_VERSION(2,35,0)
+ g_type_init();
+#endif
+
+ loop = g_main_loop_new(NULL, FALSE);
+
+ id = icd_dbus_init();
+
+ g_main_loop_run(loop);
+
+ icd_dbus_deinit(id);
+ g_main_loop_unref(loop);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_DAEMON_H__
+#define __IOT_CONNECTIVITY_MANAGER_DAEMON_H__
+
+#include "ic-common.h"
+
+#define IC_DAEMON
+#include "ic-log.h"
+
+
+#endif //__IOT_CONNECTIVITY_MANAGER_DAEMON_H__
--- /dev/null
+[D-BUS Service]
+Name=@DBUS_INTERFACE@
+Exec=@BIN_INSTALL_DIR@/@DAEMON@
\ No newline at end of file
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
INCLUDE_DIRECTORIES(include)
FILE(GLOB CLIENT_SRCS *.c *.cpp)
INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS})
-ADD_DEFINITIONS("-DENOTICE_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
+ADD_DEFINITIONS("-DIOTCON_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${CLIENT}
- ${client_pkgs_LIBRARIES}
+TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES}
oc octbstack coap oc_logger_core oc_logger pthread)
SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
-INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CLIENT}.pc DESTINATION lib/pkgconfig)
FILE(GLOB CLIENT_HEADER include/*.h)
INSTALL(FILES ${CLIENT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT})
#include <glib.h>
#include "iotcon-struct.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-ioty.h"
-#include "ic-options.h"
-#include "ic-resource-types.h"
-#include "ic-client.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-ioty.h"
+#include "icl-options.h"
+#include "icl-resource-types.h"
+#include "icl-client.h"
/* host address should begin with "coap://"
* The length of resource_type should be less than or equal to 61.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_CLIENT_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_CLIENT_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_CLIENT_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_CLIENT_H__
#include "iotcon-struct.h"
-#include "ic-options.h"
+#include "icl-options.h"
typedef void* iotcon_observe_h;
iotcon_observe_h observe_handle;
};
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_CLIENT_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_CLIENT_H__ */
#include <glib.h>
#include "iotcon.h"
-#include "ic-common.h"
-#include "ic-ioty.h"
+#include "icl.h"
+#include "icl-ioty.h"
/* 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. */
extern "C" {
#include "iotcon-struct.h"
-#include "ic.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-repr.h"
-#include "ic-ioty-repr.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-repr.h"
+#include "icl-ioty-repr.h"
}
using namespace OC;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_REPRESENTATION_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_REPRESENTATION_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_REPRESENTATION_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_REPRESENTATION_H__
#include <OCRepresentation.h>
#include "iotcon-struct.h"
iotcon_repr_h ic_ioty_repr_generate_repr(const OC::OCRepresentation& ocRep);
int ic_ioty_repr_parse(iotcon_repr_h repr, OC::OCRepresentation &ocRep);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_REPRESENTATION_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_REPRESENTATION_H__ */
extern "C" {
#include "iotcon-struct.h"
-#include "ic.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-client.h"
-#include "ic-request.h"
-#include "ic-response.h"
-#include "ic-resource-types.h"
-#include "ic-repr.h"
-#include "ic-ioty-repr.h"
-#include "ic-ioty.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-client.h"
+#include "icl-request.h"
+#include "icl-response.h"
+#include "icl-resource-types.h"
+#include "icl-repr.h"
+#include "icl-ioty-repr.h"
+#include "icl-ioty.h"
}
#define IC_UNICAST_RESOURCE_DISCOVERY ":5683/oc/core"
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_H__
#include <stdint.h>
#include "iotcon.h"
-#include "ic.h"
-#include "ic-response.h"
+#include "icl-response.h"
+
+struct ic_notify_msg {
+ int error_code;
+ iotcon_interface_e iface;
+ iotcon_repr_h repr;
+};
+
+struct ic_resource {
+ char *uri;
+ char *host;
+ bool is_observable;
+ iotcon_resource_types_h types;
+ int ifaces;
+ void *handle;
+ iotcon_request_handler_cb cb;
+ void *user_data;
+ iotcon_resource_h children[IOTCON_CONTAINED_RESOURCES_MAX];
+};
void ic_ioty_config(const char *addr, unsigned short port);
int ic_ioty_send_notify(void *resource, struct ic_notify_msg *msg,
iotcon_observers_h observers);
-
int ic_ioty_send_res_response_data(struct ic_resource_response *resp);
const iotcon_presence_h ic_ioty_subscribe_presence(const char *host_address,
int ic_ioty_convert_interface_string(const char *src, iotcon_interface_e *dest);
-#endif //__IOT_CONNECTIVITY_MANAGER_INTERNAL_IOTIVITY_H__
+#endif //__IOT_CONNECTIVITY_MANAGER_LIBRARY_IOTIVITY_H__
#include <glib.h>
#include "iotcon-struct.h"
-#include "ic-common.h"
+#include "icl.h"
API void iotcon_observers_free(iotcon_observers_h observers)
{
#include <glib.h>
#include "iotcon-struct.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-options.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-options.h"
API iotcon_options_h iotcon_options_new()
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_OPTIONS_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_OPTIONS_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_OPTIONS_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_OPTIONS_H__
#include "iotcon-struct.h"
void ic_options_free(iotcon_options_h options);
iotcon_options_h ic_options_ref(iotcon_options_h options);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_OPTIONS_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_OPTIONS_H__ */
#include <glib.h>
#include "iotcon-struct.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-query.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-query.h"
API iotcon_query_h iotcon_query_new()
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_QUERY_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_QUERY_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_QUERY_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_QUERY_H__
#include "iotcon-struct.h"
GHashTable *hash;
};
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_QUERY_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_QUERY_H__ */
#include "iotcon-struct.h"
#include "iotcon-constant.h"
#include "iotcon-representation.h"
-#include "ic-common.h"
-#include "ic-repr-obj.h"
-#include "ic-repr.h"
-#include "ic-repr-value.h"
-#include "ic-repr-list.h"
+#include "icl.h"
+#include "icl-repr-obj.h"
+#include "icl-repr.h"
+#include "icl-repr-value.h"
+#include "icl-repr-list.h"
void ic_list_inc_ref_count(iotcon_list_h val)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_LIST_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_LIST_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_LIST_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_LIST_H__
#include <glib.h>
#include <json-glib/json-glib.h>
void ic_list_inc_ref_count(iotcon_list_h val);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_LIST_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_LIST_H__ */
#include "iotcon-struct.h"
#include "iotcon-constant.h"
#include "iotcon-representation.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-repr-list.h"
-#include "ic-repr-value.h"
-#include "ic-repr.h"
-#include "ic-repr-obj.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-repr-list.h"
+#include "icl-repr-value.h"
+#include "icl-repr.h"
+#include "icl-repr-obj.h"
int ic_obj_del_value(iotcon_repr_h repr, const char *key,
iotcon_types_e value_type)
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_OBJECT_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_OBJECT_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_OBJECT_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_OBJECT_H__
#include <json-glib/json-glib.h>
JsonObject* ic_obj_to_json(iotcon_repr_h repr);
iotcon_repr_h ic_obj_from_json(JsonObject *obj);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_OBJECT_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_OBJECT_H__ */
#include "iotcon-struct.h"
#include "iotcon-representation.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-repr.h"
-#include "ic-repr-list.h"
-#include "ic-repr-value.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-repr.h"
+#include "icl-repr-list.h"
+#include "icl-repr-value.h"
static iotcon_value_h _ic_value_new(int type)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_VALUE_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_VALUE_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_VALUE_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_VALUE_H__
#include <stdbool.h>
#include <json-glib/json-glib.h>
iotcon_value_h ic_value_clone(iotcon_value_h src);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_VALUE_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_VALUE_H__ */
#include "iotcon-struct.h"
#include "iotcon-representation.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-resource-types.h"
-#include "ic-ioty.h"
-#include "ic.h"
-#include "ic-repr-list.h"
-#include "ic-repr-value.h"
-#include "ic-repr-obj.h"
-#include "ic-repr.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-resource-types.h"
+#include "icl-ioty.h"
+#include "icl-repr-list.h"
+#include "icl-repr-value.h"
+#include "icl-repr-obj.h"
+#include "icl-repr.h"
void ic_repr_inc_ref_count(iotcon_repr_h val)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_H__
#include <stdbool.h>
#include <glib.h>
void ic_repr_inc_ref_count(iotcon_repr_h val);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_REPRESENTATION_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REPRESENTATION_H__ */
*/
#include "iotcon-struct.h"
#include "iotcon-constant.h"
-#include "ic-common.h"
-#include "ic-request.h"
+#include "icl.h"
+#include "icl-request.h"
/* The content of the request should not be freed by user. */
API int iotcon_request_get_uri(iotcon_request_h request, char **uri)
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_REQUEST_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_REQUEST_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__
#include "iotcon-struct.h"
#include "iotcon-constant.h"
oc_resource_h resource_handle;
};
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_REQUEST_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__ */
#include "iotcon-struct.h"
#include "iotcon-constant.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-resource-types.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-resource-types.h"
iotcon_resource_types_h ic_resource_types_ref(iotcon_resource_types_h types)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESOURCE_TYPES_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESOURCE_TYPES_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_TYPES_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_TYPES_H__
#include "iotcon-struct.h"
const char* ic_resource_types_get_nth_data(iotcon_resource_types_h res_types, int index);
unsigned int ic_resource_types_get_length(iotcon_resource_types_h res_types);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESOURCE_TYPES_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_TYPES_H__ */
#include <glib.h>
#include "iotcon.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-ioty.h"
-#include "ic-repr.h"
-#include "ic-options.h"
-#include "ic-request.h"
-#include "ic-response.h"
+#include "icl.h"
+#include "icl-utils.h"
+#include "icl-ioty.h"
+#include "icl-repr.h"
+#include "icl-options.h"
+#include "icl-request.h"
+#include "icl-response.h"
API iotcon_response_h iotcon_response_new(iotcon_request_h request_h)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESPONSE_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESPONSE_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__
#include "iotcon-struct.h"
#include "iotcon-constant.h"
-#include "ic-request.h"
+#include "icl-request.h"
struct ic_resource_response {
char *new_uri;
oc_resource_h resource_handle;
};
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_RESPONSE_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__ */
#include <errno.h>
#include "iotcon.h"
-#include "ic-common.h"
-#include "ic-utils.h"
+#include "icl.h"
+#include "icl-utils.h"
char* ic_utils_strdup(const char *src)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_UTILITY_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_UTILITY_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__
#define IC_STR_EQUAL 0
char* ic_utils_strdup(const char *src);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_UTILITY_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_UTILITY_H__ */
#include <glib-object.h>
#include "iotcon.h"
-#include "ic-common.h"
-#include "ic-utils.h"
-#include "ic-resource-types.h"
-#include "ic-ioty.h"
-#include "ic-repr.h"
-#include "ic.h"
+#include "icl-utils.h"
+#include "icl-resource-types.h"
+#include "icl-ioty.h"
+#include "icl-repr.h"
+#include "icl.h"
/**
* @brief global context
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_H__
-#define __IOT_CONNECTIVITY_MANAGER_INTERNAL_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_H__
+#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_H__
#include "iotcon.h"
+#include "ic-common.h"
+#include "ic-log.h"
+
+#ifdef API
+#undef API
+#endif
+#define API __attribute__((visibility("default")))
+
#define IC_INTERFACE_MAX (IOTCON_INTERFACE_DEFAULT | IOTCON_INTERFACE_LINK | \
IOTCON_INTERFACE_BATCH | IOTCON_INTERFACE_GROUP)
-struct ic_resource {
- char *uri;
- char *host;
- bool is_observable;
- iotcon_resource_types_h types;
- int ifaces;
- void *handle;
- iotcon_request_handler_cb cb;
- void *user_data;
- iotcon_resource_h children[IOTCON_CONTAINED_RESOURCES_MAX];
-};
-
-struct ic_notify_msg {
- int error_code;
- iotcon_interface_e iface;
- iotcon_repr_h repr;
-};
iotcon_resource_h ic_get_resource_handler_data(void *handle);
-#endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_H__ */
<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="connman::get" type="rw" />
<smack request="dbus" type="rwx" />
+ <smack request="libiotcon" type="rwxt" />
<smack request="_" type="rw" />
<smack request="system::use_internet" type="rw" />
</request>
</define>
- <assign>
- <filesystem path="/usr/lib/libiotcon.so*" label="_" exec_label="_"/>
- </assign>
-
<request>
<domain name="iotcon" />
</request>
--- /dev/null
+[Unit]
+Description=IoT Connectivity Manager
+After=system-server.service
+Requires=system-server.service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/iotcon-daemon
+KillSignal=SIGKILL
+
+[Install]
+WantedBy=multi-user.target
Group: Network & Connectivity/Other
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.service
Source1001: %{name}.manifest
+Source1002: lib%{name}.manifest
BuildRequires: cmake
BuildRequires: boost-devel
BuildRequires: iotivity-devel
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(capi-base-common)
-
+%define _unitdir /usr/lib/systemd/system
%description
-IoT Connectivity Manager and Library
+IoT Connectivity Manager Daemon
+
+
+%package lib
+Summary: IoT Connectivity Library
+Group: Network & Connectivity/Libraries
+Requires: %{name} = %{version}
+
+%description lib
+Tizen event notification service Client library for applications.
+
%package devel
Summary: IoT Connectivity Manager (devel)
Group: Network & Connectivity/Development
-Requires: %{name} = %{version}
+Requires: %{name}-lib = %{version}
%description devel
IoT Connectivity Manager development Kit
+
+%package test
+Summary: IoT Connectivity Manager (test)
+Group: Network & Connectivity/Development
+Requires: %{name}-lib = %{version}
+
+%description test
+IoT Connectivity Manager Test Programs
+
+
%prep
%setup -q
cp %{SOURCE1001} .
+cp %{SOURCE1002} .
+
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%install
+rm -rf %{buildroot}/BUILD/%{name}*
%make_install
-%post -p /sbin/ldconfig
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+cp -af %{SOURCE1} %{buildroot}%{_unitdir}/
+ln -s ../%{name}.service %{buildroot}%{_unitdir}/multi-user.target.wants/%{name}.service
+
+%post
+systemctl daemon-reload
+if [ $1 == 1 ]; then
+ systemctl restart %{name}.service
+fi
+
+%postun
+/sbin/ldconfig
+if [ $1 == 0 ]; then
+ systemctl stop %{name}.service
+fi
+systemctl daemon-reload
+
+
+%post lib -p /sbin/ldconfig
+%postun lib -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
+%{_unitdir}/%{name}.service
+%{_unitdir}/multi-user.target.wants/%{name}.service
+%{_bindir}/%{name}-daemon
+%{_datadir}/dbus-1/services/org.tizen.%{name}.service
+%license LICENSE.APLv2
+
+%files lib
+%manifest lib%{name}.manifest
+%defattr(-,root,root,-)
%{_libdir}/lib%{name}.so.*
%license LICENSE.APLv2
-%{_bindir}/crud-test-client
-%{_bindir}/crud-test-server
-%{_bindir}/device-test-client
-%{_bindir}/device-test-server
-%{_bindir}/repr-test-client
-%{_bindir}/repr-test-server
%files devel
+%defattr(-,root,root,-)
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}/*.h
+%files test
+%defattr(-,root,root,-)
+%{_bindir}/crud-test-client
+%{_bindir}/crud-test-server
+%{_bindir}/device-test-client
+%{_bindir}/device-test-server
+%{_bindir}/repr-test-client
+%{_bindir}/repr-test-server
--- /dev/null
+<manifest>
+ <define>
+ <domain name="libiotcon" />
+ <permit>
+ <smack permit="_" type="rw" />
+ <smack permit="dbus" type="rwx" />
+ </permit>
+ <request>
+ <smack request="dbus" type="rwx" />
+ <smack request="_" type="rw" />
+ <smack request="enotice" type="rwxat" />
+ </request>
+ </define>
+ <assign>
+ <filesystem path="/usr/lib/libiotcon.so*" label="_" exec_label="_"/>
+ </assign>
+ <request>
+ <domain name="libiotcon" />
+ </request>
+</manifest>