summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorboyeon-son <bson1012@gmail.com>2018-08-14 09:23:27 +0900
committerboyeon-son <bson1012@gmail.com>2018-08-14 09:23:27 +0900
commitfdc912281834e80bebab91dda327eecbf1f1e561 (patch)
treed841f296ad0dbb742de4b0f37bbc2af84f53111e
parenta85d1df7d1eec784375b7204c53256a20dec2472 (diff)
downloadrcc-fdc912281834e80bebab91dda327eecbf1f1e561.tar.gz
rcc-fdc912281834e80bebab91dda327eecbf1f1e561.tar.bz2
rcc-fdc912281834e80bebab91dda327eecbf1f1e561.zip
Remove old files
-rwxr-xr-xCMakeLists.txt80
-rw-r--r--LICENSE204
-rw-r--r--inc/connection_manager.h32
-rw-r--r--inc/connectivity.h164
-rw-r--r--inc/controller.h27
-rw-r--r--inc/controller_internal.h28
-rw-r--r--inc/controller_util.h30
-rw-r--r--inc/log.h101
-rwxr-xr-xinc/resource.h42
-rw-r--r--inc/resource/resource_PCA9685.h29
-rw-r--r--inc/resource/resource_adc_mcp3008.h30
-rw-r--r--inc/resource/resource_flame_sensor.h35
-rw-r--r--inc/resource/resource_flame_sensor_internal.h31
-rw-r--r--inc/resource/resource_gas_detection_sensor.h34
-rw-r--r--inc/resource/resource_gas_detection_sensor_internal.h31
-rw-r--r--inc/resource/resource_illuminance_sensor.h35
-rw-r--r--inc/resource/resource_illuminance_sensor_internal.h31
-rw-r--r--inc/resource/resource_infrared_motion_sensor.h34
-rw-r--r--inc/resource/resource_infrared_motion_sensor_internal.h31
-rw-r--r--inc/resource/resource_infrared_obstacle_avoidance_sensor.h34
-rw-r--r--inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h31
-rw-r--r--inc/resource/resource_led.h27
-rw-r--r--inc/resource/resource_led_internal.h27
-rw-r--r--inc/resource/resource_motor_driver_L298N.h82
-rw-r--r--inc/resource/resource_motor_driver_L298N_internal.h25
-rwxr-xr-xinc/resource/resource_rain_sensor.h35
-rwxr-xr-xinc/resource/resource_rain_sensor_internal.h31
-rw-r--r--inc/resource/resource_servo_motor.h36
-rw-r--r--inc/resource/resource_servo_motor_internal.h25
-rw-r--r--inc/resource/resource_sound_detection_sensor.h35
-rw-r--r--inc/resource/resource_sound_detection_sensor_internal.h31
-rw-r--r--inc/resource/resource_sound_level_sensor.h36
-rw-r--r--inc/resource/resource_sound_level_sensor_internal.h27
-rw-r--r--inc/resource/resource_tilt_sensor.h35
-rw-r--r--inc/resource/resource_tilt_sensor_internal.h31
-rw-r--r--inc/resource/resource_touch_sensor.h34
-rw-r--r--inc/resource/resource_touch_sensor_internal.h31
-rw-r--r--inc/resource/resource_ultrasonic_sensor.h36
-rw-r--r--inc/resource/resource_ultrasonic_sensor_internal.h33
-rw-r--r--inc/resource/resource_vibration_sensor.h34
-rw-r--r--inc/resource/resource_vibration_sensor_internal.h31
-rwxr-xr-xinc/resource_internal.h62
-rw-r--r--inc/webutil.h88
-rw-r--r--noBuild/README.md16
-rw-r--r--noBuild/resource_camera.c233
-rw-r--r--noBuild/resource_camera.h30
-rw-r--r--org.tizen.rcc.manifest5
-rw-r--r--packaging/org.tizen.rcc.spec99
-rw-r--r--project_def.prop11
-rw-r--r--res/iotcon-test-svr-db-server.datbin2733 -> 0 bytes
-rw-r--r--res/pi.conf4
-rw-r--r--settings13
-rwxr-xr-xshared/res/default_icon.pngbin57662 -> 0 bytes
-rw-r--r--src/connection_manager.c206
-rw-r--r--src/connectivity.c1273
-rw-r--r--src/controller.c163
-rw-r--r--src/controller_internal.c47
-rw-r--r--src/controller_util.c144
-rw-r--r--src/resource.c46
-rw-r--r--src/resource/resource_PCA9685.c249
-rw-r--r--src/resource/resource_adc_mcp3008.c208
-rw-r--r--src/resource/resource_flame_sensor.c63
-rw-r--r--src/resource/resource_gas_detection_sensor.c63
-rw-r--r--src/resource/resource_illuminance_sensor.c73
-rw-r--r--src/resource/resource_infrared_motion_sensor.c58
-rw-r--r--src/resource/resource_infrared_obstacle_avoidance_sensor.c62
-rw-r--r--src/resource/resource_led.c59
-rw-r--r--src/resource/resource_motor_driver_L298N.c333
-rwxr-xr-xsrc/resource/resource_rain_sensor.c61
-rw-r--r--src/resource/resource_servo_motor.c75
-rw-r--r--src/resource/resource_sound_detection_sensor.c63
-rw-r--r--src/resource/resource_sound_level_sensor.c55
-rw-r--r--src/resource/resource_tilt_sensor.c63
-rw-r--r--src/resource/resource_touch_sensor.c62
-rw-r--r--src/resource/resource_ultrasonic_sensor.c157
-rw-r--r--src/resource/resource_vibration_sensor.c58
-rw-r--r--src/webutil.c696
-rw-r--r--tizen-manifest.xml13
-rw-r--r--tizen-manifest.xml.in18
79 files changed, 0 insertions, 6705 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100755
index f2823da..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(${P_NAME} C)
-
-SET(INSTALL_EXEC_PREFIX "${INSTALL_PREFIX}/bin")
-SET(CMAKE_VERBOSE_MAKEFILE 0)
-
-SET(PROJECT_ROOT_DIR "${CMAKE_SOURCE_DIR}")
-SET(PROJECT_RESOURCES_DIR "${PROJECT_ROOT_DIR}/res")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(APP_PKGS REQUIRED
- dlog
- aul
- capi-appfw-application
- capi-appfw-service-application
- capi-system-peripheral-io
- ecore
- eina
- iotcon
- gio-2.0
- libcurl
- glib-2.0
- json-glib-1.0
- capi-system-info
- capi-network-connection
- capi-media-camera
-)
-
-ADD_DEFINITIONS(-DCBOR_FILE_IN_RES="${INSTALL_RESDIR}/${CBOR_FILE}")
-ADD_DEFINITIONS(-DCBOR_FILE_IN_DATA="${INSTALL_OWNER_DATADIR}/${CBOR_FILE}")
-ADD_DEFINITIONS(-DCONF_FILE="${INSTALL_RESDIR}/${CONF_FILE}")
-
-FOREACH (flag ${APP_PKGS_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Winline -g -fno-builtin-malloc -fPIE")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-INCLUDE_DIRECTORIES(${PROJECT_ROOT_DIR}/inc)
-
-ADD_EXECUTABLE(${PROJECT_NAME}
- ${PROJECT_ROOT_DIR}/src/controller.c
- ${PROJECT_ROOT_DIR}/src/controller_internal.c
- ${PROJECT_ROOT_DIR}/src/controller_util.c
- ${PROJECT_ROOT_DIR}/src/connectivity.c
- ${PROJECT_ROOT_DIR}/src/connection_manager.c
- ${PROJECT_ROOT_DIR}/src/webutil.c
- ${PROJECT_ROOT_DIR}/src/resource.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_illuminance_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_infrared_motion_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_infrared_obstacle_avoidance_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_touch_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_ultrasonic_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_led.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_vibration_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_flame_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_rain_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_sound_detection_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_tilt_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_gas_detection_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_sound_level_sensor.c
- ${PROJECT_ROOT_DIR}/src/resource/resource_adc_mcp3008.c
-)
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lm)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${APP_PKGS_LDFLAGS})
-
-Message("APP_LABEL : ${APP_LABEL}")
-
-CONFIGURE_FILE(${PROJECT_ROOT_DIR}/tizen-manifest.xml.in ${ORG_PREFIX}.${PROJECT_NAME}.xml @ONLY)
-# Install
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${INSTALL_EXEC_PREFIX})
-INSTALL(FILES ${ORG_PREFIX}.${PROJECT_NAME}.xml DESTINATION ${SYS_PACKAGES_DIR})
-INSTALL(FILES ${PROJECT_ROOT_DIR}/shared/res/default_icon.png DESTINATION ${SYS_ICONS_DIR} RENAME ${PROJECT_NAME}.png)
-INSTALL(FILES ${PROJECT_ROOT_DIR}/res/${CBOR_FILE} DESTINATION ${INSTALL_RESDIR})
-INSTALL(FILES ${PROJECT_ROOT_DIR}/res/${CONF_FILE} DESTINATION ${INSTALL_RESDIR})
-
-# End of a file
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index a06208b..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,204 +0,0 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
diff --git a/inc/connection_manager.h b/inc/connection_manager.h
deleted file mode 100644
index 7a3975d..0000000
--- a/inc/connection_manager.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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>
- * Jeonghoon Park <jh1979.park@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 __RCC_CONN_MGR_H__
-#define __RCC_CONN_MGR_H__
-
-int connection_manager_get_ip(const char **ip);
-int connection_manager_init(void);
-int connection_manager_fini(void);
-
-#endif /* __RCC_CONN_MGR_H__ */
-
diff --git a/inc/connectivity.h b/inc/connectivity.h
deleted file mode 100644
index 2195885..0000000
--- a/inc/connectivity.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_CONNECTIVITY_H__
-#define __RCC_CONNECTIVITY_H__
-
-typedef struct _connectivity_resource connectivity_resource_s;
-
-typedef enum {
- CONNECTIVITY_PROTOCOL_DEFAULT = 0, /* default protocol */
- CONNECTIVITY_PROTOCOL_IOTIVITY, /* IoTvity protocol */
- CONNECTIVITY_PROTOCOL_HTTP, /* HTTP protocol */
- CONNECTIVITY_PROTOCOL_MAX
-} connectivity_protocol_e;
-
-/**
- * @brief Set connectivity protocol to communicate with other devices.
- * @param[in] protocol_type protocol type to use
- * @return 0 on success, otherwise a negative error value
- * @see You should set protocol before call connectivity_set_resource(),
- * otherwise IoTvitiy protocol will be set as default.
- */
-extern int connectivity_set_protocol(connectivity_protocol_e protocol_type);
-
-/**
- * @brief Create connectivity resource.
- * @param[in] path The path of the resource
- * @param[in] type The string data to insert into the resource types (e.g. "org.tizen.light")
- * @param[out] out_resource_info A structure containing information about connectivity resource
- * @return 0 on success, otherwise a negative error value
- * @see uri_path length must be less than 128.
- * @see You must destroy resource by calling connectivity_unset_resource() if resource is no longer needed.
- */
-extern int connectivity_set_resource(const char *path, const char *type, connectivity_resource_s **out_resource_info);
-
-/**
- * @brief Releases all resource about connectivity.
- * @param[in] resource_info A structure containing information about connectivity resource
- */
-extern void connectivity_unset_resource(connectivity_resource_s *resource);
-
-/**
- * @brief Notifies a resource's value to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be sended.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_notify_bool(connectivity_resource_s *resource_info, const char *key, bool value);
-
-/**
- * @brief Notifies a resource's value to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be sended.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_notify_int(connectivity_resource_s *resource_info, const char *key, int value);
-
-/**
- * @brief Notifies a resource's value to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be sended.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_notify_double(connectivity_resource_s *resource_info, const char *key, double value);
-
-/**
- * @brief Notifies a resource's value to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be sended.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_notify_string(connectivity_resource_s *resource_info, const char *key, const char *value);
-
-/* TODO : add comments for these functions */
-/**
- * @brief Add a boolean type value to attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be added.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_attributes_add_bool(connectivity_resource_s *resource_info, const char *key, bool value);
-
-/**
- * @brief Add a integer type value to attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be added.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_attributes_add_int(connectivity_resource_s *resource_info, const char *key, int value);
-
-/**
- * @brief Add a double type value to attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be added.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_attributes_add_double(connectivity_resource_s *resource_info, const char *key, double value);
-
-/**
- * @brief Add a string value to attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @param[in] value A value to be added.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_attributes_add_string(connectivity_resource_s *resource_info, const char *key, const char *value);
-
-/**
- * @brief Notifies values in the attributs to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @return 0 on success, otherwise a negative error value
- */
-extern int connectivity_attributes_notify_all(connectivity_resource_s *resource_info);
-
-/**
- * @brief Remove a value from attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @param[in] key A key to be sended.
- * @return 0 on success, otherwise a negative error value
- * @see If key is already exists, current value will be replaced with new value.
- */
-extern int connectivity_attributes_remove_value_by_key(connectivity_resource_s *resource_info, const char *key);
-
-/**
- * @brief Remove all values from attributes for notifying to observed devices or clouds.
- * @param[in] resource_info A structure containing information about connectivity resource
- * @return 0 on success, otherwise a negative error value
- */
-extern int connectivity_attributes_remove_all(connectivity_resource_s *resource_info);
-
-#endif /* __RCC_CONNECTIVITY_H__ */
diff --git a/inc/controller.h b/inc/controller.h
deleted file mode 100644
index e3290c7..0000000
--- a/inc/controller.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_CONTROLLER_H__
-#define __RCC_CONTROLLER_H__
-
-#include "controller_internal.h"
-
-#endif /* __RCC_CONTROLLER_H__ */
diff --git a/inc/controller_internal.h b/inc/controller_internal.h
deleted file mode 100644
index 04df334..0000000
--- a/inc/controller_internal.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_CONTROLLER_INTERNAL_H__
-#define __RCC_CONTROLLER_INTERNAL_H__
-
-extern void controller_init_internal_functions(void);
-extern void controller_fini_internal_functions(void);
-
-#endif /* __RCC_CONTROLLER_INTERNAL_H__ */
diff --git a/inc/controller_util.h b/inc/controller_util.h
deleted file mode 100644
index 8ea78ce..0000000
--- a/inc/controller_util.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_CONTROLLER_UTIL_H__
-#define __RCC_CONTROLLER_UTIL_H__
-
-int controller_util_get_path(const char **path);
-int controller_util_get_address(const char **address);
-int controller_util_get_image_address(const char **image_upload);
-void controller_util_free(void);
-
-#endif /* __RCC_CONTROLLER_UTIL_H__ */
diff --git a/inc/log.h b/inc/log.h
deleted file mode 100644
index 9ca1d9f..0000000
--- a/inc/log.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_LOG_H__
-#define __RCC_LOG_H__
-
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "RCC"
-
-#if !defined(_D)
-#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_I)
-#define _I(fmt, arg...) dlog_print(DLOG_INFO, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_W)
-#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
-#endif
-
-#if !defined(_E)
-#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s:%d] " fmt "\n", __func__, __LINE__, ##arg)
-#endif
-
-#define retvm_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- _E(fmt, ##arg); \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return val; \
- } \
-} while (0)
-
-#define retv_if(expr, val) do { \
- if (expr) { \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return (val); \
- } \
-} while (0)
-
-#define retm_if(expr, fmt, arg...) do { \
- if (expr) { \
- _E(fmt, ##arg); \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return; \
- } \
-} while (0)
-
-#define ret_if(expr) do { \
- if (expr) { \
- _E("(%s) -> %s() return", #expr, __FUNCTION__); \
- return; \
- } \
-} while (0)
-
-#define goto_if(expr, val) do { \
- if (expr) { \
- _E("(%s) -> goto", #expr); \
- goto val; \
- } \
-} while (0)
-
-#define break_if(expr) { \
- if (expr) { \
- _E("(%s) -> break", #expr); \
- break; \
- } \
-}
-
-#define continue_if(expr) { \
- if (expr) { \
- _E("(%s) -> continue", #expr); \
- continue; \
- } \
-}
-
-
-
-#endif /* __RCC_LOG_H__ */
diff --git a/inc/resource.h b/inc/resource.h
deleted file mode 100755
index d91f671..0000000
--- a/inc/resource.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_H__
-#define __RCC_RESOURCE_H__
-
-#include <peripheral_io.h>
-
-#include "resource_internal.h"
-#include "resource/resource_illuminance_sensor.h"
-#include "resource/resource_infrared_motion_sensor.h"
-#include "resource/resource_infrared_obstacle_avoidance_sensor.h"
-#include "resource/resource_touch_sensor.h"
-#include "resource/resource_ultrasonic_sensor.h"
-#include "resource/resource_led.h"
-#include "resource/resource_vibration_sensor.h"
-#include "resource/resource_flame_sensor.h"
-#include "resource/resource_rain_sensor.h"
-#include "resource/resource_sound_detection_sensor.h"
-#include "resource/resource_tilt_sensor.h"
-#include "resource/resource_gas_detection_sensor.h"
-#include "resource/resource_sound_level_sensor.h"
-
-#endif /* __RCC_RESOURCE_H__ */
diff --git a/inc/resource/resource_PCA9685.h b/inc/resource/resource_PCA9685.h
deleted file mode 100644
index d51fd04..0000000
--- a/inc/resource/resource_PCA9685.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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 __RCC_RESOURCE_PCA9685_H__
-#define __RCC_RESOURCE_PCA9685_H__
-
-#define PCA9685_CH_MAX 15
-
-int resource_pca9685_init(unsigned int ch);
-int resource_pca9685_fini(unsigned int ch);
-int resource_pca9685_set_frequency(unsigned int freq_hz);
-int resource_pca9685_set_value_to_channel(unsigned int channel, int on, int off);
-
-#endif /* __RCC_RESOURCE_PCA9685_H__ */
diff --git a/inc/resource/resource_adc_mcp3008.h b/inc/resource/resource_adc_mcp3008.h
deleted file mode 100644
index d4b2204..0000000
--- a/inc/resource/resource_adc_mcp3008.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_ADC_MCP3008_H__
-#define __RCC_RESOURCE_ADC_MCP3008_H__
-
-int resource_adc_mcp3008_init(void);
-int resource_read_adc_mcp3008(int ch_num, unsigned int *out_value);
-void resource_adc_mcp3008_fini(void);
-
-#endif /* __RCC_RESOURCE_ADC_MCP3008_H__ */
-
diff --git a/inc/resource/resource_flame_sensor.h b/inc/resource/resource_flame_sensor.h
deleted file mode 100644
index 12bf80a..0000000
--- a/inc/resource/resource_flame_sensor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_FLAME_SENSOR_H__
-#define __RCC_RESOURCE_FLAME_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected flame sensor(NS-FDSM).
- * @param[in] pin_num The number of the gpio pin connected to the flame sensor
- * @param[out] out_value The vaule of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- *
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_flame_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_FLAME_SENSOR_H__ */
diff --git a/inc/resource/resource_flame_sensor_internal.h b/inc/resource/resource_flame_sensor_internal.h
deleted file mode 100644
index 3abb73f..0000000
--- a/inc/resource/resource_flame_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_FLAME_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_FLAME_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the flame sensor
- */
-extern void resource_close_flame_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_FLAME_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_gas_detection_sensor.h b/inc/resource/resource_gas_detection_sensor.h
deleted file mode 100644
index 3db5f9d..0000000
--- a/inc/resource/resource_gas_detection_sensor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_GAS_DETECTION_SENSOR_H__
-#define __RCC_RESOURCE_GAS_DETECTION_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected to the gas detection sensor(fc-22).
- * @param[in] pin_num The number of the gpio pin connected to the digital pin of gas detection sensor
- * @param[out] out_value The value of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_gas_detection_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_GAS_DETECTION_SENSOR_H__ */
diff --git a/inc/resource/resource_gas_detection_sensor_internal.h b/inc/resource/resource_gas_detection_sensor_internal.h
deleted file mode 100644
index 736740d..0000000
--- a/inc/resource/resource_gas_detection_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_GAS_DETECTION_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_GAS_DETECTION_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the gas detection sensor
- */
-extern void resource_close_gas_detection_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_GAS_DETECTION_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_illuminance_sensor.h b/inc/resource/resource_illuminance_sensor.h
deleted file mode 100644
index 032ef7a..0000000
--- a/inc/resource/resource_illuminance_sensor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_ILLUMINANCE_SENSOR_H__
-#define __RCC_FINDER_RESOURCE_ILLUMINANCE_SENSOR_H__
-
-/**
- * @brief Reads the value of i2c bus connected illuminance sensor.
- * @param[in] i2c_bus The i2c bus number that the slave device is connected
- * @param[out] out_value The value read by the illuminance sensor
- * @return 0 on success, otherwise a negative error value
- * @see If the i2c bus is not open, creates i2c handle before reading data from the i2c slave device.
- */
-extern int resource_read_illuminance_sensor(int i2c_bus, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_ILLUMINANCE_SENSOR_H__ */
-
diff --git a/inc/resource/resource_illuminance_sensor_internal.h b/inc/resource/resource_illuminance_sensor_internal.h
deleted file mode 100644
index a803bb3..0000000
--- a/inc/resource/resource_illuminance_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__
-
-/**
- * @brief Destory the i2c handle and changes the gpio pin state to the close(0).
- */
-extern void resource_close_illuminance_sensor(void);
-
-#endif /* __RCC_RESOURCE_ILLUMINANCE_SENSOR_INTERNAL_H__ */
-
diff --git a/inc/resource/resource_infrared_motion_sensor.h b/inc/resource/resource_infrared_motion_sensor.h
deleted file mode 100644
index e7d3e83..0000000
--- a/inc/resource/resource_infrared_motion_sensor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_INFRARED_MOTION_SENSOR_H__
-#define __RCC_RESOURCE_INFRARED_MOTION_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected infrared motion sensor(HC-SR501).
- * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
- * @param[out] out_value The value of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_infrared_motion_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_INFRARED_MOTION_SENSOR_H__ */
diff --git a/inc/resource/resource_infrared_motion_sensor_internal.h b/inc/resource/resource_infrared_motion_sensor_internal.h
deleted file mode 100644
index b8a8639..0000000
--- a/inc/resource/resource_infrared_motion_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
- */
-extern void resource_close_infrared_motion_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_INFRARED_MOTION_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_infrared_obstacle_avoidance_sensor.h b/inc/resource/resource_infrared_obstacle_avoidance_sensor.h
deleted file mode 100644
index 7187b98..0000000
--- a/inc/resource/resource_infrared_obstacle_avoidance_sensor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
-#define __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected infrared obstacle avoidance sensor.
- * @param[in] pin_num The number of the gpio pin connected to the infrared obstacle avoidance sensor
- * @param[out] out_value The value of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__ */
diff --git a/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h b/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h
deleted file mode 100644
index 4173e58..0000000
--- a/inc/resource/resource_infrared_obstacle_avoidance_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the infrared obstacle avoidance sensor
- */
-extern void resource_close_infrared_obstacle_avoidance_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_led.h b/inc/resource/resource_led.h
deleted file mode 100644
index 1a0c227..0000000
--- a/inc/resource/resource_led.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_LED_H__
-#define __RCC_RESOURCE_LED_H__
-
-extern int resource_write_led(int pin_num, int write_value);
-
-#endif /* __RCC_RESOURCE_LED_H__ */
diff --git a/inc/resource/resource_led_internal.h b/inc/resource/resource_led_internal.h
deleted file mode 100644
index fc22ab9..0000000
--- a/inc/resource/resource_led_internal.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_LED_INTERNAL_H__
-#define __RCC_RESOURCE_LED_INTERNAL_H__
-
-extern void resource_close_led(int pin_num);
-
-#endif /* __RCC_RESOURCE_LED_INTERNAL_H__ */
diff --git a/inc/resource/resource_motor_driver_L298N.h b/inc/resource/resource_motor_driver_L298N.h
deleted file mode 100644
index e6b2133..0000000
--- a/inc/resource/resource_motor_driver_L298N.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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 __RCC_RESOURCE_MOTOR_DRIVER_L298N_H__
-#define __RCC_RESOURCE_MOTOR_DRIVER_L298N_H__
-
-/**
- * This module is sample codes to handling DC motors in Tizen platform.
- * HW is configured with L298N(motor driver) and PCA9685(PWM controller).
- * To control motor, we use two GPIO pins of IoT board(e.g. RPi 3) connected
- * with L298N and a PWM channel of PCA9685 connected with L298N
- */
-
-/* Default GPIO pins of raspberry pi 3 connected with IN pins of L298N */
-#define DEFAULT_MOTOR1_PIN1 26
-#define DEFAULT_MOTOR1_PIN2 20
-
-#define DEFAULT_MOTOR2_PIN1 19
-#define DEFAULT_MOTOR2_PIN2 16
-
-#define DEFAULT_MOTOR3_PIN1 6
-#define DEFAULT_MOTOR3_PIN2 12
-
-#define DEFAULT_MOTOR4_PIN1 22
-#define DEFAULT_MOTOR4_PIN2 23
-
-/* Default channel numbers of PCA9685 with enable pins of L298N */
-#define DEFAULT_MOTOR1_EN_CH 1
-#define DEFAULT_MOTOR2_EN_CH 2
-#define DEFAULT_MOTOR3_EN_CH 3
-#define DEFAULT_MOTOR4_EN_CH 4
-
-
-/**
- * @brief Enumeration for motor id.
- */
-typedef enum {
- MOTOR_ID_1,
- MOTOR_ID_2,
- MOTOR_ID_3,
- MOTOR_ID_4,
- MOTOR_ID_MAX
-} motor_id_e;
-
-/**
- * @param[in] id The motor id
- * @param[in] pin1 The first pin number to control motor
- * @param[in] pin2 The second pin number to control motor
- * @param[in] en_ch The enable channnel number to control PWM signal
- *
- * @return 0 on success, otherwise a negative error value
- * @before resource_set_motor_driver_L298N_speed() : Optional
- */
-int resource_set_motor_driver_L298N_configuration(motor_id_e id,
- unsigned int pin1, unsigned int pin2, unsigned en_ch);
-
-/**
- * @param[in] id The motor id
- * @param[in] speed The speed to control motor, 0 to stop motor,
- * positive value to rotate clockwise and higher value to rotate more fast
- * negative value to rotate couterclockwise and lower value to rotate more fast
- * @return 0 on success, otherwise a negative error value
- * @before resource_set_motor_driver_L298N_speed() : Optional
- */
-int resource_set_motor_driver_L298N_speed(motor_id_e id, int speed);
-
-#endif /* __RCC_RESOURCE_MOTOR_DRIVER_L298N_H__ */
diff --git a/inc/resource/resource_motor_driver_L298N_internal.h b/inc/resource/resource_motor_driver_L298N_internal.h
deleted file mode 100644
index fbb9284..0000000
--- a/inc/resource/resource_motor_driver_L298N_internal.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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 __RCC_RESOURCE_MOTOR_DRIVER_L298N_INTERNAL_H__
-#define __RCC_RESOURCE_MOTOR_DRIVER_L298N_INTERNAL_H__
-
-void resource_close_motor_driver_L298N(motor_id_e id);
-void resource_close_motor_driver_L298N_all(void);
-
-#endif /* __RCC_RESOURCE_MOTOR_DRIVER_L298N_INTERNAL_H__ */
diff --git a/inc/resource/resource_rain_sensor.h b/inc/resource/resource_rain_sensor.h
deleted file mode 100755
index a0d3aad..0000000
--- a/inc/resource/resource_rain_sensor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_RAIN_SENSOR_H__
-#define __RCC_RESOURCE_RAIN_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected rain sensor(FC-37 + YL-38).
- * @param[in] pin_num The number of the gpio pin connected to the rain sensor
- * @param[out] out_value The vaule of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- *
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_rain_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_RAIN_SENSOR_H__ */
diff --git a/inc/resource/resource_rain_sensor_internal.h b/inc/resource/resource_rain_sensor_internal.h
deleted file mode 100755
index bd0d49f..0000000
--- a/inc/resource/resource_rain_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_RAIN_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_RAIN_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the rain sensor
- */
-extern void resource_close_rain_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_RAIN_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_servo_motor.h b/inc/resource/resource_servo_motor.h
deleted file mode 100644
index 7d8d1de..0000000
--- a/inc/resource/resource_servo_motor.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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 __RCC_RESOURCE_SERVO_MOTOR_H__
-#define __RCC_RESOURCE_SERVO_MOTOR_H__
-
-/**
- * This module is sample codes to handling Servo motors in Tizen platform.
- * HW is configured with PCA9685(PWM controller).
- */
-
-/**
- * @param[in] id The motor id
- * @param[in] value The value to control servo motor
- *
- * @return 0 on success, otherwise a negative error value
- * @remarks Must adjust servo motor with some value before use to fit your system.
- */
-int resource_set_servo_motor_value(unsigned int motor_id, int value);
-
-#endif /* __RCC_RESOURCE_SERVO_MOTOR_H__ */
diff --git a/inc/resource/resource_servo_motor_internal.h b/inc/resource/resource_servo_motor_internal.h
deleted file mode 100644
index f0aea4b..0000000
--- a/inc/resource/resource_servo_motor_internal.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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 __RCC_RESOURCE_SERVO_MOTOR_INTERNAL_H__
-#define __RCC_RESOURCE_SERVO_MOTOR_INTERNAL_H__
-
-void resource_close_servo_motor(unsigned int ch);
-void resource_close_servo_motor_all(void);
-
-#endif /* __RCC_RESOURCE_SERVO_MOTOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_sound_detection_sensor.h b/inc/resource/resource_sound_detection_sensor.h
deleted file mode 100644
index ea989e7..0000000
--- a/inc/resource/resource_sound_detection_sensor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_SOUND_DETECTION_SENSOR_H__
-#define __RCC_RESOURCE_SOUND_DETECTION_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected sound detection sensor(NS-SDSM).
- * @param[in] pin_num The number of the gpio pin connected to the sound detection sensor
- * @param[out] out_value The vaule of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- *
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_sound_detection_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_SOUND_DETECTION_SENSOR_H__ */
diff --git a/inc/resource/resource_sound_detection_sensor_internal.h b/inc/resource/resource_sound_detection_sensor_internal.h
deleted file mode 100644
index fa1acdd..0000000
--- a/inc/resource/resource_sound_detection_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_SOUND_DETECTION_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_SOUND_DETECTION_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the sound detection sensor
- */
-extern void resource_close_sound_detection_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_SOUND_DETECTION_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_sound_level_sensor.h b/inc/resource/resource_sound_level_sensor.h
deleted file mode 100644
index 630e780..0000000
--- a/inc/resource/resource_sound_level_sensor.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_SOUND_LEVEL_SENSOR_H__
-#define __RCC_RESOURCE_SOUND_LEVEL_SENSOR_H__
-
- /**
- * @brief Reads the value from sound level sensor through AD converter(MCP3008).
- * @remarks We assume that only one AD converter is connected with device.
- * @param[in] ch_num The number of channel connected to the sound level sensor with AD converter
- * @param[out] out_value The value of a sound level
- * @return 0 on success, otherwise a negative error value
- *
- */
-extern int resource_read_sound_level_sensor(int ch_num, unsigned int *out_value);
-
-#endif /* __RCC_RESOURCE_SOUND_LEVEL_SENSOR_H__ */
-
diff --git a/inc/resource/resource_sound_level_sensor_internal.h b/inc/resource/resource_sound_level_sensor_internal.h
deleted file mode 100644
index e8c1188..0000000
--- a/inc/resource/resource_sound_level_sensor_internal.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_SOUND_LEVEL_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_SOUND_LEVEL_SENSOR_INTERNAL_H__
-
-extern void resource_close_sound_level_sensor(void);
-
-#endif /* __RCC_RESOURCE_SOUND_LEVEL_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_tilt_sensor.h b/inc/resource/resource_tilt_sensor.h
deleted file mode 100644
index c4eaa69..0000000
--- a/inc/resource/resource_tilt_sensor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_TILT_SENSOR_H__
-#define __RCC_RESOURCE_TILT_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected tilt sensor(SZH-EK084).
- * @param[in] pin_num The number of the gpio pin connected to the tilt sensor
- * @param[out] out_value The vaule of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- *
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_tilt_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_TILT_SENSOR_H__ */
diff --git a/inc/resource/resource_tilt_sensor_internal.h b/inc/resource/resource_tilt_sensor_internal.h
deleted file mode 100644
index a7dbd4d..0000000
--- a/inc/resource/resource_tilt_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_TILT_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_TILT_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the tilt sensor
- */
-extern void resource_close_tilt_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_TILT_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_touch_sensor.h b/inc/resource/resource_touch_sensor.h
deleted file mode 100644
index 9b97952..0000000
--- a/inc/resource/resource_touch_sensor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_TOUCH_SENSOR_H__
-#define __RCC_RESOURCE_TOUCH_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected touch sensor.
- * @param[in] pin_num The number of the gpio pin connected to the touch sensor
- * @param[out] out_value The value of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_touch_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_TOUCH_SENSOR_H__ */
diff --git a/inc/resource/resource_touch_sensor_internal.h b/inc/resource/resource_touch_sensor_internal.h
deleted file mode 100644
index c27b535..0000000
--- a/inc/resource/resource_touch_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_TOUCH_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_TOUCH_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the touch sensor
- */
-extern void resource_close_touch_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_TOUCH_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_ultrasonic_sensor.h b/inc/resource/resource_ultrasonic_sensor.h
deleted file mode 100644
index f3f9c99..0000000
--- a/inc/resource/resource_ultrasonic_sensor.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_ULTRASONIC_SENSOR_H__
-#define __RCC_RESOURCE_ULTRASONIC_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected ultrasonic sensor(HC-SR04).
- * @param[in] trig_pin_num The number of the gpio pin connected to the trig of the ultrasonic sensor
- * @param[in] echo_pin_num The number of the gpio pin connected to the echo of the ultrasonic sensor
- * @param[in] cb A callback function to be invoked when the gpio interrupt is triggered
- * @param[in] data The data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_ultrasonic_sensor(int trig_pin_num, int echo_pin_num, resource_read_cb cb, void *data);
-
-#endif /* __RCC_RESOURCE_ULTRASONIC_SENSOR_H__ */
diff --git a/inc/resource/resource_ultrasonic_sensor_internal.h b/inc/resource/resource_ultrasonic_sensor_internal.h
deleted file mode 100644
index 2aba4e0..0000000
--- a/inc/resource/resource_ultrasonic_sensor_internal.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] trig_pin_num The number of the gpio pin connected to the trig of the ultrasonic sensor
- * @param[in] echo_pin_num The number of the gpio pin connected to the echo of the ultrasonic sensor
- */
-extern void resource_close_ultrasonic_sensor_trig(int trig_pin_num);
-extern void resource_close_ultrasonic_sensor_echo(int echo_pin_num);
-
-#endif /* __RCC_RESOURCE_ULTRASONIC_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource/resource_vibration_sensor.h b/inc/resource/resource_vibration_sensor.h
deleted file mode 100644
index a5e9712..0000000
--- a/inc/resource/resource_vibration_sensor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_VIBRATION_SENSOR_H__
-#define __RCC_RESOURCE_VIBRATION_SENSOR_H__
-
-/**
- * @brief Reads the value of gpio connected vibration sensor(SZH-EKAD-131).
- * @param[in] pin_num The number of the gpio pin connected to the vibration sensor
- * @param[out] out_value The value of the gpio (zero or non-zero)
- * @return 0 on success, otherwise a negative error value
- * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
- */
-extern int resource_read_vibration_sensor(int pin_num, uint32_t *out_value);
-
-#endif /* __RCC_RESOURCE_VIBRATION_SENSOR_H__ */
diff --git a/inc/resource/resource_vibration_sensor_internal.h b/inc/resource/resource_vibration_sensor_internal.h
deleted file mode 100644
index 44e33f3..0000000
--- a/inc/resource/resource_vibration_sensor_internal.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_VIBRATION_SENSOR_INTERNAL_H__
-#define __RCC_RESOURCE_VIBRATION_SENSOR_INTERNAL_H__
-
-/**
- * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
- * @param[in] pin_num The number of the gpio pin connected to the vibration sensor
- */
-extern void resource_close_vibration_sensor(int pin_num);
-
-#endif /* __RCC_RESOURCE_VIBRATION_SENSOR_INTERNAL_H__ */
diff --git a/inc/resource_internal.h b/inc/resource_internal.h
deleted file mode 100755
index 9de2070..0000000
--- a/inc/resource_internal.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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 __RCC_RESOURCE_INTERNAL_H__
-#define __RCC_RESOURCE_INTERNAL_H__
-
-#include <peripheral_io.h>
-
-#include "resource/resource_illuminance_sensor_internal.h"
-#include "resource/resource_infrared_motion_sensor_internal.h"
-#include "resource/resource_infrared_obstacle_avoidance_sensor_internal.h"
-#include "resource/resource_touch_sensor_internal.h"
-#include "resource/resource_ultrasonic_sensor_internal.h"
-#include "resource/resource_led_internal.h"
-#include "resource/resource_vibration_sensor_internal.h"
-#include "resource/resource_flame_sensor_internal.h"
-#include "resource/resource_rain_sensor_internal.h"
-#include "resource/resource_sound_detection_sensor_internal.h"
-#include "resource/resource_tilt_sensor_internal.h"
-#include "resource/resource_gas_detection_sensor_internal.h"
-#include "resource/resource_sound_level_sensor_internal.h"
-
-#define PIN_MAX 40
-
-struct _resource_s {
- int opened;
- peripheral_gpio_h sensor_h;
- void (*close) (int);
-};
-typedef struct _resource_s resource_s;
-
-typedef void (*resource_read_cb)(double value, void *data);
-
-struct _resource_read_cb_s {
- resource_read_cb cb;
- void *data;
- int pin_num;
-};
-typedef struct _resource_read_cb_s resource_read_s;
-
-extern resource_s *resource_get_info(int pin_num);
-extern void resource_close_all(void);
-
-#endif /* __RCC_RESOURCE_INTERNAL_H__ */
diff --git a/inc/webutil.h b/inc/webutil.h
deleted file mode 100644
index 922b910..0000000
--- a/inc/webutil.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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>
- * Jeonghoon Park <jh1979.park@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 __RCC_WEBUTIL_H__
-#define __RCC_WEBUTIL_H__
-
-typedef enum {
- WEB_UTIL_SENSOR_NONE = 0,
- WEB_UTIL_SENSOR_MOTION = (1 << 0), /* IR motion sensor */
- WEB_UTIL_SENSOR_FLAME = (1 << 1), /* flame sensor */
- WEB_UTIL_SENSOR_HUMIDITY = (1 << 2), /* humidity sensor */
- WEB_UTIL_SENSOR_TEMPERATURE = (1 << 3), /* temperature sensor */
- WEB_UTIL_SENSOR_VIB = (1 << 4), /* vibration sensor */
- WEB_UTIL_SENSOR_CO2 = (1 << 5), /* CO2 sensor */
- WEB_UTIL_SENSOR_SOUND = (1 << 6), /* noise sensor */
- WEB_UTIL_SENSOR_TILT = (1 << 7), /* tilt sensor */
- WEB_UTIL_SENSOR_LIGHT = (1 << 8), /* light sensor */
- WEB_UTIL_SENSOR_COLLISION = (1 << 9), /* collision sensor */
- WEB_UTIL_SENSOR_OBSTACLE = (1 << 10), /* obstacle avoidance sensor */
- WEB_UTIL_SENSOR_ULTRASONIC_DISTANCE = (1 << 11), /* ultrasonic distance sensor */
- WEB_UTIL_SENSOR_RAIN = (1 << 12), /* rain sensor */
- WEB_UTIL_SENSOR_TOUCH = (1 << 13), /* touch sensor */
- WEB_UTIL_SENSOR_GAS = (1 << 14), /* gas sensor */
-} web_util_sensor_type_e;
-
-typedef struct _web_util_sensor_data_s web_util_sensor_data_s;
-struct _web_util_sensor_data_s {
- int motion;
- int flame;
- double humidity;
- double temperature;
- int virbration;
- double co2;
- int soundlevel;
- int tilt;
- int light;
- int collision;
- int obstacle;
- double distance;
- int rain;
- int touch;
- int gas;
- web_util_sensor_type_e enabled_sensor;
- const char *hash;
- const char *ip_addr;
-};
-
-int web_util_noti_init(void);
-void web_util_noti_fini(void);
-int web_util_noti_post(const char *resource, const char *json_data);
-int web_util_noti_post_image_data(const char *url, const char *device_id,
- const void *image_data, unsigned int image_size);
-int web_util_noti_get(const char *resource, char **res);
-
-int web_util_json_init(void);
-int web_util_json_fini(void);
-int web_util_json_begin(void);
-int web_util_json_end(void);
-int web_util_json_data_array_begin(void);
-int web_util_json_data_array_end(void);
-int web_util_json_add_int(const char* key, long long int value);
-int web_util_json_add_double(const char* key, double value);
-int web_util_json_add_boolean(const char* key, bool value);
-int web_util_json_add_string(const char* key, const char *value);
-int web_util_json_add_sensor_data(const char* sensorpi_id, web_util_sensor_data_s *sensor_data);
-char *web_util_get_json_string(void);
-
-#endif /* __RCC_WEBUTIL_H__ */
diff --git a/noBuild/README.md b/noBuild/README.md
deleted file mode 100644
index ad98e27..0000000
--- a/noBuild/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-Resources in this 'exception' folder need extra modules.
-
-
-You should follow the sequence like below to use these resource codes.
-
-First, Go to the craftroom to make custom platform image.(https://craftroom.tizen.org)
- And add certain module what you want to use to the basic platform image.
-
-Second, move resource C file you want to use to src/resource/ folder
- move resource h file matched with above C file to inc/resource/ folder
-
-Third, add module name to spec file and CMake file.
-#example) in spec file - BuildRequires: pkgconfig(capi-media-camera)
-# in CMake file - capi-media-camera
-
-Fourth, include header file to the resource.h file.
diff --git a/noBuild/resource_camera.c b/noBuild/resource_camera.c
deleted file mode 100644
index e3e4043..0000000
--- a/noBuild/resource_camera.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <camera.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <tizen.h>
-
-#include "log.h"
-#include "resource/resource_camera.h"
-
-#define RESOLUTION_W 320
-#define RESOLUTION_H 240
-
-static int __init(void);
-static void __completed_cb(void *user_data);
-static bool __resolution_list_cb(int width, int height, void *user_data);
-static void __capturing_cb(camera_image_data_s *image, camera_image_data_s *postview,
- camera_image_data_s *thumbnail, void *user_data);
-
-struct __camera_data {
- camera_h cam_handle;
- int resolution_w;
- int resolution_h;
- void *captured_file;
- unsigned int image_size;
- capture_completed_cb completed_cb;
- void *completed_cb_data;
-};
-
-static struct __camera_data *camera_data = NULL;
-
-int resource_capture_camera(capture_completed_cb capture_completed, void *user_data)
-{
- camera_state_e state;
- int ret = CAMERA_ERROR_NONE;
-
- if (camera_data == NULL) {
- _I("Camera is not initialized");
- ret = __init();
- if (ret < 0) {
- _E("Failed to initialize camera");
- return -1;
- }
- }
-
- ret = camera_get_state(camera_data->cam_handle, &state);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to get camera state");
- return -1;
- }
-
- if (state >= CAMERA_STATE_CAPTURING) {
- _D("Camera is now capturing");
- return 0;
- }
-
- if (state != CAMERA_STATE_PREVIEW) {
- _I("Preview is not started");
- ret = camera_start_preview(camera_data->cam_handle);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to start preview");
- return -1;
- }
- }
-
- ret = camera_start_capture(camera_data->cam_handle, __capturing_cb, __completed_cb, camera_data);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to start capturing");
- return -1;
- }
-
- camera_data->completed_cb = capture_completed;
- camera_data->completed_cb_data = user_data;
-
- return 0;
-}
-
-void resource_close_camera(void)
-{
- if (camera_data == NULL)
- return;
-
- camera_stop_preview(camera_data->cam_handle);
-
- camera_destroy(camera_data->cam_handle);
- camera_data->cam_handle = NULL;
-
- free(camera_data);
- camera_data = NULL;
-}
-
-static void __capturing_cb(camera_image_data_s *image, camera_image_data_s *postview,
- camera_image_data_s *thumbnail, void *user_data)
-{
- struct __camera_data *camera_data = user_data;
- if (image == NULL) {
- _E("Image is NULL");
- return;
- }
-
- camera_data->captured_file = malloc(image->size);
- if (camera_data->captured_file == NULL)
- return;
-
- _D("Now is on Capturing: Image size[%d x %d]", image->width, image->height);
-
- memcpy(camera_data->captured_file, image->data, image->size);
- camera_data->image_size = image->size;
-
- return;
-}
-
-static void __completed_cb(void *user_data)
-{
- struct __camera_data *camera_data = user_data;
- int ret = CAMERA_ERROR_NONE;
-
- if (camera_data->completed_cb)
- camera_data->completed_cb(camera_data->captured_file, camera_data->image_size, camera_data->completed_cb_data);
-
- free(camera_data->captured_file);
- camera_data->captured_file = NULL;
-
- if (!camera_data->cam_handle) {
- _E("Camera is NULL");
- return;
- }
- _D("Capture is completed");
-
- ret = camera_start_preview(camera_data->cam_handle);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to start preview");
- return;
- }
-
- ret = camera_stop_preview(camera_data->cam_handle);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to stop preview");
- return;
- }
-
- return;
-}
-
-static bool __resolution_list_cb(int width, int height, void *user_data)
-{
- _D("Supported resolution - Width[%d], Height[%d]", width, height);
-
- if (width > camera_data->resolution_w && width <= RESOLUTION_W &&
- height > camera_data->resolution_h && height <= RESOLUTION_H) {
- camera_data->resolution_w = width;
- camera_data->resolution_h = height;
- }
- _D("Fixed Resolution is Width[%d], Height[%d]", camera_data->resolution_w, camera_data->resolution_h);
-
- return true;
-}
-
-static int __init(void)
-{
- int ret = CAMERA_ERROR_NONE;
-
- camera_data = malloc(sizeof(struct __camera_data));
- if (camera_data == NULL) {
- _E("Failed to allocate Camera data");
- return -1;
- }
- memset(camera_data, 0, sizeof(struct __camera_data));
-
- ret = camera_create(CAMERA_DEVICE_CAMERA0, &(camera_data->cam_handle));
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to create camera");
- goto ERROR;
- }
-
- ret = camera_foreach_supported_capture_resolution(camera_data->cam_handle, __resolution_list_cb, NULL);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to foreach supported capture resolution");
- goto ERROR;
- }
-
- ret = camera_set_preview_resolution(camera_data->cam_handle, camera_data->resolution_w, camera_data->resolution_h);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to set preview resolution");
- goto ERROR;
- }
-
- ret = camera_set_capture_resolution(camera_data->cam_handle, camera_data->resolution_w, camera_data->resolution_h);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to set capture resolution");
- goto ERROR;
- }
-
- ret = camera_set_capture_format(camera_data->cam_handle, CAMERA_PIXEL_FORMAT_JPEG);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to set capture resolution");
- goto ERROR;
- }
-
- ret = camera_start_preview(camera_data->cam_handle);
- if (ret != CAMERA_ERROR_NONE) {
- _E("Failed to start preview[%d]", ret);
- goto ERROR;
- }
-
- return 0;
-
-ERROR:
- camera_destroy(camera_data->cam_handle);
- free(camera_data);
- return -1;
-}
-
diff --git a/noBuild/resource_camera.h b/noBuild/resource_camera.h
deleted file mode 100644
index c8cd915..0000000
--- a/noBuild/resource_camera.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <camera.h>
-
-#define MAX_IMAGE_FILE_LEN 256
-#define DEFAULT_FILE_PATH "/home/owner/media"
-
-typedef void (*capture_completed_cb)(const void *image, unsigned int size, void *user_data);
-
-int resource_capture_camera(capture_completed_cb capture_completed_cb, void *data);
-void resource_close_camera(void);
diff --git a/org.tizen.rcc.manifest b/org.tizen.rcc.manifest
deleted file mode 100644
index af9b883..0000000
--- a/org.tizen.rcc.manifest
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
- <request>
- <domain name="_" />
- </request>
-</manifest>
diff --git a/packaging/org.tizen.rcc.spec b/packaging/org.tizen.rcc.spec
deleted file mode 100644
index ff58a3f..0000000
--- a/packaging/org.tizen.rcc.spec
+++ /dev/null
@@ -1,99 +0,0 @@
-%define P_NAME rcc
-%define APP_LABEL "Resource Control Connectivity"
-%define ORG_PREFIX org.tizen
-
-Name: %{ORG_PREFIX}.%{P_NAME}
-%define alias %{name}
-Summary: IoTivity Application
-Group: Applications/Core Applications
-Version: 0.0.1
-Release: 1
-License: Apache 2.0
-Provides: %{name} = %{version}-%{release}
-Source0: %{name}-%{version}.tar.gz
-
-BuildRequires: cmake
-BuildRequires: hash-signer
-BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(libtzplatform-config)
-BuildRequires: pkgconfig(capi-appfw-service-application)
-BuildRequires: pkgconfig(capi-system-peripheral-io)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(eina)
-BuildRequires: pkgconfig(iotcon)
-BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(libcurl)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(json-glib-1.0)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(capi-network-connection)
-BuildRequires: pkgconfig(capi-media-camera)
-
-%description
-Resource Control Connectivity
-
-%prep
-%setup -q
-
-%build
-
-%define _pkg_dir %{TZ_SYS_RO_APP}/%{alias}
-%define _pkg_shared_dir %{_pkg_dir}/shared
-%define _pkg_data_dir %{_pkg_dir}/data
-%define _pkg_rw_data_dir /home/owner/apps_rw/%{alias}/data
-%define _pkg_res_dir %{_pkg_dir}/res
-%define _sys_icons_dir %{_pkg_shared_dir}/res
-%define _sys_packages_dir %{TZ_SYS_RO_PACKAGES}
-%define _sys_license_dir %{TZ_SYS_SHARE}/license
-%define _cbor_file iotcon-test-svr-db-server.dat
-%define _conf_file pi.conf
-
-%ifarch %{arm}
-export CFLAGS="$CFLAGS -DTIZEN_BUILD_TARGET"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_BUILD_TARGET"
-export FFLAGS="$FFLAGS -DTIZEN_BUILD_TARGET"
-%else
-export CFLAGS="$CFLAGS -DTIZEN_BUILD_EMULATOR"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_BUILD_EMULATOR"
-export FFLAGS="$FFLAGS -DTIZEN_BUILD_EMULATOR"
-%endif
-
-cmake . -DP_NAME=%{P_NAME} \
- -DORG_PREFIX=%{ORG_PREFIX} \
- -DAPP_LABEL=%{APP_LABEL} \
- -DINSTALL_PREFIX=%{_pkg_dir} \
- -DINSTALL_OWNER_DATADIR=%{_pkg_rw_data_dir} \
- -DINSTALL_RESDIR=%{_pkg_res_dir} \
- -DSYS_ICONS_DIR=%{_sys_icons_dir} \
- -DSYS_PACKAGES_DIR=%{_sys_packages_dir} \
- -DCBOR_FILE=%{_cbor_file} \
- -DCONF_FILE=%{_conf_file}
-make %{?jobs:-j%jobs}
-
-%install
-%make_install
-
-%define tizen_sign 1
-%define tizen_sign_base %{_pkg_dir}
-%define tizen_sign_level platform
-%define tizen_author_sign 1
-%define tizen_dist_sign 1
-
-%post
-/sbin/ldconfig
-chsmack -a "User::Pkg::%{alias}" %{_pkg_res_dir}/*.dat
-chmod 444 %{_pkg_res_dir}/*.dat
-
-%postun -p /sbin/ldconfig
-
-%files
-%{_pkg_res_dir}/*.dat
-%{_pkg_res_dir}/*.conf
-%manifest %{alias}.manifest
-%defattr(-,root,root,-)
-%{_pkg_dir}/bin/%{P_NAME}
-%{_sys_packages_dir}/%{alias}.xml
-%{_sys_icons_dir}/*.png
-%{_pkg_dir}/author-signature.xml
-%{_pkg_dir}/signature1.xml
diff --git a/project_def.prop b/project_def.prop
deleted file mode 100644
index 7ce5c11..0000000
--- a/project_def.prop
+++ /dev/null
@@ -1,11 +0,0 @@
-APPNAME = rcc
-
-type = app
-profile = iot-headless-4.0
-
-USER_SRCS = src/controller.c
-USER_DEFS =
-USER_INC_DIRS = inc
-USER_OBJS =
-USER_LIBS =
-USER_EDCS =
diff --git a/res/iotcon-test-svr-db-server.dat b/res/iotcon-test-svr-db-server.dat
deleted file mode 100644
index d508b68..0000000
--- a/res/iotcon-test-svr-db-server.dat
+++ /dev/null
Binary files differ
diff --git a/res/pi.conf b/res/pi.conf
deleted file mode 100644
index b7e63e9..0000000
--- a/res/pi.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[default]
-path=sensor-pi-1
-address=http://showiot.xyz/api/tt/data
-image_address=http://test.showiot.xyz/api/image/
diff --git a/settings b/settings
deleted file mode 100644
index ceacdbb..0000000
--- a/settings
+++ /dev/null
@@ -1,13 +0,0 @@
-[ethernet_b827eb0b6458_cable]
-Name=Wired
-AutoConnect=true
-Modified=2016-07-25T19:49:54.191535Z
-IPv4.method=manual
-IPv6.method=auto
-IPv6.privacy=disabled
-IPv4.DHCP.LastAddress=10.113.216.216
-Nameservers.IPv4method=dhcp
-IPv4.netmask_prefixlen=24
-IPv4.local_address=10.113.62.234
-IPv4.gateway=10.113.62.1
-#connmanctl config ethernet_b827eb0b6458_cable --ipv4 manual 10.113.62.234 255.255.255.0 10.113.62.1
diff --git a/shared/res/default_icon.png b/shared/res/default_icon.png
deleted file mode 100755
index 9765b1b..0000000
--- a/shared/res/default_icon.png
+++ /dev/null
Binary files differ
diff --git a/src/connection_manager.c b/src/connection_manager.c
deleted file mode 100644
index 0bd59f6..0000000
--- a/src/connection_manager.c
+++ /dev/null
@@ -1,206 +0,0 @@
- /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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>
- * Jeonghoon Park <jh1979.park@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.
- */
-
-#include <net_connection.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "log.h"
-
-struct conn_mgr_s {
- connection_h connection;
- connection_type_e net_state;
- connection_wifi_state_e wifi_state;
- char *ip_addr;
-};
-
-struct conn_mgr_s conn_mgr = { 0, };
-
-static const char *__connection_error_to_string(connection_error_e error)
-{
- switch (error) {
- case CONNECTION_ERROR_NONE:
- return "CONNECTION_ERROR_NONE";
- case CONNECTION_ERROR_INVALID_PARAMETER:
- return "CONNECTION_ERROR_INVALID_PARAMETER";
- case CONNECTION_ERROR_OUT_OF_MEMORY:
- return "CONNECTION_ERROR_OUT_OF_MEMORY";
- case CONNECTION_ERROR_INVALID_OPERATION:
- return "CONNECTION_ERROR_INVALID_OPERATION";
- case CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
- return "CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED";
- case CONNECTION_ERROR_OPERATION_FAILED:
- return "CONNECTION_ERROR_OPERATION_FAILED";
- case CONNECTION_ERROR_ITERATOR_END:
- return "CONNECTION_ERROR_ITERATOR_END";
- case CONNECTION_ERROR_NO_CONNECTION:
- return "CONNECTION_ERROR_NO_CONNECTION";
- case CONNECTION_ERROR_NOW_IN_PROGRESS:
- return "CONNECTION_ERROR_NOW_IN_PROGRESS";
- case CONNECTION_ERROR_ALREADY_EXISTS:
- return "CONNECTION_ERROR_ALREADY_EXISTS";
- case CONNECTION_ERROR_OPERATION_ABORTED:
- return "CONNECTION_ERROR_OPERATION_ABORTED";
- case CONNECTION_ERROR_DHCP_FAILED:
- return "CONNECTION_ERROR_DHCP_FAILED";
- case CONNECTION_ERROR_INVALID_KEY:
- return "CONNECTION_ERROR_INVALID_KEY";
- case CONNECTION_ERROR_NO_REPLY:
- return "CONNECTION_ERROR_NO_REPLY";
- case CONNECTION_ERROR_PERMISSION_DENIED:
- return "CONNECTION_ERROR_PERMISSION_DENIED";
- case CONNECTION_ERROR_NOT_SUPPORTED:
- return "CONNECTION_ERROR_NOT_SUPPORTED";
- default:
- return "CONNECTION_ERROR_UNKNOWN";
- }
-}
-
-static void __conn_mgr_ip_changed_cb(const char* ipv4_address,
- const char* ipv6_address, void* user_data)
-{
- _D("ip changed from[%s] to[%s]", conn_mgr.ip_addr, ipv4_address);
-
- if (conn_mgr.ip_addr) {
- free(conn_mgr.ip_addr);
- conn_mgr.ip_addr = strdup(ipv4_address);
- }
- return;
-}
-
-static void __conn_mgr_connection_changed_cb(connection_type_e type, void* user_data)
-{
- int ret = CONNECTION_ERROR_NONE;
- _D("connection changed from[%d] to[%d]", conn_mgr.net_state, type);
-
- conn_mgr.net_state = type;
- if (conn_mgr.net_state != CONNECTION_TYPE_WIFI) {
- ret = connection_get_wifi_state(conn_mgr.connection, &conn_mgr.wifi_state);
- if (CONNECTION_ERROR_NONE != ret)
- _E("fail connection_get_wifi_state - [%s]",
- __connection_error_to_string(ret));
- else
- _D("net_state[%d] - wifi_state[%d]",
- conn_mgr.net_state, conn_mgr.wifi_state);
- }
-
- return;
-}
-
-int connection_manager_get_ip(const char **ip)
-{
- int ret = CONNECTION_ERROR_NONE;
-
- retv_if(conn_mgr.connection == NULL, -1);
- retv_if(ip == NULL, -1);
-
- if (conn_mgr.ip_addr) {
- *ip = conn_mgr.ip_addr;
- return 0;
- }
-
- if (conn_mgr.net_state == CONNECTION_TYPE_DISCONNECTED) {
- _W("disconnected now");
- if (conn_mgr.ip_addr) {
- free(conn_mgr.ip_addr);
- conn_mgr.ip_addr = NULL;
- }
- return -1;
- }
-
- ret = connection_get_ip_address(conn_mgr.connection,
- CONNECTION_ADDRESS_FAMILY_IPV4, &conn_mgr.ip_addr);
- if ((CONNECTION_ERROR_NONE != ret) || (conn_mgr.ip_addr == NULL)) {
- _E("fail to connection_get_ip_address() - [%s]",
- __connection_error_to_string(ret));
- return -1;
- }
-
- return 0;
-}
-
-int connection_manager_init(void)
-{
- int ret = CONNECTION_ERROR_NONE;
- if (conn_mgr.connection) {
- _W("connection manager is already initialized");
- return 0;
- }
-
- ret = connection_create(&conn_mgr.connection);
- if (CONNECTION_ERROR_NONE != ret) {
- _E("fail to create connection - [%s]",
- __connection_error_to_string(ret));
- return -1;
- }
-
- ret = connection_get_type(conn_mgr.connection, &conn_mgr.net_state);
- if (CONNECTION_ERROR_NONE != ret)
- _E("fail connection_get_type - [%s]",
- __connection_error_to_string(ret));
-
- if (conn_mgr.net_state != CONNECTION_TYPE_DISCONNECTED) {
- ret = connection_get_ip_address(conn_mgr.connection,
- CONNECTION_ADDRESS_FAMILY_IPV4, &conn_mgr.ip_addr);
- if ((CONNECTION_ERROR_NONE != ret) || (conn_mgr.ip_addr == NULL))
- _E("fail to connection_get_ip_address() - [%s]",
- __connection_error_to_string(ret));
- }
-
- ret = connection_set_type_changed_cb(conn_mgr.connection,
- __conn_mgr_connection_changed_cb, NULL);
- if (CONNECTION_ERROR_NONE != ret)
- _E("fail connection_set_type_changed_cb - [%s]",
- __connection_error_to_string(ret));
-
- ret = connection_get_wifi_state(conn_mgr.connection, &conn_mgr.wifi_state);
- if (CONNECTION_ERROR_NONE != ret)
- _E("fail connection_get_wifi_state - [%s]",
- __connection_error_to_string(ret));
-
- ret = connection_set_ip_address_changed_cb(conn_mgr.connection,
- __conn_mgr_ip_changed_cb, NULL);
- if (CONNECTION_ERROR_NONE != ret)
- _E("fail toconnection_set_ip_address_changed_cb - [%s]",
- __connection_error_to_string(ret));
-
- _D("net_state[%d], wifi_state[%d], ip address[%s]",
- conn_mgr.net_state, conn_mgr.wifi_state, conn_mgr.ip_addr);
-
- return 0;
-}
-
-int connection_manager_fini(void)
-{
- if (conn_mgr.connection) {
- int ret = 0;
- ret = connection_destroy(conn_mgr.connection);
- _D("connection_destroy - [%s]", __connection_error_to_string(ret));
- conn_mgr.connection = NULL;
- }
-
- if (conn_mgr.ip_addr) {
- free(conn_mgr.ip_addr);
- conn_mgr.ip_addr = NULL;
- }
- return 0;
-}
diff --git a/src/connectivity.c b/src/connectivity.c
deleted file mode 100644
index bf420e2..0000000
--- a/src/connectivity.c
+++ /dev/null
@@ -1,1273 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-#include <app_common.h>
-#include <iotcon.h>
-
-#include "log.h"
-#include "connectivity.h"
-#include "webutil.h"
-#include "controller_util.h"
-#include "connection_manager.h"
-
-#define DEFAULT_RESOURCE_TYPE "org.tizen.door"
-#define BUFSIZE 1024
-#define URI_PATH_LEN 64
-#define URI_PATH "/door/1"
-#define PATH "path"
-#define IOTCON_DB_FILENAME "iotcon-test-svr-db-server.dat"
-
-struct _connectivity_resource {
- char *path;
- char *type;
- char *ip;
- connectivity_protocol_e protocol_type;
- GHashTable *value_hash;
- union {
- struct {
- iotcon_resource_h res;
- iotcon_observers_h observers;
- } iotcon_data;
- struct {
- /* Nothing */
- char *reserve;
- } http_data;
- } conn_data;
-};
-
-typedef enum {
- DATA_VAL_TYPE_BOOL = 0,
- DATA_VAL_TYPE_INT,
- DATA_VAL_TYPE_DOUBLE,
- DATA_VAL_TYPE_STRING
-} conn_data_val_type_e;
-
-typedef struct _conn_data_value_s {
- conn_data_val_type_e type;
- union {
- bool b_val;
- int i_val;
- double d_val;
- char *s_val;
- };
-} conn_data_value_s;
-
-static connectivity_protocol_e ProtocolType = CONNECTIVITY_PROTOCOL_DEFAULT;
-static int connectivity_iotcon_intialized = 0;
-static int connectivity_http_intialized = 0;
-
-static void _print_iotcon_error(int err_no)
-{
- switch (err_no) {
- case IOTCON_ERROR_NOT_SUPPORTED:
- _E("IOTCON_ERROR_NOT_SUPPORTED");
- break;
- case IOTCON_ERROR_PERMISSION_DENIED:
- _E("IOTCON_ERROR_PERMISSION_DENIED");
- break;
- case IOTCON_ERROR_INVALID_PARAMETER:
- _E("IOTCON_ERROR_INVALID_PARAMETER");
- break;
- default:
- _E("Error : [%d]", err_no);
- break;
- }
-
- return;
-}
-
-static void _copy_file(const char *in_filename, const char *out_filename)
-{
- char buf[BUFSIZE] = { 0, };
- size_t nread = 0;
- FILE *in = NULL;
- FILE *out = NULL;
-
- ret_if(!in_filename);
- ret_if(!out_filename);
-
- in = fopen(in_filename, "r");
- ret_if(!in);
-
- out = fopen(out_filename, "w");
- goto_if(!out, error);
-
- rewind(in);
- while ((nread = fread(buf, 1, sizeof(buf), in)) > 0) {
- if (fwrite(buf, 1, nread, out) < nread) {
- _E("critical error to copy a file");
- break;
- }
- }
-
- fclose(in);
- fclose(out);
-
- return;
-
-error:
- fclose(in);
- return;
-}
-
-static bool _query_cb(const char *key, const char *value, void *user_data)
-{
- _D("Key : [%s], Value : [%s]", key, value);
-
- return IOTCON_FUNC_CONTINUE;
-}
-
-static int _handle_query(iotcon_request_h request)
-{
- iotcon_query_h query = NULL;
- int ret = -1;
-
- ret = iotcon_request_get_query(request, &query);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- if (query) iotcon_query_foreach(query, _query_cb, NULL);
-
- return 0;
-}
-
-static int _handle_request_by_crud_type(iotcon_request_h request, connectivity_resource_s *resource_info)
-{
- iotcon_request_type_e type;
- int ret = -1;
-
- ret = iotcon_request_get_request_type(request, &type);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- switch (type) {
- case IOTCON_REQUEST_GET:
- _I("Do not support 'get' query");
- break;
- case IOTCON_REQUEST_PUT:
- _I("Do not support 'put' query");
- break;
- case IOTCON_REQUEST_POST:
- _I("Do not support 'post' query");
- break;
- case IOTCON_REQUEST_DELETE:
- _I("Do not support 'delete' query");
- break;
- default:
- _E("Cannot reach here");
- ret = -1;
- break;
- }
- retv_if(0 != ret, -1);
-
- return 0;
-}
-
-static int _handle_observer(iotcon_request_h request, iotcon_observers_h observers)
-{
- iotcon_observe_type_e observe_type;
- int ret = -1;
- int observe_id = -1;
-
- ret = iotcon_request_get_observe_type(request, &observe_type);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- if (IOTCON_OBSERVE_REGISTER == observe_type) {
- ret = iotcon_request_get_observe_id(request, &observe_id);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- _I("Add an observer : %d", observe_id);
-
- ret = iotcon_observers_add(observers, observe_id);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
- } else if (IOTCON_OBSERVE_DEREGISTER == observe_type) {
- ret = iotcon_request_get_observe_id(request, &observe_id);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- _I("Remove an observer : %d", observe_id);
-
- ret = iotcon_observers_remove(observers, observe_id);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
- }
-
- return 0;
-}
-
-static int _send_response(iotcon_request_h request, iotcon_representation_h representation, iotcon_response_result_e result)
-{
- int ret = -1;
- iotcon_response_h response;
-
- ret = iotcon_response_create(request, &response);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- ret = iotcon_response_set_result(response, result);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_response_set_representation(response, representation);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_response_send(response);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_response_destroy(response);
-
- return 0;
-
-error:
- iotcon_response_destroy(response);
- return -1;
-}
-
-static void _request_resource_handler(iotcon_resource_h resource, iotcon_request_h request, void *user_data)
-{
- connectivity_resource_s *resource_info = user_data;
- int ret = -1;
- char *host_address = NULL;
-
- ret_if(!request);
-
- ret = iotcon_request_get_host_address(request, &host_address);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- _D("Host address : %s", host_address);
-
- ret = _handle_query(request);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = _handle_request_by_crud_type(request, resource_info);
- goto_if(0 != ret, error);
-
- ret = _handle_observer(request, resource_info->conn_data.iotcon_data.observers);
- goto_if(0 != ret, error);
-
- return;
-
-error:
- _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
- return;
-}
-
-static int __init_iotcon(connectivity_resource_s *resource_info)
-{
- int ret = -1;
- iotcon_resource_types_h resource_types = NULL;
- iotcon_resource_interfaces_h ifaces = NULL;
- uint8_t policies = IOTCON_RESOURCE_NO_POLICY;
- char res_path[PATH_MAX] = {0,};
- char data_path[PATH_MAX] = {0,};
- char *prefix = NULL;
-
- retv_if(!resource_info, -1);
- retv_if(resource_info->protocol_type != CONNECTIVITY_PROTOCOL_IOTIVITY, -1);
-
- prefix = app_get_resource_path();
- retv_if(!prefix, -1);
- snprintf(res_path, sizeof(res_path)-1, "%s%s", prefix, IOTCON_DB_FILENAME);
- free(prefix);
- prefix = NULL;
-
- prefix = app_get_data_path();
- retv_if(!prefix, -1);
- snprintf(data_path, sizeof(data_path)-1, "%s%s", prefix, IOTCON_DB_FILENAME);
- free(prefix);
-
- _copy_file(res_path, data_path);
-
- ret = iotcon_initialize(data_path);
- retv_if(IOTCON_ERROR_NONE != ret, -1);
-
- /* TODO : If we have to set device name, naming it more gorgeous one */
- ret = iotcon_set_device_name(DEFAULT_RESOURCE_TYPE);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_resource_types_create(&resource_types);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_resource_types_add(resource_types, resource_info->type);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_resource_interfaces_create(&ifaces);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_resource_interfaces_add(ifaces, IOTCON_INTERFACE_DEFAULT);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_resource_interfaces_add(ifaces, IOTCON_INTERFACE_BATCH);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- policies =
- IOTCON_RESOURCE_DISCOVERABLE |
- IOTCON_RESOURCE_OBSERVABLE |
- IOTCON_RESOURCE_SECURE;
-
- ret = iotcon_resource_create(URI_PATH,
- resource_types,
- ifaces,
- policies,
- _request_resource_handler,
- resource_info,
- &resource_info->conn_data.iotcon_data.res);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_observers_create(&resource_info->conn_data.iotcon_data.observers);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_resource_types_destroy(resource_types);
- iotcon_resource_interfaces_destroy(ifaces);
- connectivity_iotcon_intialized = 1;
-
- return 0;
-
-error:
- if (resource_types) iotcon_resource_types_destroy(resource_types);
- if (ifaces) iotcon_resource_interfaces_destroy(ifaces);
- if (resource_info->conn_data.iotcon_data.res) iotcon_resource_destroy(resource_info->conn_data.iotcon_data.res);
- iotcon_deinitialize();
- return -1;
-}
-
-static int __init_http(connectivity_resource_s *resource_info)
-{
- int ret = 0;
- ret = web_util_noti_init();
- if (!ret)
- connectivity_http_intialized = 1;
-
- return ret;
-}
-
-#ifdef PRINT_DEBUG_DETAIL
-static bool __print_attributes_cb(iotcon_attributes_h attributes, const char *key, void *user_data)
-{
- iotcon_type_e type = IOTCON_TYPE_NONE;
-
- iotcon_attributes_get_type(attributes, key, &type);
-
- switch (type) {
- case IOTCON_TYPE_INT: {
- int value = 0;
- iotcon_attributes_get_int(attributes, key, &value);
- _D("key[%s] - int value [%d]", key, value);
- }
- break;
- case IOTCON_TYPE_BOOL: {
- bool value = 0;
- iotcon_attributes_get_bool(attributes, key, &value);
- _D("key[%s] - bool value [%d]", key, value);
- }
- break;
- case IOTCON_TYPE_DOUBLE: {
- double value = 0;
- iotcon_attributes_get_double(attributes, key, &value);
- _D("key[%s] - double value [%lf]", key, value);
- }
- break;
- case IOTCON_TYPE_STR: {
- char *value = 0;
- iotcon_attributes_get_str(attributes, key, &value);
- _D("key[%s] - string value [%s]", key, value);
- }
- break;
- case IOTCON_TYPE_NONE:
- case IOTCON_TYPE_BYTE_STR:
- case IOTCON_TYPE_NULL:
- case IOTCON_TYPE_LIST:
- case IOTCON_TYPE_ATTRIBUTES:
- default:
- _W("unhandled key[%s] type[%d]", key, type);
- break;
- }
-
- return IOTCON_FUNC_CONTINUE;
-}
-#endif
-
-static void __print_attribute(iotcon_attributes_h attributes)
-{
-#ifdef PRINT_DEBUG_DETAIL
- ret_if(!attributes);
-
- iotcon_attributes_foreach(attributes, __print_attributes_cb, NULL);
-#endif
- return;
-}
-
-static void _destroy_representation(iotcon_representation_h representation)
-{
- ret_if(!representation);
- iotcon_representation_destroy(representation);
- return;
-}
-
-static iotcon_representation_h _create_representation_with_bool(connectivity_resource_s *resource_info, const char *key, bool value)
-{
- iotcon_attributes_h attributes = NULL;
- iotcon_representation_h representation = NULL;
- char *uri_path = NULL;
- int ret = -1;
-
- ret = iotcon_resource_get_uri_path(resource_info->conn_data.iotcon_data.res, &uri_path);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_representation_create(&representation);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_attributes_create(&attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_uri_path(representation, uri_path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_str(attributes, PATH, resource_info->path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_bool(attributes, key, value);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_attributes(representation, attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_attributes_destroy(attributes);
-
- return representation;
-
-error:
- if (attributes) iotcon_attributes_destroy(attributes);
- if (representation) iotcon_representation_destroy(representation);
-
- return NULL;
-}
-
-static iotcon_representation_h _create_representation_with_int(connectivity_resource_s *resource_info, const char *key, int value)
-{
- iotcon_attributes_h attributes = NULL;
- iotcon_representation_h representation = NULL;
- char *uri_path = NULL;
- int ret = -1;
-
- ret = iotcon_resource_get_uri_path(resource_info->conn_data.iotcon_data.res, &uri_path);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_representation_create(&representation);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_attributes_create(&attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_uri_path(representation, uri_path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_str(attributes, PATH, resource_info->path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_int(attributes, key, value);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_attributes(representation, attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_attributes_destroy(attributes);
-
- return representation;
-
-error:
- if (attributes) iotcon_attributes_destroy(attributes);
- if (representation) iotcon_representation_destroy(representation);
-
- return NULL;
-}
-
-static iotcon_representation_h _create_representation_with_double(connectivity_resource_s *resource_info, const char *key, double value)
-{
- iotcon_attributes_h attributes = NULL;
- iotcon_representation_h representation = NULL;
- char *uri_path = NULL;
- int ret = -1;
-
- ret = iotcon_resource_get_uri_path(resource_info->conn_data.iotcon_data.res, &uri_path);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_representation_create(&representation);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_attributes_create(&attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_uri_path(representation, uri_path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_str(attributes, PATH, resource_info->path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_double(attributes, key, value);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_attributes(representation, attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_attributes_destroy(attributes);
-
- return representation;
-
-error:
- if (attributes) iotcon_attributes_destroy(attributes);
- if (representation) iotcon_representation_destroy(representation);
-
- return NULL;
-}
-
-static iotcon_representation_h _create_representation_with_string(connectivity_resource_s *resource_info, const char *key, const char *value)
-{
- iotcon_attributes_h attributes = NULL;
- iotcon_representation_h representation = NULL;
- char *uri_path = NULL;
- int ret = -1;
-
- ret = iotcon_resource_get_uri_path(resource_info->conn_data.iotcon_data.res, &uri_path);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_representation_create(&representation);
- retv_if(IOTCON_ERROR_NONE != ret, NULL);
-
- ret = iotcon_attributes_create(&attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_uri_path(representation, uri_path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_str(attributes, PATH, resource_info->path);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_attributes_add_str(attributes, key, (char *)value);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- ret = iotcon_representation_set_attributes(representation, attributes);
- goto_if(IOTCON_ERROR_NONE != ret, error);
-
- iotcon_attributes_destroy(attributes);
-
- return representation;
-
-error:
- if (attributes) iotcon_attributes_destroy(attributes);
- if (representation) iotcon_representation_destroy(representation);
-
- return NULL;
-}
-
-static inline void __noti_by_http(void)
-{
- char *json_data = NULL;
-
- json_data = web_util_get_json_string();
- if (json_data) {
- const char *url = NULL;
- controller_util_get_address(&url);
- if (url)
- web_util_noti_post(url, json_data);
- else
- _E("fail to get url");
- free(json_data);
- } else {
- _E("fail to get json_data");
- }
-
- return;
-}
-
-int connectivity_notify_bool(connectivity_resource_s *resource_info, const char *key, bool value)
-{
- int ret = -1;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("Notify key[%s], value[%d]", key, value);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- retv_if(!resource_info->conn_data.iotcon_data.res, -1);
- retv_if(!resource_info->conn_data.iotcon_data.observers, -1);
- {
- iotcon_representation_h representation;
- representation = _create_representation_with_bool(resource_info, key, value);
- retv_if(!representation, -1);
- ret = iotcon_resource_notify(resource_info->conn_data.iotcon_data.res,
- representation, resource_info->conn_data.iotcon_data.observers, IOTCON_QOS_LOW);
- if (IOTCON_ERROR_NONE != ret) {
- _W("There are some troubles for notifying value[%d]", ret);
- _print_iotcon_error(ret);
- return -1;
- }
- _destroy_representation(representation);
- }
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = web_util_json_init();
- retv_if(ret, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- web_util_json_add_string("SensorPiID", resource_info->path);
- web_util_json_add_string("SensorPiType", resource_info->type);
- web_util_json_add_string("SensorPiIP", resource_info->ip);
- web_util_json_add_boolean(key, value);
- web_util_json_end();
-
- __noti_by_http();
-
- web_util_json_fini();
- break;
- default:
- _E("Unknown protocol type[%d]", resource_info->protocol_type);
- return -1;
- break;
- }
-
- return 0;
-}
-
-int connectivity_notify_int(connectivity_resource_s *resource_info, const char *key, int value)
-{
- int ret = -1;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("Notify key[%s], value[%d]", key, value);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- retv_if(!resource_info->conn_data.iotcon_data.res, -1);
- retv_if(!resource_info->conn_data.iotcon_data.observers, -1);
- {
- iotcon_representation_h representation;
- representation = _create_representation_with_int(resource_info, key, value);
- retv_if(!representation, -1);
- ret = iotcon_resource_notify(resource_info->conn_data.iotcon_data.res,
- representation, resource_info->conn_data.iotcon_data.observers, IOTCON_QOS_LOW);
- if (IOTCON_ERROR_NONE != ret) {
- _W("There are some troubles for notifying value[%d]", ret);
- _print_iotcon_error(ret);
- return -1;
- }
- _destroy_representation(representation);
- }
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = web_util_json_init();
- retv_if(ret, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- web_util_json_add_string("SensorPiID", resource_info->path);
- web_util_json_add_string("SensorPiType", resource_info->type);
- web_util_json_add_string("SensorPiIP", resource_info->ip);
- web_util_json_add_int(key, value);
- web_util_json_end();
-
- __noti_by_http();
-
- web_util_json_fini();
- break;
- default:
- _E("Unknown protocol type[%d]", resource_info->protocol_type);
- return -1;
- break;
- }
- return 0;
-}
-
-int connectivity_notify_double(connectivity_resource_s *resource_info, const char *key, double value)
-{
- int ret = -1;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("Notify key[%s], value[%lf]", key, value);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- retv_if(!resource_info->conn_data.iotcon_data.res, -1);
- retv_if(!resource_info->conn_data.iotcon_data.observers, -1);
- {
- iotcon_representation_h representation;
- representation = _create_representation_with_double(resource_info, key, value);
- retv_if(!representation, -1);
- ret = iotcon_resource_notify(resource_info->conn_data.iotcon_data.res,
- representation, resource_info->conn_data.iotcon_data.observers, IOTCON_QOS_LOW);
- if (IOTCON_ERROR_NONE != ret) {
- _W("There are some troubles for notifying value[%d]", ret);
- _print_iotcon_error(ret);
- return -1;
- }
- _destroy_representation(representation);
- }
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = web_util_json_init();
- retv_if(ret, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- web_util_json_add_string("SensorPiID", resource_info->path);
- web_util_json_add_string("SensorPiType", resource_info->type);
- web_util_json_add_string("SensorPiIP", resource_info->ip);
- web_util_json_add_double(key, value);
- web_util_json_end();
-
- __noti_by_http();
-
- web_util_json_fini();
- break;
- default:
- _E("Unknown protocol type[%d]", resource_info->protocol_type);
- return -1;
- break;
- }
- return 0;
-}
-
-int connectivity_notify_string(connectivity_resource_s *resource_info, const char *key, const char *value)
-{
- int ret = -1;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
- retv_if(!value, -1);
-
- _D("Notify key[%s], value[%s]", key, value);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- retv_if(!resource_info->conn_data.iotcon_data.res, -1);
- retv_if(!resource_info->conn_data.iotcon_data.observers, -1);
- {
- iotcon_representation_h representation;
- representation = _create_representation_with_string(resource_info, key, value);
- retv_if(!representation, -1);
- ret = iotcon_resource_notify(resource_info->conn_data.iotcon_data.res,
- representation, resource_info->conn_data.iotcon_data.observers, IOTCON_QOS_LOW);
- if (IOTCON_ERROR_NONE != ret) {
- _W("There are some troubles for notifying value[%d]", ret);
- _print_iotcon_error(ret);
- return -1;
- }
- _destroy_representation(representation);
- }
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = web_util_json_init();
- retv_if(ret, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- web_util_json_add_string("SensorPiID", resource_info->path);
- web_util_json_add_string("SensorPiType", resource_info->type);
- web_util_json_add_string("SensorPiIP", resource_info->ip);
- web_util_json_add_string(key, value);
- web_util_json_end();
-
- __noti_by_http();
-
- web_util_json_fini();
- break;
- default:
- _E("Unknown protocol type[%d]", resource_info->protocol_type);
- return -1;
- break;
- }
- return 0;
-}
-
-static void __hash_key_free(gpointer data)
-{
- free(data);
- return;
-}
-
-static void __hash_value_free(gpointer data)
-{
- conn_data_value_s *value = data;
- if (value && (value->type == DATA_VAL_TYPE_STRING))
- free(value->s_val);
- free(value);
-
- return;
-}
-
-static int __add_value_to_hash(connectivity_resource_s *resource_info, const char *key, conn_data_value_s *value)
-{
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
- retv_if(!value, -1);
-
- if (!resource_info->value_hash) {
- resource_info->value_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
- __hash_key_free, __hash_value_free);
- retv_if(!resource_info->value_hash, -1);
- }
-
- g_hash_table_insert(resource_info->value_hash, strdup(key), value);
-
- return 0;
-}
-
-int connectivity_attributes_add_bool(connectivity_resource_s *resource_info, const char *key, bool value)
-{
- int ret = 0;
- conn_data_value_s *data_value = NULL;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("adding key[%s] - value[%d]", key, value);
-
- data_value = malloc(sizeof(conn_data_value_s));
- retv_if(!data_value, -1);
-
- data_value->type = DATA_VAL_TYPE_BOOL;
- data_value->b_val = value;
-
- ret = __add_value_to_hash(resource_info, key, data_value);
- if (ret) {
- free(data_value);
- return -1;
- }
-
- return 0;
-}
-
-int connectivity_attributes_add_int(connectivity_resource_s *resource_info, const char *key, int value)
-{
- int ret = 0;
- conn_data_value_s *data_value = NULL;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("adding key[%s] - value[%d]", key, value);
-
- data_value = malloc(sizeof(conn_data_value_s));
- retv_if(!data_value, -1);
-
- data_value->type = DATA_VAL_TYPE_INT;
- data_value->i_val = value;
-
- ret = __add_value_to_hash(resource_info, key, data_value);
- if (ret) {
- free(data_value);
- return -1;
- }
-
- return 0;
-}
-
-int connectivity_attributes_add_double(connectivity_resource_s *resource_info, const char *key, double value)
-{
- int ret = 0;
- conn_data_value_s *data_value = NULL;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- _D("adding key[%s] - value[%lf]", key, value);
-
- data_value = malloc(sizeof(conn_data_value_s));
- retv_if(!data_value, -1);
-
- data_value->type = DATA_VAL_TYPE_DOUBLE;
- data_value->d_val = value;
-
- ret = __add_value_to_hash(resource_info, key, data_value);
- if (ret) {
- free(data_value);
- return -1;
- }
-
- return 0;
-}
-
-int connectivity_attributes_add_string(connectivity_resource_s *resource_info, const char *key, const char *value)
-{
- int ret = 0;
- conn_data_value_s *data_value = NULL;
-
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
- retv_if(!value, -1);
-
- _D("adding key[%s] - value[%s]", key, value);
-
- data_value = malloc(sizeof(conn_data_value_s));
- retv_if(!data_value, -1);
-
- data_value->type = DATA_VAL_TYPE_STRING;
- data_value->s_val = strdup(value);
-
- ret = __add_value_to_hash(resource_info, key, data_value);
- if (ret) {
- free(data_value->s_val);
- free(data_value);
- return -1;
- }
-
- return 0;
-}
-
-int connectivity_attributes_remove_value_by_key(connectivity_resource_s *resource_info, const char *key)
-{
- retv_if(!resource_info, -1);
- retv_if(!key, -1);
-
- if (resource_info->value_hash)
- g_hash_table_remove(resource_info->value_hash, key);
-
- if (g_hash_table_size(resource_info->value_hash) == 0) {
- g_hash_table_unref(resource_info->value_hash);
- resource_info->value_hash = NULL;
- }
-
- return 0;
-}
-
-int connectivity_attributes_remove_all(connectivity_resource_s *resource_info)
-{
- retv_if(!resource_info, -1);
-
- if (resource_info->value_hash) {
- g_hash_table_destroy(resource_info->value_hash);
- resource_info->value_hash = NULL;
- }
-
- return 0;
-}
-
-static void __json_add_data_iter_cb(gpointer key, gpointer value, gpointer user_data)
-{
- char *name = key;
- conn_data_value_s *data = value;
- int ret = 0;
-
- ret_if(!name);
- ret_if(!data);
-
- switch (data->type) {
- case DATA_VAL_TYPE_BOOL:
- ret = web_util_json_add_boolean(name, data->b_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%d]", name, data->b_val);
- break;
- case DATA_VAL_TYPE_INT:
- ret = web_util_json_add_int(name, data->i_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%d]", name, data->i_val);
- break;
- case DATA_VAL_TYPE_DOUBLE:
- ret = web_util_json_add_double(name, data->d_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%lf]", name, data->d_val);
- break;
- case DATA_VAL_TYPE_STRING:
- ret = web_util_json_add_string(name, data->s_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%s]", name, data->s_val);
- break;
- default:
- _E("Unknown data type [%d]", data->type);
- break;
- }
-
- return;
-}
-
-static void __attr_add_data_iter_cb(gpointer key, gpointer value, gpointer user_data)
-{
- char *name = key;
- conn_data_value_s *data = value;
- iotcon_attributes_h attr = user_data;
- int ret = 0;
-
- ret_if(!name);
- ret_if(!data);
- ret_if(!attr);
-
- switch (data->type) {
- case DATA_VAL_TYPE_BOOL:
- ret = iotcon_attributes_add_bool(attr, name, data->b_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%d]", name, data->b_val);
- break;
- case DATA_VAL_TYPE_INT:
- ret = iotcon_attributes_add_int(attr, name, data->i_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%d]", name, data->i_val);
- break;
- case DATA_VAL_TYPE_DOUBLE:
- ret = iotcon_attributes_add_double(attr, name, data->d_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%lf]", name, data->d_val);
- break;
- case DATA_VAL_TYPE_STRING:
- ret = iotcon_attributes_add_str(attr, name, data->s_val);
- if (IOTCON_ERROR_NONE != ret)
- _E("failed to add key[%s], value[%s]", name, data->s_val);
- break;
- default:
- _E("Unknown data type [%d]", data->type);
- break;
- }
-
- return;
-}
-
-static int __create_attributes(connectivity_resource_s *resource_info, iotcon_attributes_h *attributes)
-{
- int ret = 0;
- iotcon_attributes_h attr = NULL;
-
- ret = iotcon_attributes_create(&attr);
- if (IOTCON_ERROR_NONE != ret) {
- _print_iotcon_error(ret);
- return -1;
- }
-
- ret = iotcon_attributes_add_str(attr, PATH, resource_info->path);
- if (IOTCON_ERROR_NONE != ret) {
- _print_iotcon_error(ret);
- iotcon_attributes_destroy(attr);
- return -1;
- }
- if (resource_info->value_hash)
- g_hash_table_foreach(resource_info->value_hash, __attr_add_data_iter_cb, attr);
-
- *attributes = attr;
-
- return 0;
-}
-
-int connectivity_attributes_notify_all(connectivity_resource_s *resource_info)
-{
- int ret = 0;
-
- retv_if(!resource_info, -1);
-
- if (resource_info->value_hash == NULL) {
- _W("You have nothing to notify now");
- return 0;
- }
-
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- retv_if(!resource_info->conn_data.iotcon_data.res, -1);
- retv_if(!resource_info->conn_data.iotcon_data.observers, -1);
- {
- char *uri_path = NULL;
- iotcon_representation_h representation = NULL;
- iotcon_attributes_h attributes = NULL;
- int iotcon_ret = 0;
-
- iotcon_ret = iotcon_resource_get_uri_path(resource_info->conn_data.iotcon_data.res, &uri_path);
- retv_if(IOTCON_ERROR_NONE != iotcon_ret, -1);
-
- iotcon_ret = iotcon_representation_create(&representation);
- retv_if(IOTCON_ERROR_NONE != iotcon_ret, -1);
-
- iotcon_ret = iotcon_representation_set_uri_path(representation, uri_path);
- if (IOTCON_ERROR_NONE != iotcon_ret) {
- _print_iotcon_error(iotcon_ret);
- ret = -1;
- }
-
- iotcon_ret = __create_attributes(resource_info, &attributes);
- if (iotcon_ret) {
- _E("failed to create attributes");
- ret = -1;
- }
- __print_attribute(attributes);
-
- iotcon_ret = iotcon_representation_set_attributes(representation, attributes);
- if (IOTCON_ERROR_NONE != iotcon_ret) {
- _print_iotcon_error(iotcon_ret);
- ret = -1;
- }
-
- iotcon_ret = iotcon_resource_notify(resource_info->conn_data.iotcon_data.res, representation,
- resource_info->conn_data.iotcon_data.observers, IOTCON_QOS_LOW);
- if (IOTCON_ERROR_NONE != iotcon_ret) {
- _print_iotcon_error(iotcon_ret);
- ret = -1;
- }
-
- iotcon_representation_destroy(representation);
- iotcon_attributes_destroy(attributes);
- }
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = web_util_json_init();
- retv_if(ret, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- web_util_json_add_string("SensorPiID", resource_info->path);
- web_util_json_add_string("SensorPiType", resource_info->type);
- web_util_json_add_string("SensorPiIP", resource_info->ip);
- g_hash_table_foreach(resource_info->value_hash, __json_add_data_iter_cb, NULL);
- web_util_json_end();
-
- __noti_by_http();
-
- web_util_json_fini();
- break;
- default:
- break;
- }
-
- g_hash_table_destroy(resource_info->value_hash);
- resource_info->value_hash = NULL;
-
- return ret;
-}
-
-void connectivity_unset_resource(connectivity_resource_s *resource_info)
-{
- ret_if(!resource_info);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- if (resource_info->conn_data.iotcon_data.observers) iotcon_observers_destroy(resource_info->conn_data.iotcon_data.observers);
- if (resource_info->conn_data.iotcon_data.res) iotcon_resource_destroy(resource_info->conn_data.iotcon_data.res);
- iotcon_deinitialize();
- connectivity_iotcon_intialized = 0;
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- web_util_noti_fini();
- connectivity_http_intialized = 0;
- break;
- default:
- break;
- }
-
- if (resource_info->path) free(resource_info->path);
- if (resource_info->type) free(resource_info->type);
- if (resource_info->ip) free(resource_info->ip);
- free(resource_info);
-
- return;
-}
-
-int connectivity_set_resource(const char *path, const char *type, connectivity_resource_s **out_resource_info)
-{
- connectivity_resource_s *resource_info = NULL;
- const char *ip = NULL;
- int ret = -1;
-
- retv_if(!path, -1);
- retv_if(!type, -1);
- retv_if(!out_resource_info, -1);
-
- resource_info = calloc(1, sizeof(connectivity_resource_s));
- retv_if(!resource_info, -1);
-
- resource_info->path = strdup(path);
- goto_if(!resource_info->path, error);
-
- resource_info->type = strdup(type);
- goto_if(!resource_info->type, error);
-
- connection_manager_get_ip(&ip);
- resource_info->ip = strdup(ip);
- goto_if(!resource_info->ip, error);
-
- resource_info->protocol_type = ProtocolType;
-
- _D("Path[%s], Type[%s], protocol_type[%d]" , resource_info->path, resource_info->type, resource_info->protocol_type);
-
- switch (resource_info->protocol_type) {
- case CONNECTIVITY_PROTOCOL_DEFAULT:
- _D("default protocol type is iotivity\n \
- To set connectivity use connectivity_set_protocol_type() function");
- resource_info->protocol_type = CONNECTIVITY_PROTOCOL_IOTIVITY;
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- ret = __init_iotcon(resource_info);
- goto_if(ret, error);
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- ret = __init_http(resource_info);
- goto_if(ret, error);
- break;
- default:
- goto error;
- break;
- }
-
- *out_resource_info = resource_info;
-
- return 0;
-
-error:
- if (resource_info->path) free(resource_info->path);
- if (resource_info->type) free(resource_info->type);
- if (resource_info->ip) free(resource_info->ip);
- if (resource_info) free(resource_info);
-
- return -1;
-}
-
-int connectivity_set_protocol(connectivity_protocol_e protocol_type)
-{
- int ret = 0;
- retv_if(protocol_type >= CONNECTIVITY_PROTOCOL_MAX, -1);
-
- switch (protocol_type) {
- case CONNECTIVITY_PROTOCOL_DEFAULT:
- case CONNECTIVITY_PROTOCOL_IOTIVITY:
- if (connectivity_iotcon_intialized) {
- _E("protocol type[%d] already initialized", protocol_type);
- return -1;
- }
- ProtocolType = CONNECTIVITY_PROTOCOL_IOTIVITY;
- break;
- case CONNECTIVITY_PROTOCOL_HTTP:
- if (connectivity_http_intialized) {
- _E("protocol type[%d] already initialized", protocol_type);
- return -1;
- }
- ProtocolType = CONNECTIVITY_PROTOCOL_HTTP;
- break;
- default:
- _E("unknown protocol type[%d]", protocol_type);
- return -1;
- break;
- }
-
- return ret;
-}
diff --git a/src/controller.c b/src/controller.c
deleted file mode 100644
index 6744fb1..0000000
--- a/src/controller.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <unistd.h>
-#include <glib.h>
-#include <Ecore.h>
-#include <tizen.h>
-#include <service_app.h>
-
-#include "log.h"
-#include "resource.h"
-#include "connectivity.h"
-#include "controller.h"
-#include "controller_util.h"
-#include "webutil.h"
-
-#define CONNECTIVITY_KEY "opened"
-#define SENSORING_TIME_INTERVAL 5.0f
-
-typedef struct app_data_s {
- Ecore_Timer *getter_timer;
- connectivity_resource_s *resource_info;
-} app_data;
-
-static Eina_Bool control_sensors_cb(void *data)
-{
- app_data *ad = data;
- int value = 1;
-
- /* This is example, get value from sensors first */
- if (connectivity_notify_int(ad->resource_info, "Motion", value) == -1)
- _E("Cannot notify message");
-
- return ECORE_CALLBACK_RENEW;
-}
-
-static bool service_app_create(void *data)
-{
- app_data *ad = data;
- int ret = -1;
- const char *path = NULL;
-
- /**
- * No modification required!!!
- * Access only when modifying internal functions.
- */
- controller_init_internal_functions();
-
- /**
- * Create a connectivity resource and registers the resource in server.
- */
- connectivity_set_protocol(CONNECTIVITY_PROTOCOL_HTTP);
-
- controller_util_get_path(&path);
- if (path == NULL) {
- _E("Failed to get path");
- return false;
- }
-
- ret = connectivity_set_resource(path, "org.tizen.door", &ad->resource_info);
- if (ret == -1) _E("Cannot broadcast resource");
-
- /**
- * Creates a timer to call the given function in the given period of time.
- * In the control_sensors_cb(), each sensor reads the measured value or writes a specific value to the sensor.
- */
- ad->getter_timer = ecore_timer_add(SENSORING_TIME_INTERVAL, control_sensors_cb, ad);
- if (!ad->getter_timer) {
- _E("Failed to add infrared motion getter timer");
- return false;
- }
-
- return true;
-}
-
-static void service_app_terminate(void *data)
-{
- app_data *ad = (app_data *)data;
-
- if (ad->getter_timer)
- ecore_timer_del(ad->getter_timer);
-
-
- /**
- * Releases the resource about connectivity.
- */
- connectivity_unset_resource(ad->resource_info);
-
- /**
- * No modification required!!!
- * Access only when modifying internal functions.
- */
- controller_fini_internal_functions();
-
- free(ad);
-}
-
-static void service_app_control(app_control_h app_control, void *data)
-{
- // Todo: add your code here.
-}
-
-static void service_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LANGUAGE_CHANGED*/
-}
-
-static void service_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void service_app_low_battery(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void service_app_low_memory(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char* argv[])
-{
- app_data *ad = NULL;
- int ret = 0;
- service_app_lifecycle_callback_s event_callback;
- app_event_handler_h handlers[5] = {NULL, };
-
- ad = calloc(1, sizeof(app_data));
- retv_if(!ad, -1);
-
- event_callback.create = service_app_create;
- event_callback.terminate = service_app_terminate;
- event_callback.app_control = service_app_control;
-
- service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
- service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
-
- ret = service_app_main(argc, argv, &event_callback, ad);
-
- return ret;
-}
diff --git a/src/controller_internal.c b/src/controller_internal.c
deleted file mode 100644
index 881d7de..0000000
--- a/src/controller_internal.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <iotcon.h>
-
-#include "log.h"
-#include "connectivity.h"
-#include "resource.h"
-#include "controller_util.h"
-#include "webutil.h"
-#include "connection_manager.h"
-
-void controller_init_internal_functions(void)
-{
- connection_manager_init();
- web_util_noti_init();
- return;
-}
-
-void controller_fini_internal_functions(void)
-{
- _I("Terminating...");
- resource_close_all();
- web_util_noti_fini();
- connection_manager_fini();
- controller_util_free();
-
- return;
-}
diff --git a/src/controller_util.c b/src/controller_util.c
deleted file mode 100644
index 5ba5d52..0000000
--- a/src/controller_util.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <glib.h>
-#include <stdio.h>
-#include <app_common.h>
-#include "log.h"
-
-#define CONF_GROUP_DEFAULT_NAME "default"
-#define CONF_KEY_PATH_NAME "path"
-#define CONF_KEY_ADDRESS_NAME "address"
-#define CONF_KEY_IMAGE_UPLOAD_NAME "image_address"
-#define CONF_FILE_NAME "pi.conf"
-
-struct controller_util_s {
- char *path;
- char *address;
- char *image_upload;
-};
-
-struct controller_util_s controller_util = { 0, };
-
-static int _read_conf_file(void)
-{
- GKeyFile *gkf = NULL;
- char conf_path[PATH_MAX] = {0,};
- char *prefix = NULL;
-
- gkf = g_key_file_new();
- retv_if(!gkf, -1);
-
- prefix = app_get_resource_path();
- retv_if(!prefix, -1);
- snprintf(conf_path, sizeof(conf_path)-1, "%s%s", prefix, CONF_FILE_NAME);
- free(prefix);
- prefix = NULL;
-
- if (!g_key_file_load_from_file(gkf, conf_path, G_KEY_FILE_NONE, NULL)) {
- _E("could not read config file %s", conf_path);
- return -1;
- }
-
- controller_util.path = g_key_file_get_string(gkf,
- CONF_GROUP_DEFAULT_NAME,
- CONF_KEY_PATH_NAME,
- NULL);
- if (!controller_util.path)
- _E("could not get the key string");
-
- controller_util.address = g_key_file_get_string(gkf,
- CONF_GROUP_DEFAULT_NAME,
- CONF_KEY_ADDRESS_NAME,
- NULL);
- if (!controller_util.address)
- _E("could not get the key string");
-
- controller_util.image_upload = g_key_file_get_string(gkf,
- CONF_GROUP_DEFAULT_NAME,
- CONF_KEY_IMAGE_UPLOAD_NAME,
- NULL);
- if (!controller_util.image_upload)
- _E("could not get the key string");
-
- g_key_file_free(gkf);
-
- return 0;
-}
-
-int controller_util_get_path(const char **path)
-{
- retv_if(!path, -1);
-
- if (!controller_util.path) {
- int ret = -1;
- ret = _read_conf_file();
- retv_if(-1 == ret, -1);
- }
-
- *path = controller_util.path;
-
- return 0;
-}
-
-int controller_util_get_address(const char **address)
-{
- retv_if(!address, -1);
-
- if (!controller_util.address) {
- int ret = -1;
- ret = _read_conf_file();
- retv_if(-1 == ret, -1);
- }
-
- *address = controller_util.address;
-
- return 0;
-}
-
-int controller_util_get_image_address(const char **image_upload)
-{
- retv_if(!image_upload, -1);
-
- if (!controller_util.image_upload) {
- int ret = -1;
- ret = _read_conf_file();
- retv_if(-1 == ret, -1);
- }
-
- *image_upload = controller_util.image_upload;
-
- return 0;
-}
-
-void controller_util_free(void)
-{
- if (controller_util.path) {
- free(controller_util.path);
- controller_util.path = NULL;
- }
-
- if (controller_util.address) {
- free(controller_util.address);
- controller_util.address = NULL;
- }
-}
diff --git a/src/resource.c b/src/resource.c
deleted file mode 100644
index 691a905..0000000
--- a/src/resource.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <peripheral_io.h>
-
-#include "log.h"
-#include "resource.h"
-
-static resource_s resource_info[PIN_MAX] = { {0, NULL, NULL}, };
-
-resource_s *resource_get_info(int pin_num)
-{
- return &resource_info[pin_num];
-}
-
-void resource_close_all(void)
-{
- int i = 0;
- for (i = 0; i < PIN_MAX; i++) {
- if (!resource_info[i].opened) continue;
- _I("GPIO[%d] is closing...", i);
-
- if (resource_info[i].close)
- resource_info[i].close(i);
- }
- resource_close_illuminance_sensor();
- resource_close_sound_level_sensor();
-}
diff --git a/src/resource/resource_PCA9685.c b/src/resource/resource_PCA9685.c
deleted file mode 100644
index 84fb6a3..0000000
--- a/src/resource/resource_PCA9685.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <peripheral_io.h>
-#include "log.h"
-#include "resource/resource_PCA9685.h"
-
-#define RPI3_I2C_BUS 1
-
-/* Registers/etc: */
-#define PCA9685_ADDRESS 0x40
-#define MODE1 0x00
-#define MODE2 0x01
-#define SUBADR1 0x02
-#define SUBADR2 0x03
-#define SUBADR3 0x04
-#define PRESCALE 0xFE
-#define LED0_ON_L 0x06
-#define LED0_ON_H 0x07
-#define LED0_OFF_L 0x08
-#define LED0_OFF_H 0x09
-#define ALL_LED_ON_L 0xFA
-#define ALL_LED_ON_H 0xFB
-#define ALL_LED_OFF_L 0xFC
-#define ALL_LED_OFF_H 0xFD
-
-/* Bits: */
-#define RESTART 0x80
-#define SLEEP 0x10
-#define ALLCALL 0x01
-#define INVRT 0x10
-#define OUTDRV 0x04
-
-typedef enum {
- PCA9685_CH_STATE_NONE,
- PCA9685_CH_STATE_USED,
-} pca9685_ch_state_e;
-
-static peripheral_i2c_h g_i2c_h = NULL;
-static unsigned int ref_count = 0;
-static pca9685_ch_state_e ch_state[PCA9685_CH_MAX + 1] = {PCA9685_CH_STATE_NONE, };
-
-int resource_pca9685_set_frequency(unsigned int freq_hz)
-{
- int ret = PERIPHERAL_ERROR_NONE;
- double prescale_value = 0.0;
- int prescale = 0;
- uint8_t oldmode = 0;
- uint8_t newmode = 0;
-
- prescale_value = 25000000.0; // 25MHz
- prescale_value /= 4096.0; // 12-bit
- prescale_value /= (double)freq_hz;
- prescale_value -= 1.0;
-
- prescale = (int)floor(prescale_value + 0.5);
-
- ret = peripheral_i2c_read_register_byte(g_i2c_h, MODE1, &oldmode);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to read register");
-
- newmode = (oldmode & 0x7F) | 0x10; // sleep
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE1, newmode); // go to sleep
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h, PRESCALE, prescale);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE1, oldmode);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- usleep(500);
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE1, (oldmode | 0x80));
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- return 0;
-}
-
-int resource_pca9685_set_value_to_channel(unsigned int channel, int on, int off)
-{
- int ret = PERIPHERAL_ERROR_NONE;
- retvm_if(g_i2c_h == NULL, -1, "Not initialized yet");
-
- retvm_if(ch_state[channel] == PCA9685_CH_STATE_NONE, -1,
- "ch[%u] is not in used state", channel);
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- LED0_ON_L + 4*channel, on & 0xFF);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- LED0_ON_H + 4*channel, on >> 8);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- LED0_OFF_L + 4*channel, off & 0xFF);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- LED0_OFF_H + 4*channel, off >> 8);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- return 0;
-}
-
-static int resource_pca9685_set_value_to_all(int on, int off)
-{
- int ret = PERIPHERAL_ERROR_NONE;
- retvm_if(g_i2c_h == NULL, -1, "Not initialized yet");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- ALL_LED_ON_L, on & 0xFF);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- ALL_LED_ON_H, on >> 8);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- ALL_LED_OFF_L, off & 0xFF);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h,
- ALL_LED_OFF_H, off >> 8);
- retvm_if(ret != PERIPHERAL_ERROR_NONE, -1, "failed to write register");
-
- return 0;
-}
-
-int resource_pca9685_init(unsigned int ch)
-{
- uint8_t mode1 = 0;
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (ch > PCA9685_CH_MAX) {
- _E("channel[%u] is out of range", ch);
- return -1;
- }
-
- if (ch_state[ch] == PCA9685_CH_STATE_USED) {
- _E("channel[%u] is already in used state", ch);
- return -1;
- }
-
- if (g_i2c_h)
- goto PASS_OPEN_HANDLE;
-
- ret = peripheral_i2c_open(RPI3_I2C_BUS, PCA9685_ADDRESS, &g_i2c_h);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to open pca9685-[bus:%d, addr:%d]",
- RPI3_I2C_BUS, PCA9685_ADDRESS);
- return -1;
- }
- ret = resource_pca9685_set_value_to_all(0, 0);
- if (ret) {
- _E("failed to reset all value to register");
- goto ERROR;
- }
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE2, OUTDRV);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to write register");
- goto ERROR;
- }
-
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE1, ALLCALL);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to write register");
- goto ERROR;
- }
-
- usleep(500); // wait for oscillator
-
- ret = peripheral_i2c_read_register_byte(g_i2c_h, MODE1, &mode1);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to read register");
- goto ERROR;
- }
-
- mode1 = mode1 & (~SLEEP); // # wake up (reset sleep)
- ret = peripheral_i2c_write_register_byte(g_i2c_h, MODE1, mode1);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to write register");
- goto ERROR;
- }
-
- usleep(500); // wait for oscillator
-
- ret = resource_pca9685_set_frequency(60);
- if (ret) {
- _E("failed to set frequency");
- goto ERROR;
- }
-
-PASS_OPEN_HANDLE:
- ref_count++;
- ch_state[ch] = PCA9685_CH_STATE_USED;
- _D("pca9685 - ref_count[%u]", ref_count);
- _D("sets ch[%u] used state", ch);
-
- return 0;
-
-ERROR:
- if (g_i2c_h)
- peripheral_i2c_close(g_i2c_h);
-
- g_i2c_h = NULL;
- return -1;
-}
-
-int resource_pca9685_fini(unsigned int ch)
-{
- if (ch_state[ch] == PCA9685_CH_STATE_NONE) {
- _E("channel[%u] is not in used state", ch);
- return -1;
- }
- resource_pca9685_set_value_to_channel(ch, 0, 0);
- ch_state[ch] = PCA9685_CH_STATE_NONE;
-
- ref_count--;
- _D("ref count - %u", ref_count);
-
- if (ref_count == 0 && g_i2c_h) {
- _D("finalizing pca9685");
- resource_pca9685_set_value_to_all(0, 0);
- peripheral_i2c_close(g_i2c_h);
- g_i2c_h = NULL;
- }
-
- return 0;
-}
diff --git a/src/resource/resource_adc_mcp3008.c b/src/resource/resource_adc_mcp3008.c
deleted file mode 100644
index 14dff94..0000000
--- a/src/resource/resource_adc_mcp3008.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <tizen.h>
-#include <system_info.h>
-#include <string.h>
-#include "log.h"
-
-
-#define MCP3008_SPEED 3600000
-#define MCP3008_BPW 8
-
-#define MCP3008_TX_WORD1 0x01 /* 0b00000001 */
-#define MCP3008_TX_CH0 0x80 /* 0b10000000 */
-#define MCP3008_TX_CH1 0x90 /* 0b10010000 */
-#define MCP3008_TX_CH2 0xA0 /* 0b10100000 */
-#define MCP3008_TX_CH3 0xB0 /* 0b10110000 */
-#define MCP3008_TX_CH4 0xC0 /* 0b11000000 */
-#define MCP3008_TX_CH5 0xD0 /* 0b11010000 */
-#define MCP3008_TX_CH6 0xE0 /* 0b11100000 */
-#define MCP3008_TX_CH7 0xF0 /* 0b11110000 */
-#define MCP3008_TX_WORD3 0x00 /* 0b00000000 */
-
-#define MCP3008_RX_WORD1_MASK 0x00 /* 0b00000000 */
-#define MCP3008_RX_WORD2_NULL_BIT_MASK 0x04 /* 0b00000100 */
-#define MCP3008_RX_WORD2_MASK 0x03 /* 0b00000011 */
-#define MCP3008_RX_WORD3_MASK 0xFF /* 0b11111111 */
-#define UINT10_VALIDATION_MASK 0x3FF
-
-#define MODEL_NAME_KEY "http://tizen.org/system/model_name"
-#define MODEL_NAME_RPI3 "rpi3"
-#define MODEL_NAME_ARTIK "artik"
-
-static peripheral_spi_h MCP3008_H = NULL;
-static unsigned int ref_count = 0;
-
-int resource_adc_mcp3008_init(void)
-{
- int ret = 0;
- int bus = -1;
- char *model_name = NULL;
-
- if (MCP3008_H) {
- _D("SPI device aleady initialized [ref_count : %u]", ref_count);
- ref_count++;
- return 0;
- }
-
- system_info_get_platform_string(MODEL_NAME_KEY, &model_name);
- if (!model_name) {
- _E("fail to get model name");
- return -1;
- }
-
- if (!strcmp(model_name, MODEL_NAME_RPI3)) {
- bus = 0;
- } else if (!strcmp(model_name, MODEL_NAME_ARTIK)) {
- bus = 2;
- } else {
- _E("unknown model name : %s", model_name);
- free(model_name);
- return -1;
- }
- free(model_name);
- model_name = NULL;
-
- ret = peripheral_spi_open(bus, 0, &MCP3008_H);
- if (PERIPHERAL_ERROR_NONE != ret) {
- _E("spi open failed :%s ", get_error_message(ret));
- return -1;
- }
-
- ret = peripheral_spi_set_mode(MCP3008_H, PERIPHERAL_SPI_MODE_0);
- if (PERIPHERAL_ERROR_NONE != ret) {
- _E("peripheral_spi_set_mode failed :%s ", get_error_message(ret));
- goto error_after_open;
- }
- ret = peripheral_spi_set_bit_order(MCP3008_H, PERIPHERAL_SPI_BIT_ORDER_MSB);
- if (PERIPHERAL_ERROR_NONE != ret) {
- _E("peripheral_spi_set_bit_order failed :%s ", get_error_message(ret));
- goto error_after_open;
- }
-
- ret = peripheral_spi_set_bits_per_word(MCP3008_H, MCP3008_BPW);
- if (PERIPHERAL_ERROR_NONE != ret) {
- _E("peripheral_spi_set_bits_per_word failed :%s ", get_error_message(ret));
- goto error_after_open;
- }
-
- ret = peripheral_spi_set_frequency(MCP3008_H, MCP3008_SPEED);
- if (PERIPHERAL_ERROR_NONE != ret) {
- _E("peripheral_spi_set_frequency failed :%s ", get_error_message(ret));
- goto error_after_open;
- }
-
- ref_count++;
-
- return 0;
-
-error_after_open:
- peripheral_spi_close(MCP3008_H);
- MCP3008_H = NULL;
- return -1;
-}
-
-
-int resource_read_adc_mcp3008(int ch_num, unsigned int *out_value)
-{
- unsigned char rx[3] = {0, };
- unsigned char tx[3] = {0, };
- unsigned char rx_w1 = 0;
- unsigned char rx_w2 = 0;
- unsigned char rx_w2_nb = 0;
- unsigned char rx_w3 = 0;
- unsigned short int result = 0;
-
- retv_if(MCP3008_H == NULL, -1);
- retv_if(out_value == NULL, -1);
- retv_if((ch_num < 0 || ch_num > 7), -1);
-
- tx[0] = MCP3008_TX_WORD1;
- switch (ch_num) {
- case 0:
- tx[1] = MCP3008_TX_CH0;
- break;
- case 1:
- tx[1] = MCP3008_TX_CH1;
- break;
- case 2:
- tx[1] = MCP3008_TX_CH2;
- break;
- case 3:
- tx[1] = MCP3008_TX_CH3;
- break;
- case 4:
- tx[1] = MCP3008_TX_CH4;
- break;
- case 5:
- tx[1] = MCP3008_TX_CH5;
- break;
- case 6:
- tx[1] = MCP3008_TX_CH6;
- break;
- case 7:
- tx[1] = MCP3008_TX_CH7;
- break;
- default:
- tx[1] = MCP3008_TX_CH0;
- break;
- }
- tx[2] = MCP3008_TX_WORD3;
-
- peripheral_spi_transfer(MCP3008_H, tx, rx, 3);
-
- rx_w1 = rx[0] & MCP3008_RX_WORD1_MASK;
- retv_if(rx_w1 != 0, -1);
-
- rx_w2_nb = rx[1] & MCP3008_RX_WORD2_NULL_BIT_MASK;
- retv_if(rx_w2_nb != 0, -1);
-
- rx_w2 = rx[1] & MCP3008_RX_WORD2_MASK;
- rx_w3 = rx[2] & MCP3008_RX_WORD3_MASK;
-
- result = ((rx_w2 << 8) | (rx_w3)) & UINT10_VALIDATION_MASK;
-
- // _D("%hu", result);
-
- *out_value = result;
-
- return 0;
-}
-
-void resource_adc_mcp3008_fini(void)
-{
- if (MCP3008_H)
- ref_count--;
- else
- return;
-
- if (ref_count == 0) {
- peripheral_spi_close(MCP3008_H);
- MCP3008_H = NULL;
- }
-
- return;
-}
-
diff --git a/src/resource/resource_flame_sensor.c b/src/resource/resource_flame_sensor.c
deleted file mode 100644
index 5f121e5..0000000
--- a/src/resource/resource_flame_sensor.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_flame_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Flame Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_flame_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_flame_sensor;
- }
-
- /**
- * This model(NS-FDSM) normally outputs 1, and outputs 0 as out_value when a flame is detected.
- */
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_gas_detection_sensor.c b/src/resource/resource_gas_detection_sensor.c
deleted file mode 100644
index 9125154..0000000
--- a/src/resource/resource_gas_detection_sensor.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_gas_detection_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Gas Detection Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_gas_detection_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_gas_detection_sensor;
- }
-
- /**
- * This model(FC-22) normally outputs 1, and outputs 0 as out_value when a flame is detected.
- */
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_illuminance_sensor.c b/src/resource/resource_illuminance_sensor.c
deleted file mode 100644
index ca99b5a..0000000
--- a/src/resource/resource_illuminance_sensor.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-#define I2C_PIN_MAX 28
-/* I2C */
-#define GY30_ADDR 0x23 /* Address of GY30 light sensor */
-#define GY30_CONT_HIGH_RES_MODE 0x10 /* Start measurement at 11x resolution. Measurement time is approx 120mx */
-#define GY30_CONSTANT_NUM (1.2)
-
-static struct {
- int opened;
- peripheral_i2c_h sensor_h;
-} resource_sensor_s;
-
-void resource_close_illuminance_sensor(void)
-{
- if (!resource_sensor_s.opened) return;
-
- _I("Illuminance Sensor is finishing...");
- peripheral_i2c_close(resource_sensor_s.sensor_h);
- resource_sensor_s.opened = 0;
-}
-
-int resource_read_illuminance_sensor(int i2c_bus, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
- unsigned char buf[10] = { 0, };
-
- if (!resource_sensor_s.opened) {
- ret = peripheral_i2c_open(i2c_bus, GY30_ADDR, &resource_sensor_s.sensor_h);
- retv_if(!resource_sensor_s.sensor_h, -1);
- resource_sensor_s.opened = 1;
- }
-
- buf[0] = GY30_CONT_HIGH_RES_MODE;
- ret = peripheral_i2c_write(resource_sensor_s.sensor_h, buf, 1);
- retv_if(ret < 0, -1);
-
- ret = peripheral_i2c_read(resource_sensor_s.sensor_h, buf, 2);
- retv_if(ret < 0, -1);
-
- *out_value = (buf[0] << 8 | buf[1]) / GY30_CONSTANT_NUM; // Just Sum High 8bit and Low 8bit
-
- _I("Illuminance Sensor Value : %d", *out_value);
-
- return 0;
-}
diff --git a/src/resource/resource_infrared_motion_sensor.c b/src/resource/resource_infrared_motion_sensor.c
deleted file mode 100644
index 53c353b..0000000
--- a/src/resource/resource_infrared_motion_sensor.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_infrared_motion_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Infrared Motion Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_infrared_motion_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_infrared_motion_sensor;
- }
-
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- return 0;
-}
diff --git a/src/resource/resource_infrared_obstacle_avoidance_sensor.c b/src/resource/resource_infrared_obstacle_avoidance_sensor.c
deleted file mode 100644
index e085611..0000000
--- a/src/resource/resource_infrared_obstacle_avoidance_sensor.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_infrared_obstacle_avoidance_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Infrared Obstacle Avoidance Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_infrared_obstacle_avoidance_sensor;
- }
-
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- _I("Infrared Obstacle Avoidance Sensor Value : %d", *out_value);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_led.c b/src/resource/resource_led.c
deleted file mode 100644
index 02d56de..0000000
--- a/src/resource/resource_led.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_led(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("LED is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_write_led(int pin_num, int write_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_led;
- }
-
- ret = peripheral_gpio_write(resource_get_info(pin_num)->sensor_h, write_value);
- retv_if(ret < 0, -1);
-
- _I("LED Value : %s", write_value ? "ON":"OFF");
-
- return 0;
-}
diff --git a/src/resource/resource_motor_driver_L298N.c b/src/resource/resource_motor_driver_L298N.c
deleted file mode 100644
index b82a76e..0000000
--- a/src/resource/resource_motor_driver_L298N.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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.
- */
-
-#include <stdlib.h>
-#include <peripheral_io.h>
-#include "log.h"
-#include "resource/resource_PCA9685.h"
-#include "resource/resource_motor_driver_L298N.h"
-
-typedef enum {
- MOTOR_STATE_NONE,
- MOTOR_STATE_CONFIGURED,
- MOTOR_STATE_STOP,
- MOTOR_STATE_FORWARD,
- MOTOR_STATE_BACKWARD,
-} motor_state_e;
-
-typedef struct __motor_driver_s {
- unsigned int pin_1;
- unsigned int pin_2;
- unsigned int en_ch;
- motor_state_e motor_state;
- peripheral_gpio_h pin1_h;
- peripheral_gpio_h pin2_h;
-} motor_driver_s;
-
-static motor_driver_s g_md_h[MOTOR_ID_MAX] = {
- {0, 0, 0, MOTOR_STATE_NONE, NULL, NULL},
-};
-
-
-/* see Principle section in http://wiki.sunfounder.cc/index.php?title=Motor_Driver_Module-L298N */
-
-static int __motor_brake_n_stop_by_id(motor_id_e id)
-{
- int ret = PERIPHERAL_ERROR_NONE;
- int motor1_v = 0;
- int motor2_v = 0;
-
- if (g_md_h[id].motor_state <= MOTOR_STATE_CONFIGURED) {
- _E("motor[%d] are not initialized - state(%d)",
- id, g_md_h[id].motor_state);
- return -1;
- }
-
- if (g_md_h[id].motor_state == MOTOR_STATE_STOP) {
- _D("motor[%d] is already stopped", id);
- return 0;
- }
-
- if (g_md_h[id].motor_state == MOTOR_STATE_FORWARD) {
- motor1_v = 0;
- motor2_v = 0;
- } else if (g_md_h[id].motor_state == MOTOR_STATE_BACKWARD) {
- motor1_v = 1;
- motor2_v = 1;
- }
-
- /* Brake DC motor */
- ret = peripheral_gpio_write(g_md_h[id].pin1_h, motor1_v);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("Failed to set value[%d] Motor[%d] pin 1", motor1_v, id);
- return -1;
- }
-
- ret = peripheral_gpio_write(g_md_h[id].pin2_h, motor2_v);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("Failed to set value[%d] Motor[%d] pin 2", motor2_v, id);
- return -1;
- }
-
- /* set stop DC motor */
- // need to stop motor or not?, it may stop motor to free running
- resource_pca9685_set_value_to_channel(g_md_h[id].en_ch, 0, 0);
-
- g_md_h[id].motor_state = MOTOR_STATE_STOP;
-
- return 0;
-}
-
-static int __set_default_configuration_by_id(motor_id_e id)
-{
- unsigned int pin_1, pin_2, en_ch;
-
- switch (id) {
- case MOTOR_ID_1:
- pin_1 = DEFAULT_MOTOR1_PIN1;
- pin_2 = DEFAULT_MOTOR1_PIN2;
- en_ch = DEFAULT_MOTOR1_EN_CH;
- break;
- case MOTOR_ID_2:
- pin_1 = DEFAULT_MOTOR2_PIN1;
- pin_2 = DEFAULT_MOTOR2_PIN2;
- en_ch = DEFAULT_MOTOR2_EN_CH;
- break;
- case MOTOR_ID_3:
- pin_1 = DEFAULT_MOTOR3_PIN1;
- pin_2 = DEFAULT_MOTOR3_PIN2;
- en_ch = DEFAULT_MOTOR3_EN_CH;
- break;
- case MOTOR_ID_4:
- pin_1 = DEFAULT_MOTOR4_PIN1;
- pin_2 = DEFAULT_MOTOR4_PIN2;
- en_ch = DEFAULT_MOTOR4_EN_CH;
- break;
- case MOTOR_ID_MAX:
- default:
- _E("Unkwon ID[%d]", id);
- return -1;
- break;
- }
-
- g_md_h[id].pin_1 = pin_1;
- g_md_h[id].pin_2 = pin_2;
- g_md_h[id].en_ch = en_ch;
- g_md_h[id].motor_state = MOTOR_STATE_CONFIGURED;
-
- return 0;
-}
-
-static int __fini_motor_by_id(motor_id_e id)
-{
- retv_if(id == MOTOR_ID_MAX, -1);
-
- if (g_md_h[id].motor_state <= MOTOR_STATE_CONFIGURED)
- return 0;
-
- if (g_md_h[id].motor_state > MOTOR_STATE_STOP)
- __motor_brake_n_stop_by_id(id);
-
- resource_pca9685_fini(g_md_h[id].en_ch);
-
- if (g_md_h[id].pin1_h) {
- peripheral_gpio_close(g_md_h[id].pin1_h);
- g_md_h[id].pin1_h = NULL;
- }
-
- if (g_md_h[id].pin2_h) {
- peripheral_gpio_close(g_md_h[id].pin2_h);
- g_md_h[id].pin2_h = NULL;
- }
-
- g_md_h[id].motor_state = MOTOR_STATE_CONFIGURED;
-
- return 0;
-}
-
-static int __init_motor_by_id(motor_id_e id)
-{
- int ret = 0;
-
- retv_if(id == MOTOR_ID_MAX, -1);
-
- if (g_md_h[id].motor_state == MOTOR_STATE_NONE)
- __set_default_configuration_by_id(id);
-
- ret = resource_pca9685_init(g_md_h[id].en_ch);
- if (ret) {
- _E("failed to init PCA9685");
- return -1;
- }
-
- /* open pins for Motor */
- ret = peripheral_gpio_open(g_md_h[id].pin_1, &g_md_h[id].pin1_h);
- if (ret == PERIPHERAL_ERROR_NONE)
- peripheral_gpio_set_direction(g_md_h[id].pin1_h,
- PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- else {
- _E("failed to open Motor[%d] gpio pin1[%u]", id, g_md_h[id].pin_1);
- goto ERROR;
- }
-
- ret = peripheral_gpio_open(g_md_h[id].pin_2, &g_md_h[id].pin2_h);
- if (ret == PERIPHERAL_ERROR_NONE)
- peripheral_gpio_set_direction(g_md_h[id].pin2_h,
- PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- else {
- _E("failed to open Motor[%d] gpio pin2[%u]", id, g_md_h[id].pin_2);
- goto ERROR;
- }
-
- g_md_h[id].motor_state = MOTOR_STATE_STOP;
-
- return 0;
-
-ERROR:
- resource_pca9685_fini(g_md_h[id].en_ch);
-
- if (g_md_h[id].pin1_h) {
- peripheral_gpio_close(g_md_h[id].pin1_h);
- g_md_h[id].pin1_h = NULL;
- }
-
- if (g_md_h[id].pin2_h) {
- peripheral_gpio_close(g_md_h[id].pin2_h);
- g_md_h[id].pin2_h = NULL;
- }
-
- return -1;
-}
-
-void resource_close_motor_driver_L298N(motor_id_e id)
-{
- __fini_motor_by_id(id);
- return;
-}
-
-void resource_close_motor_driver_L298N_all(void)
-{
- int i;
- for (i = MOTOR_ID_1; i < MOTOR_ID_MAX; i++)
- __fini_motor_by_id(i);
-
- return;
-}
-
-int resource_set_motor_driver_L298N_configuration(motor_id_e id,
- unsigned int pin1, unsigned int pin2, unsigned en_ch)
-{
-
- if (g_md_h[id].motor_state > MOTOR_STATE_CONFIGURED) {
- _E("cannot set configuration motor[%d] in this state[%d]",
- id, g_md_h[id].motor_state);
- return -1;
- }
-
- g_md_h[id].pin_1 = pin1;
- g_md_h[id].pin_2 = pin2;
- g_md_h[id].en_ch = en_ch;
- g_md_h[id].motor_state = MOTOR_STATE_CONFIGURED;
-
- return 0;
-}
-
-int resource_set_motor_driver_L298N_speed(motor_id_e id, int speed)
-{
- int ret = 0;
- const int value_max = 4095;
- int value = 0;
- int e_state = MOTOR_STATE_NONE;
- int motor_v_1 = 0;
- int motor_v_2 = 0;
-
- if (g_md_h[id].motor_state <= MOTOR_STATE_CONFIGURED) {
- ret = __init_motor_by_id(id);
- if (ret) {
- _E("failed to __init_motor_by_id()");
- return -1;
- }
- }
-
- value = abs(speed);
-
- if (value > value_max) {
- value = value_max;
- _D("max speed is %d", value_max);
- }
- _D("set speed %d", value);
-
- if (speed == 0) {
- /* brake and stop */
- ret = __motor_brake_n_stop_by_id(id);
- if (ret) {
- _E("failed to stop motor[%d]", id);
- return -1;
- }
- return 0; /* done */
- }
-
- if (speed > 0)
- e_state = MOTOR_STATE_FORWARD; /* will be set forward */
- else
- e_state = MOTOR_STATE_BACKWARD; /* will be set backward */
-
- if (g_md_h[id].motor_state == e_state)
- goto SET_SPEED;
- else {
- /* brake and stop */
- ret = __motor_brake_n_stop_by_id(id);
- if (ret) {
- _E("failed to stop motor[%d]", id);
- return -1;
- }
- }
-
- switch (e_state) {
- case MOTOR_STATE_FORWARD:
- motor_v_1 = 1;
- motor_v_2 = 0;
- break;
- case MOTOR_STATE_BACKWARD:
- motor_v_1 = 0;
- motor_v_2 = 1;
- break;
- }
- ret = peripheral_gpio_write(g_md_h[id].pin1_h, motor_v_1);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to set value[%d] Motor[%d] pin 1", motor_v_1, id);
- return -1;
- }
-
- ret = peripheral_gpio_write(g_md_h[id].pin2_h, motor_v_2);
- if (ret != PERIPHERAL_ERROR_NONE) {
- _E("failed to set value[%d] Motor[%d] pin 2", motor_v_2, id);
- return -1;
- }
-
-SET_SPEED:
- ret = resource_pca9685_set_value_to_channel(g_md_h[id].en_ch, 0, value);
- if (ret) {
- _E("failed to set speed - %d", speed);
- return -1;
- }
-
- g_md_h[id].motor_state = e_state;
-
- return 0;
-}
diff --git a/src/resource/resource_rain_sensor.c b/src/resource/resource_rain_sensor.c
deleted file mode 100755
index df5ec93..0000000
--- a/src/resource/resource_rain_sensor.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_rain_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Rain Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_rain_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_flame_sensor;
- }
-
- /**
- * This model(FC-37 + YL-38) normally outputs 1, and outputs 0 as out_value when a rain is detected.
- */
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_servo_motor.c b/src/resource/resource_servo_motor.c
deleted file mode 100644
index 9a93206..0000000
--- a/src/resource/resource_servo_motor.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Contact: Jeonghoon Park <jh1979.park@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.
- */
-
-#include "log.h"
-#include "resource/resource_PCA9685.h"
-
-#define SERVO_MOTOR_MAX PCA9685_CH_MAX
-
-static int servo_motor_index[SERVO_MOTOR_MAX + 1] = {0, };
-
-static int resource_servo_motor_init(unsigned int ch)
-{
- int ret = 0;
- ret = resource_pca9685_init(ch);
- if (ret) {
- _E("failed to init PCA9685 with ch[%u]", ch);
- return -1;
- }
- servo_motor_index[ch] = 1;
-
- return 0;
-}
-
-void resource_close_servo_motor(unsigned int ch)
-{
- if (servo_motor_index[ch] == 1) {
- resource_pca9685_fini(ch);
- servo_motor_index[ch] = 0;
- }
-
- return;
-}
-
-void resource_close_servo_motor_all(void)
-{
- unsigned int i;
-
- for (i = 0 ; i <= SERVO_MOTOR_MAX; i++)
- resource_close_servo_motor(i);
-
- return;
-}
-
-int resource_set_servo_motor_value(unsigned int motor_id, int value)
-{
- int ret = 0;
-
- if (motor_id > SERVO_MOTOR_MAX)
- return -1;
-
- if (servo_motor_index[motor_id] == 0) {
- ret = resource_servo_motor_init(motor_id);
- if (ret)
- return -1;
- }
-
- ret = resource_pca9685_set_value_to_channel(motor_id, 0, value);
-
- return ret;
-}
diff --git a/src/resource/resource_sound_detection_sensor.c b/src/resource/resource_sound_detection_sensor.c
deleted file mode 100644
index dda64f0..0000000
--- a/src/resource/resource_sound_detection_sensor.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_sound_detection_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Sound Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_sound_detection_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_sound_detection_sensor;
- }
-
- /**
- * This model(NS-SDSM) normally outputs 1, and outputs 0 as out_value when sound is detected.
- */
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_sound_level_sensor.c b/src/resource/resource_sound_level_sensor.c
deleted file mode 100644
index 0d20b59..0000000
--- a/src/resource/resource_sound_level_sensor.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource/resource_adc_mcp3008.h"
-
-static bool initialized = false;
-
-void resource_close_sound_level_sensor(void)
-{
- resource_adc_mcp3008_fini();
- initialized = false;
-}
-
-int resource_read_sound_level_sensor(int ch_num, unsigned int *out_value)
-{
- unsigned int read_value = 0;
- int ret = 0;
-
- if (!initialized) {
- ret = resource_adc_mcp3008_init();
- retv_if(ret != 0, -1);
- initialized = true;
- }
- ret = resource_read_adc_mcp3008(ch_num, &read_value);
- retv_if(ret != 0, -1);
-
- *out_value = read_value;
-
- return 0;
-}
-
diff --git a/src/resource/resource_tilt_sensor.c b/src/resource/resource_tilt_sensor.c
deleted file mode 100644
index 46f0b7e..0000000
--- a/src/resource/resource_tilt_sensor.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_tilt_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Infrared Motion Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_tilt_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_tilt_sensor;
- }
-
- /**
- * This model(SZH-EK084) normally outputs 1, and outputs 0 as out_value when the sensor is tilted.
- */
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- *out_value = !*out_value;
-
- return 0;
-}
diff --git a/src/resource/resource_touch_sensor.c b/src/resource/resource_touch_sensor.c
deleted file mode 100644
index f26bb15..0000000
--- a/src/resource/resource_touch_sensor.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_touch_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Touch Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_touch_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- _I("Touch sensor is initializing...");
-
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_touch_sensor;
- }
-
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- _I("Touch Sensor Value : %d", *out_value);
-
- return 0;
-}
diff --git a/src/resource/resource_ultrasonic_sensor.c b/src/resource/resource_ultrasonic_sensor.c
deleted file mode 100644
index 336e623..0000000
--- a/src/resource/resource_ultrasonic_sensor.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-#include <gio/gio.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-static resource_read_s *resource_read_info = NULL;
-static unsigned long long triggered_time = 0;
-
-void resource_close_ultrasonic_sensor_trig(int trig_pin_num)
-{
- if (!resource_get_info(trig_pin_num)->opened) return;
-
- _I("Ultrasonic sensor's trig is finishing...");
-
- peripheral_gpio_close(resource_get_info(trig_pin_num)->sensor_h);
- resource_get_info(trig_pin_num)->opened = 0;
-}
-
-void resource_close_ultrasonic_sensor_echo(int echo_pin_num)
-{
- if (!resource_get_info(echo_pin_num)->opened) return;
-
- _I("Ultrasonic sensor's echo is finishing...");
-
- peripheral_gpio_close(resource_get_info(echo_pin_num)->sensor_h);
- resource_get_info(echo_pin_num)->opened = 0;
- free(resource_read_info);
- resource_read_info = NULL;
-}
-
-static unsigned long long _get_timestamp(void)
-{
- struct timespec t;
- clock_gettime(CLOCK_REALTIME, &t);
- return ((unsigned long long)(t.tv_sec)*1000000000LL + t.tv_nsec) / 1000;
-}
-
-static void _resource_read_ultrasonic_sensor_cb(peripheral_gpio_h gpio, peripheral_error_e error, void *user_data)
-{
- float dist = 0;
- uint32_t value;
- unsigned long long returned_time = 0;
- resource_read_s *resource_read_info = user_data;
-
- ret_if(!resource_read_info);
- ret_if(!resource_read_info->cb);
-
- peripheral_gpio_read(gpio, &value);
-
- if (value == 1) {
- triggered_time = _get_timestamp();
- } else if (value == 0) {
- returned_time = _get_timestamp();
- }
-
- if (triggered_time > 0 && value == 0) {
- dist = returned_time - triggered_time;
- if (dist < 150 || dist > 25000) {
- dist = -1;
- } else {
- dist = (dist * 34300) / 2000000;
- }
-
- resource_read_info->cb(dist, resource_read_info->data);
- }
-}
-
-int resource_read_ultrasonic_sensor(int trig_pin_num, int echo_pin_num, resource_read_cb cb, void *data)
-{
- int ret = 0;
-
- triggered_time = 0;
-
- if (resource_read_info == NULL) {
- resource_read_info = calloc(1, sizeof(resource_read_s));
- retv_if(!resource_read_info, -1);
- } else {
- peripheral_gpio_unset_interrupted_cb(resource_get_info(resource_read_info->pin_num)->sensor_h);
- }
- resource_read_info->cb = cb;
- resource_read_info->data = data;
- resource_read_info->pin_num = echo_pin_num;
-
- if (!resource_get_info(trig_pin_num)->opened) {
- _I("Ultrasonic sensor's trig is initializing...");
-
- ret = peripheral_gpio_open(trig_pin_num, &resource_get_info(trig_pin_num)->sensor_h);
- retv_if(!resource_get_info(trig_pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(trig_pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
- retv_if(ret != 0, -1);
-
- resource_get_info(trig_pin_num)->opened = 1;
- resource_get_info(trig_pin_num)->close = resource_close_ultrasonic_sensor_trig;
- }
-
- if (!resource_get_info(echo_pin_num)->opened) {
- _I("Ultrasonic sensor's echo is initializing...");
-
- ret = peripheral_gpio_open(echo_pin_num, &resource_get_info(echo_pin_num)->sensor_h);
- retv_if(!resource_get_info(echo_pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(echo_pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- ret = peripheral_gpio_set_edge_mode(resource_get_info(echo_pin_num)->sensor_h, PERIPHERAL_GPIO_EDGE_BOTH);
- retv_if(ret != 0, -1);
-
- resource_get_info(echo_pin_num)->opened = 1;
- resource_get_info(echo_pin_num)->close = resource_close_ultrasonic_sensor_echo;
- }
-
- if (resource_get_info(echo_pin_num)->sensor_h) {
- ret = peripheral_gpio_set_interrupted_cb(resource_get_info(echo_pin_num)->sensor_h, _resource_read_ultrasonic_sensor_cb, resource_read_info);
- retv_if(ret != 0, -1);
- }
-
- ret = peripheral_gpio_write(resource_get_info(trig_pin_num)->sensor_h, 0);
- retv_if(ret < 0, -1);
-
- usleep(20000);
-
- ret = peripheral_gpio_write(resource_get_info(trig_pin_num)->sensor_h, 1);
- retv_if(ret < 0, -1);
-
- usleep(20000);
-
- ret = peripheral_gpio_write(resource_get_info(trig_pin_num)->sensor_h, 0);
- retv_if(ret < 0, -1);
-
- return 0;
-}
diff --git a/src/resource/resource_vibration_sensor.c b/src/resource/resource_vibration_sensor.c
deleted file mode 100644
index dd65dda..0000000
--- a/src/resource/resource_vibration_sensor.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <peripheral_io.h>
-#include <sys/time.h>
-
-#include "log.h"
-#include "resource_internal.h"
-
-void resource_close_vibration_sensor(int pin_num)
-{
- if (!resource_get_info(pin_num)->opened) return;
-
- _I("Vibration Sensor is finishing...");
- peripheral_gpio_close(resource_get_info(pin_num)->sensor_h);
- resource_get_info(pin_num)->opened = 0;
-}
-
-int resource_read_vibration_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!resource_get_info(pin_num)->opened) {
- ret = peripheral_gpio_open(pin_num, &resource_get_info(pin_num)->sensor_h);
- retv_if(!resource_get_info(pin_num)->sensor_h, -1);
-
- ret = peripheral_gpio_set_direction(resource_get_info(pin_num)->sensor_h, PERIPHERAL_GPIO_DIRECTION_IN);
- retv_if(ret != 0, -1);
-
- resource_get_info(pin_num)->opened = 1;
- resource_get_info(pin_num)->close = resource_close_vibration_sensor;
- }
-
- ret = peripheral_gpio_read(resource_get_info(pin_num)->sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- return 0;
-}
diff --git a/src/webutil.c b/src/webutil.c
deleted file mode 100644
index 5938587..0000000
--- a/src/webutil.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * 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>
- * Jeonghoon Park <jh1979.park@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.
- */
-
-#include <stdbool.h>
-#include <curl/curl.h>
-#include <glib.h>
-#include <json-glib/json-glib.h>
-#include "log.h"
-#include "webutil.h"
-
-#define URI_PATH_LEN 64
-#define REQ_CON_TIMEOUT 5L
-#define REQ_TIMEOUT 7L
-
-typedef struct _wu_json_handle {
- JsonBuilder *builder;
- bool is_begin;
- bool is_end;
-} wu_json_handle;
-
-static wu_json_handle Json_h = {NULL, false, false};
-
-static size_t _post_response_write_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
-{
- size_t res_size = 0;
-
- res_size = size*nmemb;
-
- if (res_size > 0)
- _I("POST response : %s", ptr);
- /* What should we do here, if response body has negative message? */
-
- return res_size;
-}
-
-static size_t _get_response_write_callback(void *ptr, size_t size, size_t nmemb, void *data)
-{
- size_t res_size = 0;
- char **received = (char **)data;
-
- res_size = size*nmemb;
-
- if (received && res_size > 0)
- *received = strndup((char *)ptr, size*nmemb);
- else
- _E("fail to get response [res size : %d]", res_size);
-
- return res_size;
-}
-
-static int __curl_debug(CURL *handle, curl_infotype type,
- char *data, size_t size, void *userptr)
-{
- const char *prefix = NULL;
- char *message = NULL;
-
- switch (type) {
- case CURLINFO_END:
- return 0;
- case CURLINFO_TEXT:
- _D("== text Info: %s", data);
- return 0;
- case CURLINFO_HEADER_OUT:
- prefix = "=> Send header:";
- break;
- case CURLINFO_DATA_OUT:
- prefix = "=> Send data:";
- break;
- case CURLINFO_SSL_DATA_OUT:
- prefix = "=> Send SSL data:";
- break;
- case CURLINFO_HEADER_IN:
- prefix = "<= Recv header:";
- break;
- case CURLINFO_DATA_IN:
- prefix = "<= Recv data:";
- break;
- case CURLINFO_SSL_DATA_IN:
- prefix = "<= Recv SSL data:";
- break;
- }
- message = g_strndup(data, size);
- _D("%s %s", prefix, message);
- g_free(message);
- return 0;
-}
-
-static const char *_get_time_str(void)
-{
- struct timeval val;
- struct tm *ptm;
- static char res_time[40] = {0, };
-
- gettimeofday(&val, NULL);
- ptm = localtime(&val.tv_sec);
-
- // format : YY-MM-DD_hh:mm:ss:uuuuuu
- snprintf(res_time, sizeof(res_time), "%04d-%02d-%02d_%02d:%02d:%02d:%06ld"
- , ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday
- , ptm->tm_hour, ptm->tm_min, ptm->tm_sec
- , val.tv_usec);
-
- return (const char *)res_time;
-}
-
-
-int web_util_noti_init(void)
-{
- int ret = 0;
- CURLcode result;
- result = curl_global_init(CURL_GLOBAL_DEFAULT);
- if (result != CURLE_OK) {
- _E("curl_global_init() failed: %s",
- curl_easy_strerror(result));
- ret = -1;
- }
- return ret;
-}
-
-void web_util_noti_fini(void)
-{
- curl_global_cleanup();
- return;
-}
-
-int web_util_noti_post_image_data(const char *url, const char *device_id,
- const void *image_data, unsigned int image_size)
-{
- int ret = 0;
- CURL *curl = NULL;
- CURLcode response = CURLE_OK;
- struct curl_httppost *formpost = NULL;
- struct curl_httppost *lastptr = NULL;
- char *filename = NULL;
- char *post_url = NULL;
-
- retv_if(url == NULL, -1);
- retv_if(device_id == NULL, -1);
- retv_if(image_data == NULL, -1);
- retv_if(image_size == 0, -1);
-
- curl = curl_easy_init();
-
- if (!curl) {
- _E("fail to init curl");
- return -1;
- }
-
- filename = g_strdup_printf("%s_%s.jpg", device_id, _get_time_str());
- post_url = g_strdup_printf("%s?id=%s", url, device_id);
- _D("FileName: [%s], PostUrl: [%s]", filename, post_url);
-
- curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "content-type:",
- CURLFORM_COPYCONTENTS, "multipart/form-data",
- CURLFORM_END);
-
- curl_formadd(&formpost, &lastptr,
- CURLFORM_COPYNAME, "imageFile",
- CURLFORM_BUFFER, filename,
- CURLFORM_BUFFERPTR, image_data,
- CURLFORM_BUFFERLENGTH, image_size,
- CURLFORM_END);
-
- curl_easy_setopt(curl, CURLOPT_URL, post_url);
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
-
- /* if CURLOPT_VERBOSE is enabled, __curl_debug() function will be called */
- // curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, __curl_debug);
-
- // curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, REQ_CON_TIMEOUT);
- // curl_easy_setopt(curl, CURLOPT_TIMEOUT, REQ_TIMEOUT);
-
- response = curl_easy_perform(curl);
-
- if (response != CURLE_OK) {
- _E("curl_easy_perform() failed: %s",
- curl_easy_strerror(response));
- ret = -1;
- }
-
- curl_easy_cleanup(curl);
- curl_formfree(formpost);
- g_free(post_url);
- g_free(filename);
-
- return ret;
-}
-
-int web_util_noti_post(const char *resource, const char *json_data)
-{
- int ret = 0;
- CURL *curl = NULL;
- CURLcode response = CURLE_OK;
- struct curl_slist *headers = NULL;
-
- retv_if(resource == NULL, -1);
- retv_if(json_data == NULL, -1);
-
- _I("server : %s", resource);
- _I("json_data : %s", json_data);
-
- curl = curl_easy_init();
-
- if (!curl) {
- _E("fail to init curl");
- return -1;
- }
-
- headers = curl_slist_append(headers, "Accept: application/json");
- headers = curl_slist_append(headers, "Content-Type: application/json");
-
- curl_easy_setopt(curl, CURLOPT_URL, resource);
- curl_easy_setopt(curl, CURLOPT_POST, 1L);
- curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
- curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _post_response_write_callback);
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, REQ_CON_TIMEOUT);
- curl_easy_setopt(curl, CURLOPT_TIMEOUT, REQ_TIMEOUT);
-
- response = curl_easy_perform(curl);
-
- if (response != CURLE_OK) {
- _E("curl_easy_perform() failed: %s",
- curl_easy_strerror(response));
- /* What should we do here, if response is kind of errors? */
- ret = -1;
- }
-
- curl_slist_free_all(headers);
- curl_easy_cleanup(curl);
-
- return ret;
-}
-
-int web_util_noti_get(const char *resource, char **res)
-{
- int ret = 0;
- CURL *curl = NULL;
- CURLcode response = CURLE_OK;
-
- retv_if(resource == NULL, -1);
-
- _I("GET to [%s]", resource);
-
- curl = curl_easy_init();
-
- if (!curl) {
- _E("fail to init curl");
- return -1;
- }
-
- curl_easy_setopt(curl, CURLOPT_URL, resource);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _get_response_write_callback);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)res);
- curl_easy_setopt(curl, CURLOPT_USERAGENT, "tizen-iot-agent/1.0");
- curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, REQ_CON_TIMEOUT);
-
- response = curl_easy_perform(curl);
-
- if (response != CURLE_OK) {
- _E("curl_easy_perform() failed: %s",
- curl_easy_strerror(response));
- /* What should we do here, if response is kind of errors? */
- ret = -1;
- }
-
- curl_easy_cleanup(curl);
-
- return ret;
-}
-
-int web_util_json_init(void)
-{
- if (Json_h.builder)
- g_object_unref(Json_h.builder);
-
- Json_h.is_begin = false;
- Json_h.is_end = false;
- Json_h.builder = json_builder_new();
- retv_if(Json_h.builder == NULL, -1);
-
- return 0;
-}
-
-int web_util_json_fini(void)
-{
-
- if (Json_h.builder) {
- g_object_unref(Json_h.builder);
- Json_h.builder = NULL;
- }
-
- Json_h.is_begin = false;
- Json_h.is_end = false;
-
- return 0;
-}
-
-int web_util_json_begin(void)
-{
- retv_if(Json_h.builder == NULL, -1);
- retv_if(Json_h.is_begin == true, -1);
- retv_if(Json_h.is_end == true, -1);
-
- Json_h.is_begin = true;
-
- json_builder_begin_object(Json_h.builder);
-
- return 0;
-}
-
-int web_util_json_end(void)
-{
- retv_if(Json_h.builder == NULL, -1);
- retv_if(Json_h.is_begin == false, -1);
- retv_if(Json_h.is_end == true, -1);
-
- json_builder_end_object(Json_h.builder);
- Json_h.is_end = true;
-
- return 0;
-}
-
-int web_util_json_add_int(const char* key, long long int value)
-{
- retv_if(!key, -1);
-
- if (Json_h.builder == NULL) {
- _E("Handle for json is not initialized, call web_util_json_init() first");
- return -1;
- }
-
- if (Json_h.is_begin == false) {
- _E("json object has not begun, call web_util_json_begin() first");
- return -1;
- }
-
- if (Json_h.is_end == true) {
- _E("json object has already ended, call web_util_json_begin() first");
- return -1;
- }
-
- json_builder_set_member_name(Json_h.builder, key);
- json_builder_add_int_value(Json_h.builder, value);
-
- return 0;
-}
-
-int web_util_json_add_double(const char* key, double value)
-{
- retv_if(!key, -1);
-
- if (Json_h.builder == NULL) {
- _E("Handle for json is not initialized, call web_util_json_init() first");
- return -1;
- }
-
- if (Json_h.is_begin == false) {
- _E("json object has not begun, call web_util_json_begin() first");
- return -1;
- }
-
- if (Json_h.is_end == true) {
- _E("json object has already ended, call web_util_json_begin() first");
- return -1;
- }
-
- json_builder_set_member_name(Json_h.builder, key);
- json_builder_add_double_value(Json_h.builder, value);
-
- return 0;
-}
-
-int web_util_json_add_boolean(const char* key, bool value)
-{
- retv_if(!key, -1);
-
- if (Json_h.builder == NULL) {
- _E("Handle for json is not initialized, call web_util_json_init() first");
- return -1;
- }
-
- if (Json_h.is_begin == false) {
- _E("json object has not begun, call web_util_json_begin() first");
- return -1;
- }
-
- if (Json_h.is_end == true) {
- _E("json object has already ended, call web_util_json_begin() first");
- return -1;
- }
-
- json_builder_set_member_name(Json_h.builder, key);
- json_builder_add_boolean_value(Json_h.builder, value);
-
- return 0;
-}
-
-int web_util_json_add_string(const char* key, const char *value)
-{
- retv_if(!key, -1);
-
- if (Json_h.builder == NULL) {
- _E("Handle for json is not initialized, call web_util_json_init() first");
- return -1;
- }
-
- if (Json_h.is_begin == false) {
- _E("json object has not begun, call web_util_json_begin() first");
- return -1;
- }
-
- if (Json_h.is_end == true) {
- _E("json object has already ended, call web_util_json_begin() first");
- return -1;
- }
-
- json_builder_set_member_name(Json_h.builder, key);
- json_builder_add_string_value(Json_h.builder, value);
-
- return 0;
-}
-
-int web_util_json_data_array_begin(void)
-{
- int ret = 0;
- retv_if(Json_h.builder == NULL, -1);
-
- ret = web_util_json_begin();
- retv_if(ret, -1);
-
- json_builder_set_member_name(Json_h.builder, "SensorDataList");
- json_builder_begin_array(Json_h.builder);
-
- return 0;
-}
-
-int web_util_json_data_array_end(void)
-{
- retv_if(Json_h.builder == NULL, -1);
- retv_if(Json_h.is_begin == false, -1);
- retv_if(Json_h.is_end == true, -1);
-
- json_builder_end_array(Json_h.builder);
- web_util_json_end();
-
- return 0;
-}
-
-int web_util_json_add_sensor_data(const char* sensorpi_id, web_util_sensor_data_s *sensor_data)
-{
- const char n_id[] = "SensorPiID";
- const char n_motion[] = "Motion";
- const char n_flame[] = "Flame";
- const char n_hum[] = "Humidity";
- const char n_temp[] = "Temperature";
- const char n_vib[] = "Vibration";
- const char n_co2[] = "CO2";
- const char n_sound[] = "SoundLevel";
- const char n_tilt[] = "Tilt";
- const char n_light[] = "Light";
- const char n_collision[] = "Collision";
- const char n_obstacle[] = "Obstacle";
- const char n_distance[] = "Distance";
- const char n_rain[] = "Rain";
- const char n_touch[] = "Touch";
- const char n_gas[] = "Gas";
- const char n_e_sensor[] = "SensorEnabled";
- const char n_hash[] = "Hash";
- const char n_ip[] = "SensorPiIP";
-
- retv_if(!sensorpi_id, -1);
- retv_if(Json_h.builder == NULL, -1);
- retv_if(Json_h.is_begin == false, -1);
- retv_if(Json_h.is_end == true, -1);
- retv_if(sensor_data == NULL, -1);
-
- /* JSON structure :
- {
- SensorPiID: string,
- SensorPiIP: string,
- Motion: boolean,
- Flame: boolean,
- Humidity: double,
- Temperature: double,
- Vibration: boolean,
- CO2: double,
- SoundLevel: int,
- Tilt: int,
- Light: int,
- Collision: int,
- Obstacle: int,
- Distance: double,
- Rain: int,
- Touch: int,
- Gas: int,
- SensorEnabled: [Motion, ],
- Hash: string,
- }
- */
-
- json_builder_begin_object(Json_h.builder);
-
- json_builder_set_member_name(Json_h.builder, n_id);
- json_builder_add_string_value(Json_h.builder, sensorpi_id);
-
- if (sensor_data->ip_addr) {
- json_builder_set_member_name(Json_h.builder, n_ip);
- json_builder_add_string_value(Json_h.builder, sensor_data->ip_addr);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_MOTION) {
- json_builder_set_member_name(Json_h.builder, n_motion);
- json_builder_add_int_value(Json_h.builder, sensor_data->motion);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_FLAME) {
- json_builder_set_member_name(Json_h.builder, n_flame);
- json_builder_add_int_value(Json_h.builder, sensor_data->flame);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_HUMIDITY) {
- json_builder_set_member_name(Json_h.builder, n_hum);
- json_builder_add_double_value(Json_h.builder, sensor_data->humidity);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TEMPERATURE) {
- json_builder_set_member_name(Json_h.builder, n_temp);
- json_builder_add_double_value(Json_h.builder, sensor_data->temperature);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_VIB) {
- json_builder_set_member_name(Json_h.builder, n_vib);
- json_builder_add_int_value(Json_h.builder, sensor_data->virbration);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_CO2) {
- json_builder_set_member_name(Json_h.builder, n_co2);
- json_builder_add_double_value(Json_h.builder, sensor_data->co2);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_SOUND) {
- json_builder_set_member_name(Json_h.builder, n_sound);
- json_builder_add_int_value(Json_h.builder, sensor_data->soundlevel);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TILT) {
- json_builder_set_member_name(Json_h.builder, n_tilt);
- json_builder_add_int_value(Json_h.builder, sensor_data->tilt);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_LIGHT) {
- json_builder_set_member_name(Json_h.builder, n_light);
- json_builder_add_int_value(Json_h.builder, sensor_data->light);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_COLLISION) {
- json_builder_set_member_name(Json_h.builder, n_collision);
- json_builder_add_int_value(Json_h.builder, sensor_data->collision);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_OBSTACLE) {
- json_builder_set_member_name(Json_h.builder, n_obstacle);
- json_builder_add_int_value(Json_h.builder, sensor_data->obstacle);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_ULTRASONIC_DISTANCE) {
- json_builder_set_member_name(Json_h.builder, n_distance);
- json_builder_add_double_value(Json_h.builder, sensor_data->distance);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_RAIN) {
- json_builder_set_member_name(Json_h.builder, n_rain);
- json_builder_add_int_value(Json_h.builder, sensor_data->rain);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TOUCH) {
- json_builder_set_member_name(Json_h.builder, n_touch);
- json_builder_add_int_value(Json_h.builder, sensor_data->touch);
- }
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_GAS) {
- json_builder_set_member_name(Json_h.builder, n_gas);
- json_builder_add_int_value(Json_h.builder, sensor_data->gas);
- }
-
- json_builder_set_member_name(Json_h.builder, n_e_sensor);
- json_builder_begin_array(Json_h.builder);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_MOTION)
- json_builder_add_string_value(Json_h.builder, n_motion);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_FLAME)
- json_builder_add_string_value(Json_h.builder, n_flame);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_HUMIDITY)
- json_builder_add_string_value(Json_h.builder, n_hum);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TEMPERATURE)
- json_builder_add_string_value(Json_h.builder, n_temp);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_VIB)
- json_builder_add_string_value(Json_h.builder, n_vib);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_CO2)
- json_builder_add_string_value(Json_h.builder, n_co2);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_SOUND)
- json_builder_add_string_value(Json_h.builder, n_sound);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TILT)
- json_builder_add_string_value(Json_h.builder, n_tilt);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_LIGHT)
- json_builder_add_string_value(Json_h.builder, n_light);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_COLLISION)
- json_builder_add_string_value(Json_h.builder, n_collision);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_OBSTACLE)
- json_builder_add_string_value(Json_h.builder, n_obstacle);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_ULTRASONIC_DISTANCE)
- json_builder_add_string_value(Json_h.builder, n_distance);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_RAIN)
- json_builder_add_string_value(Json_h.builder, n_rain);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_TOUCH)
- json_builder_add_string_value(Json_h.builder, n_touch);
-
- if (sensor_data->enabled_sensor & WEB_UTIL_SENSOR_GAS)
- json_builder_add_string_value(Json_h.builder, n_gas);
-
- json_builder_end_array(Json_h.builder);
-
- if (sensor_data->hash) {
- json_builder_set_member_name(Json_h.builder, n_hash);
- json_builder_add_string_value(Json_h.builder, sensor_data->hash);
- }
-
- json_builder_end_object(Json_h.builder);
-
- return 0;
-}
-
-char *web_util_get_json_string(void)
-{
- JsonGenerator *gen = NULL;
- JsonNode *root = NULL;
- char *str = NULL;
-
- retv_if(Json_h.builder == NULL, NULL);
- retv_if(Json_h.is_begin == false, NULL);
- retv_if(Json_h.is_end == false, NULL);
-
- root = json_builder_get_root(Json_h.builder);
- retv_if(root == NULL, NULL);
-
- gen = json_generator_new();
- goto_if(gen == NULL, DONE);
- json_generator_set_root(gen, root);
-
- str = json_generator_to_data(gen, NULL);
-
-DONE:
- if (gen)
- g_object_unref(gen);
-
- if (root)
- json_node_free(root);
-
- return str;
-}
-
diff --git a/tizen-manifest.xml b/tizen-manifest.xml
deleted file mode 100644
index d6f2430..0000000
--- a/tizen-manifest.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="4.0" package="org.tizen.rcc" version="1.0.0">
- <profile name="iot-headless"/>
- <service-application appid="org.tizen.rcc" exec="rcc" multiple="false" nodisplay="true" taskmanage="false" type="capp">
- <label>rcc</label>
- </service-application>
- <privileges>
- <privilege>http://tizen.org/privilege/appdir.shareddata</privilege>
- <privilege>http://tizen.org/privilege/network.get</privilege>
- <privilege>http://tizen.org/privilege/internet</privilege>
- <privilege>http://tizen.org/privilege/peripheralio</privilege>
- </privileges>
-</manifest>
diff --git a/tizen-manifest.xml.in b/tizen-manifest.xml.in
deleted file mode 100644
index e014ce2..0000000
--- a/tizen-manifest.xml.in
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="4.0" package="@ORG_PREFIX@.@PROJECT_NAME@" version="1.0.0">
- <profile name="mobile"/>
- <author email="jinny.yoon@samsung.com" href="www.samsung.com">Jin Yoon</author>
- <author email="gs86.lee@samsung.com" href="www.samsung.com">Geunsun Lee</author>
- <author email="ey928.lee@samsung.com" href="www.samsung.com">Eunyoung Lee</author>
- <author email="junkyu.han@samsung.com" href="www.samsung.com">Junkyu Han</author>
- <service-application appid="@ORG_PREFIX@.@PROJECT_NAME@" auto-restart="false" exec="@PROJECT_NAME@" multiple="false" nodisplay="true" on-boot="false" taskmanage="false" type="capp">
- <label>@APP_LABEL@</label>
- <icon>@PROJECT_NAME@.png</icon>
- </service-application>
- <privileges>
- <privilege>http://tizen.org/privilege/network.get</privilege>
- <privilege>http://tizen.org/privilege/internet</privilege>
- <privilege>http://tizen.org/privilege/peripheralio</privilege>
- <privilege>http://tizen.org/privilege/camera</privilege>
- </privileges>
-</manifest>