* limitations under the License.
*/
-#ifndef CION_API_CION_H_
-#define CION_API_CION_H_
+#ifndef CION_TIZEN_API_CION_H_
+#define CION_TIZEN_API_CION_H_
-#include <cion_channel.h>
#include <cion_error.h>
+#include <cion_peer_info.h>
-#endif // CION_API_CION_H_
+#endif // CION_TIZEN_API_CION_H_
+++ /dev/null
-/*
- * Copyright (c) 2020 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.
- */
-
-#include "cion/tizen-api/cion.h"
-
-#ifndef C_EXPORT
-#define C_EXPORT extern "C" __attribute__((visibility("default")))
-#endif
-
-C_EXPORT int cion_capability_create(cion_capability_h *handle) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_destroy(cion_capability_h handle) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_id(cion_capability_h handle,
- char **device_id) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_name(cion_capability_h handle,
- char **device_name) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_platform(
- cion_capability_h handle, char **device_platform) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_platform_version(
- cion_capability_h handle, char **device_platform_version) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_type(cion_capability_h handle,
- char **device_type) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_model_number(
- cion_capability_h handle, char **device_model_number) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_device_sw_version(
- cion_capability_h handle, char **device_sw_version) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_host_package_name(
- cion_capability_h handle, const char *pkg_id,
- char **host_package_name) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_get_value(cion_capability_h handle,
- const char *key, char **value) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_add_version_control_handler(
- cion_capability_h handle, const char *id,
- cion_capability_invalid_version_cb callback, void *data) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_capability_remove_version_control_handler(
- cion_capability_h handle, const char *id) {
- return CION_ERROR_NONE;
-}
+++ /dev/null
-/*
- * Copyright (c) 2020 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 CION_API_CION_CAPABILITY_H_
-#define CION_API_CION_CAPABILITY_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief The handle for device info.
- */
-typedef struct _cion_capability_st* cion_capability_h;
-
-/**
- * @brief Called when the cion package version is invaild.
- * @param[in] handle The handle for device info
- * @param[in] gear_app_id The app id
- * @param[in] data The user data passed from the foreach function
- */
-typedef void (*cion_capability_invalid_version_cb)(
- cion_capability_h handle, const char *gear_app_id, void *data);
-
-/**
- * @brief Creates the device info handle.
- * @remarks handle is set to NULL if an error occurs
- * @param[out] handle The device info handle
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_create(cion_capability_h *handle);
-
-/**
- * @brief Destroys the device info handle and releases all its resources.
- * @param[in] handle The handle for device info
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_destroy(cion_capability_h handle);
-
-/**
- * @brief Gets the device ID.
- * @param[in] handle The handle for device info
- * @param[out] device_id Device ID
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_id(cion_capability_h handle,
- char **device_id);
-
-/**
- * @brief Gets the device name.
- * @param[in] handle The handle for device info
- * @param[out] device_name Device name
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_name(cion_capability_h handle,
- char **device_name);
-
-/**
- * @brief Gets the device's platform.
- * @param[in] handle The handle for device info
- * @param[out] device_platform Platform name
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_platform(cion_capability_h handle,
- char **device_platform);
-
-/**
- * @brief Gets the device's platform version.
- * @param[in] handle The handle for device info
- * @param[out] device_platform_version Platform version
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_platform_version(
- cion_capability_h handle, char **device_platform_version);
-
-/**
- * @brief Gets the device's type.
- * @param[in] handle The handle for device info
- * @param[out] device_type Device type
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_type(cion_capability_h handle,
- char **device_type);
-
-/**
- * @brief Gets the device model number.
- * @param[in] handle The handle for device info
- * @param[out] device_model_number Device model number
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_model_number(cion_capability_h handle,
- char **device_model_number);
-
-/**
- * @brief Gets the device software version.
- * @param[in] handle The handle for device info
- * @param[out] device_sw_version Device S/W version
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_device_sw_version(cion_capability_h handle,
- char **device_sw_version);
-
-/**
- * @brief Gets cion package name.
- * @param[in] handle The handle for device info
- * @param[in] pkg_id Package ID
- * @param[out] host_package_name Host package name
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_get_host_package_name(cion_capability_h handle,
- const char *pkg_id, char **host_package_name);
-
-/**
- * @brief Gets the string value.
- * @param[in] handle The handle for device info
- * @param[in] key The key from which data should be read
- * @param[out] value The current value of the given key
- * @return @c 0 on success,
- * otherwise a negative error value
- */
-int cion_capability_get_value(cion_capability_h handle,
- const char *key, char **value);
-
-/**
- * @brief Registers a callback function to be invoked when the cion package version is invaild.
- * @param[in] handle The handle for device info
- * @param[in] id ID for this handler
- * @param[in] callback The callback function to register
- * @param[in] data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_add_version_control_handler(
- cion_capability_h handle, const char *id,
- cion_capability_invalid_version_cb callback, void *data);
-
-/**
- * @brief Unregisters a callback function for version control.
- * @param[in] handle The handle for device info
- * @param[in] id ID for this handler
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_capability_remove_version_control_handler(
- cion_capability_h handle, const char *id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CION_API_CION_CAPABILITY_H_
+++ /dev/null
-/*
- * Copyright (c) 2020 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.
- */
-
-#include "cion/tizen-api/cion.h"
-
-#ifndef C_EXPORT
-#define C_EXPORT extern "C" __attribute__((visibility("default")))
-#endif
-
-C_EXPORT int cion_channel_create(cion_channel_h* channel,
- cion_capability_h cap_handle, const char* remote_app_id,
- cion_channel_events_st events, void* user_data) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_destroy(cion_channel_h channel) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_send_async(cion_channel_h channel,
- const char *data, size_t size) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_send(cion_channel_h channel,
- const char *data, size_t size, char **out_data, size_t *out_size) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_send_file(cion_channel_h channel,
- const char *path) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_try_connect(cion_channel_h channel) {
- return CION_ERROR_NONE;
-}
-
-C_EXPORT int cion_channel_disconnect(cion_channel_h channel) {
- return CION_ERROR_NONE;
-}
+++ /dev/null
-/*
- * Copyright (c) 2020 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 CION_API_CION_CHANNEL_H_
-#define CION_API_CION_CHANNEL_H_
-
-#include <stdio.h>
-
-#include <cion_capability.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum _cion_connection_status_e {
- CION_CONNECTION_STATUS_ONLINE,
- CION_CONNECTION_STATUS_OFFLINE,
-} cion_connection_status_e;
-
-typedef struct _cion_channel_st* cion_channel_h;
-
-/**
- * @brief The callback for receiving data form cion app.
- * @param[in] channel The handle for channel
- * @param[in] data Received data
- * @param[in] size The size of received data
- * @param[in] user_data The user data passed from cion_channel_create()
- * @return 0 on success, otherwise a negative error value.
- */
-typedef void (*cion_channel_data_receive_cb)(cion_channel_h channel,
- const char *data, size_t size, void *user_data);
-
-/**
- * @brief The callback for handling the request.
- * @param[in] channel The handle for channel
- * @param[in] data Received data
- * @param[in] size The size of received data
- * @param[out] ret_data Data to be returned
- * @param[out] ret_size The size of returned data
- * @param[in] user_data The user data passed from cioncion_channel_data_receive_cb_channel_create()
- * @return 0 on success, otherwise a negative error value.
- */
-typedef void (*cion_channel_data_request_cb)(cion_channel_h channel,
- const char *data, size_t size, char **ret_data, size_t *ret_size,
- void *user_data);
-
-/**
- * @brief The callback for handling errors.
- * @param[in] channel The handle for channel
- * @param[in] code Reserved error code(TBD)
- * @param[in] user_data The user data passed from cion_channel_create()
- * @return 0 on success, otherwise a negative error value.
- */
-typedef void (*cion_channel_error_cb)(cion_channel_h channel,
- int code, void *user_data);
-
-/**
- * @brief The callback for receiving file events.
- * @param[in] channel The handle for channel
- * @param[in] path Receiving file path
- * @param[in] progress The progress for receiving a file
- * @param[in] user_data The user data passed from cion_channel_create()
- * @return 0 on success, otherwise a negative error value.
- */
-typedef void (*cion_channel_file_receive_cb)(cion_channel_h channel,
- const char *path, int progress, void *user_data);
-
-/**
- * @brief The callback for receiving current status for channel.
- * @param[in] channel The handle for channel
- * @param[in] status Current channel status
- * @param[in] user_data The user data passed from cion_channel_create()
- * @return 0 on success, otherwise a negative error value.
- */
-typedef void (*cion_channel_conn_status_cb)(cion_channel_h channel,
- cion_connection_status_e status, void *user_data);
-
-typedef struct _cion_channel_events {
- cion_channel_data_receive_cb on_data_received;
- cion_channel_data_request_cb on_data_requested;
- cion_channel_conn_status_cb on_status_changed;
- cion_channel_error_cb on_error;
- cion_channel_file_receive_cb on_file_received;
-} cion_channel_events_st;
-
-/**
- * @brief Creates a channel handle.
- * @param[out] channel The channel handle
- * @param[in] cap_handle The handle for managing capabilities
- * @param[in] remote_app_id The cion app ID
- * @param[in] events Callbacks for handling some events
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_create(cion_channel_h *channel,
- cion_capability_h cap_handle, const char *remote_app_id,
- cion_channel_events_st events, void *user_data);
-
-/**
- * @brief Destroys the channel handle.
- * @param[in] channel The channel handle
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_destroy(cion_channel_h channel);
-
-/**
- * @brief Sends data asynchronously.
- * @param[in] channel The channel handle
- * @param[in] data Data to send
- * @param[in] size The size of data
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_send_async(cion_channel_h channel,
- const char *data, size_t size);
-
-/**
- * @brief Sends data and receives a reply synchronously.
- * @param[in] channel The channel handle
- * @param[in] data Data to send
- * @param[in] size The size of data
- * @param[out] out_data Received data
- * @param[out] out_size The size of received data
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_send(cion_channel_h channel, const char *data,
- size_t size, char **out_data, size_t *out_size);
-
-/**
- * @brief Sends a file asynchronously.
- * @param[in] channel The channel handle
- * @param[in] path File path to send
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_send_file(cion_channel_h channel, const char *path);
-
-/**
- * @brief Try to connect physicial channel.
- * @param[in] channel The channel handle
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_try_connect(cion_channel_h channel);
-
-/**
- * @brief Disconnects physicial channel.
- * @param[in] channel The channel handle
- * @param[out] shared_data The handle for shared data
- * @return 0 on success, otherwise a negative error value.
- */
-int cion_channel_disconnect(cion_channel_h channel);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CION_API_CION_CHANNEL_H_
*/
#include "cion/tizen-api/cion.h"
-#include "cion/tizen-api/cion_peer_info.h"
#include <string.h>