From: Eunyoung Lee Date: Fri, 3 Nov 2017 05:34:39 +0000 (+0900) Subject: Fixed the code for compatibility with Tizen Studio 2.0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F158792%2F3;p=apps%2Fnative%2Fposition-finder-server.git Fixed the code for compatibility with Tizen Studio 2.0 Change-Id: I75b11f1b09ecf82fc9124467332770a457a7c5dc --- diff --git a/.cproject b/.cproject index 125fc5e..3b6306a 100644 --- a/.cproject +++ b/.cproject @@ -1,8 +1,8 @@ - - + + @@ -16,74 +16,34 @@ - - - - - - - - - - + + @@ -305,71 +195,34 @@ - - - - - - - - - + - + - + - diff --git a/.gitignore b/.gitignore index d8802b2..02065b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vsproject ./Debug/ ./SA_Report/ +/Debug/ +/SA_Report/ diff --git a/.project b/.project index 45527b0..47ede70 100644 --- a/.project +++ b/.project @@ -5,11 +5,6 @@ - - org.tizen.nativecore.apichecker.apicheckerbuilder - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder @@ -27,11 +22,10 @@ org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecore.apichecker.apicheckernature - 1503023742063 + 1509686595052 26 @@ -40,7 +34,7 @@ - 1503023742075 + 1509686595057 6 diff --git a/.tproject b/.tproject index de5a150..f857534 100644 --- a/.tproject +++ b/.tproject @@ -2,7 +2,7 @@ - wearable-3.0 + iot-headless-4.0 diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index bd6c79c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,73 +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 -) - -ADD_DEFINITIONS(-DCBOR_FILE_IN_RES="${INSTALL_RESDIR}/${CBOR_FILE}") -ADD_DEFINITIONS(-DCBOR_FILE_IN_DATA="${INSTALL_OWNER_DATADIR}/${CBOR_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/connectivity.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 ${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}) - -# End of a file diff --git a/LICENSE.Flora b/LICENSE.Flora deleted file mode 100644 index 4a0af40..0000000 --- a/LICENSE.Flora +++ /dev/null @@ -1,206 +0,0 @@ -Flora License - -Version 1.1, April, 2013 - -http://floralicense.org/license/ - -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. - -"Tizen Certified Platform" shall mean a software platform that complies -with the standards set forth in the Tizen Compliance Specification -and passes the Tizen Compliance Tests as defined from time to time -by the Tizen Technical Steering Group and certified by the Tizen -Association or its designated agent. - -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 -solely as incorporated into a Tizen Certified Platform, 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 solely -as incorporated into a Tizen Certified Platform 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 pursuant to the copyright license -above, in any medium, with or without modifications, and in Source or -Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works - a copy of this License; and - 2. You must cause any modified files to carry prominent notices stating - that You changed the files; and - 3. 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 - 4. 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 - and your own copyright statement or terms and conditions do not conflict - the conditions stated in the License including section 3. - -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 Flora License to your work - -To apply the Flora 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 Flora License, Version 1.1 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://floralicense.org/license/ - - 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/peripheral_io.h b/inc/peripheral_io.h deleted file mode 100644 index 7ff48d4..0000000 --- a/inc/peripheral_io.h +++ /dev/null @@ -1,1200 +0,0 @@ -/* - * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd. - * - * 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 __TIZEN_SYSTEM_PERIPHERAL_IO_H__ -#define __TIZEN_SYSTEM_PERIPHERAL_IO_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_MODULE - * @{ - */ - -/** - * @file peripheral_io.h - * @brief This file contains the peripheral-io API. - */ - -/** - * @brief Enumeration for peripheral-io error. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - PERIPHERAL_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */ - PERIPHERAL_ERROR_NO_DEVICE = TIZEN_ERROR_NO_SUCH_DEVICE, /**< No such device */ - PERIPHERAL_ERROR_TRY_AGAIN = TIZEN_ERROR_TRY_AGAIN, /**< Try again */ - PERIPHERAL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - PERIPHERAL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - PERIPHERAL_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */ - PERIPHERAL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - PERIPHERAL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ - PERIPHERAL_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */ -} peripheral_error_e; - -/** -* @} -*/ - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_GPIO_MODULE - * @{ - */ - -/** - * @brief Enumeration of GPIO direction options. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_GPIO_DIRECTION_IN = 0, /**< Input Mode */ - PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH, /**< Output mode with high value */ - PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW, /**< Output mode with low value */ -} peripheral_gpio_direction_e; - -/** - * @brief Enumeration of edge types for the GPIO interrupt. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_GPIO_EDGE_NONE = 0, /**< No interrupt on GPIO */ - PERIPHERAL_GPIO_EDGE_RISING, /**< Interrupt on rising only */ - PERIPHERAL_GPIO_EDGE_FALLING, /**< Interrupt on falling only */ - PERIPHERAL_GPIO_EDGE_BOTH, /**< Interrupt on rising & falling */ -} peripheral_gpio_edge_e; - -/** - * @brief The handle of a GPIO pin. - * @since_tizen 4.0 - */ -typedef struct _peripheral_gpio_s *peripheral_gpio_h; - -/** - * @platform - * @brief Opens a GPIO pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks @a gpio should be released with peripheral_gpio_close() - * - * @param[in] gpio_pin The GPIO pin number - * @param[out] gpio The GPIO handle is created on success - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @post peripheral_gpio_close() - */ -int peripheral_gpio_open(int gpio_pin, peripheral_gpio_h *gpio); - -/** - * @platform - * @brief Closes a GPIO pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @pre peripheral_gpio_open() - */ -int peripheral_gpio_close(peripheral_gpio_h gpio); - -/** - * @platform - * @brief Sets the GPIO direction. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * @param[in] direction The direction of the GPIO pin - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_gpio_direction_e - */ -int peripheral_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction); - -/** - * @platform - * @brief Sets the GPIO edge mode. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * @param[in] edge The edge mode of the GPIO pin - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_gpio_edge_e - */ -int peripheral_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge); - -/** - * @platform - * @brief The GPIO interrupted callback called when the GPIO interrupt is triggered. - * @since_tizen 4.0 - * - * @param[in] gpio The GPIO handle - * @param[in] error The GPIO error - * @param[in] user_data The user data passed from the callback registration function - * - * @see peripheral_gpio_set_interrupted_cb() - */ -typedef void(*peripheral_gpio_interrupted_cb)(peripheral_gpio_h gpio, peripheral_error_e error, void *user_data); - -/** - * @platform - * @brief Sets the GPIO interrupted callback to be invoked when the GPIO interrupt is triggered. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * @param[in] callback The GPIO interrupted callback function to set - * @param[in] user_data The user data to be passed to the callback function - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * - * @post peripheral_gpio_unset_interrupted_cb() - * @see peripheral_gpio_set_edge_mode() - */ -int peripheral_gpio_set_interrupted_cb(peripheral_gpio_h gpio, peripheral_gpio_interrupted_cb callback, void *user_data); - -/** - * @platform - * @brief Unsets the GPIO interrupted callback. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * - * @pre peripheral_gpio_set_interrupted_cb() - */ -int peripheral_gpio_unset_interrupted_cb(peripheral_gpio_h gpio); - -/** - * @platform - * @brief Gets the current value of the GPIO pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * @param[out] value The value to get - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_gpio_write() - */ -int peripheral_gpio_read(peripheral_gpio_h gpio, uint32_t *value); - -/** - * @platform - * @brief Sets the value of the GPIO pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] gpio The GPIO handle - * @param[in] value The value to set (must be 0 or 1) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_gpio_read() - */ -int peripheral_gpio_write(peripheral_gpio_h gpio, uint32_t value); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_I2C_MODULE - * @{ - */ - -/** - * @brief The handle of the I2C slave device. - * @since_tizen 4.0 - */ -typedef struct _peripheral_i2c_s *peripheral_i2c_h; - -/** - * @platform - * @brief Opens an I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks @a i2c should be released with peripheral_i2c_close() - * - * @param[in] bus The I2C bus number that the slave device is connected - * @param[in] address The address of the slave device - * @param[out] i2c The I2C handle is created on success - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @post peripheral_i2c_close() - */ -int peripheral_i2c_open(int bus, int address, peripheral_i2c_h *i2c); - -/** - * @platform - * @brief Closes an I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @pre peripheral_i2c_open() - */ -int peripheral_i2c_close(peripheral_i2c_h i2c); - -/** - * @platform - * @brief Reads the bytes data from the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[out] data The data buffer to read - * @param[in] length The size of data buffer (in bytes) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_write() - */ -int peripheral_i2c_read(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); - -/** - * @platform - * @brief Writes the bytes data to the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[in] data The data buffer to write - * @param[in] length The size of data buffer (in bytes) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_read() - */ -int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, uint32_t length); - -/** - * @platform - * @brief Reads single byte data from the register of the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[in] reg The register address of the I2C slave device to read - * @param[out] data The single byte data to read - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_write_register_byte() - */ -int peripheral_i2c_read_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t *data); - -/** - * @platform - * @brief Writes single byte data to the register of the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[in] reg The register address of the I2C slave device to write - * @param[in] data The single byte data to write - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_read_register_byte() - */ -int peripheral_i2c_write_register_byte(peripheral_i2c_h i2c, uint8_t reg, uint8_t data); - -/** - * @platform - * @brief Reads word data from the register of the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[in] reg The register address of the I2C slave device to read - * @param[out] data The word(2 bytes) data to read - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_write_register_word() - */ -int peripheral_i2c_read_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t *data); - -/** - * @platform - * @brief Writes word data to the register of the I2C slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] i2c The I2C handle - * @param[in] reg The register address of the I2C slave device to write - * @param[in] data The word(2 bytes) data to write - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_i2c_read_register_word() - */ -int peripheral_i2c_write_register_word(peripheral_i2c_h i2c, uint8_t reg, uint16_t data); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_PWM_MODULE - * @{ - */ - -/** - * @brief The handle of the PWM device. - * @since_tizen 4.0 - */ -typedef struct _peripheral_pwm_s *peripheral_pwm_h; - -/** - * @brief Enumeration for Polarity. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_PWM_POLARITY_ACTIVE_HIGH = 0, /**< PWM signal start in the active high state (Normal) */ - PERIPHERAL_PWM_POLARITY_ACTIVE_LOW, /**< PWM signal start in the active low state (Inversed) */ -} peripheral_pwm_polarity_e; - -/** - * @platform - * @brief Opens the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks @a pwm should be released with peripheral_pwm_close() - * - * @param[in] chip The PWM chip number - * @param[in] pin The PWM pin(channel) number to control - * @param[out] pwm The PWM handle is created on success - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @post peripheral_pwm_close() - */ -int peripheral_pwm_open(int chip, int pin, peripheral_pwm_h *pwm); - -/** - * @platform - * @brief Closes the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] pwm The PWM handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @pre peripheral_pwm_open() - */ -int peripheral_pwm_close(peripheral_pwm_h pwm); - -/** - * @platform - * @brief Sets period of the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] pwm The PWM handle - * @param[in] period_ns The total period of the PWM pin (in nanoseconds) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - */ -int peripheral_pwm_set_period(peripheral_pwm_h pwm, uint32_t period_ns); - -/** - * @platform - * @brief Sets duty cycle of the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] pwm The PWM handle - * @param[in] duty_cycle_ns The duty cycle of the PWM pin (in nanoseconds) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - */ -int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle_ns); - -/** - * @platform - * @brief Sets polarity of the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] pwm The PWM handle - * @param[in] polarity The polarity of the PWM pin - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_pwm_polarity_e - */ -int peripheral_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity); - -/** - * @platform - * @brief Enables the PWM pin. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] pwm The PWM handle - * @param[in] enabled Enable/disable the PWM pin - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - */ -int peripheral_pwm_set_enabled(peripheral_pwm_h pwm, bool enabled); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_UART_MODULE - * @{ - */ - -/** - * @brief The handle to the UART device. - * @since_tizen 4.0 - */ -typedef struct _peripheral_uart_s *peripheral_uart_h; - -/** - * @brief Enumeration for baud rate. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_BAUD_RATE_0 = 0, /**< The number of signal in one second is 0 */ - PERIPHERAL_UART_BAUD_RATE_50, /**< The number of signal in one second is 50 */ - PERIPHERAL_UART_BAUD_RATE_75, /**< The number of signal in one second is 75 */ - PERIPHERAL_UART_BAUD_RATE_110, /**< The number of signal in one second is 110 */ - PERIPHERAL_UART_BAUD_RATE_134, /**< The number of signal in one second is 134 */ - PERIPHERAL_UART_BAUD_RATE_150, /**< The number of signal in one second is 150 */ - PERIPHERAL_UART_BAUD_RATE_200, /**< The number of signal in one second is 200 */ - PERIPHERAL_UART_BAUD_RATE_300, /**< The number of signal in one second is 300 */ - PERIPHERAL_UART_BAUD_RATE_600, /**< The number of signal in one second is 600 */ - PERIPHERAL_UART_BAUD_RATE_1200, /**< The number of signal in one second is 1200 */ - PERIPHERAL_UART_BAUD_RATE_1800, /**< The number of signal in one second is 1800 */ - PERIPHERAL_UART_BAUD_RATE_2400, /**< The number of signal in one second is 2400 */ - PERIPHERAL_UART_BAUD_RATE_4800, /**< The number of signal in one second is 4800 */ - PERIPHERAL_UART_BAUD_RATE_9600, /**< The number of signal in one second is 9600 */ - PERIPHERAL_UART_BAUD_RATE_19200, /**< The number of signal in one second is 19200 */ - PERIPHERAL_UART_BAUD_RATE_38400, /**< The number of signal in one second is 38400 */ - PERIPHERAL_UART_BAUD_RATE_57600, /**< The number of signal in one second is 57600 */ - PERIPHERAL_UART_BAUD_RATE_115200, /**< The number of signal in one second is 115200 */ - PERIPHERAL_UART_BAUD_RATE_230400, /**< The number of signal in one second is 230400 */ -} peripheral_uart_baud_rate_e; - -/** - * @brief Enumeration for byte size. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_BYTE_SIZE_5BIT = 0, /**< 5 data bits */ - PERIPHERAL_UART_BYTE_SIZE_6BIT, /**< 6 data bits */ - PERIPHERAL_UART_BYTE_SIZE_7BIT, /**< 7 data bits */ - PERIPHERAL_UART_BYTE_SIZE_8BIT, /**< 8 data bits */ -} peripheral_uart_byte_size_e; - -/** - * @brief Enumeration for parity bit. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_PARITY_NONE = 0, /**< No parity is used */ - PERIPHERAL_UART_PARITY_EVEN, /**< Even parity is used */ - PERIPHERAL_UART_PARITY_ODD, /**< ODD parity is used */ -} peripheral_uart_parity_e; - -/** - * @brief Enumeration for stop bits. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_STOP_BITS_1BIT = 0, /**< One stop bit */ - PERIPHERAL_UART_STOP_BITS_2BIT, /**< Two stop bits */ -} peripheral_uart_stop_bits_e; - -/** - * @brief Enumeration for hardware flow control. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_NONE = 0, /**< No hardware flow control */ - PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS, /**< Automatic RTS/CTS hardware flow control*/ -} peripheral_uart_hardware_flow_control_e; - -/** - * @brief Enumeration for software flow control. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE = 0, /**< No software flow control */ - PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_XONXOFF, /**< XON/XOFF software flow control */ -} peripheral_uart_software_flow_control_e; - -/** - * @platform - * @brief Opens the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks @a uart should be released with peripheral_uart_close() - * - * @param[in] port The UART port number that the slave device is connected - * @param[out] uart The UART handle is created on success - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @post peripheral_uart_close() - */ -int peripheral_uart_open(int port, peripheral_uart_h *uart); - -/** - * @platform - * @brief Closes the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @pre peripheral_uart_open() - */ -int peripheral_uart_close(peripheral_uart_h uart); - -/** - * @platform - * @brief Sets baud rate of the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] baud Baud rate of the UART device - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_baud_rate_e - */ -int peripheral_uart_set_baud_rate(peripheral_uart_h uart, peripheral_uart_baud_rate_e baud); - -/** - * @platform - * @brief Sets byte size of the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] byte_size Byte size of the UART device - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_byte_size_e - */ -int peripheral_uart_set_byte_size(peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size); - -/** - * @platform - * @brief Sets parity bit of the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] parity Parity bit of the UART device - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_parity_e - */ -int peripheral_uart_set_parity(peripheral_uart_h uart, peripheral_uart_parity_e parity); - -/** - * @platform - * @brief Sets stop bits of the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] stop_bits Stop bits of the UART device - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_stop_bits_e - */ -int peripheral_uart_set_stop_bits(peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits); - -/** - * @platform - * @brief Sets flow control of the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] sw_flow_control Software flow control (Turns a transmitter on or off) - * @param[in] hw_flow_control Hardware flow control (Turns "Request to Send/Clear to Send" on or off) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_software_flow_control_e - * @see peripheral_uart_hardware_flow_control_e - */ -int peripheral_uart_set_flow_control(peripheral_uart_h uart, - peripheral_uart_software_flow_control_e sw_flow_control, - peripheral_uart_hardware_flow_control_e hw_flow_control); - -/** - * @platform - * @brief Reads data from the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[out] data The buffer to read - * @param[out] length The size of buffer (in bytes) - * - * @return the number of bytes read on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_write() - */ -int peripheral_uart_read(peripheral_uart_h uart, uint8_t *data, uint32_t length); - -/** - * @platform - * @brief Writes data to the UART slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] uart The UART handle - * @param[in] data The buffer to write - * @param[in] length The size of buffer (in bytes) - * - * @return the number of bytes write on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_TRY_AGAIN Try again - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_uart_read() - */ -int peripheral_uart_write(peripheral_uart_h uart, uint8_t *data, uint32_t length); - -/** -* @} -*/ - -/** - * @addtogroup CAPI_SYSTEM_PERIPHERAL_IO_SPI_MODULE - * @{ - */ - -/** - * @brief The handle of a SPI device. - * @since_tizen 4.0 - */ -typedef struct _peripheral_spi_s *peripheral_spi_h; - -/** - * @brief Enumeration of SPI transfer modes. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_SPI_MODE_0 = 0, /**< CPOL = 0, CPHa = 0 Mode */ - PERIPHERAL_SPI_MODE_1, /**< CPOL = 0, CPHa = 1 Mode */ - PERIPHERAL_SPI_MODE_2, /**< CPOL = 1, CPHa = 0 Mode */ - PERIPHERAL_SPI_MODE_3, /**< CPOL = 1, CPHa = 1 Mode */ -} peripheral_spi_mode_e; - -/** - * @brief Enumeration of bit orders. - * @since_tizen 4.0 - */ -typedef enum { - PERIPHERAL_SPI_BIT_ORDER_MSB = 0, /**< Use most siginificant bit first */ - PERIPHERAL_SPI_BIT_ORDER_LSB, /**< Use least significant bit first */ -} peripheral_spi_bit_order_e; - -/** - * @platform - * @brief Opens a SPI slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks @a spi should be released with peripheral_spi_close() - * - * @param[in] bus The SPI bus number - * @param[in] cs The SPI chip select number - * @param[out] spi The SPI device handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_OUT_OF_MEMORY Memory allocation failed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_RESOURCE_BUSY Device is in use - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @post peripheral_spi_close() - */ -int peripheral_spi_open(int bus, int cs, peripheral_spi_h *spi); - -/** - * @platform - * @brief Closes the SPI slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_open() - */ -int peripheral_spi_close(peripheral_spi_h spi); - -/** - * @platform - * @brief Sets the SPI transfer mode. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[in] mode The SPI transfer mode - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_mode_e - */ -int peripheral_spi_set_mode(peripheral_spi_h spi, peripheral_spi_mode_e mode); - -/** - * @platform - * @brief Sets the SPI bit order. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[in] bit_order The transfer bit order - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_bit_order_e - */ -int peripheral_spi_set_bit_order(peripheral_spi_h spi, peripheral_spi_bit_order_e bit_order); - -/** - * @platform - * @brief Sets the number of bits per word. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[in] bits The number of bits per word (in bits) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - */ -int peripheral_spi_set_bits_per_word(peripheral_spi_h spi, uint8_t bits); - -/** - * @platform - * @brief Sets the frequency of the SPI bus. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * @remarks The frequencies supported are board dependent. - * - * @param[in] spi The SPI device handle - * @param[in] freq_hz Frequency to set (in Hz) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - */ -int peripheral_spi_set_frequency(peripheral_spi_h spi, uint32_t freq_hz); - -/** - * @platform - * @brief Reads the bytes data from the SPI slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[out] data The data buffer to read - * @param[in] length The size of data buffer (in bytes) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_write() - */ -int peripheral_spi_read(peripheral_spi_h spi, uint8_t *data, uint32_t length); - -/** - * @platform - * @brief Writes the bytes data to the SPI slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[in] data The data buffer to write - * @param[in] length The size of data buffer (in bytes) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_read() - */ -int peripheral_spi_write(peripheral_spi_h spi, uint8_t *data, uint32_t length); - -/** - * @platform - * @brief Exchanges the bytes data to the SPI slave device. - * @since_tizen 4.0 - * @privlevel platform - * @privilege http://tizen.org/privilege/peripheralio - * - * @param[in] spi The SPI device handle - * @param[in] txdata The data buffer to write - * @param[out] rxdata The data buffer to read - * @param[in] length The size of txdata and rxdata buffer (in bytes) - * - * @return 0 on success, otherwise a negative error value - * @retval #PERIPHERAL_ERROR_NONE Successful - * @retval #PERIPHERAL_ERROR_IO_ERROR I/O operation failed - * @retval #PERIPHERAL_ERROR_NO_DEVICE Device does not exist or is removed - * @retval #PERIPHERAL_ERROR_PERMISSION_DENIED Permission denied - * @retval #PERIPHERAL_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #PERIPHERAL_ERROR_NOT_SUPPORTED Not supported - * @retval #PERIPHERAL_ERROR_UNKNOWN Unknown internal error - * - * @see peripheral_spi_read() - * @see peripheral_spi_write() - */ -int peripheral_spi_transfer(peripheral_spi_h spi, uint8_t *txdata, uint8_t *rxdata, uint32_t length); - -/** -* @} -*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __TIZEN_SYSTEM_PERIPHERAL_IO_H__ */ diff --git a/inc/resource/resource_rain_sensor.h b/inc/resource/resource_rain_sensor.h old mode 100755 new mode 100644 diff --git a/inc/resource/resource_rain_sensor_internal.h b/inc/resource/resource_rain_sensor_internal.h old mode 100755 new mode 100644 diff --git a/lib/libperipheralio.so b/lib/libperipheralio.so deleted file mode 100755 index 618c38b..0000000 Binary files a/lib/libperipheralio.so and /dev/null differ diff --git a/org.tizen.position-finder-server.manifest b/org.tizen.position-finder-server.manifest deleted file mode 100644 index af9b883..0000000 --- a/org.tizen.position-finder-server.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packaging/org.tizen.position-finder-server.spec b/packaging/org.tizen.position-finder-server.spec deleted file mode 100644 index dbb783b..0000000 --- a/packaging/org.tizen.position-finder-server.spec +++ /dev/null @@ -1,93 +0,0 @@ -%define P_NAME position-finder-server -%define APP_LABEL "Position Finder Server" -%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: Flora-1.1 -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) - -%description -Server for Position Finder - -%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_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 - -%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_RESDIR=%{_pkg_res_dir} \ - -DSYS_ICONS_DIR=%{_sys_icons_dir} \ - -DSYS_PACKAGES_DIR=%{_sys_packages_dir} \ - -DCBOR_FILE=%{_cbor_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 -#%find_lang position-finder-server - -%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 -%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 index 569599d..9826857 100644 --- a/project_def.prop +++ b/project_def.prop @@ -1,7 +1,7 @@ APPNAME = position-finder-server type = app -profile = wearable-3.0 +profile = iot-headless-4.0 USER_SRCS = src/position-finder-server.c USER_DEFS = diff --git a/script/sd_fusing_rpi3.sh b/script/sd_fusing_rpi3.sh deleted file mode 100755 index f322e3c..0000000 --- a/script/sd_fusing_rpi3.sh +++ /dev/null @@ -1,328 +0,0 @@ -#!/bin/bash - -declare FORMAT="" -declare DEVICE="" - -# Binaires array for fusing -declare -a FUSING_BINARY_ARRAY -declare -i FUSING_BINARY_NUM=0 - -declare CONV_ASCII="" -declare -i FUS_ENTRY_NUM=0 - -# binary name | part number | bs -declare -a PART_TABLE=( - "boot.img" 1 512 - "rootfs.img" 2 4M - "system-data.img" 3 4M - "user.img" 5 4M - "modules.img" 6 512 - "ramdisk.img" 7 512 - "ramdisk-recovery.img" 8 512 - ) - -declare -r -i PART_TABLE_ROW=3 -declare -r -i PART_TABLE_COL=${#PART_TABLE[*]}/${PART_TABLE_ROW} - -# partition table support -function get_index_use_name () { - local -r binary_name=$1 - - for ((idx=0;idx<$PART_TABLE_COL;idx++)); do - if [ ${PART_TABLE[idx * ${PART_TABLE_ROW} + 0]} == $binary_name ]; then - return $idx - fi - done - - # return out of bound index - return $idx -} - -function print_message () { - local color=$1 - local message=$2 - - tput setaf $color - tput bold - echo "" - echo $message - tput sgr 0 -} - -function fusing_image () { - local -r fusing_img=$1 - - # get binary info using basename - get_index_use_name $(basename $fusing_img) - local -r -i part_idx=$? - - if [ $part_idx -ne $PART_TABLE_COL ];then - local -r device=$DEVICE${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 1]} - local -r bs=${PART_TABLE[${part_idx} * ${PART_TABLE_ROW} + 2]} - else - echo "Not supported binary: $fusing_img" - return - fi - - local -r input_size=`du -b $fusing_img | awk '{print $1}'` - - print_message 2 "[Fusing $1]" - umount $device - dd if=$fusing_img | pv -s $input_size | dd of=$device bs=$bs - resize2fs -f $device -} - -function fuse_image_tarball () { - local -r filepath=$1 - local -r temp_dir="tar_tmp" - - mkdir -p $temp_dir - tar xvf $filepath -C $temp_dir - cd $temp_dir - - for file in * - do - fusing_image $file - done - - cd .. - rm -rf $temp_dir - eval sync -} - -function fuse_image () { - - if [ "$FUSING_BINARY_NUM" == 0 ]; then - return - fi - - for ((fuse_idx = 0 ; fuse_idx < $FUSING_BINARY_NUM ; fuse_idx++)) - do - local filename=${FUSING_BINARY_ARRAY[fuse_idx]} - - case "$filename" in - *.tar | *.tar.gz) - fuse_image_tarball $filename - ;; - *) - fusing_image $filename - ;; - esac - done - echo "" -} - -# partition format -function mkpart_3 () { - # NOTE: if your sfdisk version is less than 2.26.0, then you should use following sfdisk command: - # sfdisk --in-order --Linux --unit M $DISK <<-__EOF__ - - # NOTE: sfdisk 2.26 doesn't support units other than sectors and marks --unit option as deprecated. - # The input data needs to contain multipliers (MiB) instead. - local version=`sfdisk -v | awk '{print $4}'` - local major=${version%%.*} - local version=${version:`expr index $version .`} - local minor=${version%%.*} - local sfdisk_new=0 - - if [ $major -gt 2 ]; then - sfdisk_new=1 - else - if [ $major -eq 2 -a $minor -ge 26 ]; then - sfdisk_new=1 - fi - fi - - local -r DISK=$DEVICE - local -r SIZE=`sfdisk -s $DISK` - local -r SIZE_MB=$((SIZE >> 10)) - - local -r BOOT_SZ=64 - local -r ROOTFS_SZ=3072 - local -r DATA_SZ=512 - local -r MODULE_SZ=20 - local -r RAMDISK_SZ=8 - local -r RAMDISK_RECOVERY_SZ=12 - if [ $sfdisk_new == 1 ]; then - local -r EXTEND_SZ=8 - else - local -r EXTEND_SZ=4 - fi - - let "USER_SZ = $SIZE_MB - $BOOT_SZ - $ROOTFS_SZ - $DATA_SZ - $MODULE_SZ - $RAMDISK_SZ - $RAMDISK_RECOVERY_SZ - $EXTEND_SZ" - - local -r BOOT=boot - local -r ROOTFS=rootfs - local -r SYSTEMDATA=system-data - local -r USER=user - local -r MODULE=modules - local -r RAMDISK=ramdisk - local -r RAMDISK_RECOVERY=ramdisk-recovery - - if [[ $USER_SZ -le 100 ]] - then - echo "We recommend to use more than 4GB disk" - exit 0 - fi - - echo "========================================" - echo "Label dev size" - echo "========================================" - echo $BOOT" " $DISK"1 " $BOOT_SZ "MB" - echo $ROOTFS" " $DISK"2 " $ROOTFS_SZ "MB" - echo $SYSTEMDATA" " $DISK"3 " $DATA_SZ "MB" - echo "[Extend]"" " $DISK"4" - echo " "$USER" " $DISK"5 " $USER_SZ "MB" - echo " "$MODULE" " $DISK"6 " $MODULE_SZ "MB" - echo " "$RAMDISK" " $DISK"7 " $RAMDISK_SZ "MB" - echo " "$RAMDISK_RECOVERY" " $DISK"7 " $RAMDISK_RECOVERY_SZ "MB" - - local MOUNT_LIST=`mount | grep $DISK | awk '{print $1}'` - for mnt in $MOUNT_LIST - do - umount $mnt - done - - echo "Remove partition table..." - dd if=/dev/zero of=$DISK bs=512 count=16 conv=notrunc - - if [ $sfdisk_new == 1 ]; then - sfdisk $DISK <<-__EOF__ - 4MiB,${BOOT_SZ}MiB,0xE,* - 8MiB,${ROOTFS_SZ}MiB,,- - 8MiB,${DATA_SZ}MiB,,- - 8MiB,,E,- - ,${USER_SZ}MiB,,- - ,${MODULE_SZ}MiB,,- - ,${RAMDISK_SZ}MiB,,- - ,${RAMDISK_RECOVERY_SZ}MiB,,- - __EOF__ - else - sfdisk --in-order --Linux --unit M $DISK <<-__EOF__ - 4,$BOOT_SZ,0xE,* - ,$ROOTFS_SZ,,- - ,$DATA_SZ,,- - ,,E,- - ,$USER_SZ,,- - ,$MODULE_SZ,,- - ,$RAMDISK_SZ,,- - ,$RAMDISK_RECOVERY_SZ,,- - __EOF__ - fi - - mkfs.vfat -F 16 ${DISK}1 -n $BOOT - mkfs.ext4 -q ${DISK}2 -L $ROOTFS -F - mkfs.ext4 -q ${DISK}3 -L $SYSTEMDATA -F - mkfs.ext4 -q ${DISK}5 -L $USER -F - mkfs.ext4 -q ${DISK}6 -L $MODULE -F - mkfs.ext4 -q ${DISK}7 -L $RAMDISK -F - mkfs.ext4 -q ${DISK}8 -L $RAMDISK_RECOVERY -F -} - -function show_usage () { - echo "- Usage:" - echo " sudo ./sd_fusing*.sh -d [-b ..] [--format]" -} - -function check_partition_format () { - if [ "$FORMAT" != "2" ]; then - echo "-----------------------" - echo "Skip $DEVICE format" - echo "-----------------------" - return 0 - fi - - echo "-------------------------------" - echo "Start $DEVICE format" - echo "" - mkpart_3 - echo "End $DEVICE format" - echo "-------------------------------" - echo "" -} - -function check_args () { - if [ "$DEVICE" == "" ]; then - echo "$(tput setaf 1)$(tput bold)- Device node is empty!" - show_usage - tput sgr 0 - exit 0 - fi - - if [ "$DEVICE" != "" ]; then - echo "Device: $DEVICE" - fi - - if [ "$FUSING_BINARY_NUM" != 0 ]; then - echo "Fusing binary: " - for ((bid = 0 ; bid < $FUSING_BINARY_NUM ; bid++)) - do - echo " ${FUSING_BINARY_ARRAY[bid]}" - done - echo "" - fi - - if [ "$FORMAT" == "1" ]; then - echo "" - echo "$(tput setaf 3)$(tput bold)$DEVICE will be formatted, Is it OK? [y/n]" - tput sgr 0 - read input - if [ "$input" == "y" ] || [ "$input" == "Y" ]; then - FORMAT=2 - else - FORMAT=0 - fi - fi -} - -function print_logo () { - echo "" - echo "Raspberry Pi3 downloader, version 0.1" - echo "" -} - -print_logo - -function add_fusing_binary() { - local declare binary_name=$1 - FUSING_BINARY_ARRAY[$FUSING_BINARY_NUM]=$binary_name - - FUSING_BINARY_NUM=$((FUSING_BINARY_NUM + 1)) -} - - -declare -i binary_option=0 - -while test $# -ne 0; do - option=$1 - shift - - case $option in - --f | --format) - FORMAT="1" - binary_option=0 - ;; - -d) - DEVICE=$1 - binary_option=0 - shift - ;; - -b) - add_fusing_binary $1 - binary_option=1 - shift - ;; - *) - if [ $binary_option == 1 ];then - add_fusing_binary $option - else - echo "Unkown command: $option" - exit - fi - ;; - esac -done - -check_args -check_partition_format -fuse_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 Binary files a/shared/res/default_icon.png and /dev/null differ diff --git a/shared/res/position-finder-server.png b/shared/res/position-finder-server.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/shared/res/position-finder-server.png differ diff --git a/src/controller.c b/src/controller.c index 967dcc5..98679d1 100644 --- a/src/controller.c +++ b/src/controller.c @@ -35,36 +35,26 @@ typedef struct app_data_s { connectivity_resource_s *resource_info; } app_data; -static void _ultrasonic_sensor_read_cb(double value, void *data) + +static Eina_Bool _control_sensors_cb(void *data) { app_data *ad = data; + int value = -1; + int ret = -1; #if 0 - if (value < 0) { - _E("OUT OF RANGE"); - } else { - _D("Measured Distance : %0.2fcm", value); - - if (connectivity_notify_double(ad->resource_info, "distance", value) == -1) - _E("Cannot notify message"); + ret = resource_read_infrared_motion_sensor(PIN_NUMBER, &value); + if (ret != 0) { + _E("Cannot read sensor value"); } #endif - return; -} - -static Eina_Bool _control_sensors_cb(void *data) -{ - app_data *ad = data; - int ret = 0; - #if 0 - ret = resource_read_ultrasonic_sensor(TRIG_PIN_NUMBER, ECHO_PIN_NUMBER, _ultrasonic_sensor_read_cb, ad); - if (ret < 0) { - _E("Failed to read from ultrasonic sensor"); + ret = connectivity_notify_int(ad->resource_info, KEY, value); + if (ret != 0) { + _E("Cannot notify value"); } #endif - return ECORE_CALLBACK_RENEW; } @@ -74,17 +64,19 @@ static bool service_app_create(void *data) int ret = -1; /** - * No modification required!!! + * DO NOT EDIT: please don't edit the function below. * Access only when modifying internal functions. */ controller_init_internal_functions(); - /** - * Create a connectivity resource and registers the resource in server. - */ +#if 0 + ret = connectivity_set_connectivity_type(CONNECTIVITY_TYPE); + if (ret == -1) _E("Cannot set connectivity type"); +#endif + #if 0 ret = connectivity_set_resource("/door/0", "org.tizen.door", &ad->resource_info); - if (ret == -1) _E("Cannot broadcast resource"); + if (ret == -1) _E("Cannot set connectivity resource"); #endif /** @@ -94,7 +86,7 @@ static bool service_app_create(void *data) #if 0 ad->getter_timer = ecore_timer_add( Duration , _control_sensors_cb, ad); if (!ad->getter_timer) { - _E("Failed to add infrared motion getter timer"); + _E("Failed to add getter timer"); return false; } #endif @@ -110,13 +102,10 @@ static void service_app_terminate(void *data) ecore_timer_del(ad->getter_timer); } - /** - * Releases the resource about connectivity. - */ connectivity_unset_resource(ad->resource_info); /** - * No modification required!!! + * DO NOT EDIT: please don't edit the function below. * Access only when modifying internal functions. */ controller_fini_internal_functions(); @@ -126,7 +115,7 @@ static void service_app_terminate(void *data) static void service_app_control(app_control_h app_control, void *data) { - // Todo: add your code here. + /* APP_CONTROL */ } static void service_app_lang_changed(app_event_info_h event_info, void *user_data) diff --git a/src/resource/resource_rain_sensor.c b/src/resource/resource_rain_sensor.c old mode 100755 new mode 100644 diff --git a/tizen-manifest.xml b/tizen-manifest.xml index 83a5923..a81cfe3 100644 --- a/tizen-manifest.xml +++ b/tizen-manifest.xml @@ -1,9 +1,9 @@ - - + + - default_icon.png + position-finder-server.png http://tizen.org/privilege/appdir.shareddata