#ifndef __POSITION_FINDER_CONNECTIVITY_H__
#define __POSITION_FINDER_CONNECTIVITY_H__
+#include "connectivity_internal.h"
+
+struct connectivity_resource {
+ iotcon_resource_h res;
+ iotcon_observers_h observers;
+};
+
typedef struct connectivity_resource connectivity_resource_s;
-extern int connectivity_notify(connectivity_resource_s *user_data, int value);
-extern int connectivity_init(const char *device_name);
-extern int connectivity_fini(void);
+extern int connectivity_set_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource_info);
+extern void connectivity_unset_resource(connectivity_resource_s *resource);
-extern void connectivity_destroy_resource(connectivity_resource_s *resource);
-extern int connectivity_create_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource);
+extern int connectivity_notify(connectivity_resource_s *resource_info, int value);
#endif /* __POSITION_FINDER_CONNECTIVITY_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ * Geunsun Lee <gs86.lee@samsung.com>
+ * Eunyoung Lee <ey928.lee@samsung.com>
+ * Junkyu Han <junkyu.han@samsung.com>
+ *
+ * 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 __POSITION_FINDER_CONNECTIVITY_INTERNAL_H__
+#define __POSITION_FINDER_CONNECTIVITY_INTERNAL_H__
+
+extern int connectivity_init(const char *device_name);
+extern int connectivity_fini(void);
+
+#endif /* __POSITION_FINDER_CONNECTIVITY_INTERNAL_H__ */
#define ULTRASONIC_RESOURCE_2_URI "/door/2"
#define ULTRASONIC_RESOURCE_TYPE "org.tizen.door"
-struct connectivity_resource {
- iotcon_resource_h res;
- iotcon_observers_h observers;
-};
static bool _resource_created;
static void _request_resource_handler(iotcon_resource_h resource, iotcon_request_h request, void *user_data);
return -1;
}
-int connectivity_notify(connectivity_resource_s *user_data, int value)
+int connectivity_notify(connectivity_resource_s *resource_info, int value)
{
iotcon_representation_h representation;
- connectivity_resource_s *resource_info = user_data;
int ret = -1;
retv_if(!resource_info, -1);
new_resource_info = calloc(1, sizeof(connectivity_resource_s));
retv_if(!new_resource_info, -1);
- ret = connectivity_create_resource(ULTRASONIC_RESOURCE_2_URI, ULTRASONIC_RESOURCE_TYPE, &new_resource_info);
+ ret = connectivity_set_resource(ULTRASONIC_RESOURCE_2_URI, ULTRASONIC_RESOURCE_TYPE, &new_resource_info);
retv_if(0 != ret, -1);
_resource_created = true;
{
int ret = -1;
- ret = iotcon_initialize("../res/iotcon-test-svr-db-server.dat");
+ ret = iotcon_initialize("/usr/apps/org.tizen.position-finder-server/res/iotcon-test-svr-db-server.dat");
retv_if(IOTCON_ERROR_NONE != ret, -1);
ret = iotcon_set_device_name(device_name);
return 0;
}
-void connectivity_destroy_resource(connectivity_resource_s *resource_info)
+void connectivity_unset_resource(connectivity_resource_s *resource_info)
{
ret_if(!resource_info);
if (resource_info->observers) iotcon_observers_destroy(resource_info->observers);
free(resource_info);
}
-int connectivity_create_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource_info)
+int connectivity_set_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource_info)
{
iotcon_resource_types_h resource_types = NULL;
iotcon_resource_interfaces_h ifaces = NULL;