idlc/gen_cion/java_cion_stub_gen.cc \
idlc/gen_cion/java_cion_stub_repo_gen.cc \
idlc/gen_cion/java_cion_utility_gen.cc \
+ idlc/gen_aitt_plugin/aitt_plugin_c_transportable.cc \
+ idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen.cc \
+ idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen.cc \
+ idlc/gen_aitt_plugin/aitt_plugin_loader.cc \
idlc/options.cc \
idlc/main.cc
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ast AST_GEN_SOURCES)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/gen GEN_SOURCES)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/gen_cion GEN_CION_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/gen_aitt_plugin GEN_AITT_PLUGIN_SOURCES)
BISON_TARGET(TIDLC ${CMAKE_CURRENT_SOURCE_DIR}/ast/tidlc.yy ${CMAKE_CURRENT_SOURCE_DIR}/ast/tidlc_y.cpp)
FLEX_TARGET(TIDLC ${CMAKE_CURRENT_SOURCE_DIR}/ast/tidlc.ll ${CMAKE_CURRENT_SOURCE_DIR}/ast/tidlc_l.cpp)
${FLEX_TIDLC_OUTPUTS}
${GEN_SOURCES}
${GEN_CION_SOURCES}
+ ${GEN_AITT_PLUGIN_SOURCES}
${SOURCES}
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBPKGS_LIBRARIES} ${EXE_STATIC})
return isProxy_;
}
+ void EnableGeneratedAPI(bool enable) {
+ isGenAPI_ = enable;
+ }
+
+ bool IsGeneratedAPI() {
+ return isGenAPI_;
+ }
+
void SetType(int type) {
type_ = type;
}
std::ofstream out_file_;
bool hasNamespace_ = true;
bool isProxy_ = true;
+ bool isGenAPI_ = false;
int type_ = 0;
};
--- /dev/null
+/*
+ * Copyright (c) 2022 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 "idlc/gen_aitt_plugin/aitt_plugin_c_transportable.h"
+
+#include <utility>
+
+#include "idlc/gen/replace_all.h"
+
+namespace {
+
+constexpr const char __CLINET_FILE_SEND[] =
+R"__c_cb(
+ plugin_payload_h pl;
+ int ret = plugin_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_create : %d", ret);
+ return ret;
+ }
+
+ ret = plugin_payload_set_file_path(pl, <FILE_PATH>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_set_file_path : %d - %s", ret, value);
+ plugin_payload_destroy(pl);
+ return ret;
+ }
+
+ ret = plugin_client_send_payload_async(<CLIENT_H>, pl, NULL, NULL);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_client_send_payload_async : %d - %s", ret, value);
+ plugin_payload_destroy(pl);
+ return ret;
+ }
+
+ plugin_payload_destroy(pl);
+)__c_cb";
+
+constexpr const char __SERVER_FILE_SEND[] =
+R"__c_cb(
+ plugin_payload_h pl;
+ int r = plugin_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+
+ if (r != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_create : %d", r);
+ return r;
+ }
+
+ r = plugin_payload_set_file_path(pl, <FILE_PATH>);
+ if (r != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_set_file_path : %d - %s", r, value);
+ plugin_payload_destroy(pl);
+ return r;
+ }
+
+ r = plugin_server_send_payload_async(<SERVER_H>, <PEER_H>, pl, NULL, NULL);
+ if (r != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_server_send_payload_async : %d - %s", r, value);
+ plugin_payload_destroy(pl);
+ return r;
+ }
+
+ plugin_payload_destroy(pl);
+)__c_cb";
+
+constexpr const char __SERVER_REGISTER[] =
+R"__c_cb(
+
+ ret = plugin_server_create(&__<NAME>.stub, service_name, display_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to create stub handle. error(%d)", ret);
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+
+ ret = plugin_server_add_connection_result_cb(__<NAME>.stub, __<PREFIX>_<NAME>_connection_result_cb, &__<NAME>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add connection result event callback");
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+
+ ret = plugin_server_add_payload_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_payload_received_cb, &__<NAME>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add payload recieved event callback");
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+
+ ret = plugin_server_add_disconnected_cb(__<NAME>.stub, __<PREFIX>_<NAME>_disconnected_cb, &__<NAME>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add disconnected event callback");
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+
+ ret = plugin_server_set_data_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_data_received_cb, &__<NAME>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add data recieved event callback");
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+
+ ret = plugin_server_listen(__<NAME>.stub, __<PREFIX>_<NAME>_connection_request_cb, &__<NAME>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to listen events. error(%d)", ret);
+ <PREFIX>_<NAME>_unregister();
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __SERVER_UNREGISTER[] =
+R"__c_cb(
+ if (__<NAME>.stub) {
+ plugin_server_destroy(__<NAME>.stub);
+ __<NAME>.stub = nullptr;
+ }
+)__c_cb";
+
+constexpr const char __SERVER_ACCEPT[] =
+R"__c_cb(
+ ret = plugin_server_accept(__<NAME>.stub, peer_info);
+ if (ret != AITT_PLUGIN_ERROR_NONE)
+ _E("Failed to accept. error(%d)", ret);
+)__c_cb";
+
+constexpr const char __SERVER_REJECT[] =
+R"__c_cb(
+ ret = plugin_server_reject(__<NAME>.stub, peer_info, reason);
+ if (ret != AITT_PLUGIN_ERROR_NONE)
+ _E("Failed to reject. error(%d)", ret);
+)__c_cb";
+
+constexpr const char __SERVER_SET_DISPLAY_NAME[] =
+R"__c_cb(
+ ret = plugin_server_set_display_name(__<NAME>.stub, display_name);
+ if (ret != AITT_PLUGIN_ERROR_NONE)
+ _E("Failed to set display name. error(%d)", ret);
+)__c_cb";
+
+constexpr const char __CLIENT_TRY_CONNECT[] =
+R"__c_cb(
+ ret = plugin_client_connect(<CLIENT>, <PEER>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to connect to stub. error(%d)", ret);
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_DISCONNECT[] =
+R"__c_cb(
+ ret = plugin_client_disconnect(<CLIENT>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to disconnect to stub. error(%d)", ret);
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_TRY_DISCOVERY[] =
+R"__c_cb(
+ ret = plugin_client_try_discovery(<CLIENT>, __<PREFIX>_<NAME>_discovered, h);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to discovery to stub. error(%d)", ret);
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_STOP_DISCOVERY[] =
+R"__c_cb(
+ ret = plugin_client_stop_discovery(<CLIENT>);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to stop discovery to stub. error(%d)", ret);
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_SEND_ASYNC[] =
+R"__c_cb(
+ res_ = plugin_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_create : %d", res_);
+ plugin_payload_destroy(<PAYLOAD>);
+ goto out;
+ }
+
+ res_ = plugin_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_set_data : %d", res_);
+ plugin_payload_destroy(<PAYLOAD>);
+ goto out;
+ }
+
+ res_ = plugin_client_send_payload_async(<CLIENT>, <PAYLOAD>, NULL, NULL);
+ plugin_payload_destroy(<PAYLOAD>);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_client_send_payload_async : %d", res_);
+ goto out;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_SEND[] =
+R"__c_cb(
+ res_ = plugin_client_send_data(<CLIENT>, <DATA>, <DATA_SIZE> , 5 * 1000, &<RET_DATA>, &<RET_DATA_SIZE>);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to send parcel. error(%d)", res_);
+ goto out;
+ }
+)__c_cb";
+
+constexpr const char __SERVER_SEND_ASYNC[] =
+R"__c_cb(
+ ret_ = plugin_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+ if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_create : %d", ret_);
+ plugin_payload_destroy(<PAYLOAD>);
+ goto out;
+ }
+
+ ret_ = plugin_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
+ if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_set_data : %d", ret_);
+ plugin_payload_destroy(<PAYLOAD>);
+ goto out;
+ }
+
+ ret_ = plugin_server_send_payload_async(<SERVER>, peer_info, <PAYLOAD>, NULL, NULL);
+ plugin_payload_destroy(<PAYLOAD>);
+ if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_client_send_payload_async : %d", ret_);
+ goto out;
+ }
+)__c_cb";
+
+constexpr const char __GROUP_PUBLISH[] =
+R"__c_cb(
+ res_ = plugin_payload_create(&pl_, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_create : %d", res_);
+ plugin_payload_destroy(pl_);
+ goto out;
+ }
+
+ res_ = plugin_payload_set_data(pl_, (const unsigned char*)data_, data_size_);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_payload_set_data : %d", res_);
+ plugin_payload_destroy(pl_);
+ goto out;
+ }
+
+ res_ = plugin_group_publish(h->group, pl_);
+ plugin_payload_destroy(pl_);
+ if (res_ != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to plugin_group_publish : %d", res_);
+ goto out;
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_CREATE[] =
+R"__c_cb(
+ ret = plugin_client_create(&handle->client, service_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to create proxy handle. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ handle->callback = *callback;
+ handle->user_data = user_data;
+
+ ret = plugin_client_add_connection_result_cb(handle->client, __<PREFIX>_<NAME>_connection_result, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add connection result cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ ret = plugin_client_add_disconnected_cb(handle->client, __<PREFIX>_<NAME>_disconnected, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add disconnected event cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ ret = plugin_client_add_payload_received_cb(handle->client, __<PREFIX>_<NAME>_received, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add received event cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+)__c_cb";
+
+constexpr const char __GROUP_CREATE[] =
+R"__c_cb(
+ ret = plugin_group_create(&handle->group, topic_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to create group handle. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ handle->callback = *callback;
+ handle->user_data = user_data;
+
+ ret = plugin_group_add_joined_cb(handle->group, __<PREFIX>_<NAME>_joined_cb, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add connection result cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ ret = plugin_group_add_left_cb(handle->group, __<PREFIX>_<NAME>_left_cb, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add disconnected event cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ ret = plugin_group_add_payload_received_cb(handle->group, __<PREFIX>_<NAME>_received, handle);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to add received event cb. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ ret = plugin_group_subscribe(handle->group);
+ if (ret != AITT_PLUGIN_ERROR_NONE) {
+ _E("Failed to subscribe event. error(%d)", ret);
+ <PREFIX>_<NAME>_destroy(handle);
+ return ret;
+ }
+
+ *h = handle;
+)__c_cb";
+
+constexpr const char __GROUP_DESTROY[] =
+R"__c_cb(
+ if (h->group) {
+ plugin_group_unsubscribe(h->group);
+ plugin_group_destroy(h->group);
+ }
+)__c_cb";
+
+constexpr const char __CLIENT_DESTROY[] =
+R"__c_cb(
+ if (h->client)
+ plugin_client_destroy(h->client);
+)__c_cb";
+
+constexpr const char __PEER_INFO_CLONE[] =
+ "plugin_peer_info_clone(<SRC_PEER>, <DEST_PEER>);";
+
+constexpr const char __SERVER_FOREACH_CONNECTED_PEER_INFO[] =
+ "plugin_server_foreach_connected_peer_info(__<NAME>.stub, callback, user_data);";
+
+constexpr const char __SERVER_SET_ONDEMAND_LAUNCH_ENABLED[] =
+R"__c_cb(
+ int ret;
+
+ ret = plugin_server_set_on_demand_launch_enabled(__<NAME>.stub, enable);
+ if (ret != AITT_PLUGIN_ERROR_NONE)
+ _E("Failed to set ondemand launch enable. error(%d)", ret);
+
+ return ret;
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_HANDLES[] =
+R"__c_cb(
+
+typedef enum _<MODULE_PREFIX>_error {
+ AITT_PLUGIN_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */
+ AITT_PLUGIN_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+ AITT_PLUGIN_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ AITT_PLUGIN_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ AITT_PLUGIN_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ AITT_PLUGIN_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented */
+ AITT_PLUGIN_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Already in progress */
+ AITT_PLUGIN_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ AITT_PLUGIN_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timed out */
+ AITT_PLUGIN_ERROR_OPERATION_FAILED = TIZEN_ERROR_CION | 0x01, /**< Operation failed */
+} <MODULE_PREFIX>_error_e;
+
+enum AittProtocol {
+ AITT_TYPE_MQTT = (0x1 << 0), // Publish message through the MQTT
+ AITT_TYPE_TCP = (0x1 << 1), // Publish message to peers using the TCP
+ AITT_TYPE_UDP = (0x1 << 2), // Publish message to peers using the UDP
+ AITT_TYPE_SRTP = (0x1 << 3), // Publish message to peers using the SRTP
+ AITT_TYPE_WEBRTC = (0x1 << 4), // Publish message to peers using the WEBRTC
+};
+
+/**
+ * @brief The aitt plugin peer info handle.
+ */
+typedef void *<MODULE_PREFIX>_peer_info_h;
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_CONNECTION_RESULT_HANDLE[] =
+R"__c_cb(
+typedef enum _aitt_connection_status_e {
+ AITT_PLUGIN_CONNECTION_STATUS_OK, /**< Connection is ok **/
+ AITT_PLUGIN_CONNECTION_STATUS_REJECTED, /**< Connection is rejected **/
+ AITT_PLUGIN_CONNECTION_STATUS_ERROR, /**< Connection error occurs **/
+} <MODULE_PREFIX>_connection_status_e;
+
+/**
+ * @brief The Aitt plugin connection result handle.
+ */
+typedef void *<MODULE_PREFIX>_connection_result_h;
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_PAYLOAD_HANDLE[] =
+R"__c_cb(
+/**
+ * @brief Enumeration for <MODULE_PREFIX>_payload transfer status types.
+ */
+typedef enum _payload_transfer_status_e {
+ AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_SUCCESS, /**< Transfer is success **/
+ AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_FAILURE, /**< Transfer is failed **/
+ AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS, /**< Transfer is in progress **/
+} <MODULE_PREFIX>_payload_transfer_status_e;
+
+/**
+ * @brief The <MODULE_PREFIX>_payload handle.
+ */
+ typedef void *<MODULE_PREFIX>_payload_h;
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_PAYLOAD_BASE[] =
+R"__c_cb(
+/**
+ * @brief Saves the payload as a file.
+ * @remarks The @a path is absolute path.
+ * @remarks If the media storage is used, %http://tizen.org/privilege/mediastorage privilege is necessary. \n
+ * If the external storage is used, %http://tizen.org/privilege/externalstorage privilege is necessary.
+ * @param[in] payload The <MODULE_PREFIX>_payload handle
+ * @param[in] path The path of file
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OPERATION_FAILED Operation failed
+ */
+int <MODULE_PREFIX>_payload_save_as_file(<MODULE_PREFIX>_payload_h payload, const char *path);
+
+/**
+ * @brief Gets the name of received file from the payload.
+ * @remarks @a file_name must be released using free().
+ * @param[in] payload The <MODULE_PREFIX>_payload handle
+ * @param[out] file_name The name of file
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+
+int <MODULE_PREFIX>_payload_get_received_file_name(<MODULE_PREFIX>_payload_h payload,
+ char **file_name);
+
+/**
+ * @brief Gets the size of currently received file from the payload.
+ * @param[in] payload The <MODULE_PREFIX>_payload handle
+ * @param[out] bytes The size of file
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int <MODULE_PREFIX>_payload_get_received_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes);
+
+/**
+ * @brief Gets the total size of file from the payload.
+ * @param[in] payload The <MODULE_PREFIX>_payload handle
+ * @param[out] bytes The size of file
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int <MODULE_PREFIX>_payload_get_total_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes);
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_COMMON_BASE[] =
+R"__c_cb(
+/**
+ * @brief Creates a clone of aitt plugin peer info handle.
+ * @remarks @a peer_info_clone must be released using <MODULE_PREFIX>_peer_info_destroy().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] peer_info_clone The cloned peer information handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #AITT_PLUGIN_ERROR_IO_ERROR IO error
+ * @see <MODULE_PREFIX>_peer_info_destroy()
+ */
+int <MODULE_PREFIX>_peer_info_clone(const <MODULE_PREFIX>_peer_info_h peer_info,
+ <MODULE_PREFIX>_peer_info_h *peer_info_clone);
+
+/**
+ * @brief Destroys the peer info handle and releases all its resources.
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see <MODULE_PREFIX>_peer_info_clone()
+ */
+int <MODULE_PREFIX>_peer_info_destroy(<MODULE_PREFIX>_peer_info_h peer_info);
+
+/**
+ * @brief Gets the device ID.
+ * @remarks @a device_id must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] device_id The device ID
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_device_id(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_id);
+
+/**
+ * @brief Gets the device name.
+ * @remarks @a device_name must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] device_name The device name
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_device_name(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_name);
+
+/**
+ * @brief Gets the device's platform.
+ * @remarks @a device_platform must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] device_platform The platform name
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_device_platform(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_platform);
+
+/**
+ * @brief Gets the device's platform version.
+ * @remarks @a device_platform_version must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] device_platform_version The platform version
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_device_platform_version(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_platform_version);
+
+/**
+ * @brief Gets the device's type.
+ * @remarks @a device_type must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] device_type Device type
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_device_type(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_type);
+
+/**
+ * @brief Gets application ID of peer.
+ * @remarks @a app_id must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] app_id The application ID
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_app_id(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **app_id);
+
+/**
+ * @brief Gets application version of peer.
+ * @remarks @a app_version must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] app_version The application version
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_app_version(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **app_version);
+
+/**
+ * @brief Gets UUID of peer.
+ * @remarks @a uuid must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] uuid The UUID
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_uuid(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **uuid);
+
+/**
+ * @brief Gets display name of peer.
+ * @details The custom name for service name. \n
+ * It is possible that @a display_name does not exist.
+ * @remarks @a display_name must be released using free().
+ * @param[in] peer_info The aitt plugin peer information handle
+ * @param[out] display_name The display name
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_peer_info_get_display_name(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **display_name);
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_CONNECTION_RESULT_BASE[] =
+R"__c_cb(
+/**
+ * @brief Gets the connection result status.
+ * @param[in] result The connection result handle
+ * @param[out] status Connection result status
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int <MODULE_PREFIX>_connection_result_get_status(const <MODULE_PREFIX>_connection_result_h result,
+ <MODULE_PREFIX>_connection_status_e *status);
+
+/**
+ * @brief Gets the connection result reason.
+ * @remarks @a reason must be released using free().
+ * @param[in] result The connection result handle
+ * @param[out] reason Connection result reason, should be freed after use
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connection_result_h result,
+ char **reason);
+)__c_cb";
+
+constexpr const char __COMMON_BODY_PEERINFO_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_peer_info_clone(const <MODULE_PREFIX>_peer_info_h peer_info,
+ <MODULE_PREFIX>_peer_info_h *peer_info_clone) {
+ return plugin_peer_info_clone(peer_info, peer_info_clone);
+}
+
+int <MODULE_PREFIX>_peer_info_destroy(<MODULE_PREFIX>_peer_info_h peer_info) {
+ return plugin_peer_info_destroy(peer_info);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_id(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_id) {
+ return plugin_peer_info_get_device_id(peer_info, device_id);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_name(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_name) {
+ return plugin_peer_info_get_device_name(peer_info, device_name);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_platform(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_platform) {
+ return plugin_peer_info_get_device_platform(peer_info, device_platform);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_platform_version(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_platform_version) {
+ return plugin_peer_info_get_device_platform_version(peer_info, device_platform_version);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_type(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **device_type) {
+ return plugin_peer_info_get_device_type(peer_info, device_type);
+}
+
+int <MODULE_PREFIX>_peer_info_get_app_id(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **app_id) {
+ return plugin_peer_info_get_app_id(peer_info, app_id);
+}
+
+int <MODULE_PREFIX>_peer_info_get_app_version(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **app_version) {
+ return plugin_peer_info_get_app_version(peer_info, app_version);
+}
+
+int <MODULE_PREFIX>_peer_info_get_uuid(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **uuid) {
+ return plugin_peer_info_get_uuid(peer_info, uuid);
+}
+
+int <MODULE_PREFIX>_peer_info_get_display_name(<MODULE_PREFIX>_peer_info_h peer_info,
+ char **display_name) {
+ return plugin_peer_info_get_display_name(peer_info, display_name);
+}
+)__c_cb";
+
+/**
+ * <PREFIX> The prefix of the connection result.
+ */
+constexpr const char __COMMON_BODY_CONNECTION_RESULT_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_connection_result_get_status(const <MODULE_PREFIX>_connection_result_h result,
+ <MODULE_PREFIX>_connection_status_e *status) {
+ return plugin_connection_result_get_status(result,(plugin_connection_status_e *)status);
+}
+
+int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connection_result_h result,
+ char **reason) {
+ return plugin_connection_result_get_reason(result, reason);
+}
+)__c_cb";
+
+/**
+ * <PREFIX> The prefix of the payload.
+ */
+constexpr const char __COMMON_BODY_PAYLOAD_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_payload_save_as_file(<MODULE_PREFIX>_payload_h payload, const char *path) {
+ return plugin_payload_save_as_file(payload, path);
+}
+
+int <MODULE_PREFIX>_payload_get_received_file_name(<MODULE_PREFIX>_payload_h payload,
+ char **file_name) {
+ return plugin_payload_get_received_file_name(payload, file_name);
+}
+
+int <MODULE_PREFIX>_payload_get_received_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
+ return plugin_payload_get_received_bytes( payload, bytes);
+}
+
+int <MODULE_PREFIX>_payload_get_total_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
+ return plugin_payload_get_total_bytes( payload, bytes);
+}
+)__c_cb";
+
+constexpr const char __INCLUDE_HEADER_DEF[] =
+R"__c_cb(
+#include <stdlib.h>
+#include <stdint.h>
+)__c_cb";
+
+constexpr const char __SERVER_HEADER_EXTRA[] =
+R"__c_cb(
+/**
+ * @brief Registers the set of the callback functions and the service_name.
+ * @details This function registers the set of the callback functions to handle stub events.
+ * And, the <MODULE_PREFIX>_server_listen() is called internally to handle events.
+
+ * @privilege %http://tizen.org/privilege/d2d.datasharing \n
+ * %http://tizen.org/privilege/internet
+ * @param[in] service_name The name of service
+ * @param[in] display_name The display name of service
+ * @param[in] broker_ip IP address of the broker to connect to
+ * @param[in] port The network port to connect to. Usually 1883
+ * @param[in] user_name The user name to connect to
+ * @param[in] password The Password to connect to
+ * @param[in] my_ip Own device ip address for connecting by others
+ * @param[in] protocols value of @a aitt_protocol_e. The value can be bitwise-or'd
+ * @param[in] callback The set of callback functions to handle stub events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_NOT_SUPPORTED Not supported
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #<ERROR_PREFIX>_ERROR_OPERATION_FAILED Operation failed
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+ * @see <PREFIX>_<NAME>_unregister()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name,
+ const char *broker_ip, int broker_port, const char *user_name,
+ const char *password, const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data);
+)__c_cb";
+
+constexpr const char __SERVER_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name,
+ const char *broker_ip, int broker_port, const char *user_name,
+ const char *password, const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data)
+)__c_cb";
+
+constexpr const char __CLIENT_HEADER_EXTRA[] =
+R"__c_cb(
+/**
+ * @brief Creates a <PREFIX>_<NAME> handle.
+ * @remarks The @a h handle should be released using
+ * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
+ * @privilege %http://tizen.org/privilege/d2d.datasharing \n
+ * %http://tizen.org/privilege/internet
+ * @param[in] service_name The name of service
+ * @param[in] broker_ip IP address of the broker to connect to
+ * @param[in] port The network port to connect to. Usually 1883.
+ * @param[in] user_name The user name to connect to
+ * @param[in] password The Password to connect to
+ * @param[in] my_ip Own device ip address for connecting by others
+ * @param[in] protocols value of @a aitt_protocol_e. The value can be bitwise-or'd.
+ * @param[in] callback The set of callback functions to handle proxy events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] h The <PREFIX>_<NAME> handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @see <PREFIX>_<NAME>_destroy()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_create(const char *service_name, const char *broker_ip, int broker_port,
+ const char *user_name, const char *password, const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+)__c_cb";
+
+constexpr const char __CLIENT_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_create(const char *service_name, const char *broker_ip, int broker_port,
+ const char *user_name, const char *password, const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
+)__c_cb";
+
+
+constexpr const char __GROUP_HEADER_EXTRA[] =
+R"__c_cb(
+/**
+ * @brief Creates a <PREFIX>_<NAME> handle.
+ * @remarks The @a h handle should be released using
+ * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
+ *
+ * @privilege %http://tizen.org/privilege/d2d.datasharing
+ * %http://tizen.org/privilege/internet
+ * @param[in] topic_name topic_name The name of topic
+ * @param[in] broker_ip IP address of the broker to connect to
+ * @param[in] port The network port to connect to. Usually 1883.
+ * @param[in] user_name The user name to connect to
+ * @param[in] password The Password to connect to
+ * @param[in] my_ip Own device ip address for connecting by others
+ * @param[in] protocols value of @a aitt_protocol_e. The value can be bitwise-or'd.
+ * @param[in] callback The set of callback functions to handle events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] h The <PREFIX>_<NAME> handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_NOT_SUPPORTED Not supported
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #AITT_PLUGIN_ERROR_PERMISSION_DENIED Permission denied
+
+ * @see <PREFIX>_<NAME>_destroy()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_create(const char *topic_name, const char *broker_ip, int broker_port,
+ const char *user_name, const char *password,
+ const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+)__c_cb";
+
+constexpr const char __GROUP_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_create(const char *topic_name, const char *broker_ip, int broker_port,
+ const char *user_name, const char *password,
+ const char *my_ip, int protocols,
+ <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
+)__c_cb";
+
+
+} // namespace
+
+namespace tidl {
+
+std::string AittPluginCTransportable::GenInclude(bool body, int type) const {
+ if (!body)
+ return __INCLUDE_HEADER_DEF;
+
+ switch (type) {
+ case 1:
+ {
+ return "#include \"aitt_plugin_proxy_internal.h\"";
+ }
+ case 2:
+ {
+ return "#include \"aitt_plugin_stub_internal.h\"";
+ }
+ case 3:
+ {
+ return "#include \"aitt_plugin_group_internal.h\"";
+ }
+ default:
+ return {};
+ }
+}
+
+std::string AittPluginCTransportable::GenHeaderBase() const {
+ return __COMMON_HEADER_COMMON_BASE;
+}
+
+std::string AittPluginCTransportable::GenHeaderPayloadHandle() const {
+ return __COMMON_HEADER_PAYLOAD_HANDLE;
+}
+
+std::string AittPluginCTransportable::GenHeaderCommonHandle() const {
+ return __COMMON_HEADER_HANDLES;
+}
+
+std::string AittPluginCTransportable::GenHeaderConnectionHandle() const {
+ return __COMMON_HEADER_CONNECTION_RESULT_HANDLE;
+}
+
+std::string AittPluginCTransportable::GenHeaderPayloadBase() const {
+ return __COMMON_HEADER_PAYLOAD_BASE;
+}
+
+std::string AittPluginCTransportable::GenHeaderConnectionBase() const {
+ return __COMMON_HEADER_CONNECTION_RESULT_BASE;
+}
+
+std::string AittPluginCTransportable::GenBodyPayloadBase() const {
+ return __COMMON_BODY_PAYLOAD_BASE;
+}
+
+std::string AittPluginCTransportable::GenBodyConnectionBase() const {
+ return __COMMON_BODY_CONNECTION_RESULT_BASE;
+}
+
+std::string AittPluginCTransportable::GenBodyPeerInfoBase() const {
+ return __COMMON_BODY_PEERINFO_BASE;
+}
+
+std::string AittPluginCTransportable::GenProxyPrefix() const {
+ return "aitt_plugin_proxy";
+}
+
+std::string AittPluginCTransportable::GenStubPrefix() const {
+ return "aitt_plugin_stub";
+}
+
+std::string AittPluginCTransportable::GenGroupPrefix() const {
+ return "aitt_plugin_group";
+}
+
+std::string AittPluginCTransportable::GenModulePrefix() const {
+ return "aitt_plugin";
+}
+
+std::string AittPluginCTransportable::GenErrorPrefix() const {
+ return "AITT_PLUGIN";
+}
+
+std::string AittPluginCTransportable::GenServerExtra(bool body) const {
+ if (body)
+ return __SERVER_BODY_EXTRA;
+ else
+ return __SERVER_HEADER_EXTRA;
+}
+
+std::string AittPluginCTransportable::GenClientExtra(bool body) const {
+ if (body)
+ return __CLIENT_BODY_EXTRA;
+ else
+ return __CLIENT_HEADER_EXTRA;
+}
+
+std::string AittPluginCTransportable::GenGroupExtra(bool body) const {
+ if (body)
+ return __GROUP_BODY_EXTRA;
+ else
+ return __GROUP_HEADER_EXTRA;
+}
+
+std::string AittPluginCTransportable::GenClientSendAsync(std::string client,
+ std::string payload, std::string size) const {
+ return std::string(ReplaceAll(__CLIENT_SEND_ASYNC, {
+ { "<CLIENT>", client },
+ { "<PAYLOAD>", payload},
+ { "<SIZE>", size} }));
+}
+
+std::string AittPluginCTransportable::GenClientSend(std::string client,
+ std::string data, std::string data_size,
+ std::string ret_data, std::string ret_data_size) const {
+ return std::string(ReplaceAll(__CLIENT_SEND, {
+ { "<CLIENT>", client },
+ { "<DATA>", data},
+ { "<DATA_SIZE>", data_size},
+ { "<RET_DATA>", ret_data},
+ { "<RET_DATA_SIZE>", ret_data_size} }));
+}
+
+std::string AittPluginCTransportable::GenServerSendAsync(std::string server,
+ std::string client,
+ std::string payload, std::string size) const {
+ return std::string(ReplaceAll(__SERVER_SEND_ASYNC, {
+ { "<SERVER>", server },
+ { "<CLIENT>", client},
+ { "<PAYLOAD>", payload},
+ { "<SIZE>", size} }));
+}
+
+std::string AittPluginCTransportable::GenServerFileSend(std::string path,
+ std::string server, std::string peer) const {
+ return std::string(ReplaceAll(__SERVER_FILE_SEND, {
+ { "<FILE_PATH>", path },
+ { "<SERVER_H>", server },
+ { "<PEER_H>", peer } }));
+}
+
+std::string AittPluginCTransportable::GenClientFileSend(std::string path,
+ std::string client) const {
+ return std::string(ReplaceAll(__CLINET_FILE_SEND, {
+ { "<FILE_PATH>", path },
+ { "<CLIENT_H>", client } }));
+}
+
+std::string AittPluginCTransportable::GenGroupType() const {
+ return "plugin_group_h";
+}
+
+std::string AittPluginCTransportable::GenPayloadTransferStatusType(bool internal_type) const {
+ if (internal_type)
+ return "transfer_status_e";
+ else
+ return "<MODULE_PREFIX>_payload_transfer_status_e";
+}
+
+std::string AittPluginCTransportable::GenPeerInfoType() const {
+ return "<MODULE_PREFIX>_peer_info_h";
+}
+
+std::string AittPluginCTransportable::GenPeerInfoDestroy(std::string peer) const {
+ return std::string(ReplaceAll("<MODULE_PREFIX>_peer_info_destroy(<PEER>);", {
+ { "<PEER>", peer } }));
+}
+
+std::string AittPluginCTransportable::GenPayloadType(bool internal_type) const {
+ if (internal_type)
+ return "plugin_payload_h";
+ else
+ return "<MODULE_PREFIX>_payload_h";
+}
+
+std::string AittPluginCTransportable::GenClientType() const {
+ return "plugin_client_h";
+}
+
+std::string AittPluginCTransportable::GenSecurityType(bool definition) const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenServerType() const {
+ return "plugin_server_h";
+}
+
+std::string AittPluginCTransportable::GenClientTryConnect(std::string client,
+ std::string peer) const {
+ return std::string(ReplaceAll(__CLIENT_TRY_CONNECT, {
+ { "<CLIENT>", client },
+ { "<PEER>", peer } }));
+}
+
+std::string AittPluginCTransportable::GenClientDisconnect(
+ std::string client) const {
+ return std::string(ReplaceAll(__CLIENT_DISCONNECT, {
+ { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCTransportable::GenClientTryDiscovery(
+ std::string client) const {
+ return std::string(ReplaceAll(__CLIENT_TRY_DISCOVERY, {
+ { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCTransportable::GenClientStopDiscovery(
+ std::string client) const {
+ return std::string(ReplaceAll(__CLIENT_STOP_DISCOVERY, {
+ { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCTransportable::GenServerRegister() const {
+ return __SERVER_REGISTER;
+}
+
+std::string AittPluginCTransportable::GenServerUnregister() const {
+ return __SERVER_UNREGISTER;
+}
+
+std::string AittPluginCTransportable::GenClientExtraHeader() const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenClientExtraBody() const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenServerExtraHeader() const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenServerExtraBody() const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenServerAccept() const {
+ return __SERVER_ACCEPT;
+}
+
+std::string AittPluginCTransportable::GenServerReject() const {
+ return __SERVER_REJECT;
+}
+
+std::string AittPluginCTransportable::GenServerSetDisplayName() const {
+ return __SERVER_SET_DISPLAY_NAME;
+}
+
+std::string AittPluginCTransportable::GenGroupPublish() const {
+ return __GROUP_PUBLISH;
+}
+
+std::string AittPluginCTransportable::GenPayloadTypeEnum() const {
+ return "plugin_payload_type_e";
+}
+
+std::string AittPluginCTransportable::GenPayloadTypeData() const {
+ return "AITT_PLUGIN_PAYLOAD_TYPE_DATA";
+}
+
+std::string AittPluginCTransportable::GenPayloadTypeFile() const {
+ return "AITT_PLUGIN_PAYLOAD_TYPE_FILE";
+}
+
+std::string AittPluginCTransportable::GenPayloadGetType() const {
+ return "ret = plugin_payload_get_type(payload, &type);";
+}
+
+std::string AittPluginCTransportable::GenErrorNone() const {
+ return "AITT_PLUGIN_ERROR_NONE";
+}
+
+std::string AittPluginCTransportable::GenPayloadGetData() const {
+ return "ret = plugin_payload_get_data(payload, &data, &data_len);";
+}
+
+std::string AittPluginCTransportable::GenClientCreate() const {
+ return __CLIENT_CREATE;
+}
+
+std::string AittPluginCTransportable::GenGroupCreate() const {
+ return __GROUP_CREATE;
+}
+
+std::string AittPluginCTransportable::GenGroupDestroy() const {
+ return __GROUP_DESTROY;
+}
+
+std::string AittPluginCTransportable::GenClientDestroy() const {
+ return __CLIENT_DESTROY;
+}
+
+std::string AittPluginCTransportable::GenSetSecurityCA(std::string arg) const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenSetSecurityCert(std::string arg) const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenSetSecurityPrivateKey(std::string arg) const {
+ return "";
+}
+
+std::string AittPluginCTransportable::GenPeerInfoClone(std::string src_peer,
+ std::string dest_peer) const {
+ return std::string(ReplaceAll(__PEER_INFO_CLONE, {
+ { "<SRC_PEER>", src_peer },
+ { "<DEST_PEER>", dest_peer } }));
+}
+
+std::string AittPluginCTransportable::GenServerForeachConnectedPeerInfo(
+ std::string name) const {
+ return std::string(ReplaceAll(__SERVER_FOREACH_CONNECTED_PEER_INFO, {
+ { "<NAME>", name } }));
+}
+
+} // namespace tidl
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_GEN_AITT_PLUGIN_C_TRANSPORTABLE_H_
+#define IDLC_GEN_AITT_PLUGIN_C_TRANSPORTABLE_H_
+
+#include <string>
+
+#include "idlc/gen_cion/c_transportable.h"
+
+namespace tidl {
+
+class AittPluginCTransportable : public CTransportable {
+ public:
+ virtual ~AittPluginCTransportable() = default;
+ std::string GenInclude(bool body = true, int type = 0) const override;
+ std::string GenHeaderBase() const override;
+ std::string GenHeaderPayloadHandle() const override;
+ std::string GenHeaderCommonHandle() const override;
+ std::string GenHeaderConnectionHandle() const override;
+ std::string GenHeaderPayloadBase() const override;
+ std::string GenHeaderConnectionBase() const override;
+ std::string GenBodyPayloadBase() const override;
+ std::string GenBodyConnectionBase() const override;
+ std::string GenBodyPeerInfoBase() const override;
+ std::string GenProxyPrefix() const override;
+ std::string GenStubPrefix() const override;
+ std::string GenGroupPrefix() const override;
+ std::string GenModulePrefix() const override;
+ std::string GenErrorPrefix() const override;
+ std::string GenServerExtra(bool body = true) const override;
+ std::string GenClientExtra(bool body = true) const override;
+ std::string GenGroupExtra(bool body = true) const override;
+ std::string GenClientSendAsync(std::string client,
+ std::string payload, std::string size) const override;
+ std::string GenClientSend(std::string client, std::string data,
+ std::string data_size, std::string ret_data,
+ std::string ret_data_size) const override;
+ std::string GenServerSendAsync(std::string server, std::string client,
+ std::string payload, std::string size) const override;
+ std::string GenServerFileSend(std::string path,
+ std::string server, std::string peer) const override;
+ std::string GenClientFileSend(std::string path,
+ std::string client) const override;
+ std::string GenGroupType() const override;
+ std::string GenPayloadTransferStatusType(bool internal_type = false) const override;
+ std::string GenPeerInfoType() const override;
+ std::string GenPeerInfoDestroy(std::string peer) const override;
+ std::string GenPayloadType(bool internal_type = false) const override;
+ std::string GenClientType() const override;
+ std::string GenSecurityType(bool definition = true) const override;
+ std::string GenServerType() const override;
+ std::string GenClientTryConnect(std::string client,
+ std::string peer) const override;
+ std::string GenClientDisconnect(std::string client) const override;
+ std::string GenClientTryDiscovery(std::string client) const override;
+ std::string GenClientStopDiscovery(std::string client) const override;
+ std::string GenServerRegister() const override;
+ std::string GenServerUnregister() const override;
+ std::string GenClientExtraHeader() const override;
+ std::string GenClientExtraBody() const override;
+ std::string GenServerExtraHeader() const override;
+ std::string GenServerExtraBody() const override;
+ std::string GenServerAccept() const override;
+ std::string GenServerReject() const override;
+ std::string GenServerSetDisplayName() const override;
+ std::string GenGroupPublish() const override;
+ std::string GenPayloadTypeEnum() const override;
+ std::string GenPayloadTypeData() const override;
+ std::string GenPayloadTypeFile() const override;
+ std::string GenPayloadGetType() const override;
+ std::string GenErrorNone() const override;
+ std::string GenPayloadGetData() const override;
+ std::string GenClientCreate() const override;
+ std::string GenGroupCreate() const override;
+ std::string GenGroupDestroy() const override;
+ std::string GenClientDestroy() const override;
+ std::string GenSetSecurityCA(std::string arg) const override;
+ std::string GenSetSecurityCert(std::string arg) const override;
+ std::string GenSetSecurityPrivateKey(std::string arg) const override;
+ std::string GenPeerInfoClone(std::string src_peer,
+ std::string dest_peer) const override;
+ std::string GenServerForeachConnectedPeerInfo(std::string name) const override;
+};
+
+} // namespace tidl
+
+#endif // IDLC_GEN_AITT_PLUGIN_C_TRANSPORTABLE_H_
--- /dev/null
+/*
+ * Copyright (c) 2022 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 <algorithm>
+
+#include "idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen_cb.h"
+
+namespace tidl {
+
+AittPluginInternalBodyGen::AittPluginInternalBodyGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionBodyGeneratorBase(doc, trans) {
+}
+
+void AittPluginInternalBodyGen::OnInitGen(std::ofstream& stream) {
+ GenVersion(stream);
+ GenGNUSourceDefinition(stream);
+ GenIncludeHeader(stream);
+ GenLogTag(stream, std::string("AITT_PLUGIN_INTERNAL"));
+ GenLogDefinition(stream);
+ GenBody(stream);
+ GenPluginInit(stream);
+}
+
+
+void AittPluginInternalBodyGen::GenPluginInit(std::ofstream& stream) {
+ stream << CB_PLUGIN_INIT_BASE;
+}
+
+void AittPluginInternalBodyGen::GenIncludeHeader(std::ofstream& stream) {
+ stream << tidl::ReplaceAll(CB_INTERNAL_HEADER, "<PREFIX>", GetHandlePrefix());
+}
+
+void AittPluginInternalBodyGen::GenLoadModule(std::ofstream& stream) {
+ stream << CB_LOAD_MOUDLE_BASE;
+ stream << CB_LOAD_MOUDLE_PAYLOAD;
+ stream << CB_LOAD_MOUDLE_PEERINFO;
+ stream << CB_LOAD_MOUDLE_CONNECTION;
+
+ switch (GetType()) {
+ case 1:
+ {
+ stream << CB_LOAD_MOUDLE_CLIENT;
+ break;
+ }
+ case 2:
+ {
+ stream << CB_LOAD_MOUDLE_SERVER;
+ break;
+ }
+ case 3:
+ {
+ stream << CB_LOAD_MOUDLE_GROUP;
+ break;
+ }
+ default:
+ break;
+ }
+ stream << CB_LOAD_MOUDLE_BASE_RETURN;
+}
+
+void AittPluginInternalBodyGen::GenBody(std::ofstream& stream) {
+ stream << CB_BODY_BASE;
+ switch (GetType()) {
+ case 1:
+ {
+ stream << CB_BODY_CLIENT;
+ break;
+ }
+ case 2:
+ {
+ stream << CB_BODY_SERVER;
+ break;
+ }
+ case 3:
+ {
+ stream << CB_BODY_GROUP;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ GenLoadModule(stream);
+}
+
+void AittPluginInternalBodyGen::OnFiniGen(std::ofstream& stream) {
+}
+
+} // namespace tidl
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_AITT_PLUGIN_C_INTERNAL_BODY_GEN_H_
+#define IDLC_AITT_PLUGIN_C_INTERNAL_BODY_GEN_H_
+
+#include <memory>
+#include <string>
+
+#include "idlc/gen_cion/c_cion_body_gen_base.h"
+
+namespace tidl {
+
+class AittPluginInternalBodyGen : public CCionBodyGeneratorBase {
+ public:
+ explicit AittPluginInternalBodyGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
+ virtual ~AittPluginInternalBodyGen() = default;
+
+ void OnInitGen(std::ofstream& stream) override;
+ void OnFiniGen(std::ofstream& stream) override;
+
+ private:
+ void GenPluginInit(std::ofstream& stream);
+ void GenIncludeHeader(std::ofstream& stream);
+ void GenLoadModule(std::ofstream& stream);
+ void GenBody(std::ofstream& stream);
+};
+
+} // namespace tidl
+
+#endif // IDLC_AITT_PLUGIN_C_INTERNAL_BODY_GEN_H_
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_C_AITT_PLUGIN_GEN_INTERNAL_BODY_GEN_CB_H_
+#define IDLC_C_AITT_PLUGIN_GEN_INTERNAL_BODY_GEN_CB_H_
+
+constexpr const char CB_INTERNAL_HEADER[] =
+R"__c_cb(
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <dlog.h>
+
+#include "<PREFIX>_internal.h"
+
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_SERVER[] =
+R"__c_cb(
+ if (!__load_server_channel())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_PAYLOAD[] =
+R"__c_cb(
+ if (!__load_payload())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_PEERINFO[] =
+R"__c_cb(
+ if (!__load_peerinfo())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_CONNECTION[] =
+R"__c_cb(
+ if (!__load_connection())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_CLIENT[] =
+R"__c_cb(
+ if (!__load_client_channel())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_GROUP[] =
+R"__c_cb(
+ if (!__load_group_channel())
+ goto out;
+)__c_cb";
+
+constexpr const char CB_PLUGIN_INIT_BASE[] =
+R"__c_cb(
+PLUGIN_CTOR static void _plugin_init(void)
+{
+ __load_module();
+}
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_BASE[] =
+R"__c_cb(
+static void __load_module() {
+ plugin_handle = dlopen(LIBAITT_PLUGIN_INFO, RTLD_LAZY | RTLD_GLOBAL);
+ if (!plugin_handle) {
+ LOGE("Failed to load - %s", dlerror());
+ return;
+ }
+)__c_cb";
+
+constexpr const char CB_LOAD_MOUDLE_BASE_RETURN[] =
+R"__c_cb(
+ return;
+
+out:
+
+ dlclose(plugin_handle);
+}
+)__c_cb";
+
+constexpr const char CB_BODY_BASE[] =
+R"__c_cb(
+
+#define LIBAITT_PLUGIN_INFO "/usr/lib/libaitt_plugin.so"
+static void *plugin_handle;
+
+#define PLUGIN_CTOR __attribute__((constructor))
+
+static bool __load_payload() {
+ plugin_payload_create = dlsym(plugin_handle,
+ "aitt_plugin_payload_create");
+ if (!plugin_payload_create) {
+ LOGE("Failed to find plugin_payload_create");
+ return false;
+ }
+
+ plugin_payload_destroy = dlsym(plugin_handle,
+ "aitt_plugin_payload_destroy");
+ if (!plugin_payload_destroy) {
+ LOGE("Failed to find plugin_payload_destroy");
+ return false;
+ }
+
+ plugin_payload_get_type = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_type");
+ if (!plugin_payload_get_type) {
+ LOGE("Failed to find plugin_payload_get_type");
+ return false;
+ }
+
+ plugin_payload_get_data = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_data");
+ if (!plugin_payload_get_data) {
+ LOGE("Failed to find plugin_payload_get_data");
+ return false;
+ }
+
+ plugin_payload_set_data = dlsym(plugin_handle,
+ "aitt_plugin_payload_set_data");
+ if (!plugin_payload_set_data) {
+ LOGE("Failed to find plugin_payload_set_data");
+ return false;
+ }
+
+ plugin_payload_save_as_file = dlsym(plugin_handle,
+ "aitt_plugin_payload_save_as_file");
+ if (!plugin_payload_save_as_file) {
+ LOGE("Failed to find plugin_payload_save_as_file");
+ return false;
+ }
+
+ plugin_payload_get_received_file_name = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_received_file_name");
+ if (!plugin_payload_get_received_file_name) {
+ LOGE("Failed to find plugin_payload_get_received_file_name");
+ return false;
+ }
+
+ plugin_payload_get_received_bytes = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_received_bytes");
+ if (!plugin_payload_get_received_bytes) {
+ LOGE("Failed to init plugin_payload_get_received_bytes");
+ return false;
+ }
+
+ plugin_payload_get_total_bytes = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_total_bytes");
+ if (!plugin_payload_get_total_bytes) {
+ LOGE("Failed to find plugin_payload_get_total_bytes");
+ return false;
+ }
+
+ plugin_payload_set_file_path = dlsym(plugin_handle,
+ "aitt_plugin_payload_set_file_path");
+ if (!plugin_payload_set_file_path) {
+ LOGE("Failed to find plugin_payload_set_file_path");
+ return false;
+ }
+
+ plugin_payload_get_payload_id = dlsym(plugin_handle,
+ "aitt_plugin_payload_get_payload_id");
+ if (!plugin_payload_get_payload_id) {
+ LOGE("Failed to find plugin_payload_get_payload_id");
+ return false;
+ }
+
+ return true;
+}
+
+static bool __load_peerinfo() {
+ plugin_peer_info_clone = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_clone");
+ if (!plugin_peer_info_clone) {
+ LOGE("Failed to find plugin_peer_info_clone");
+ return false;
+ }
+
+ plugin_peer_info_destroy = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_destroy");
+ if (!plugin_peer_info_destroy) {
+ LOGE("Failed to find plugin_peer_info_destroy");
+ return false;
+ }
+
+ plugin_peer_info_get_device_id = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_device_id");
+ if (!plugin_peer_info_get_device_id) {
+ LOGE("Failed to find plugin_peer_info_get_device_id");
+ return false;
+ }
+
+ plugin_peer_info_get_device_name = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_device_name");
+ if (!plugin_peer_info_get_device_name) {
+ LOGE("Failed to find plugin_peer_info_get_device_name");
+ return false;
+ }
+
+ plugin_peer_info_get_device_platform = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_device_platform");
+ if (!plugin_peer_info_get_device_platform) {
+ LOGE("Failed to find plugin_peer_info_get_device_platform");
+ return false;
+ }
+
+ plugin_peer_info_get_device_platform_version = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_device_platform_version");
+ if (!plugin_peer_info_get_device_platform_version) {
+ LOGE("Failed to find plugin_peer_info_get_device_platform_version");
+ return false;
+ }
+
+ plugin_peer_info_get_device_type = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_device_type");
+ if (!plugin_peer_info_get_device_type) {
+ LOGE("Failed to find plugin_peer_info_get_device_type");
+ return false;
+ }
+
+ plugin_peer_info_get_app_id = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_app_id");
+ if (!plugin_peer_info_get_app_id) {
+ LOGE("Failed to init plugin_peer_info_get_app_id");
+ return false;
+ }
+
+ plugin_peer_info_get_app_version = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_app_version");
+ if (!plugin_peer_info_get_app_version) {
+ LOGE("Failed to find plugin_peer_info_get_app_version");
+ return false;
+ }
+
+ plugin_peer_info_get_uuid = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_uuid");
+ if (!plugin_peer_info_get_uuid) {
+ LOGE("Failed to find plugin_peer_info_get_uuid");
+ return false;
+ }
+
+ plugin_peer_info_get_display_name = dlsym(plugin_handle,
+ "aitt_plugin_peer_info_get_display_name");
+ if (!plugin_peer_info_get_display_name) {
+ LOGE("Failed to find plugin_peer_info_get_display_name");
+ return false;
+ }
+
+ return true;
+}
+
+static bool __load_connection() {
+ plugin_connection_result_get_status = dlsym(plugin_handle,
+ "aitt_plugin_connection_result_get_status");
+ if (!plugin_connection_result_get_status) {
+ LOGE("Failed to find plugin_connection_result_get_status");
+ return false;
+ }
+
+ plugin_connection_result_get_reason = dlsym(plugin_handle,
+ "aitt_plugin_connection_result_get_reason");
+ if (!plugin_connection_result_get_reason) {
+ LOGE("Failed to find plugin_connection_result_get_reason");
+ return false;
+ }
+
+ return true;
+}
+)__c_cb";
+
+constexpr const char CB_BODY_GROUP[] =
+R"__c_cb(
+static bool __load_group_channel() {
+ plugin_group_create = dlsym(plugin_handle, "aitt_plugin_group_create");
+ if (!plugin_group_create) {
+ LOGE("Failed to find plugin_group_create");
+ return false;
+ }
+
+ plugin_group_destroy = dlsym(plugin_handle,
+ "aitt_plugin_group_destroy");
+ if (!plugin_group_destroy) {
+ LOGE("Failed to find plugin_group_destroy");
+ return false;
+ }
+
+ plugin_group_subscribe = dlsym(plugin_handle,
+ "aitt_plugin_group_subscribe");
+ if (!plugin_group_subscribe) {
+ LOGE("Failed to find plugin_group_subscribe");
+ return false;
+ }
+
+ plugin_group_unsubscribe = dlsym(plugin_handle,
+ "aitt_plugin_group_unsubscribe");
+ if (!plugin_group_unsubscribe) {
+ LOGE("Failed to find plugin_group_unsubscribe");
+ return false;
+ }
+
+ plugin_group_publish = dlsym(plugin_handle,
+ "aitt_plugin_group_publish");
+ if (!plugin_group_publish) {
+ LOGE("Failed to find plugin_group_publish");
+ return false;
+ }
+
+ plugin_group_add_payload_received_cb = dlsym(plugin_handle,
+ "aitt_plugin_group_add_payload_received_cb");
+ if (!plugin_group_add_payload_received_cb) {
+ LOGE("Failed to find plugin_group_add_payload_received_cb");
+ return false;
+ }
+
+ plugin_group_add_joined_cb = dlsym(plugin_handle,
+ "aitt_plugin_group_add_joined_cb");
+ if (!(*plugin_group_add_joined_cb)) {
+ LOGE("Failed to find plugin_group_add_joined_cb");
+ return false;
+ }
+
+ plugin_group_add_left_cb = dlsym(plugin_handle,
+ "aitt_plugin_group_add_left_cb");
+ if (!plugin_group_add_left_cb) {
+ LOGE("Failed to init plugin_group_add_left_cb");
+ return false;
+ }
+
+ return true;
+}
+)__c_cb";
+
+constexpr const char CB_BODY_CLIENT[] =
+R"__c_cb(
+static bool __load_client_channel() {
+ plugin_client_create = dlsym(plugin_handle, "aitt_plugin_client_create");
+ if (!plugin_client_create) {
+ LOGE("Failed to find plugin_client_create");
+ return false;
+ }
+
+ plugin_client_destroy = dlsym(plugin_handle,
+ "aitt_plugin_client_destroy");
+ if (!plugin_client_destroy) {
+ LOGE("Failed to find plugin_client_destroy");
+ return false;
+ }
+
+ plugin_client_try_discovery = dlsym(plugin_handle,
+ "aitt_plugin_client_try_discovery");
+ if (!plugin_client_try_discovery) {
+ LOGE("Failed to find plugin_client_try_discovery");
+ return false;
+ }
+
+ plugin_client_stop_discovery = dlsym(plugin_handle,
+ "aitt_plugin_client_stop_discovery");
+ if (!plugin_client_stop_discovery) {
+ LOGE("Failed to find plugin_client_stop_discovery");
+ return false;
+ }
+
+ plugin_client_connect = dlsym(plugin_handle,
+ "aitt_plugin_client_connect");
+ if (!plugin_client_connect) {
+ LOGE("Failed to find plugin_client_connect");
+ return false;
+ }
+
+ plugin_client_disconnect = dlsym(plugin_handle,
+ "aitt_plugin_client_disconnect");
+ if (!plugin_client_disconnect) {
+ LOGE("Failed to find plugin_client_disconnect");
+ return false;
+ }
+
+ plugin_client_send_data = dlsym(plugin_handle,
+ "aitt_plugin_client_send_data");
+ if (!(*plugin_client_send_data)) {
+ LOGE("Failed to find plugin_client_send_data");
+ return false;
+ }
+
+ plugin_client_send_payload_async = dlsym(plugin_handle,
+ "aitt_plugin_client_send_payload_async");
+ if (!plugin_client_send_payload_async) {
+ LOGE("Failed to init plugin_client_send_payload_async");
+ return false;
+ }
+
+ plugin_client_add_connection_result_cb = dlsym(plugin_handle,
+ "aitt_plugin_client_add_connection_result_cb");
+ if (!plugin_client_add_connection_result_cb) {
+ LOGE("Failed to find plugin_client_add_connection_result_cb");
+ return false;
+ }
+
+ plugin_client_add_payload_received_cb = dlsym(plugin_handle,
+ "aitt_plugin_client_add_payload_received_cb");
+ if (!plugin_client_add_payload_received_cb) {
+ LOGE("Failed to find plugin_client_add_payload_received_cb");
+ return false;
+ }
+
+ plugin_client_add_disconnected_cb = dlsym(plugin_handle,
+ "aitt_plugin_client_add_disconnected_cb");
+ if (!plugin_client_add_disconnected_cb) {
+ LOGE("Failed to find plugin_client_add_disconnected_cb");
+ return false;
+ }
+
+ return true;
+}
+)__c_cb";
+
+constexpr const char CB_BODY_SERVER[] =
+R"__c_cb(
+static bool __load_server_channel() {
+ plugin_server_create = dlsym(plugin_handle, "aitt_plugin_server_create");
+ if (!plugin_server_create) {
+ LOGE("Failed to find plugin_server_create");
+ return false;
+ }
+
+ plugin_server_add_connection_result_cb = dlsym(plugin_handle,
+ "aitt_plugin_server_add_connection_result_cb");
+ if (!plugin_server_add_connection_result_cb) {
+ LOGE("Failed to find plugin_server_add_connection_result_cb");
+ return false;
+ }
+
+ plugin_server_add_payload_received_cb = dlsym(plugin_handle,
+ "aitt_plugin_server_add_payload_received_cb");
+ if (!plugin_server_add_payload_received_cb) {
+ LOGE("Failed to find plugin_server_add_payload_received_cb");
+ return false;
+ }
+
+ plugin_server_add_disconnected_cb = dlsym(plugin_handle,
+ "aitt_plugin_server_add_disconnected_cb");
+ if (!plugin_server_add_disconnected_cb) {
+ LOGE("Failed to find plugin_server_add_disconnected_cb");
+ return false;
+ }
+
+ plugin_server_set_data_received_cb = dlsym(plugin_handle,
+ "aitt_plugin_server_set_data_received_cb");
+ if (!plugin_server_set_data_received_cb) {
+ LOGE("Failed to find plugin_server_set_data_received_cb");
+ return false;
+ }
+
+ plugin_server_listen = dlsym(plugin_handle, "aitt_plugin_server_listen");
+ if (!plugin_server_listen) {
+ LOGE("Failed to find plugin_server_listen");
+ return false;
+ }
+
+ plugin_server_foreach_connected_peer_info = dlsym(plugin_handle,
+ "aitt_plugin_server_foreach_connected_peer_info");
+ if (!(*plugin_server_foreach_connected_peer_info)) {
+ LOGE("Failed to find plugin_server_foreach_connected_peer_info");
+ return false;
+ }
+
+ plugin_server_accept = dlsym(plugin_handle, "aitt_plugin_server_accept");
+ if (!plugin_server_accept) {
+ LOGE("Failed to init plugin_server_accept");
+ return false;
+ }
+
+ plugin_server_reject = dlsym(plugin_handle, "aitt_plugin_server_reject");
+ if (!plugin_server_reject) {
+ LOGE("Failed to find plugin_server_reject");
+ return false;
+ }
+
+ plugin_server_set_display_name = dlsym(plugin_handle,
+ "aitt_plugin_server_set_display_name");
+ if (!plugin_server_set_display_name) {
+ LOGE("Failed to find plugin_server_set_display_name");
+ return false;
+ }
+
+ plugin_server_send_payload_async = dlsym(plugin_handle,
+ "aitt_plugin_server_send_payload_async");
+ if (!plugin_server_send_payload_async) {
+ LOGE("Failed to find plugin_server_send_payload_async");
+ return false;
+ }
+
+ plugin_server_destroy = dlsym(plugin_handle,
+ "aitt_plugin_server_destroy");
+ if (!plugin_server_destroy) {
+ LOGE("Failed to find plugin_server_destroy");
+ return false;
+ }
+
+ return true;
+}
+)__c_cb";
+
+#endif // IDLC_C_AITT_PLUGIN_GEN_INTERNAL_BODY_GEN_CB_H_
--- /dev/null
+/*
+ * Copyright (c) 2022 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 "idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen.h"
+
+namespace {
+#include "idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen_cb.h"
+}
+
+namespace tidl {
+
+AittPluginInternalHeaderGen::AittPluginInternalHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionHeaderGeneratorBase(doc, trans) {}
+
+void AittPluginInternalHeaderGen::OnInitGen(std::ofstream& stream) {
+ GenVersion(stream);
+
+ stream << CB_HEADER_START;
+ stream << CB_HEADER_DEF_COMMON;
+
+ switch (GetType()) {
+ case 1:
+ {
+ stream << CB_HEADER_DEF_CLIENT;
+ stream << CB_HEADER_FUN_CLIENT;
+ break;
+ }
+ case 2:
+ {
+ stream << CB_HEADER_DEF_SERVER;
+ stream << CB_HEADER_FUN_SERVER;
+ break;
+ }
+ case 3:
+ {
+ stream << CB_HEADER_DEF_GROUP;
+ stream << CB_HEADER_FUN_GROUP;
+ break;
+ }
+ default:
+ break;
+ }
+ stream << CB_HEADER_FUN_COMMOM;
+
+}
+
+void AittPluginInternalHeaderGen::OnFiniGen(std::ofstream& stream) {
+ GenExplicitLinkageClose(stream);
+}
+
+} // namespace tidl
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_AITT_PLUGIN_C_INTERNAL_HEADER_GEN_H_
+#define IDLC_AITT_PLUGIN_C_INTERNAL_HEADER_GEN_H_
+
+#include <memory>
+#include <string>
+
+#include "idlc/gen_cion/c_cion_header_gen_base.h"
+
+namespace tidl {
+
+class AittPluginInternalHeaderGen : public CCionHeaderGeneratorBase {
+ public:
+ explicit AittPluginInternalHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
+ virtual ~AittPluginInternalHeaderGen() = default;
+
+ void OnInitGen(std::ofstream& stream) override;
+ void OnFiniGen(std::ofstream& stream) override;
+};
+
+} // namespace tidl
+
+#endif // IDLC_AITT_PLUGIN_C_INTERNAL_HEADER_GEN_H_
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_C_AITT_PLUGIN_GEN_INTERNAL_HEADER_GEN_CB_H_
+#define IDLC_C_AITT_PLUGIN_GEN_INTERNAL_HEADER_GEN_CB_H_
+constexpr const char CB_HEADER_START[] =
+R"__c_cb(
+
+#pragma once
+
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _transfer_status_e {
+ SUCCESS, /**< Transfer is success **/
+ FAILURE, /**< Transfer is failed **/
+ IN_PROGRESS, /**< Transfer is in progress **/
+} transfer_status_e;
+
+typedef enum _payload_type_e {
+ AITT_PLUGIN_PAYLOAD_TYPE_DATA, /**< Data type payload **/
+ AITT_PLUGIN_PAYLOAD_TYPE_FILE, /**< File type payload **/
+} plugin_payload_type_e;
+
+typedef enum _connection_status_e {
+ CONNECTION_STATUS_OK, /**< Connection is ok **/
+ CONNECTION_STATUS_REJECTED, /**< Connection is rejected **/
+ CONNECTION_STATUS_ERROR, /**< Connection error occurs **/
+} plugin_connection_status_e;
+)__c_cb";
+
+constexpr const char CB_HEADER_DEF_COMMON[] =
+R"__c_cb(
+typedef void *plugin_peer_info_h;
+typedef void *plugin_connection_result_h;
+typedef void *plugin_payload_h;
+typedef void *plugin_payload_async_result_h;
+)__c_cb";
+
+constexpr const char CB_HEADER_DEF_SERVER[] =
+R"__c_cb(
+typedef void *plugin_server_h;
+
+typedef void (*plugin_server_connection_result_cb)(
+ const char *service_name, const plugin_peer_info_h peer_info,
+ const plugin_connection_result_h result, void *user_data);
+typedef void (*plugin_server_payload_received_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, const plugin_payload_h payload,
+ transfer_status_e status, void *user_data);
+typedef void (*plugin_server_connection_request_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*plugin_server_disconnected_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*plugin_server_data_received_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, const unsigned char *data,
+ unsigned int data_size, unsigned char **return_data,
+ unsigned int *return_data_size, void *user_data);
+typedef bool (*plugin_server_connected_peer_info_cb)(
+ const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*plugin_server_payload_async_result_cb)(
+ const plugin_payload_async_result_h result, void *user_data);
+)__c_cb";
+
+constexpr const char CB_HEADER_DEF_GROUP[] =
+R"__c_cb(
+typedef void *plugin_group_h;
+
+typedef void (*plugin_group_payload_received_cb)(const char *topic_name,
+ const plugin_peer_info_h peer_info, plugin_payload_h payload,
+ void *user_data);
+typedef void (*plugin_group_joined_cb)(const char *topic_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+
+typedef void (*plugin_group_left_cb)(const char *topic_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+)__c_cb";
+
+constexpr const char CB_HEADER_DEF_CLIENT[] =
+R"__c_cb(
+typedef void *plugin_client_h;
+
+typedef void (*plugin_client_server_discovered_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*plugin_client_connection_result_cb)(
+ const char *service_name, const plugin_peer_info_h peer_info,
+ const plugin_connection_result_h result, void *user_data);
+typedef void (*plugin_client_payload_async_result_cb)(
+ const plugin_payload_async_result_h result, void *user_data);
+typedef void (*plugin_client_payload_received_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, const plugin_payload_h payload,
+ transfer_status_e status, void *user_data);
+typedef void (*plugin_client_disconnected_cb)(const char *service_name,
+ const plugin_peer_info_h peer_info, void *user_data);
+)__c_cb";
+
+constexpr const char CB_HEADER_FUN_GROUP[] =
+R"__c_cb(
+int (*plugin_group_create)(plugin_group_h *, const char *,
+ const char *, int , const char *, const char *,
+ const char *, int);
+int (*plugin_group_destroy)(plugin_group_h);
+int (*plugin_group_subscribe)(plugin_group_h);
+int (*plugin_group_unsubscribe)(plugin_group_h);
+int (*plugin_group_publish)(plugin_group_h, plugin_payload_h);
+int (*plugin_group_add_payload_received_cb)(plugin_group_h,
+ plugin_group_payload_received_cb, void *);
+int (*plugin_group_add_joined_cb)(plugin_group_h,
+ plugin_group_joined_cb, void *);
+int (*plugin_group_add_left_cb)(plugin_group_h,
+ plugin_group_left_cb, void *);
+)__c_cb";
+
+constexpr const char CB_HEADER_FUN_CLIENT[] =
+R"__c_cb(
+int (*plugin_client_create)(plugin_client_h *, const char *,
+ const char *, int , const char *, const char *,
+ const char *, int);
+int (*plugin_client_destroy)(plugin_client_h);
+int (*plugin_client_try_discovery)(plugin_client_h,
+ plugin_client_server_discovered_cb, void *);
+int (*plugin_client_stop_discovery)(plugin_client_h);
+int (*plugin_client_connect)(plugin_client_h, const plugin_peer_info_h);
+int (*plugin_client_disconnect)(plugin_client_h);
+int (*plugin_client_send_data)(plugin_client_h, unsigned char *,
+ unsigned int, int, unsigned char **, unsigned int *);
+int (*plugin_client_send_payload_async)(plugin_client_h,
+ plugin_payload_h, plugin_client_payload_async_result_cb, void *);
+int (*plugin_client_add_connection_result_cb)(plugin_client_h,
+ plugin_client_connection_result_cb, void *);
+int (*plugin_client_add_payload_received_cb)(plugin_client_h,
+ plugin_client_payload_received_cb, void *);
+int (*plugin_client_add_disconnected_cb)(plugin_client_h,
+ plugin_client_disconnected_cb, void *);
+)__c_cb";
+
+constexpr const char CB_HEADER_FUN_SERVER[] =
+R"__c_cb(
+int (*plugin_server_create)(plugin_server_h *, const char *,
+ const char *, const char *, int ,const char *, const char *, const char *, int);
+int (*plugin_server_add_connection_result_cb)(plugin_server_h,
+ plugin_server_connection_result_cb, void *);
+int (*plugin_server_add_payload_received_cb)(plugin_server_h,
+ plugin_server_payload_received_cb, void *);
+int (*plugin_server_add_disconnected_cb)(plugin_server_h,
+ plugin_server_disconnected_cb, void *);
+int (*plugin_server_set_data_received_cb)(plugin_server_h,
+ plugin_server_data_received_cb , void *);
+int (*plugin_server_destroy)(plugin_server_h);
+int (*plugin_server_listen)(plugin_server_h,
+ plugin_server_connection_request_cb, void *);
+int (*plugin_server_foreach_connected_peer_info)(plugin_server_h,
+ plugin_server_connected_peer_info_cb, void *);
+int (*plugin_server_accept)(plugin_server_h, const plugin_peer_info_h);
+int (*plugin_server_reject)(plugin_server_h,const plugin_peer_info_h,
+ const char *);
+int (*plugin_server_set_display_name)(plugin_server_h, const char *);
+int (*plugin_server_send_payload_async)(plugin_server_h,
+ plugin_peer_info_h, plugin_payload_h,
+ plugin_server_payload_async_result_cb, void *);
+)__c_cb";
+
+constexpr const char CB_HEADER_FUN_COMMOM[] =
+R"__c_cb(
+int (*plugin_payload_create)(plugin_payload_h *, plugin_payload_type_e);
+int (*plugin_payload_destroy)(plugin_payload_h);
+int (*plugin_payload_get_type)(plugin_payload_h, plugin_payload_type_e *);
+int (*plugin_payload_get_data)(plugin_payload_h, unsigned char **, unsigned int *);
+int (*plugin_payload_set_data)(plugin_payload_h, const unsigned char *, unsigned int);
+int (*plugin_payload_save_as_file)(plugin_payload_h, const char *);
+int (*plugin_payload_get_received_file_name)(plugin_payload_h, char **);
+int (*plugin_payload_get_received_bytes)(plugin_payload_h, uint64_t *);
+int (*plugin_payload_get_total_bytes)(plugin_payload_h, uint64_t *);
+int (*plugin_payload_set_file_path)(plugin_payload_h, const char *);
+int (*plugin_payload_get_payload_id)(plugin_payload_h, char **);
+
+int (*plugin_peer_info_clone)(const plugin_peer_info_h, plugin_peer_info_h *);
+int (*plugin_peer_info_destroy)(plugin_peer_info_h);
+int (*plugin_peer_info_get_device_id)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_device_name)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_device_platform)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_device_platform_version)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_device_type)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_app_id)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_app_version)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_uuid)(plugin_peer_info_h, char **);
+int (*plugin_peer_info_get_display_name)(plugin_peer_info_h, char **);
+
+int (*plugin_connection_result_get_status)(const plugin_connection_result_h, plugin_connection_status_e *);
+int (*plugin_connection_result_get_reason)(const plugin_connection_result_h, char **reason);
+)__c_cb";
+
+#endif // IDLC_C_AITT_PLUGIN_GEN_INTERNAL_HEADER_GEN_CB_H_
--- /dev/null
+/*
+ * Copyright (c) 2022 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 "idlc/gen_aitt_plugin/aitt_plugin_loader.h"
+
+#include "idlc/gen_aitt_plugin/aitt_plugin_c_transportable.h"
+#include "idlc/gen_cion/default_cpp_transportable.h"
+#include "idlc/gen_cion/default_java_transportable.h"
+#include "idlc/gen_cion/default_cs_transportable.h"
+
+namespace tidl {
+
+AIttPluginLoader::AIttPluginLoader(const std::string& plugin_path) {
+ if (plugin_path.empty()) {
+ C_.reset(new AittPluginCTransportable());
+// Cpp_.reset(new DefaultCppTransportable());
+// Cs_.reset(new DefaultCsTransportable());
+// Java_.reset(new DefaultJavaTransportable());
+ } else {
+ // TODO
+ }
+}
+
+const CTransportable& AIttPluginLoader::C() {
+ return *C_;
+}
+
+const CppTransportable& AIttPluginLoader::Cpp() {
+ return *Cpp_;
+}
+
+const CsTransportable& AIttPluginLoader::Cs() {
+ return *Cs_;
+
+}
+
+const JavaTransportable& AIttPluginLoader::Java() {
+ return *Java_;
+}
+} // namespace tidl
--- /dev/null
+/*
+ * Copyright (c) 2022 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 IDLC_GEN_AITT_PLUGIN_LOADER_H_
+#define IDLC_GEN_AITT_PLUGIN_LOADER_H_
+
+#include <memory>
+#include <string>
+
+#include "idlc/gen_cion/transportable.h"
+
+namespace tidl {
+
+class AIttPluginLoader : public Transportable {
+ public:
+ explicit AIttPluginLoader(const std::string& plugin_path);
+
+ const CTransportable& C() override;
+ const CppTransportable& Cpp() override;
+ const CsTransportable& Cs() override;
+ const JavaTransportable& Java() override;
+
+ private:
+ std::unique_ptr<CTransportable> C_;
+ std::unique_ptr<CppTransportable> Cpp_;
+ std::unique_ptr<CsTransportable> Cs_;
+ std::unique_ptr<JavaTransportable> Java_;
+};
+
+} // namespace tidl
+
+#endif // IDLC_GEN_AITT_PLUGIN_LOADER_H_
\ No newline at end of file
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
ret = rpc_port_parcel_read_array_count(parcel, &h->size);
if (ret != RPC_PORT_ERROR_NONE) {
_E("Failed to read array count. error(%d)", ret);
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
h->value = calloc(h->size, sizeof(<ELEMENT_TYPE_SIZE>));
if (h->value == nullptr) {
_E("Out of memory");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
<PARCEL_READ>
}
- set_last_result(CION_ERROR_NONE);
+ set_last_result(<ERROR_PREFIX>_ERROR_NONE);
}
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
handle->parcelable.to = __<PREFIX>_<NAME>_to;
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<ELEMENTS_FREE>
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone)
if (h == nullptr || clone == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
ret = rpc_port_parcel_create(&parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
return ret;
ret = get_last_result();
rpc_port_parcel_destroy(parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
return ret;
*clone = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_set(<PREFIX>_<NAME>_h h, <PARAM_TYPE_IN>*value, int size)
if (h == nullptr || value == nullptr || size <= 0) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
handle->size = size;
ret = <PREFIX>_<NAME>_clone(handle, &clone);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to clone handle. error(%d)", ret);
handle->value = nullptr;
handle->size = 0;
clone->size = 0;
<PREFIX>_<NAME>_destroy(clone);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_get(<PREFIX>_<NAME>_h h, <PARAM_TYPE_OUT>*value, int *size)
if (h == nullptr || value == nullptr || size == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_clone(h, &handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to clone handle. error(%d)", ret);
return ret;
}
handle->size = 0;
<PREFIX>_<NAME>_destroy(handle);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
)__c_cb";
constexpr const char CB_STRUCTURE_ARRAY_USER_DEFINED_PARCEL_READ[] =
R"__c_cb(
ret = <PREFIX>_<NAME>_create(&value);
-if (ret != CION_ERROR_NONE) {
+if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
set_last_result(ret);
return;
rpc_port_parcel_read_bundle(parcel, &value);
if (value == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
rpc_port_parcel_read_string(parcel, &value);
if (value == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
* limitations under the License.
*/
+#include <algorithm>
#include <cstring>
#include <vector>
namespace tidl {
-CCionBodyGeneratorBase::CCionBodyGeneratorBase(std::shared_ptr<Document> doc)
- : CCionGeneratorBase(doc) {
+CCionBodyGeneratorBase::CCionBodyGeneratorBase(
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionGeneratorBase(doc, trans) {
parcel_type_map_ = {
{"none", ""},
{"char", "byte"},
void CCionBodyGeneratorBase::GenLogTag(std::ofstream& stream,
const std::string& log_tag) {
- std::string code(ReplaceAll(CB_LOG_TAG, "<LOG_TAG>", log_tag));
+ std::string tag = log_tag;
+ std::transform(tag.begin(), tag.end(), tag.begin(), ::toupper);
+ std::string code(ReplaceAll(CB_LOG_TAG, "<LOG_TAG>", tag));
stream << code;
}
GetHandlePrefix());
code = ReplaceAll(code, "<NAME>", GetFullNameFromType(type));
} else if (type.ToString() == "bundle") {
- code = std::string(CB_STRUCTURE_ARRAY_BUNDLE_PARCEL_READ);
+ code = ReplaceAll(CB_STRUCTURE_ARRAY_BUNDLE_PARCEL_READ,
+ "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix());
} else if (type.ToString() == "string" || type.ToString() == "file") {
- code = std::string(CB_STRUCTURE_ARRAY_STRING_PARCEL_READ);
+ code = ReplaceAll(CB_STRUCTURE_ARRAY_STRING_PARCEL_READ,
+ "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix());
} else {
code = ReplaceAll(CB_STRUCTURE_ARRAY_BASE_PARCEL_READ, "<PARCEL_TYPE>",
GetParcelType(type));
// @see #CB_STRUCTURE_ARRAY_BASE
void CCionBodyGeneratorBase::GenStructureArrayBase(std::ofstream& stream,
const Structure& st) {
- std::string code(ReplaceAll(CB_STRUCTURE_ARRAY_BASE, "<PREFIX>",
- GetHandlePrefix()));
- code = ReplaceAll(code, "<NAME>", st.GetID());
-
auto& elm = *(st.GetElements().begin());
- code = ReplaceAll(code, "<PARCEL_WRITE>", GenArrayParcelWrite(elm));
- code = ReplaceAll(code, "<PARCEL_READ>", GenArrayParcelRead(elm));
-
auto& type = elm->GetType();
- auto param_type = GetParamTypeString(ParameterType::Direction::IN, type);
- code = ReplaceAll(code, "<PARAM_TYPE_IN>", param_type);
- param_type = GetParamTypeString(ParameterType::Direction::OUT, type);
- code = ReplaceAll(code, "<PARAM_TYPE_OUT>", param_type);
-
- auto element_type = GetDataTypeString(type, false);
- code = ReplaceAll(code, "<ELEMENT_TYPE>", element_type);
- auto element_type_size = GetDataTypeString(type, false);
- element_type_size = RemoveLastSpaces(element_type_size);
- code = ReplaceAll(code, "<ELEMENT_TYPE_SIZE>", element_type_size);
- code = ReplaceAll(code, "<ELEMENTS_FREE>", GenArrayElementsFree(elm));
- stream << SmartIndent(code);
+ ReplaceAll(CB_STRUCTURE_ARRAY_BASE)
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<NAME>", st.GetID())
+ .Change("<PARCEL_WRITE>", GenArrayParcelWrite(elm))
+ .Change("<PARCEL_READ>", GenArrayParcelRead(elm))
+ .Change("<PARAM_TYPE_IN>", GetParamTypeString(
+ ParameterType::Direction::IN, type))
+ .Change("<PARAM_TYPE_OUT>", GetParamTypeString(
+ ParameterType::Direction::OUT, type))
+ .Change("<ELEMENT_TYPE>", GetDataTypeString(type, false))
+ .Change("<ELEMENT_TYPE_SIZE>", RemoveLastSpaces(
+ GetDataTypeString(type, false)))
+ .Change("<ELEMENTS_FREE>", GenArrayElementsFree(elm))
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Transform([&](std::string str) {
+ return SmartIndent(str);
+ })
+ .Out(stream);
}
// @see #CB_STRUCTURE_LIST_USER_DEFINED_FREE
// @see #CB_STRUCTURE_LIST_BASE
void CCionBodyGeneratorBase::GenStructureListBase(std::ofstream& stream,
const Structure& st) {
- std::string code(ReplaceAll(CB_STRUCTURE_LIST_BASE, "<PREFIX>",
- GetHandlePrefix()));
- code = ReplaceAll(code, "<NAME>", st.GetID());
auto& elm = *(st.GetElements().begin());
auto& type = elm->GetType();
- code = ReplaceAll(code, "<DATA_TYPE>", GetDataTypeString(type, true));
- code = ReplaceAll(code, "<DATA_FREE>", GenListDataFree(elm));
-
- auto param_type = GetParamTypeString(ParameterType::Direction::IN, type);
- code = ReplaceAll(code, "<PARAM_TYPE_IN>", param_type);
-
- code = ReplaceAll(code, "<PARCEL_WRITE>", GenListParcelWrite(elm));
- code = ReplaceAll(code, "<PARCEL_READ>", GenListParcelRead(elm));
-
- code = ReplaceAll(code, "<LIST_ADD>", GenListAdd(elm));
- code = ReplaceAll(code, "<CALLBACK_PARAM_TYPE>",
- GenListCallbackParamType(elm));
-
- stream << SmartIndent(code);
+ ReplaceAll(CB_STRUCTURE_LIST_BASE)
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<NAME>", st.GetID())
+ .Change("<DATA_TYPE>", GetDataTypeString(type, true))
+ .Change("<DATA_FREE>", GenListDataFree(elm))
+ .Change("<PARAM_TYPE_IN>", GetParamTypeString(
+ ParameterType::Direction::IN, type))
+ .Change("<PARCEL_WRITE>", GenListParcelWrite(elm))
+ .Change("<PARCEL_READ>", GenListParcelRead(elm))
+ .Change("<LIST_ADD>", GenListAdd(elm))
+ .Change("<CALLBACK_PARAM_TYPE>", GenListCallbackParamType(elm))
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Transform([&](std::string str) {
+ return SmartIndent(str);
+ })
+ .Out(stream);
}
std::string CCionBodyGeneratorBase::GenBaseElements(const Elements& elms) {
return code;
}
+void CCionBodyGeneratorBase::GenCommonFuntions(std::ofstream& stream) {
+ std::string code = GetTransportable().C().GenBodyPeerInfoBase();
+ if(GetType() != 3) {
+ code += GetTransportable().C().GenBodyConnectionBase();
+ code += GetTransportable().C().GenBodyPayloadBase();
+ }
+
+ ReplaceAll(code,"<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
// @see #CB_STRUCTURE_BASE_USER_DEFINED_FREE
// @see #CB_STRUCTURE_BASE_BUNDLE_FREE
// @see #CB_STRUCTURE_BASE_STRING_FREE
code += GenBaseSetGet(st.GetID(), elms);
+ code = ReplaceAll(code, "<ERROR_PREFIX>",
+ GetTransportable().C().GenErrorPrefix());
+
stream << SmartIndent(code);
}
GetTransportable().C().GenServerFileSend("value",
"server", "peer_info"));
}
+
+ code = ReplaceAll(code)
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix());
+
stream << SmartIndent(code);
}
if (!has_list_file)
return;
- stream << SmartIndent(std::string(CB_PRIVATE_SHARING_LIST_SET));
-}
+ std::string code(ReplaceAll(CB_PRIVATE_SHARING_LIST_SET,
+ "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
+
+ stream << SmartIndent(code);
+ }
// @see #CB_LIST_FILE_SET_PAYLOAD
// @see #CB_ARRAY_FILE_SET_PRIVATE_SHARING
std::string CCionBodyGeneratorBase::GetFilePayloadSendString(const Interface& iface,
const Declaration& decl, bool is_proxy) {
- if (HasFile(iface, decl, is_proxy) != NotExist)
- return is_proxy? CB_FILE_PAYLOAD_SEND_CLIENT : CB_FILE_PAYLOAD_SEND_SERVER;
+ if (HasFile(iface, decl, is_proxy) != NotExist) {
+ std::string code;
+ if (is_proxy)
+ code = ReplaceAll(CB_FILE_PAYLOAD_SEND_CLIENT,
+ "<MODULE_PREFIX>", GetMoudlePrefix());
+ else
+ code = ReplaceAll(CB_FILE_PAYLOAD_SEND_SERVER,
+ "<MODULE_PREFIX>", GetMoudlePrefix());
+
+ return code;
+ }
return {};
}
File,
ArrayFile
};
- explicit CCionBodyGeneratorBase(std::shared_ptr<Document> doc);
+ explicit CCionBodyGeneratorBase(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionBodyGeneratorBase() = default;
void GenStructureDefs(std::ofstream& stream);
std::string GetFilePayloadSendString(const Interface& iface,
const Declaration& decl, bool is_proxy);
std::string GenSecurityString(const Interface& iface);
+ void GenCommonFuntions(std::ofstream& stream);
+ void GenFilePayloadFuntions(std::ofstream& stream);
+
private:
void GenStructureDef(std::ofstream& stream, const Structure& st);
void GenStructureBaseDef(std::ofstream& stream, const Structure& st);
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
<PARCEL_READ>
- set_last_result(CION_ERROR_NONE);
+ set_last_result(<ERROR_PREFIX>_ERROR_NONE);
}
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
handle->parcelable.to = __<PREFIX>_<NAME>_to;
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<ELEMENTS_FREE>
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone)
if (h == nullptr || clone == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
ret = rpc_port_parcel_create(&parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
return ret;
ret = get_last_result();
rpc_port_parcel_destroy(parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
return ret;
*clone = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
)__c_cb";
<PREFIX>_<NAME>_create(&h-><ELEMENT_NAME>);
if (h-><ELEMENT_NAME> == nullptr) {
_E("Failed to create handle");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
rpc_port_parcel_read(parcel, &h-><ELEMENT_NAME>->parcelable, h-><ELEMENT_NAME>);
-if (get_last_result() != CION_ERROR_NONE) {
+if (get_last_result() != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data");
return;
}
rpc_port_parcel_read_bundle(parcel, &h-><ELEMENT_NAME>);
if (h-><ELEMENT_NAME> == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
)__c_cb";
rpc_port_parcel_read_string(parcel, &h-><ELEMENT_NAME>);
if (h-><ELEMENT_NAME> == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
)__c_cb";
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_clone(value, &new_value);
-if (ret != CION_ERROR_NONE) {
+if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to clone handle. error(%d)", ret);
return ret;
}
h-><ELEMENT_NAME> = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = bundle_dup(value);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
<ELEMENT_FREE>
h-><ELEMENT_NAME> = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = strdup(value);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
<ELEMENT_FREE>
h-><ELEMENT_NAME> = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
R"__c_cb(
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
h-><ELEMENT_NAME> = value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (h-><ELEMENT_NAME> == nullptr) {
_E("<ELEMENT_NAME> is nullptr");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_clone(h-><ELEMENT_NAME>, &new_value);
-if (ret != CION_ERROR_NONE) {
+if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to clone handle. error(%d)", ret);
return ret;
}
*value = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (h-><ELEMENT_NAME> == nullptr) {
_E("<ELEMENT_NAME> is nullptr");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = bundle_dup(h-><ELEMENT_NAME>);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
*value = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (h-><ELEMENT_NAME> == nullptr) {
_E("<ELEMENT_NAME> is nullptr");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = strdup(h-><ELEMENT_NAME>);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
*value = new_value;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
R"__c_cb(
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*value = h-><ELEMENT_NAME>;
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
constexpr const char CB_INTERFACE_METHOD_FILE_PAYLOAD_SENDER_CLIENT_DEF[] =
-R"__c_cb(static int __cion_file_payload_send(<CLIENT_T> client, GList *list))__c_cb";
+R"__c_cb(static int __<MODULE_PREFIX>_file_payload_send(<CLIENT_T> client, GList *list))__c_cb";
constexpr const char CB_INTERFACE_METHOD_FILE_PAYLOAD_SENDER_SERVER_DEF[] =
-R"__c_cb(static int __cion_file_payload_send(<SERVER_T> server, const <PEER_T> peer_info, GList *list))__c_cb";
+R"__c_cb(static int __<MODULE_PREFIX>_file_payload_send(<SERVER_T> server, const <PEER_T> peer_info, GList *list))__c_cb";
constexpr const char CB_INTERFACE_METHOD_FILE_PAYLOAD_SENDER_DEF[] =
R"__c_cb(<FILE_PAYLOAD_SENDER_DEF>
{
const char *value;
GList *iter;
- int ret = CION_ERROR_NONE;
+ int ret = <ERROR_PREFIX>_ERROR_NONE;
if (g_list_length(list) == 0) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
iter = list;
size = g_list_length(list);
if (size == 0) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
array_file = calloc(size, sizeof(const char*));
if (array_file == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
iter = list;
constexpr const char CB_FILE_PAYLOAD_SEND_CLIENT[] =
R"__c_cb(
-res_ = __cion_file_payload_send(h->client, payload_files_);
-if (res_ != CION_ERROR_NONE) {
- _E("Failed to __cion_file_payload_send : %d", res_);
+res_ = __<MODULE_PREFIX>_file_payload_send(h->client, payload_files_);
+if (res_ != <ERROR_PREFIX>_ERROR_NONE) {
+ _E("Failed to __<MODULE_PREFIX>_file_payload_send : %d", res_);
goto out;
}
)__c_cb";
constexpr const char CB_FILE_PAYLOAD_SEND_SERVER[] =
R"__c_cb(
-__cion_file_payload_send(__<NAME>.stub, peer_info, payload_files_);
+__<MODULE_PREFIX>_file_payload_send(__<NAME>.stub, peer_info, payload_files_);
)__c_cb";
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
ret = rpc_port_parcel_read_array_count(parcel, &len);
if (ret != RPC_PORT_ERROR_NONE) {
_E("Failed to read array count. error(%d)", ret);
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
<PARCEL_READ>
}
- set_last_result(CION_ERROR_NONE);
+ set_last_result(<ERROR_PREFIX>_ERROR_NONE);
}
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
handle->parcelable.to = __<PREFIX>_<NAME>_to;
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (h->list) {
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone)
if (h == nullptr || clone == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
if (ret != RPC_PORT_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
rpc_port_parcel_write(parcel, &h->parcelable, h);
ret = get_last_result();
rpc_port_parcel_destroy(parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret);
<PREFIX>_<NAME>_destroy(handle);
return ret;
*clone = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_add(<PREFIX>_<NAME>_h h, <PARAM_TYPE_IN>value)
if (h == nullptr || callback == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
iter = h->list;
break;
}
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_remove(<PREFIX>_<NAME>_h h, unsigned int nth)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
found = g_list_nth(h->list, nth);
if (found == nullptr)
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
value = found->data;
h->list = g_list_remove_link(h->list, found);
<DATA_FREE>
g_list_free(found);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_length(<PREFIX>_<NAME>_h h, unsigned int *length)
{
if (h == nullptr || length == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*length = g_list_length(h->list);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
)__c_cb";
constexpr const char CB_STRUCTURE_LIST_USER_DEFINED_PARCEL_READ[] =
R"__c_cb(
ret = <PREFIX>_<NAME>_create(&value);
-if (ret != CION_ERROR_NONE) {
+if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
set_last_result(ret);
return;
}
rpc_port_parcel_read(parcel, &value->parcelable, value);
-if (get_last_result() != CION_ERROR_NONE) {
+if (get_last_result() != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", get_last_result());
<PREFIX>_<NAME>_destroy(value);
return;
rpc_port_parcel_read_bundle(parcel, &value);
if (value == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
rpc_port_parcel_read_string(parcel, &value);
if (value == nullptr) {
_E("Failed to read data");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
value = calloc(1, sizeof(sizeof(<VALUE_TYPE>)));
if (value == nullptr) {
_E("Out of memory");
- set_last_result(CION_ERROR_OUT_OF_MEMORY);
+ set_last_result(<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY);
return;
}
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_clone(value, &new_value);
-if (ret != CION_ERROR_NONE)
+if (ret != <ERROR_PREFIX>_ERROR_NONE)
return ret;
h->list = g_list_append(h->list, new_value);
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
constexpr const char CB_STRUCTURE_LIST_BUNDLE_ADD[] =
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = bundle_dup(value);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
h->list = g_list_append(h->list, new_value);
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
constexpr const char CB_STRUCTURE_LIST_STRING_ADD[] =
if (h == nullptr || value == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = strdup(value);
if (new_value == nullptr) {
_E("Failed to duplicate value");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
h->list = g_list_append(h->list, new_value);
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
new_value = calloc(1, sizeof(<VALUE_TYPE>));
if (new_value == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
*new_value = value;
h->list = g_list_append(h->list, new_value);
-return CION_ERROR_NONE;
+return <ERROR_PREFIX>_ERROR_NONE;
)__c_cb";
/**
namespace {
#include "idlc/gen_cion/c_cion_gen_base_cb.h"
-
-constexpr const char PREFIX_CION_PROXY[] = "cion_proxy";
-constexpr const char PREFIX_CION_STUB[] = "cion_stub";
-constexpr const char PREFIX_CION_GROUP[] = "cion_group";
-
} // namespace
namespace tidl {
-CCionGeneratorBase::CCionGeneratorBase(std::shared_ptr<Document> doc)
- : CionPluginBase(std::move(doc)) {
+CCionGeneratorBase::CCionGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CionPluginBase(std::move(doc), trans) {
structures_.clear();
type_map_ = {
{"char", "char "},
str = CB_HEADER;
}
- stream << ReplaceAll(str, "<INCLUDE>", GetTransportable().C().GenInclude());
+ str = ReplaceAll(str, "<INCLUDE>", GetTransportable().C().GenInclude(body, GetType()));
+ str = ReplaceAll(str, "<PREFIX>", GetHandlePrefix());
+ stream << str;
}
void CCionGeneratorBase::GenGNUSourceDefinition(std::ofstream& stream) {
return "-1";
}
+std::string CCionGeneratorBase::GetMoudlePrefix() {
+ std::string prefix = GetTransportable().C().GenModulePrefix();
+
+ if (!HasNamespace() || !IsGeneratedAPI())
+ return prefix;
+
+ return prefix + "_" + GetFileNamespace();
+}
+
std::string CCionGeneratorBase::GetHandlePrefix() {
std::string prefix;
switch(static_cast<tidl::Options::Type>(GetType())) {
case tidl::Options::Type::TYPE_STUB:
- prefix = PREFIX_CION_STUB;
+ prefix = GetTransportable().C().GenStubPrefix();
break;
case tidl::Options::Type::TYPE_PROXY:
- prefix = PREFIX_CION_PROXY;
+ prefix = GetTransportable().C().GenProxyPrefix();
break;
case tidl::Options::Type::TYPE_GROUP:
- prefix = PREFIX_CION_GROUP;
+ prefix = GetTransportable().C().GenGroupPrefix();
break;
default:
break;
class CCionGeneratorBase : public CionPluginBase {
public:
- explicit CCionGeneratorBase(std::shared_ptr<Document> doc);
+ explicit CCionGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionGeneratorBase() = default;
std::string RemoveLine(std::string lines, unsigned int line_num = 1);
void GenIncludeDefaultHeaders(std::ofstream& stream, bool body = true);
void GenGNUSourceDefinition(std::ofstream& stream);
std::string GetHandlePrefix();
+ std::string GetMoudlePrefix();
std::string RemoveLastSpaces(const std::string& str);
private:
#include <libgen.h>
#include <glib.h>
#include <dlog.h>
-<INCLUDE>
#include <rpc-port-parcel.h>
+<INCLUDE>
)__c_cb";
#endif // IDLC_C_CION_GEN_C_GEN_BASE_CB_H_
\ No newline at end of file
namespace tidl {
CCionGroupBodyGen::CCionGroupBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options)
- : CCionBodyGeneratorBase(doc), options_(std::move(options)) {
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans)
+ : CCionBodyGeneratorBase(doc, trans), options_(std::move(options)) {
}
void CCionGroupBodyGen::OnInitGen(std::ofstream& stream) {
GenGNUSourceDefinition(stream);
GenIncludeDefaultHeaders(stream);
GenIncludeHeader(stream);
- GenLogTag(stream, std::string("CION_GROUP"));
+ GenLogTag(stream, GetTransportable().C().GenGroupPrefix());
GenLogDefinition(stream);
GenBaseDefinition(stream);
GenInterfaceMethodHandlerType(stream);
GenStructureDefs(stream);
GenInterfaceDefs(stream);
GenStructures(stream);
+ GenCommonFuntions(stream);
GenInterfaces(stream);
}
void CCionGroupBodyGen::GenInterfaceMethodHandlerType(std::ofstream& stream) {
std::string code(ReplaceAll(CB_INTERFACE_METHOD_HANDLER_TYPE,
"<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType()));
+ code = ReplaceAll(code, "<MODULE_PREFIX>", GetMoudlePrefix());
+
stream << SmartIndent(code);
}
std::string prefix = GetHandlePrefix();
std::string name = iface.GetID();
ReplaceAll(CB_INTERFACE_BASE)
+ .Change("<EXTRA>", GetTransportable().C().GenGroupExtra())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
.Change("<GROUP_CREATE>", GetTransportable().C().GenGroupCreate())
- .Change("<PREFIX>", prefix)
.Change("<NAME>", name)
.ChangeToUpper("<UPPERCASE_PREFIX>", prefix)
.ChangeToUpper("<UPPERCASE_NAME>", name)
.Change("<SET_SECURITY>", GenSecurityString(iface))
.Change("<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType())
.Change("<SECURITY_T>", GetTransportable().C().GenSecurityType())
- .Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType())
+ .Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType(true))
.Change("<PAYLOAD_TYPE_E>", GetTransportable().C().GenPayloadTypeEnum())
.Change("<PAYLOAD_GET_TYPE>", GetTransportable().C().GenPayloadGetType())
.Change("<ERROR_NONE>", GetTransportable().C().GenErrorNone())
.Change("<PAYLOAD_TYPE_DATA>", GetTransportable().C().GenPayloadTypeData())
.Change("<PAYLOAD_GET_DATA>", GetTransportable().C().GenPayloadGetData())
.Change("<GROUP_DESTROY>", GetTransportable().C().GenGroupDestroy())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<PREFIX>", prefix)
.Transform([&](std::string str) {
return SmartIndent(str);
})
void CCionGroupBodyGen::GenInterfaceMethodHandlerBase(std::ofstream& stream,
const Interface& iface, const Declaration& decl) {
ReplaceAll(CB_INTERFACE_METHOD_HANDLER_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
{ "<METHOD_HANDLER_ARGS_DECL>", GenMethodHandlerArgsDecl(iface, decl) },
{ "<METHOD_HANDLER_CALLBACK_INVOKE>",
GenMethodHandlerCallbackInvoke(decl) },
{ "<METHOD_HANDLER_ARGS_FREE>", GenMethodHandlerArgsFree(iface, decl) },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
})
.Transform([&](std::string str){
return SmartIndent(str);
.ChangeToUpper("<UPPERCASE_NAME>", name)
.ChangeToUpper("<UPPERCASE_METHOD_NAME>", method_name)
.Change("<METHOD_PARCEL_WRITE>", GenMethodParcelWrite(iface, decl))
- .Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType())
- .Change("<GROUP_PUBLISH>", GetTransportable().C().GenGroupPublish()));
+ .Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType(true))
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<GROUP_PUBLISH>", GetTransportable().C().GenGroupPublish())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
return code;
}
class CCionGroupBodyGen : public CCionBodyGeneratorBase {
public:
explicit CCionGroupBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options);
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionGroupBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
constexpr const char CB_INTERFACE_METHOD_HANDLER_TYPE[] =
R"__c_cb(
-typedef int (*cion_group_method_handler)(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, void *data);
+typedef int (*_group_method_handler)(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, void *data);
)__c_cb";
/**
typedef struct <PREFIX>_<NAME>_s {
char *topic_name;
<GROUP_T> group;
- <SECURITY_T> security;
+ <SECURITY_T>
<PREFIX>_<NAME>_callback_s callback;
GRecMutex mutex;
void *user_data;
static int __<PREFIX>_<NAME>_method_<METHOD_NAME>_handler(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, void *user_data)
{
<PREFIX>_<NAME>_t *h = user_data;
- int ret_ = CION_ERROR_NONE;
+ int ret_ = <ERROR_PREFIX>_ERROR_NONE;
<METHOD_HANDLER_ARGS_DECL>
if (h == nullptr || h->group == nullptr) {
_E("Invalid parameter");
- ret_ = CION_ERROR_INVALID_PARAMETER;
+ ret_ = <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
goto out;
}
<METHOD_HANDLER_PARCEL_READ>
R"__c_cb(
static int __<PREFIX>_<NAME>_process_received_event(<PREFIX>_<NAME>_t *h, const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel)
{
- int ret = CION_ERROR_NONE;
+ int ret = <ERROR_PREFIX>_ERROR_NONE;
int cmd = -1;
rpc_port_parcel_read_int32(parcel, &cmd);
ret = __<NAME>_method_table[cmd](peer_info, parcel, h);
} else {
_W("Invalid protocol. cmd(%d)", cmd);
- ret = CION_ERROR_INVALID_PARAMETER;
+ ret = <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
return ret;
<PAYLOAD_GET_TYPE>
if (ret != <ERROR_NONE> || type != <PAYLOAD_TYPE_DATA>) {
- _E("Faled to cion_payload_get_type : [%d][%d]", ret, type);
+ _E("Faled to <MODULE_PREFIX>_payload_get_type : [%d][%d]", ret, type);
return;
}
<PAYLOAD_GET_DATA>
if (ret != <ERROR_NONE>) {
- _E("Faled to cion_payload_get_data : %d", ret);
+ _E("Faled to <MODULE_PREFIX>_payload_get_data : %d", ret);
return;
}
}
-int <PREFIX>_<NAME>_create(const char *topic_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
-{
+<EXTRA> {
<PREFIX>_<NAME>_t *handle;
int ret;
- <SECURITY_T> security;
+ <SECURITY_T>
if (topic_name == nullptr || callback == nullptr || h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (callback->joined == nullptr || callback->left == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
g_rec_mutex_init(&handle->mutex);
if (handle->topic_name == nullptr) {
_E("Failed to duplicate topic name");
<PREFIX>_<NAME>_destroy(handle);
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
<GROUP_CREATE>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
g_rec_mutex_lock(&h->mutex);
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
)__c_cb";
if (h == nullptr<METHOD_PARAMS_CHECK>) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
if (h->group == nullptr) {
_E("Not connected");
g_rec_mutex_unlock(&h->mutex);
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
res_ = rpc_port_parcel_create(&parcel_);
- if (res_ != CION_ERROR_NONE) {
+ if (res_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", res_);
g_rec_mutex_unlock(&h->mutex);
set_last_result(res_);
<PREFIX>_<NAME>_create(&<ARG>);
if (<ARG> == nullptr) {
_E("Failed to create handle");
- ret_ = CION_ERROR_OUT_OF_MEMORY;
+ ret_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
rpc_port_parcel_read(parcel, &<ARG>->parcelable, <ARG>);
-if (get_last_result() != CION_ERROR_NONE) {
+if (get_last_result() != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data");
<PREFIX>_<NAME>_destroy(<ARG>);
<ARG> = nullptr;
constexpr const char CB_INTERFACE_METHOD_DELEGATE_PARCEL_READ[] =
R"__c_cb(
ret_ = <PREFIX>_<NAME>_create(&<ARG>);
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret_);
goto out;
}
__<PREFIX>_<NAME>_set_peerInfo(<ARG>, peer_info);
rpc_port_parcel_read(parcel, &<ARG>->parcelable, <ARG>);
ret_ = get_last_result();
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret_);
goto out;
}
*/
constexpr const char CB_INTERFACE_METHOD_TABLE[] =
R"__c_cb(
-static cion_group_method_handler __<NAME>_method_table[] = {
+static _group_method_handler __<NAME>_method_table[] = {
<METHOD_HANDLERS>
};
)__c_cb";
rpc_port_parcel_read_bundle(parcel, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- ret_ = CION_ERROR_OUT_OF_MEMORY;
+ ret_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
rpc_port_parcel_read_string(parcel, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- ret_ = CION_ERROR_OUT_OF_MEMORY;
+ ret_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
)__c_cb";
namespace tidl {
-CCionGroupHeaderGen::CCionGroupHeaderGen(std::shared_ptr<Document> doc)
- : CCionHeaderGeneratorBase(doc) {
+CCionGroupHeaderGen::CCionGroupHeaderGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CCionHeaderGeneratorBase(doc, trans) {
}
void CCionGroupHeaderGen::OnInitGen(std::ofstream& stream) {
GenPragmaOnce(stream);
GenIncludeDefaultHeaders(stream, false);
GenExplicitLinkageOpen(stream);
+ GenCommonHandles(stream);
GenStructureHandles(stream);
GenInterfaceHandles(stream);
GenStructures(stream);
+ GenCommonBase(stream);
GenInterfaceCallbacks(stream);
GenInterfaces(stream);
}
void CCionGroupHeaderGen::GenInterfaceCallbackBase(std::ofstream& stream,
const Interface& iface) {
ReplaceAll(CB_INTERFACE_CALLBACK_BASE)
- .Change("<PREFIX>", GetHandlePrefix())
.Change("<NAME>", iface.GetID())
.Change("<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<PREFIX>", GetHandlePrefix())
.Transform([&](std::string code) {
return SmartIndent(code);
})
const Interface& iface, const Declaration& decl) {
ReplaceAll(CB_INTERFACE_METHOD_CALLBACK_BASE, {
{ "<RETURN_TYPE>", GetReturnTypeString(decl.GetType()) },
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
{ "<METHOD_PARAMS>", GenMethodParams(iface, decl) },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() },
})
.Transform([&](std::string code) {
return SmartIndent(code);
void CCionGroupHeaderGen::GenInterfaceBase(std::ofstream& stream,
const Interface& iface) {
ReplaceAll(CB_INTERFACE_BASE, {
+ { "<EXTRA>", GetTransportable().C().GenGroupExtra(false) },
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID()},
- { "<METHOD_CALLBACK_DECLS>", GenMethodCallbackDecls(iface) }
+ { "<METHOD_CALLBACK_DECLS>", GenMethodCallbackDecls(iface) },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() }
})
.Transform([&](std::string code) {
return SmartIndent(code);
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
- { "<METHOD_PARAMS>", GenMethodParams(iface, decl) }
+ { "<METHOD_PARAMS>", GenMethodParams(iface, decl) },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() }
})
.Transform([&](std::string code) {
return SmartIndent(code);
class CCionGroupHeaderGen : public CCionHeaderGeneratorBase {
public:
- explicit CCionGroupHeaderGen(std::shared_ptr<Document> doc);
+ explicit CCionGroupHeaderGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionGroupHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
* @brief Called when a peer joins a topic.
*
* @param[in] h The <PREFIX>_<NAME> handle
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data
- * @see cion_peer_info_clone()
+ * @see <MODULE_PREFIX>_peer_info_clone()
* @see #<PREFIX>_<NAME>_callback_s
*/
typedef void (*<PREFIX>_<NAME>_joined_cb)(<PREFIX>_<NAME>_h h,
* @brief Called when a peer leaves a topic.
*
* @param[in] h The <PREFIX>_<NAME> handle
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data
- * @see cion_peer_info_clone()
+ * @see <MODULE_PREFIX>_peer_info_clone()
* @see #<PREFIX>_<NAME>_callback_s
*/
typedef void (*<PREFIX>_<NAME>_left_cb)(<PREFIX>_<NAME>_h h,
<METHOD_CALLBACK_DECLS>
} <PREFIX>_<NAME>_callback_s;
-/**
- * @brief Creates a <PREFIX>_<NAME> handle.
- * @remarks The @a h handle should be released using
- * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
- *
- * @privilege %http://tizen.org/privilege/d2d.datasharing
- * %http://tizen.org/privilege/internet
- *
- * @param[in] topic_name topic_name The name of topic
- * @param[in] callback The set of callback functions to handle events
- * @param[in] user_data The user data to be passed to the callback function
- * @param[out] h The <PREFIX>_<NAME> handle
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_NOT_SUPPORTED Not supported
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CION_ERROR_PERMISSION_DENIED Permission denied
-
- * @see <PREFIX>_<NAME>_destroy()
- * @see #<PREFIX>_<NAME>_callback_s
- */
-int <PREFIX>_<NAME>_create(const char *topic_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+<EXTRA>
/**
* @brief Destroys the <PREFIX>_<NAME> handle.
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h);
/**
* @brief Called when the payload is received.
*
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] ...
* @param[in] user_data The user data passed from the registration function
- * @see cion_peer_info_clone()
+ * @see <MODULE_PREFIX>_peer_info_clone()
* @see #<PREFIX>_<NAME>_callback_s;
*/
typedef <RETURN_TYPE> (*<PREFIX>_<NAME>_<METHOD_NAME>_cb)(const <PEER_INFO_T> peer_info<METHOD_PARAMS>, void *user_data);
* @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section.
* @param[in] h The <PREFIX>_<NAME> handle
* @param[in] ...
- * @exception #CION_ERROR_NONE Successful
- * @exception #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @exception #CION_ERROR_IO_ERROR I/O error
+ * @exception #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @exception #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception #<ERROR_PREFIX>_ERROR_IO_ERROR I/O error
*/
<RETURN_TYPE><PREFIX>_<NAME>_invoke_<METHOD_NAME>(<PREFIX>_<NAME>_h h<METHOD_PARAMS>);
)__c_cb";
namespace tidl {
-CCionHeaderGeneratorBase::CCionHeaderGeneratorBase(std::shared_ptr<Document> doc)
- : CCionGeneratorBase(doc) {
+CCionHeaderGeneratorBase::CCionHeaderGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionGeneratorBase(doc, trans) {
for (auto& b : GetDocument().GetBlocks()) {
if (b->GetType() == Block::TYPE_STRUCTURE) {
auto& st = static_cast<const Structure&>(*b);
stream << CB_EXPLICIT_LINKAGE_CLOSE;
}
+void CCionHeaderGeneratorBase::GenCommonHandles(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderCommonHandle())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
+void CCionHeaderGeneratorBase::GenFileHandle(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderPayloadHandle())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
+void CCionHeaderGeneratorBase::GenFileBase(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderPayloadBase())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
+void CCionHeaderGeneratorBase::GenConnectionHandle(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderConnectionHandle())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
+void CCionHeaderGeneratorBase::GenConnectionBase(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderConnectionBase())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
+void CCionHeaderGeneratorBase::GenCommonBase(std::ofstream& stream) {
+ ReplaceAll(GetTransportable().C().GenHeaderBase())
+ .Change("<PREFIX>", GetHandlePrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Out(stream);
+}
+
void CCionHeaderGeneratorBase::GenStructureHandles(std::ofstream& stream) {
for (auto& b : GetDocument().GetBlocks()) {
if (b->GetType() == Block::TYPE_STRUCTURE) {
GetParamTypeString(ParameterType::Direction::IN, type))
.Change("<PARAM_TYPE_OUT>",
GetParamTypeString(ParameterType::Direction::OUT, type))
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
.Transform([&](std::string str) {
return SmartIndent(str);
})
.Change("<NAME>", st.GetID())
.Change("<PARAM_TYPE_IN>",
GetParamTypeString(ParameterType::Direction::IN, type))
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
.Transform([&](std::string str) {
return SmartIndent(str);
})
ReplaceAll(CB_STRUCTURE_BASE)
.Change("<PREFIX>", GetHandlePrefix())
.Change("<NAME>", st.GetID())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
.Transform([&](std::string str) {
return SmartIndent(str);
})
.Change("<PARAM_TYPE_OUT>",
GetParamTypeString(ParameterType::Direction::OUT, type))
.Change("<ELEMENT_NAME>", e->GetID())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
.Transform([&](std::string str) {
return SmartIndent(str);
})
class CCionHeaderGeneratorBase : public CCionGeneratorBase {
public:
- explicit CCionHeaderGeneratorBase(std::shared_ptr<Document> doc);
+ explicit CCionHeaderGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionHeaderGeneratorBase() = default;
void GenPragmaOnce(std::ofstream& stream);
void GenExplicitLinkageClose(std::ofstream& stream);
void GenStructureHandles(std::ofstream& stream);
void GenStructures(std::ofstream& stream);
+ void GenCommonHandles(std::ofstream& stream);
+ void GenCommonBase(std::ofstream& stream);
+ void GenFileHandle(std::ofstream& stream);
+ void GenFileBase(std::ofstream& stream);
+ void GenConnectionHandle(std::ofstream& stream);
+ void GenConnectionBase(std::ofstream& stream);
private:
void GenStructureHandle(std::ofstream& stream, const Structure& st);
* @param[out] h The <PREFIX>_<NAME> handle that is newly created
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h);
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h);
* @param[out] clone If successful, a new created <PREFIX>_<NAME> handle will be returned
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone);
* @param[in] size The size of the array
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_get()
*/
int <PREFIX>_<NAME>_set(<PREFIX>_<NAME>_h h, <PARAM_TYPE_IN>*value, int size);
* @param[out] size The size of the array
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_set()
*/
int <PREFIX>_<NAME>_get(<PREFIX>_<NAME>_h h, <PARAM_TYPE_OUT>*value, int *size);
* @param[out] h The <PREFIX>_<NAME> handle that is newly created
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h);
* @param[in] The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h);
* @param[out] clone If successful, a new created <PREFIX>_<NAME> handle will be returned
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone);
* @param[in] value The value
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_remove()
*/
int <PREFIX>_<NAME>_add(<PREFIX>_<NAME>_h h, <PARAM_TYPE_IN>value);
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_cb()
*/
int <PREFIX>_<NAME>_foreach(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_cb callback, void *user_data);
* @param[in] nth The position of the element
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_remove(<PREFIX>_<NAME>_h h, unsigned int nth);
* @param[out] length The number of elements
* @return @c on 0 success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_length(<PREFIX>_<NAME>_h h, unsigned int *length);
)__c_cb";
* @param[out] h The <PREFIX>_<NAME> handle that is newly created
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMTER Invaid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMTER Invaid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_create(<PREFIX>_<NAME>_h *h);
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h);
* @param[out] clone If successful, a new created <PREFIX>_<NAME> handle will be returned
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_destroy()
*/
int <PREFIX>_<NAME>_clone(<PREFIX>_<NAME>_h h, <PREFIX>_<NAME>_h *clone);
* @param[in] value The <ELEMENT_NAME>
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_get_<ELEMENT_NAME>()
*/
int <PREFIX>_<NAME>_set_<ELEMENT_NAME>(<PREFIX>_<NAME>_h h, <PARAM_TYPE_IN>value);
* @param[out] value The <ELEMENT_NAME>
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_set_<ELEMENT_NAME>
*/
int <PREFIX>_<NAME>_get_<ELEMENT_NAME>(<PREFIX>_<NAME>_h h, <PARAM_TYPE_OUT>value);
namespace tidl {
CCionProxyBodyGen::CCionProxyBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options)
- : CCionBodyGeneratorBase(doc), options_(std::move(options)) {
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans)
+ : CCionBodyGeneratorBase(doc, trans), options_(std::move(options)) {
}
void CCionProxyBodyGen::OnInitGen(std::ofstream& stream) {
GenGNUSourceDefinition(stream);
GenIncludeDefaultHeaders(stream);
GenIncludeHeader(stream);
- GenLogTag(stream, std::string("CION_PROXY"));
+ GenLogTag(stream, GetTransportable().C().GenProxyPrefix());
GenLogDefinition(stream);
GenBaseDefinition(stream);
GenInterfaceDelegateCallback(stream);
GenInterfaceDefs(stream);
GenFilePayloadSend(stream, true);
GenStructures(stream);
+ GenCommonFuntions(stream);
GenInterfaces(stream);
}
{ "<NAME>", iface.GetID() },
{ "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
{ "<CLIENT_T>", GetTransportable().C().GenClientType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
{ "<SECURITY_T>", GetTransportable().C().GenSecurityType() }
})
.Transform([&](std::string code) {
.Change("<CLIENT_STOP_DISCOVERY>",
GetTransportable().C().GenClientStopDiscovery("h->client"))
.Change("<CLIENT_CREATE>", GetTransportable().C().GenClientCreate())
- .Change("<PREFIX>", prefix)
+ .Change("<EXTRA>", GetTransportable().C().GenClientExtra())
.Change("<NAME>", name)
.ChangeToUpper("<UPPERCASE_PREFIX>", prefix)
.ChangeToUpper("<UPPERCASE_NAME>", name)
.Change("<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType())
.Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType())
.Change("<PAYLOAD_TRANSFER_STATUS_T>",
- GetTransportable().C().GenPayloadTransferStatusType())
+ GetTransportable().C().GenPayloadTransferStatusType(true))
.Change("<SECURITY_T>", GetTransportable().C().GenSecurityType())
.Change("<PAYLOAD_TYPE_E>", GetTransportable().C().GenPayloadTypeEnum())
.Change("<PAYLOAD_GET_TYPE>", GetTransportable().C().GenPayloadGetType())
.Change("<PAYLOAD_TYPE_FILE>", GetTransportable().C().GenPayloadTypeFile())
.Change("<PAYLOAD_GET_DATA>", GetTransportable().C().GenPayloadGetData())
.Change("<CLIENT_DESTROY>", GetTransportable().C().GenClientDestroy())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<PREFIX>", prefix)
.Transform([&](std::string code) {
return SmartIndent(code);
})
.Change("<DELEGATE_ARGS_FREE>", delegate_args_free)
.Change("<DELEGATE_CALLBACK_ARGS>", GenDelegateCallbackArgs(decl))
.Change("<GOTO_STATEMENT>", has_free ? "out:" + NLine(1) : "")
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
.Transform([&](std::string code) {
return SmartIndent(code);
})
.Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType())
.Change("<CLIENT_SEND_ASYNC>",
GetTransportable().C().GenClientSendAsync(
- "h->client", "pl_", "data_size_")));
+ "h->client", "pl_", "data_size_"))
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
return code;
}
decl))
.Change("<CLIENT_SEND>", GetTransportable().C().GenClientSend(
"h->client", "data_", "data_size_",
- "return_data_", "return_data_size_")));
+ "return_data_", "return_data_size_"))
+ .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+ .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
return code;
}
class CCionProxyBodyGen : public CCionBodyGeneratorBase {
public:
explicit CCionProxyBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options);
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionProxyBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
constexpr const char CB_INTERFACE_DELEGATE_CALLBACK[] =
R"__c_cb(
-typedef void (*cion_proxy_delegate_cb)(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id);
+typedef void (*_proxy_delegate_cb)(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id);
)__c_cb";
/**
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
rpc_port_parcel_read_bool(parcel, &h->once);
_I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
- set_last_result(CION_ERROR_NONE);
+ set_last_result(<ERROR_PREFIX>_ERROR_NONE);
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_create(<PREFIX>_<NAME>_<DELEGATE_NAME>_h *h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_<DELEGATE_NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
handle->parcelable.to = __<PREFIX>_<NAME>_<DELEGATE_NAME>_to;
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
_W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_clone(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_h *clone)
if (h == nullptr || clone == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_<DELEGATE_NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
ret = rpc_port_parcel_create(&parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret);
<PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(handle);
return ret;
ret = get_last_result();
rpc_port_parcel_destroy(parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret);
<PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(handle);
return ret;
*clone = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_set_callback(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_cb callback, void *user_data)
{
if (h == nullptr || callback == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
h->callback = callback;
h->user_data = user_data;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_set_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool once)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
h->once = once;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *id)
{
if (h == nullptr || id == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*id = h->id;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_seq_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *seq_id)
{
if (h == nullptr || seq_id == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*seq_id = h->seq_id;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_is_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool *once)
{
if (h == nullptr || once == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*once = h->once;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_tag(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, char **tag)
if (h == nullptr || tag == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id);
new_tag = strdup(buf);
if (new_tag == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
*tag = new_tag;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_dispose(<PREFIX>_<NAME>_h proxy, <PREFIX>_<NAME>_<DELEGATE_NAME>_h h)
if (proxy == nullptr || h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
found = g_list_find(proxy->delegates, h);
if (found == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
proxy->delegates = g_list_remove_link(proxy->delegates, found);
<PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(h);
g_list_free(found);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
static void __<PREFIX>_<NAME>_<DELEGATE_NAME>_delegate_handler(GList **delegates, rpc_port_parcel_h parcel, int id, int seq_id)
}
rpc_port_parcel_read(parcel, &<ARG>->parcelable, <ARG>);
-if (get_last_result() != CION_ERROR_NONE) {
+if (get_last_result() != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data");
goto out;
}
*/
constexpr const char CB_INTERFACE_DELEGATE_TABLE[] =
R"__c_cb(
-static cion_proxy_delegate_cb __<PREFIX>_<NAME>_delegate_table[] = {
+static _proxy_delegate_cb __<PREFIX>_<NAME>_delegate_table[] = {
<DELEGATE_HANDLERS>
};
)__c_cb";
typedef struct <PREFIX>_<NAME>_s {
char *service_name;
<CLIENT_T> client;
- <SECURITY_T> security;
+ <SECURITY_T>
<PREFIX>_<NAME>_callback_s callback;
void *user_data;
GList *delegates;
}
static void __<PREFIX>_<NAME>_connection_result(const char *service_name, const <PEER_INFO_T> peer_info,
- const cion_connection_result_h result, void *user_data)
+ const <MODULE_PREFIX>_connection_result_h result, void *user_data)
{
<PREFIX>_<NAME>_h h = user_data;
<PAYLOAD_GET_TYPE>
if (ret != <ERROR_NONE>) {
- _E("Faled to cion_payload_get_type : %d", ret);
+ _E("Faled to <MODULE_PREFIX>_payload_get_type : %d", ret);
return;
}
if (type == <PAYLOAD_TYPE_DATA>) {
<PAYLOAD_GET_DATA>
if (ret != <ERROR_NONE>) {
- _E("Faled to cion_payload_get_data : %d", ret);
+ _E("Faled to <MODULE_PREFIX>_payload_get_data : %d", ret);
return;
}
}
-int <PREFIX>_<NAME>_create(const char *service_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
-{
+<EXTRA> {
<PREFIX>_<NAME>_t *handle;
int ret;
- <SECURITY_T> security;
+ <SECURITY_T>
if (service_name == nullptr || callback == nullptr || h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (callback->connection_result == nullptr || callback->disconnected == nullptr || callback->discovered == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
g_rec_mutex_init(&handle->mutex);
if (handle->service_name == nullptr) {
_E("Failed to duplicate service name");
<PREFIX>_<NAME>_destroy(handle);
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
<CLIENT_CREATE>
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
g_rec_mutex_lock(&h->mutex);
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_try_connect(<PREFIX>_<NAME>_h h, const <PEER_INFO_T> peer_info)
if (h == nullptr || h->client == nullptr || peer_info == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<CLIENT_TRY_CONNECT>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
if (h == nullptr || h->client == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<CLIENT_DISCONNECT>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_try_discovery(<PREFIX>_<NAME>_h h)
if (h == nullptr || h->client == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<CLIENT_TRY_DISCOVERY>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_stop_discovery(<PREFIX>_<NAME>_h h)
if (h == nullptr || h->client == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<CLIENT_STOP_DISCOVERY>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
)__c_cb";
if (h == nullptr<METHOD_PARAMS_CHECK>) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
if (h->client == nullptr) {
_E("Not connected");
g_rec_mutex_unlock(&h->mutex);
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
res_ = rpc_port_parcel_create(&parcel_);
- if (res_ != CION_ERROR_NONE) {
+ if (res_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", res_);
g_rec_mutex_unlock(&h->mutex);
set_last_result(res_);
if (h == nullptr<METHOD_PARAMS_CHECK>) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return ret_;
}
g_rec_mutex_lock(&h->mutex);
if (h->client == nullptr) {
_E("Not connected");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
g_rec_mutex_unlock(&h->mutex);
return ret_;
}
__<PREFIX>_<NAME>_consume_command(return_data_, return_data_size_, &parcel_);
if (parcel_ == nullptr) {
_E("Invalid protocol");
- res_ = CION_ERROR_IO_ERROR;
+ res_ = <ERROR_PREFIX>_ERROR_IO_ERROR;
goto out;
}
<PREFIX>_<NAME>_create(&<ARG>);
if (<ARG> == nullptr) {
_E("Failed to create handle");
- res_ = CION_ERROR_OUT_OF_MEMORY;
+ res_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
rpc_port_parcel_read(parcel_, &<ARG>->parcelable, <ARG>);
-if (get_last_result() != CION_ERROR_NONE) {
+if (get_last_result() != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data");
<PREFIX>_<NAME>_destroy(<ARG>);
<ARG> = nullptr;
rpc_port_parcel_read_bundle(parcel_, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- res_ = CION_ERROR_OUT_OF_MEMORY;
+ res_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
rpc_port_parcel_read_string(parcel_, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- res_ = CION_ERROR_OUT_OF_MEMORY;
+ res_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
)__c_cb";
namespace tidl {
-CCionProxyHeaderGen::CCionProxyHeaderGen(std::shared_ptr<Document> doc)
- : CCionHeaderGeneratorBase(doc) {
+CCionProxyHeaderGen::CCionProxyHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionHeaderGeneratorBase(doc, trans) {
}
void CCionProxyHeaderGen::OnInitGen(std::ofstream& stream) {
GenPragmaOnce(stream);
GenIncludeDefaultHeaders(stream, false);
GenExplicitLinkageOpen(stream);
+ GenCommonHandles(stream);
+ GenConnectionHandle(stream);
+ GenFileHandle(stream);
GenStructureHandles(stream);
GenInterfaceHandles(stream);
+ GenCommonBase(stream);
+ GenConnectionBase(stream);
+ GenFileBase(stream);
GenStructures(stream);
GenInterfaces(stream);
}
void CCionProxyHeaderGen::GenInterfaceBase(std::ofstream& stream,
const Interface& iface) {
std::string code(ReplaceAll(CB_INTERFACE_BASE, {
+ { "<EXTRA>", GetTransportable().C().GenClientExtra(false) },
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
{ "<PAYLOAD_T>", GetTransportable().C().GenPayloadType() },
{ "<PAYLOAD_TRANSFER_STATUS_T>",
- GetTransportable().C().GenPayloadTransferStatusType() }
+ GetTransportable().C().GenPayloadTransferStatusType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() }
}));
stream << SmartIndent(code);
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<DELEGATE_NAME>", decl.GetID() },
- { "<DELEGATE_PARAMS>", GenDelegateParams(iface, decl) }
+ { "<DELEGATE_PARAMS>", GenDelegateParams(iface, decl) },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() }
}));
stream << SmartIndent(code);
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
- { "<METHOD_PARAMS>", GenMethodParams(iface, decl) }
+ { "<METHOD_PARAMS>", GenMethodParams(iface, decl) },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() }
}));
stream << SmartIndent(code);
}
class CCionProxyHeaderGen : public CCionHeaderGeneratorBase {
public:
- explicit CCionProxyHeaderGen(std::shared_ptr<Document> doc);
+ explicit CCionProxyHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionProxyHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
* @param[out] h The <PREFIX>_<NAME>_<DELEGATE_NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memorya
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memorya
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy()
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_dispose()
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_set_callback()
* @param[in] h The <PREFIX>_<NAME>_<DELEGATE_NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_create()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h);
* @param[out] clone If successful, a new created <PREFIX>_<NAME>_<DELEGATE_NAME> handle will be returned
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_clone(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_h *clone);
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_set_callback(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_cb callback, void *user_data);
* @param[in] once The flag if it's true, the delegate will be deleted after invocation
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_set_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool once);
* @param[out] id The ID
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *id);
* @param[out] seq_id The Sequence ID
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_seq_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *seq_id);
* @param[out] once The flag, it's true, the handle is for one-time
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_is_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool *once);
* @param[out] tag The tag
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_tag(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, char **tag);
* @param[in] h The <PREFIX>_<NAME>_<DELEGATE_NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_create()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_dispose(<PREFIX>_<NAME>_h proxy, <PREFIX>_<NAME>_<DELEGATE_NAME>_h h);
* @brief Called when the connection is accepted or rejected.
*
* @param[in] h The <PREFIX>_<NAME> handle
+ * @param[in] result The handle for connection result \n
+ * The @a result can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data passed from the registeration function
* @see #<PREFIX>_<NAME>_callback_s
*/
typedef void (*<PREFIX>_<NAME>_connection_result_cb)(<PREFIX>_<NAME>_h h,
- const cion_connection_result_h result, void *user_data);
+ const <MODULE_PREFIX>_connection_result_h result, void *user_data);
/**
* @brief Called when the proxy is disconnected.
/**
* @brief Called when the stub is discovered.
*
- * @param[in] h The <PREFIX>_<NAME> handle
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data passed from the registeration function
* @see #<PREFIX>_<NAME>_callback_s
- * @see #cion_peer_info_get_app_id()
- * @see #cion_peer_info_get_display_name()
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_get_app_id()
+ * @see #<MODULE_PREFIX>_peer_info_get_display_name()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
* @par Sample code:
* @code
<PREFIX>_<NAME>_h handle = user_data;
char *app_id = NULL;
- cion_peer_info_get_app_id(peer_info, &app_id);
+ <MODULE_PREFIX>_peer_info_get_app_id(peer_info, &app_id);
LOGI("stub_discovered(%s)", app_id);
<PREFIX>_<NAME>_try_connect(handle, peer_info);
/**
* @brief Called when the payload is received.
*
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] payload The received payload \n
* The @a payload can be used only in the callback. \n
* @param[in] status The status of transfer
* @param[in] user_data The user data passed from the registeration function
* @see #<PREFIX>_<NAME>_callback_s
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
*
* @par Sample code:
* @code
uint64_t bytes, total;
char data_path_buff[512];
- cion_peer_info_get_app_id(peer_info, &app_id);
- cion_payload_get_total_bytes(payload, &total);
- cion_payload_get_received_bytes(payload, &bytes);
- cion_payload_get_received_file_name(payload, &file_name);
+ <MODULE_PREFIX>_peer_info_get_app_id(peer_info, &app_id);
+ <MODULE_PREFIX>_payload_get_total_bytes(payload, &total);
+ <MODULE_PREFIX>_payload_get_received_bytes(payload, &bytes);
+ <MODULE_PREFIX>_payload_get_received_file_name(payload, &file_name);
- if (status == CION_PAYLOAD_TRANSFER_STATUS_SUCCESS) {
+ if (status == <ERROR_PREFIX>_PAYLOAD_TRANSFER_STATUS_SUCCESS) {
data_path = app_get_data_path();
if (data_path == NULL) {
LOGE("failed to get data path.");
}
snprintf(data_path_buff, 512, "%s%s", data_path, file_name);
- ret = cion_payload_save_as_file(payload, data_path_buff);
+ ret = <MODULE_PREFIX>_payload_save_as_file(payload, data_path_buff);
free(data_path);
LOGI("save file %s : %d", data_path_buff, ret);
} else {
<PREFIX>_<NAME>_file_received_cb file_received; /**< This callback function is called when when the payload is received. */
} <PREFIX>_<NAME>_callback_s;
-/**
- * @brief Creates a <PREFIX>_<NAME> handle.
- * @remarks The @a h handle should be released using
- * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
- *
- * @param[in] service_name The name of service
- * @param[in] callback The set of callback functions to handle proxy events
- * @param[in] user_data The user data to be passed to the callback function
- * @param[out] h The <PREFIX>_<NAME> handle
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @see <PREFIX>_<NAME>_destroy()
- * @see #<PREFIX>_<NAME>_callback_s
- */
-int <PREFIX>_<NAME>_create(const char *service_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+<EXTRA>
/**
* @brief Destroys the <PREFIX>_<NAME> handle.
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_destroy(<PREFIX>_<NAME>_h h);
* @privilege http://tizen.org/privilege/d2d.datasharing
*
* @param[in] h The <PREFIX>_<NAME> handle
- * @param[in] peer_info The Cion peer information handle
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #CION_ERROR_IO_ERROR IO error
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
*/
int <PREFIX>_<NAME>_try_connect(<PREFIX>_<NAME>_h h, const <PEER_INFO_T> peer_info);
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_create()
*/
int <PREFIX>_<NAME>_disconnect(<PREFIX>_<NAME>_h h);
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_ALREADY_IN_PROGRESS Already in progress
- * @retval #CION_ERROR_IO_ERROR IO error
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_ALREADY_IN_PROGRESS Already in progress
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
* @see <PREFIX>_<NAME>_stub_discovered_cb
*/
int <PREFIX>_<NAME>_try_discovery(<PREFIX>_<NAME>_h h);
* @param[in] h The <PREFIX>_<NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_OPERATION Invalid operation
* @see <PREFIX>_<NAME>_stub_discovered_cb
*/
int <PREFIX>_<NAME>_stop_discovery(<PREFIX>_<NAME>_h h);
* @remarks The specific error code can be obtained using the get_last_result() function. Error codes are described in Exception section.
* @param[in] h The <PREFIX>_<NAME> handle
* @param[in] ...
- * @exception #CION_ERROR_NONE Successful
- * @exception #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @exception #CION_ERROR_IO_ERROR I/O error
+ * @exception #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @exception #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception #<ERROR_PREFIX>_ERROR_IO_ERROR I/O error
*/
<RETURN_TYPE><PREFIX>_<NAME>_invoke_<METHOD_NAME>(<PREFIX>_<NAME>_h h<METHOD_PARAMS>);
)__c_cb";
namespace tidl {
CCionStubBodyGen::CCionStubBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options)
- : CCionBodyGeneratorBase(doc), options_(options) {
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans)
+ : CCionBodyGeneratorBase(doc, trans), options_(options) {
}
void CCionStubBodyGen::OnInitGen(std::ofstream& stream) {
GenGNUSourceDefinition(stream);
GenIncludeDefaultHeaders(stream);
GenIncludeHeader(stream);
- GenLogTag(stream, std::string("CION_STUB"));
+ GenLogTag(stream, GetTransportable().C().GenStubPrefix());
GenLogDefinition(stream);
GenBaseDefinition(stream);
GenThreadEnableDefinition(stream);
GenInterfaceDefs(stream);
GenFilePayloadSend(stream, false);
GenStructures(stream);
+ GenCommonFuntions(stream);
GenInterfaces(stream);
}
void CCionStubBodyGen::GenInterfaceMethodHandlerType(std::ofstream& stream) {
std::string code(ReplaceAll(CB_INTERFACE_METHOD_HANDLER_TYPE,
"<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType()));
+ code = ReplaceAll(code, "<MODULE_PREFIX>", GetMoudlePrefix());
stream << SmartIndent(code);
}
void CCionStubBodyGen::GenInterfaceDelegateDef(std::ofstream& stream,
const Interface& iface, const Declaration& decl) {
std::string code(ReplaceAll(CB_INTERFACE_DELEGATE_DEF, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<DELEGATE_NAME>", decl.GetID() },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
void CCionStubBodyGen::GenInterfaceContextBase(std::ofstream& stream,
const Interface& iface) {
std::string code(ReplaceAll(CB_INTERFACE_CONTEXT_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
std::string file_def = GetFilePayloadDefString(iface, decl, false);
std::string code(ReplaceAll(CB_INTERFACE_DELEGATE_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<FILE_LIST_SEND>", file_send },
{ "<FILE_LIST_FREE>", file_free },
{ "<SERVER_SEND_ASYNC>", GetTransportable().C().GenServerSendAsync(
.GenPeerInfoClone("h->peer_info", "&handle->peer_info") },
{ "<PEER_INFO_CLONE2>",
GetTransportable().C()
- .GenPeerInfoClone("peer_info", "&h->peer_info") }
+ .GenPeerInfoClone("peer_info", "&h->peer_info") },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
std::string file_free = GetFilePayloadFreeString(iface, decl);
std::string code(ReplaceAll(CB_INTERFACE_METHOD_HANDLER_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<FILE_LIST_SEND>", file_send },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
{ "<METHOD_HANDLER_PARCEL_WRITE>", GenMethodHandlerParcelWrite(iface, decl) },
{ "<FILE_LIST_FREE>", file_free },
{ "<METHOD_HANDLER_ARGS_FREE>", GenMethodHandlerArgsFree(iface, decl) },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
{ "<SERVER_REJECT>", GetTransportable().C().GenServerReject() },
{ "<SERVER_SET_DISPLAY_NAME>",
GetTransportable().C().GenServerSetDisplayName() },
- { "<PREFIX>", GetHandlePrefix() },
+ { "<EXTRA>", GetTransportable().C().GenServerExtra() },
{ "<NAME>", iface.GetID() },
{ "<SET_SECURITY>", GenSecurityString(iface) },
{ "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
{ "<PAYLOAD_T>", GetTransportable().C().GenPayloadType() },
{ "<PAYLOAD_TRANSFER_STATUS_T>",
- GetTransportable().C().GenPayloadTransferStatusType() },
+ GetTransportable().C().GenPayloadTransferStatusType(true) },
{ "<SECURITY_T>", GetTransportable().C().GenSecurityType() },
{ "<PAYLOAD_TYPE_E>", GetTransportable().C().GenPayloadTypeEnum() },
{ "<PAYLOAD_GET_TYPE>", GetTransportable().C().GenPayloadGetType() },
{ "<PAYLOAD_TYPE_FILE>", GetTransportable().C().GenPayloadTypeFile() },
{ "<PAYLOAD_GET_DATA>", GetTransportable().C().GenPayloadGetData() },
{ "<SERVER_FOREACH_CONNECTED_PEER_INFO>", GetTransportable().C().GenServerForeachConnectedPeerInfo(iface.GetID()) },
- { "<SERVER_SET_ONDEMAND_LAUNCH_ENABLED>", GetTransportable().C().GenServerSetOnDemandLaunchEnabled(iface.GetID()) }
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
class CCionStubBodyGen : public CCionBodyGeneratorBase {
public:
explicit CCionStubBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options);
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionStubBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
*/
constexpr const char CB_INTERFACE_METHOD_HANDLER_TYPE[] =
R"__c_cb(
-typedef int (*cion_stub_method_handler)(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, rpc_port_parcel_h return_parcel, void *data);
+typedef int (*_stub_method_handler)(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, rpc_port_parcel_h return_parcel, void *data);
)__c_cb";
/**
R"__c_cb(
typedef struct <PREFIX>_<NAME>_s {
<SERVER_T> stub;
- <SECURITY_T> security;
+ <SECURITY_T>
<PREFIX>_<NAME>_callback_s callback;
void *user_data;
GRecMutex mutex;
R"__c_cb(
static int __<PREFIX>_<NAME>_process_received_event(<PREFIX>_<NAME>_t *h, const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, rpc_port_parcel_h return_parcel)
{
- int ret = CION_ERROR_NONE;
+ int ret = <ERROR_PREFIX>_ERROR_NONE;
int cmd = -1;
rpc_port_parcel_read_int32(parcel, &cmd);
ret = __<NAME>_method_table[cmd](peer_info, parcel, return_parcel, h);
} else {
_W("Invalid protocol. cmd(%d)", cmd);
- ret = CION_ERROR_INVALID_PARAMETER;
+ ret = <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
return ret;
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
- set_last_result(CION_ERROR_INVALID_PARAMETER);
+ set_last_result(<ERROR_PREFIX>_ERROR_INVALID_PARAMETER);
return;
}
rpc_port_parcel_read_bool(parcel, &h->once);
_I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
- set_last_result(CION_ERROR_NONE);
+ set_last_result(<ERROR_PREFIX>_ERROR_NONE);
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_create(<PREFIX>_<NAME>_<DELEGATE_NAME>_h *h)
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
handle = calloc(1, sizeof(<PREFIX>_<NAME>_<DELEGATE_NAME>_t));
if (handle == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
handle->parcelable.to = __<PREFIX>_<NAME>_<DELEGATE_NAME>_to;
*h = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h)
{
if (h == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
_W("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
free(h);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_clone(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_h *clone)
if (h == nullptr || clone == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
ret = <PREFIX>_<NAME>_<DELEGATE_NAME>_create(&handle);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret);
return ret;
}
*clone = handle;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *id)
{
if (h == nullptr || id == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*id = h->id;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_seq_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *seq_id)
{
if (h == nullptr || seq_id == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*seq_id = h->seq_id;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_is_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool *once)
{
if (h == nullptr || once == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
*once = h->once;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_tag(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, char **tag)
if (h == nullptr || tag == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
snprintf(buf, sizeof(buf), "%d::%d", h->id, h->seq_id);
value = strdup(buf);
if (value == nullptr) {
_E("Out of memory");
- return CION_ERROR_OUT_OF_MEMORY;
+ return <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
}
*tag = value;
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
static int __<PREFIX>_<NAME>_<DELEGATE_NAME>_set_peerInfo(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, const <PEER_INFO_T> peer_info)
{
if (h == nullptr || peer_info == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
return <PEER_INFO_CLONE2>
if (h == nullptr || h->peer_info == nullptr<DELEGATE_PARAMS_CHECK>) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
peer_info = h->peer_info;
if (h->once && !h->valid) {
_E("The delegate handle is already used");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
g_rec_mutex_lock(&__<NAME>.mutex);
ret_ = rpc_port_parcel_create(&parcel_);
- if (ret_ != CION_ERROR_NONE) {
+ if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret_);
g_rec_mutex_unlock(&__<NAME>.mutex);
return ret_;
static int __<PREFIX>_<NAME>_method_<METHOD_NAME>_handler(const <PEER_INFO_T> peer_info, rpc_port_parcel_h parcel, rpc_port_parcel_h return_parcel, void *user_data)
{
<PREFIX>_<NAME>_t *h = user_data;
- int ret_ = CION_ERROR_NONE;
+ int ret_ = <ERROR_PREFIX>_ERROR_NONE;
<FILE_LIST_DEF>
<METHOD_HANDLER_ARGS_DECL>
if (h == nullptr || h->stub == nullptr) {
_E("Invalid parameter");
- ret_ = CION_ERROR_INVALID_PARAMETER;
+ ret_ = <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
goto out;
}
<METHOD_HANDLER_PARCEL_READ>
constexpr const char CB_INTERFACE_METHOD_DELEGATE_PARCEL_READ[] =
R"__c_cb(
ret_ = <PREFIX>_<NAME>_create(&<ARG>);
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret_);
goto out;
}
__<PREFIX>_<NAME>_set_peerInfo(<ARG>, peer_info);
rpc_port_parcel_read(parcel, &<ARG>->parcelable, <ARG>);
ret_ = get_last_result();
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret_);
goto out;
}
constexpr const char CB_INTERFACE_METHOD_USER_DEFINED_PARCEL_READ[] =
R"__c_cb(
ret_ = <PREFIX>_<NAME>_create(&<ARG>);
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create handle. error(%d)", ret_);
goto out;
}
rpc_port_parcel_read(parcel, &<ARG>->parcelable, <ARG>);
ret_ = get_last_result();
-if (ret_ != CION_ERROR_NONE) {
+if (ret_ != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to read data. error(%d)", ret_);
goto out;
}
rpc_port_parcel_read_bundle(parcel, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- ret_ = CION_ERROR_OUT_OF_MEMORY;
+ ret_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
)__c_cb";
rpc_port_parcel_read_string(parcel, &<ARG>);
if (<ARG> == nullptr) {
_E("Failed to read data");
- ret_ = CION_ERROR_OUT_OF_MEMORY;
+ ret_ = <ERROR_PREFIX>_ERROR_OUT_OF_MEMORY;
goto out;
}
)__c_cb";
*/
constexpr const char CB_INTERFACE_METHOD_TABLE[] =
R"__c_cb(
-static cion_stub_method_handler __<NAME>_method_table[] = {
+static _stub_method_handler __<NAME>_method_table[] = {
<METHOD_HANDLERS>
};
)__c_cb";
}
static void __<PREFIX>_<NAME>_connection_result_cb(const char *service_name, const <PEER_INFO_T> peer_info,
- const cion_connection_result_h result, void *user_data)
+ const <MODULE_PREFIX>_connection_result_h result, void *user_data)
{
<PREFIX>_<NAME>_t *h = user_data;
<PAYLOAD_GET_TYPE>
if (ret != <ERROR_NONE>) {
- _E("Faled to cion_payload_get_type : %d", ret);
+ _E("Faled to <MODULE_PREFIX>_payload_get_type : %d", ret);
return;
}
if (type == <PAYLOAD_TYPE_DATA>) {
<PAYLOAD_GET_DATA>
if (ret != <ERROR_NONE>) {
- _E("Faled to cion_payload_get_data : %d", ret);
+ _E("Faled to <MODULE_PREFIX>_payload_get_data : %d", ret);
return;
}
}
ret = rpc_port_parcel_create(&return_parcel);
- if (ret != CION_ERROR_NONE) {
+ if (ret != <ERROR_PREFIX>_ERROR_NONE) {
_E("Failed to create parcel handle. error(%d)", ret);
rpc_port_parcel_destroy(parcel);
return;
}
-int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data)
-{
+<EXTRA>{
int ret;
- <SECURITY_T> security;
+ <SECURITY_T>
if (callback == nullptr || callback->connection_result == nullptr || callback->disconnected == nullptr || callback->connection_request == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
if (__<NAME>.stub) {
_E("Already exists");
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
g_rec_mutex_init(&__<NAME>.mutex);
<SERVER_REGISTER>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_unregister(void)
<SERVER_UNREGISTER>
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_foreach_peer_info(<PREFIX>_<NAME>_peer_info_cb callback, void *user_data)
{
if (callback == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
g_rec_mutex_lock(&__<NAME>.mutex);
<SERVER_FOREACH_CONNECTED_PEER_INFO>
g_rec_mutex_unlock(&__<NAME>.mutex);
- return CION_ERROR_NONE;
+ return <ERROR_PREFIX>_ERROR_NONE;
}
int <PREFIX>_<NAME>_accept(const <PEER_INFO_T> peer_info)
if (peer_info == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<SERVER_ACCEPT>
if (peer_info == nullptr) {
_E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<SERVER_REJECT>
int ret;
if (display_name == nullptr) {
- _E("Invalid parameter");
- return CION_ERROR_INVALID_PARAMETER;
+ _E("Invalid parameter");
+ return <ERROR_PREFIX>_ERROR_INVALID_PARAMETER;
}
<SERVER_SET_DISPLAY_NAME>
return ret;
}
-
-int <PREFIX>_<NAME>_set_ondemand_launch_enabled(bool enable)
-{
- <SERVER_SET_ONDEMAND_LAUNCH_ENABLED>
-}
-
)__c_cb";
#endif // IDLC_C_CION_GEN_C_STUB_BODY_GEN_CB_H_
namespace tidl {
-CCionStubHeaderGen::CCionStubHeaderGen(std::shared_ptr<Document> doc)
- : CCionHeaderGeneratorBase(doc) {}
+CCionStubHeaderGen::CCionStubHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CCionHeaderGeneratorBase(doc, trans) {}
void CCionStubHeaderGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
GenPragmaOnce(stream);
GenIncludeDefaultHeaders(stream, false);
GenExplicitLinkageOpen(stream);
+ GenCommonHandles(stream);
+ GenConnectionHandle(stream);
+ GenFileHandle(stream);
GenStructureHandles(stream);
GenInterfaceHandles(stream);
+ GenCommonBase(stream);
+ GenConnectionBase(stream);
+ GenFileBase(stream);
GenStructures(stream);
GenInterfaceCallbacks(stream);
GenInterfaces(stream);
void CCionStubHeaderGen::GenInterfaceCallbackBase(std::ofstream& stream,
const Interface& iface) {
std::string code(ReplaceAll(CB_INTERFACE_CALLBACK_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
{ "<PAYLOAD_T>", GetTransportable().C().GenPayloadType() },
{ "<PAYLOAD_TRANSFER_STATUS_T>",
- GetTransportable().C().GenPayloadTransferStatusType() }
+ GetTransportable().C().GenPayloadTransferStatusType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<PREFIX>", GetHandlePrefix() },
}));
stream << SmartIndent(code);
const Interface& iface, const Declaration& decl) {
std::string code(ReplaceAll(CB_INTERFACE_METHOD_CALLBACK_BASE, {
{ "<RETURN_TYPE>", GetReturnTypeString(decl.GetType()) },
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<METHOD_NAME>", decl.GetID() },
{ "<METHOD_PARAMS>", GenMethodParams(iface, decl) },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
void CCionStubHeaderGen::GenInterfaceDelegateBase(std::ofstream& stream,
const Interface& iface, const Declaration& decl) {
std::string code(ReplaceAll(CB_INTERFACE_DELEGATE_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<DELEGATE_NAME>", decl.GetID() },
- { "<DELEGATE_PARAMS>", GenDelegateParams(iface, decl) }
+ { "<DELEGATE_PARAMS>", GenDelegateParams(iface, decl) },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
void CCionStubHeaderGen::GenInterfaceBase(std::ofstream& stream,
const Interface& iface) {
std::string code(ReplaceAll(CB_INTERFACE_BASE, {
- { "<PREFIX>", GetHandlePrefix() },
+ { "<EXTRA>", GetTransportable().C().GenServerExtra(false) },
{ "<NAME>", iface.GetID() },
{ "<METHOD_CALLBACK_DECLS>", GenMethodCallbackDecls(iface) },
- { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() }
+ { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
+ { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
+ { "<MODULE_PREFIX>", GetMoudlePrefix() },
+ { "<PREFIX>", GetHandlePrefix() }
}));
stream << SmartIndent(code);
class CCionStubHeaderGen : public CCionHeaderGeneratorBase {
public:
- explicit CCionStubHeaderGen(std::shared_ptr<Document> doc);
+ explicit CCionStubHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CCionStubHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
* @param[out] h The <PREFIX>_<NAME>_<DELEGATE_NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_create(<PREFIX>_<NAME>_<DELEGATE_NAME>_h *h);
* @param[in] h The <PREFIX>_<NAME>_<DELEGATE_NAME> handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_clone()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h);
* @param[out] clone If successful, a new created <PREFIX>_<NAME>_<DELEGATE_NAME> handle will be returned
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
* @see <PREFIX>_<NAME>_<DELEGATE_NAME>_destroy()
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_clone(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, <PREFIX>_<NAME>_<DELEGATE_NAME>_h *clone);
* @param[out] id The ID
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *id);
* @param[out] seq_id The Sequence ID
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_seq_id(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, int *seq_id);
* @param[out] once The flag, it's true, the handle is for one-time
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_is_once(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, bool *once);
* @param[out] tag The tag
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_get_tag(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h, char **tag);
* @param[in] ...
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CION_ERROR_IO_ERROR I/O error
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR I/O error
*/
int <PREFIX>_<NAME>_<DELEGATE_NAME>_invoke(<PREFIX>_<NAME>_<DELEGATE_NAME>_h h<DELEGATE_PARAMS>);
)__c_cb";
* @brief Called when the proxy is connected.
* @details The callback function is called when the proxy is connected to the stub.
*
- * @param[in] peer_info The Cion peer information handle
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] result The handle for connection result
* @param[in] user_data The user data passed from the registration function
* @see #<PREFIX>_<NAME>_callback_s
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
*/
typedef void (*<PREFIX>_<NAME>_connection_result_cb)(const <PEER_INFO_T> peer_info,
- const cion_connection_result_h result, void *user_data);
+ const <MODULE_PREFIX>_connection_result_h result, void *user_data);
/**
* @brief Called when the proxy is disconnected.
* @details The callback function is called when the proxy is disconnected from the stub.
*
- * @param[in] peer_info The Cion peer information handle
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data passed from the registration function
* @see #<PREFIX>_<NAME>_callback_s
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
*/
typedef void (*<PREFIX>_<NAME>_disconnected_cb)(const <PEER_INFO_T> peer_info, void *user_data);
/**
* @brief Called when the payload is received.
*
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] payload The received payload \n
* The @a payload can be used only in the callback. \n
* @param[in] status The status of transfer
* @param[in] user_data The user data passed from the registeration function
* @see #<PREFIX>_<NAME>_callback_s
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
*
* @par Sample code:
* @code
void <PREFIX>_<NAME>__file_received_cb(const <PEER_INFO_T> peer_info, const <PAYLOAD_T> payload,
- <PAYLOAD_TRANSFER_STATUS_T> status, void *user_data)
+ <PAYLOAD_TRANSFER_STATUS_T> status, void *user_data)
{
<PREFIX>_<NAME>_h handle = user_data;
uint64_t bytes, total;
char data_path_buff[512];
- cion_peer_info_get_app_id(peer_info, &app_id);
- cion_payload_get_total_bytes(payload, &total);
- cion_payload_get_received_bytes(payload, &bytes);
- cion_payload_get_received_file_name(payload, &file_name);
+ <MODULE_PREFIX>_peer_info_get_app_id(peer_info, &app_id);
+ <MODULE_PREFIX>_payload_get_total_bytes(payload, &total);
+ <MODULE_PREFIX>_payload_get_received_bytes(payload, &bytes);
+ <MODULE_PREFIX>_payload_get_received_file_name(payload, &file_name);
- if (status == CION_PAYLOAD_TRANSFER_STATUS_SUCCESS) {
+ if (status == <ERROR_PREFIX>_PAYLOAD_TRANSFER_STATUS_SUCCESS) {
data_path = app_get_data_path();
if (data_path == NULL) {
LOGE("failed to get data path.");
}
snprintf(data_path_buff, 512, "%s%s", data_path, file_name);
- ret = cion_payload_save_as_file(payload, data_path_buff);
+ ret = <MODULE_PREFIX>_payload_save_as_file(payload, data_path_buff);
free(data_path);
LOGI("save file %s : %d", data_path_buff, ret);
} else {
/**
* @brief Called when a connection is requested.
* @since_tizen 6.5
- * @param[in] peer_info The Cion peer information handle \n
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle \n
* The @a peer_info can be used only in the callback. To use outside, make a copy.
* @param[in] user_data The user data passed from the registration function
* @see #<PREFIX>_<NAME>_register()
- * @see #cion_peer_info_clone()
+ * @see #<MODULE_PREFIX>_peer_info_clone()
*
* @par Sample code:
* @code
char *app_version = NULL;
- cion_peer_info_get_app_version(peer_info, &app_version);
+ <MODULE_PREFIX>_peer_info_get_app_version(peer_info, &app_version);
if(strcmp(app_version, "1.1") == 0) {
<PREFIX>_<NAME>_accept(peer_info);
<METHOD_CALLBACK_DECLS>
} <PREFIX>_<NAME>_callback_s;
-/**
- * @brief Registers the set of the callback functions and the service_name.
- * @details This function registers the set of the callback functions to handle stub events.
- * And, the cion_server_listen() is called internally to handle events.
-
- * @privilege http://tizen.org/privilege/d2d.datasharing
- * @param[in] service_name The name of service
- * @param[in] display_name The display name of service
- * @param[in] callback The set of callback functions to handle stub events
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_NOT_SUPPORTED Not supported
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CION_ERROR_IO_ERROR IO error
- * @retval #CION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #CION_ERROR_OPERATION_FAILED Operation failed
- * @retval #CION_ERROR_PERMISSION_DENIED Permission denied
- * @see <PREFIX>_<NAME>_unregister()
- * @see #<PREFIX>_<NAME>_callback_s
- */
-int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data);
+<EXTRA>
/**
* @brief Unregisters the registered service_name.
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_peer_info_cb()
*/
int <PREFIX>_<NAME>_foreach_peer_info(<PREFIX>_<NAME>_peer_info_cb callback, void *user_data);
/**
* @brief Accepts the connection request from a peer.
- * @param[in] peer_info The Cion peer information handle
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_register()
* @see <PREFIX>_<NAME>_connection_request_cb()
*/
/**
* @brief Rejects the connection request from a peer.
- * @param[in] peer_info The Cion peer information handle
+ * @param[in] peer_info The <MODULE_PREFIX> peer information handle
* @param[in] reason The reason of reject
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
* @see <PREFIX>_<NAME>_register()
* @see <PREFIX>_<NAME>_connection_request_cb()
*/
* @param[in] display_name The display name
* @return @c 0 on success,
* otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CION_ERROR_IO_ERROR IO error
- * @see cion_peer_info_get_display_name()
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
+ * @see <MODULE_PREFIX>_peer_info_get_display_name()
*/
int <PREFIX>_<NAME>_set_display_name(const char *display_name);
-/**
- * @brief Sets on-demand launch state.
- * @details If the on-demand launch state is enabled, the server is launched on demand
- * when the request comes.
- * @privilege http://tizen.org/privilege/d2d.remotelaunch
-
- * @param[in] enabled The enable state
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #CION_ERROR_NONE Successful
- * @retval #CION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #CION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #CION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #CION_ERROR_IO_ERROR IO error
- */
-int <PREFIX>_<NAME>_set_ondemand_launch_enabled(bool enable);
-
)__c_cb";
/**
class CTransportable {
public:
virtual ~CTransportable() = default;
- virtual std::string GenInclude() const = 0;
+ virtual std::string GenInclude(bool body = true, int type = 0) const = 0;
+ virtual std::string GenHeaderBase() const = 0;
+ virtual std::string GenHeaderPayloadHandle() const = 0;
+ virtual std::string GenHeaderCommonHandle() const = 0;
+ virtual std::string GenHeaderConnectionHandle() const = 0;
+ virtual std::string GenHeaderPayloadBase() const = 0;
+ virtual std::string GenHeaderConnectionBase() const = 0;
+ virtual std::string GenBodyPayloadBase() const = 0;
+ virtual std::string GenBodyConnectionBase() const = 0;
+ virtual std::string GenBodyPeerInfoBase() const = 0;
+ virtual std::string GenProxyPrefix() const = 0;
+ virtual std::string GenStubPrefix() const = 0;
+ virtual std::string GenGroupPrefix() const = 0;
+ virtual std::string GenModulePrefix() const = 0;
+ virtual std::string GenErrorPrefix() const = 0;
+ virtual std::string GenServerExtra(bool body = true) const = 0;
+ virtual std::string GenClientExtra(bool body = true) const = 0;
+ virtual std::string GenGroupExtra(bool body = true) const = 0;
virtual std::string GenClientSendAsync(std::string client,
std::string payload, std::string size) const = 0;
virtual std::string GenClientSend(std::string client, std::string data,
virtual std::string GenClientFileSend(std::string path,
std::string client) const = 0;
virtual std::string GenGroupType() const = 0;
- virtual std::string GenPayloadTransferStatusType() const = 0;
+ virtual std::string GenPayloadTransferStatusType(bool internal_type = false) const = 0;
virtual std::string GenPeerInfoType() const = 0;
virtual std::string GenPeerInfoDestroy(std::string peer) const = 0;
- virtual std::string GenPayloadType() const = 0;
+ virtual std::string GenPayloadType(bool internal_type = false) const = 0;
virtual std::string GenClientType() const = 0;
- virtual std::string GenSecurityType() const = 0;
+ virtual std::string GenSecurityType(bool definition = true) const = 0;
virtual std::string GenServerType() const = 0;
virtual std::string GenClientTryConnect(std::string client,
std::string peer) const = 0;
virtual std::string GenPeerInfoClone(std::string src_peer,
std::string dest_peer) const = 0;
virtual std::string GenServerForeachConnectedPeerInfo(std::string name) const = 0;
- virtual std::string GenServerSetOnDemandLaunchEnabled(std::string name) const = 0;
};
} // namespace tidl
namespace tidl {
-CionPluginBase::CionPluginBase(std::shared_ptr<Document> doc)
+CionPluginBase::CionPluginBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
: Generator(std::move(doc)) {
- transportable_.reset(new PluginLoader(""));
+ transportable_ = trans;
}
Transportable& CionPluginBase::GetTransportable() {
class CionPluginBase : public Generator {
public:
- explicit CionPluginBase(std::shared_ptr<Document> doc);
+ explicit CionPluginBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CionPluginBase() = default;
Transportable& GetTransportable();
private:
- std::unique_ptr<Transportable> transportable_;
+ std::shared_ptr<tidl::Transportable> transportable_;
};
} // namespace tidl
namespace tidl {
-CppCionGeneratorBase::CppCionGeneratorBase(std::shared_ptr<Document> doc)
- : CionPluginBase(doc) {
+CppCionGeneratorBase::CppCionGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CionPluginBase(doc, trans) {
type_map_ = {
{"char", "char"}, {"int", "int"}, {"short", "short"},
{"long", "long long"}, {"string", "std::string"}, {"bool", "bool"},
class CppCionGeneratorBase : public CionPluginBase {
public:
- explicit CppCionGeneratorBase(std::shared_ptr<Document> doc);
+ explicit CppCionGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionGeneratorBase() = default;
void GenVersion(std::ofstream& stream);
namespace tidl {
-CppCionGroupBodyGen::CppCionGroupBodyGen(std::shared_ptr<Document> doc)
- : CppCionGeneratorBase(doc) {}
+CppCionGroupBodyGen::CppCionGroupBodyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans) {}
void CppCionGroupBodyGen::OnInitGen(std::ofstream& stream) {
std::string key(".cc");
class CppCionGroupBodyGen : public CppCionGeneratorBase {
public:
- explicit CppCionGroupBodyGen(std::shared_ptr<Document> doc);
+ explicit CppCionGroupBodyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionGroupBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CppCionGroupHeaderGen::CppCionGroupHeaderGen(std::shared_ptr<Document> doc)
- : CppCionGeneratorBase(doc) {}
+CppCionGroupHeaderGen::CppCionGroupHeaderGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans) {}
void CppCionGroupHeaderGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CppCionGroupHeaderGen : public CppCionGeneratorBase {
public:
- explicit CppCionGroupHeaderGen(std::shared_ptr<Document> doc);
+ explicit CppCionGroupHeaderGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionGroupHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CppCionProxyBodyGen::CppCionProxyBodyGen(std::shared_ptr<Document> doc)
- : CppCionGeneratorBase(doc) {}
+CppCionProxyBodyGen::CppCionProxyBodyGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans) {}
void CppCionProxyBodyGen::OnInitGen(std::ofstream& stream) {
std::string key(".cc");
class CppCionProxyBodyGen : public CppCionGeneratorBase {
public:
- explicit CppCionProxyBodyGen(std::shared_ptr<Document> doc);
+ explicit CppCionProxyBodyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionProxyBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CppCionProxyHeaderGen::CppCionProxyHeaderGen(std::shared_ptr<Document> doc)
- : CppCionGeneratorBase(doc) {}
+CppCionProxyHeaderGen::CppCionProxyHeaderGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans) {}
void CppCionProxyHeaderGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CppCionProxyHeaderGen : public CppCionGeneratorBase {
public:
- explicit CppCionProxyHeaderGen(std::shared_ptr<Document> doc);
+ explicit CppCionProxyHeaderGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionProxyHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
CppCionStubBodyGen::CppCionStubBodyGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options)
- : CppCionGeneratorBase(doc), options_(options) {}
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans), options_(options) {}
void CppCionStubBodyGen::OnInitGen(std::ofstream& stream) {
std::string key(".cc");
class CppCionStubBodyGen : public CppCionGeneratorBase {
public:
- explicit CppCionStubBodyGen(std::shared_ptr<Document> doc, std::shared_ptr<Options> options);
+ explicit CppCionStubBodyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionStubBodyGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
CppCionStubHeaderGen::CppCionStubHeaderGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options)
- : CppCionGeneratorBase(doc), options_(options) {}
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans)
+ : CppCionGeneratorBase(doc, trans), options_(options) {}
void CppCionStubHeaderGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CppCionStubHeaderGen : public CppCionGeneratorBase {
public:
explicit CppCionStubHeaderGen(std::shared_ptr<Document> doc,
- std::shared_ptr<Options> options);
+ std::shared_ptr<Options> options, std::shared_ptr<tidl::Transportable> trans);
virtual ~CppCionStubHeaderGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CsCionGeneratorBase::CsCionGeneratorBase(std::shared_ptr<Document> doc)
- : CionPluginBase(std::move(doc)) {
+CsCionGeneratorBase::CsCionGeneratorBase(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CionPluginBase(std::move(doc), trans) {
type_map_ = {
{"char", "byte"}, {"int", "int"}, {"short", "short"},
{"long", "long"}, {"string", "string"}, {"bool", "bool"},
class CsCionGeneratorBase : public CionPluginBase {
public:
- explicit CsCionGeneratorBase(std::shared_ptr<Document> doc);
+ explicit CsCionGeneratorBase(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CsCionGeneratorBase() = default;
void GenVersion(std::ofstream& stream);
namespace tidl {
-CsCionGroupGen::CsCionGroupGen(std::shared_ptr<Document> doc)
- : CsCionGeneratorBase(doc) {}
+CsCionGroupGen::CsCionGroupGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CsCionGeneratorBase(doc, trans) {}
void CsCionGroupGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CsCionGroupGen : public CsCionGeneratorBase {
public:
- explicit CsCionGroupGen(std::shared_ptr<Document> doc);
+ explicit CsCionGroupGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CsCionGroupGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CsCionProxyGen::CsCionProxyGen(std::shared_ptr<Document> doc)
- : CsCionGeneratorBase(doc) {}
+CsCionProxyGen::CsCionProxyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CsCionGeneratorBase(doc, trans) {}
void CsCionProxyGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CsCionProxyGen : public CsCionGeneratorBase {
public:
- explicit CsCionProxyGen(std::shared_ptr<Document> doc);
+ explicit CsCionProxyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CsCionProxyGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-CsCionStubGen::CsCionStubGen(std::shared_ptr<Document> doc)
- : CsCionGeneratorBase(doc) {}
+CsCionStubGen::CsCionStubGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : CsCionGeneratorBase(doc, trans) {}
void CsCionStubGen::OnInitGen(std::ofstream& stream) {
GenVersion(stream);
class CsCionStubGen : public CsCionGeneratorBase {
public:
- explicit CsCionStubGen(std::shared_ptr<Document> doc);
+ explicit CsCionStubGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~CsCionStubGen() = default;
void OnInitGen(std::ofstream& stream) override;
constexpr const char __SERVER_FOREACH_CONNECTED_PEER_INFO[] =
"cion_server_foreach_connected_peer_info(__<NAME>.stub, callback, user_data);";
-constexpr const char __SERVER_SET_ONDEMAND_LAUNCH_ENABLED[] =
+constexpr const char __SERVER_HEADER_EXTRA[] =
R"__c_cb(
+/**
+ * @brief Sets on-demand launch state.
+ * @details If the on-demand launch state is enabled, the server is launched on demand
+ * when the request comes.
+ * @privilege http://tizen.org/privilege/d2d.remotelaunch
+
+ * @param[in] enabled The enable state
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
+ */
+int <PREFIX>_<NAME>_set_ondemand_launch_enabled(bool enable);
+
+/**
+ * @brief Registers the set of the callback functions and the service_name.
+ * @details This function registers the set of the callback functions to handle stub events.
+ * And, the <PREFIX>_server_listen() is called internally to handle events.
+
+ * @privilege %http://tizen.org/privilege/d2d.datasharing \n
+ * %http://tizen.org/privilege/internet
+ * @param[in] service_name The name of service
+ * @param[in] display_name The display name of service
+ * @param[in] callback The set of callback functions to handle stub events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_NOT_SUPPORTED Not supported
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_IO_ERROR IO error
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #<ERROR_PREFIX>_ERROR_OPERATION_FAILED Operation failed
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+ * @see <PREFIX>_<NAME>_unregister()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data);
+)__c_cb";
+
+constexpr const char __SERVER_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_set_ondemand_launch_enabled(bool enable)
+{
int ret;
ret = cion_server_set_on_demand_launch_enabled(__<NAME>.stub, enable);
_E("Failed to set ondemand launch enable. error(%d)", ret);
return ret;
+}
+
+int <PREFIX>_<NAME>_register(const char *service_name, const char *display_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data)
+)__c_cb";
+
+constexpr const char __CLIENT_HEADER_EXTRA[] =
+R"__c_cb(
+/**
+ * @brief Creates a <PREFIX>_<NAME> handle.
+ * @remarks The @a h handle should be released using
+ * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
+ * @privilege %http://tizen.org/privilege/d2d.datasharing \n
+ * %http://tizen.org/privilege/internet
+ * @param[in] service_name The name of service
+ * @param[in] callback The set of callback functions to handle proxy events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] h The <PREFIX>_<NAME> handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+ * @see <PREFIX>_<NAME>_destroy()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_create(const char *service_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+
+)__c_cb";
+
+constexpr const char __CLIENT_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_create(const char *service_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
+)__c_cb";
+
+constexpr const char __GROUP_HEADER_EXTRA[] =
+R"__c_cb(
+/**
+ * @brief Creates a <PREFIX>_<NAME> handle.
+ * @remarks The @a h handle should be released using
+ * the <PREFIX>_<NAME>_destroy() if it's no longer needed.
+ *
+ * @privilege %http://tizen.org/privilege/d2d.datasharing
+ * %http://tizen.org/privilege/internet
+ *
+ * @param[in] topic_name topic_name The name of topic
+ * @param[in] callback The set of callback functions to handle events
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] h The <PREFIX>_<NAME> handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #<ERROR_PREFIX>_ERROR_NONE Successful
+ * @retval #<ERROR_PREFIX>_ERROR_NOT_SUPPORTED Not supported
+ * @retval #<ERROR_PREFIX>_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #<ERROR_PREFIX>_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #<ERROR_PREFIX>_ERROR_PERMISSION_DENIED Permission denied
+
+ * @see <PREFIX>_<NAME>_destroy()
+ * @see #<PREFIX>_<NAME>_callback_s
+ */
+int <PREFIX>_<NAME>_create(const char *topic_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h);
+)__c_cb";
+
+constexpr const char __GROUP_BODY_EXTRA[] =
+R"__c_cb(
+int <PREFIX>_<NAME>_create(const char *topic_name, <PREFIX>_<NAME>_callback_s *callback, void *user_data, <PREFIX>_<NAME>_h *h)
)__c_cb";
} // namespace
namespace tidl {
-std::string DefaultCTransportable::GenInclude() const {
+std::string DefaultCTransportable::GenInclude(bool body, int type) const {
return "#include <cion.h>";
}
+std::string DefaultCTransportable::GenHeaderBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenHeaderPayloadHandle() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenHeaderCommonHandle() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenHeaderConnectionHandle() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenHeaderPayloadBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenHeaderConnectionBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenBodyPayloadBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenBodyConnectionBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenBodyPeerInfoBase() const {
+ return "";
+}
+
+std::string DefaultCTransportable::GenProxyPrefix() const {
+ return "cion_proxy";
+}
+
+std::string DefaultCTransportable::GenStubPrefix() const {
+ return "cion_stub";
+}
+
+std::string DefaultCTransportable::GenGroupPrefix() const {
+ return "cion_group";
+}
+
+std::string DefaultCTransportable::GenModulePrefix() const {
+ return "cion";
+}
+
+std::string DefaultCTransportable::GenErrorPrefix() const {
+ return "CION";
+}
+
+std::string DefaultCTransportable::GenServerExtra(bool body) const {
+ if (body)
+ return __SERVER_BODY_EXTRA;
+ else
+ return __SERVER_HEADER_EXTRA;
+}
+
+std::string DefaultCTransportable::GenClientExtra(bool body) const {
+ if (body)
+ return __CLIENT_BODY_EXTRA;
+ else
+ return __CLIENT_HEADER_EXTRA;
+}
+
+std::string DefaultCTransportable::GenGroupExtra(bool body) const {
+ if (body)
+ return __GROUP_BODY_EXTRA;
+ else
+ return __GROUP_HEADER_EXTRA;
+}
+
std::string DefaultCTransportable::GenClientSendAsync(std::string client,
std::string payload, std::string size) const {
return std::string(ReplaceAll(__CLIENT_SEND_ASYNC, {
return "cion_group_h";
}
-std::string DefaultCTransportable::GenPayloadTransferStatusType() const {
+std::string DefaultCTransportable::GenPayloadTransferStatusType(bool internal_type) const {
return "cion_payload_transfer_status_e";
}
{ "<PEER>", peer } }));
}
-std::string DefaultCTransportable::GenPayloadType() const {
+std::string DefaultCTransportable::GenPayloadType(bool internal_type) const {
return "cion_payload_h";
}
return "cion_client_h";
}
-std::string DefaultCTransportable::GenSecurityType() const {
- return "cion_security_h";
+std::string DefaultCTransportable::GenSecurityType(bool definition) const {
+ if (definition)
+ return "cion_security_h security;";
+ else
+ return "cion_security_h";
}
std::string DefaultCTransportable::GenServerType() const {
{ "<NAME>", name } }));
}
-std::string DefaultCTransportable::GenServerSetOnDemandLaunchEnabled(std::string name) const {
- return std::string(ReplaceAll(__SERVER_SET_ONDEMAND_LAUNCH_ENABLED, {
- { "<NAME>", name } }));
-}
-
} // namespace tidl
class DefaultCTransportable : public CTransportable {
public:
virtual ~DefaultCTransportable() = default;
- std::string GenInclude() const override;
+ std::string GenInclude(bool body = true, int type = 0) const override;
+ std::string GenHeaderBase() const override;
+ std::string GenHeaderPayloadHandle() const override;
+ std::string GenHeaderCommonHandle() const override;
+ std::string GenHeaderConnectionHandle() const override;
+ std::string GenHeaderPayloadBase() const override;
+ std::string GenHeaderConnectionBase() const override;
+ std::string GenBodyPayloadBase() const override;
+ std::string GenBodyConnectionBase() const override;
+ std::string GenBodyPeerInfoBase() const override;
+ std::string GenProxyPrefix() const override;
+ std::string GenStubPrefix() const override;
+ std::string GenGroupPrefix() const override;
+ std::string GenModulePrefix() const override;
+ std::string GenErrorPrefix() const override;
+ std::string GenServerExtra(bool body = true) const override;
+ std::string GenClientExtra(bool body = true) const override;
+ std::string GenGroupExtra(bool body = true) const override;
std::string GenClientSendAsync(std::string client,
std::string payload, std::string size) const override;
std::string GenClientSend(std::string client, std::string data,
std::string GenClientFileSend(std::string path,
std::string client) const override;
std::string GenGroupType() const override;
- std::string GenPayloadTransferStatusType() const override;
+ std::string GenPayloadTransferStatusType(bool internal_type) const override;
std::string GenPeerInfoType() const override;
std::string GenPeerInfoDestroy(std::string peer) const override;
- std::string GenPayloadType() const override;
+ std::string GenPayloadType(bool internal_type) const override;
std::string GenClientType() const override;
- std::string GenSecurityType() const override;
+ std::string GenSecurityType(bool definition = true) const override;
std::string GenServerType() const override;
std::string GenClientTryConnect(std::string client,
std::string peer) const override;
std::string GenPeerInfoClone(std::string src_peer,
std::string dest_peer) const override;
std::string GenServerForeachConnectedPeerInfo(std::string name) const override;
- std::string GenServerSetOnDemandLaunchEnabled(std::string name) const override;
};
} // namespace tidl
namespace tidl {
JavaCionCommonGen::JavaCionCommonGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionCommonGen::OnInitGen(std::ofstream& stream) {
class JavaCionCommonGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionCommonGen(std::shared_ptr<Document> doc);
+ explicit JavaCionCommonGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionCommonGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-JavaCionGeneratorBase::JavaCionGeneratorBase(std::shared_ptr<Document> doc)
- : CionPluginBase(std::move(doc)) {
+JavaCionGeneratorBase::JavaCionGeneratorBase(
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : CionPluginBase(std::move(doc), trans) {
type_map_ = {
{"char", "byte"}, {"int", "int"}, {"short", "short"},
{"long", "long"}, {"string", "String"}, {"bool", "boolean"},
class JavaCionGeneratorBase : public CionPluginBase {
public:
- explicit JavaCionGeneratorBase(std::shared_ptr<Document> doc);
+ explicit JavaCionGeneratorBase(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionGeneratorBase() = default;
void GenMethodId(std::ofstream& stream,
const Interface& iface, bool is_group = false);
namespace tidl {
-JavaCionGroupGen::JavaCionGroupGen(std::shared_ptr<Document> doc)
- : JavaCionGeneratorBase(doc) {}
+JavaCionGroupGen::JavaCionGroupGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {}
void JavaCionGroupGen::OnInitGen(std::ofstream& stream) {
std::string fname = MakeDir(FileName, "/group");
class JavaCionGroupGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionGroupGen(std::shared_ptr<Document> doc);
+ explicit JavaCionGroupGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionGroupGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
JavaCionGroupRepoGen::JavaCionGroupRepoGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionGroupRepoGen::OnInitGen(std::ofstream& stream) {
class JavaCionGroupRepoGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionGroupRepoGen(std::shared_ptr<Document> doc);
+ explicit JavaCionGroupRepoGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionGroupRepoGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-JavaCionProxyGen::JavaCionProxyGen(std::shared_ptr<Document> doc)
- : JavaCionGeneratorBase(doc) {}
+JavaCionProxyGen::JavaCionProxyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {}
void JavaCionProxyGen::OnInitGen(std::ofstream& stream) {
std::string fname = MakeDir(FileName, "/client");
class JavaCionProxyGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionProxyGen(std::shared_ptr<Document> doc);
+ explicit JavaCionProxyGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionProxyGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
JavaCionProxyRepoGen::JavaCionProxyRepoGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionProxyRepoGen::OnInitGen(std::ofstream& stream) {
class JavaCionProxyRepoGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionProxyRepoGen(std::shared_ptr<Document> doc);
+ explicit JavaCionProxyRepoGen(std::shared_ptr<Document> doc,
+ std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionProxyRepoGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
JavaCionStructureGen::JavaCionStructureGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionStructureGen::OnInitGen(std::ofstream& stream) {
class JavaCionStructureGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionStructureGen(std::shared_ptr<Document> doc);
+ explicit JavaCionStructureGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionStructureGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
-JavaCionStubGen::JavaCionStubGen(std::shared_ptr<Document> doc)
- : JavaCionGeneratorBase(doc) {}
+JavaCionStubGen::JavaCionStubGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {}
void JavaCionStubGen::OnInitGen(std::ofstream& stream) {
std::string fname = MakeDir(FileName, "/server");
class JavaCionStubGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionStubGen(std::shared_ptr<Document> doc);
+ explicit JavaCionStubGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionStubGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
JavaCionStubRepoGen::JavaCionStubRepoGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionStubRepoGen::OnInitGen(std::ofstream& stream) {
class JavaCionStubRepoGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionStubRepoGen(std::shared_ptr<Document> doc);
+ explicit JavaCionStubRepoGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionStubRepoGen() = default;
void OnInitGen(std::ofstream& stream) override;
namespace tidl {
JavaCionUtilityGen::JavaCionUtilityGen(
- std::shared_ptr<Document> doc) : JavaCionGeneratorBase(doc) {
+ std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans)
+ : JavaCionGeneratorBase(doc, trans) {
}
void JavaCionUtilityGen::OnInitGen(std::ofstream& stream) {
class JavaCionUtilityGen : public JavaCionGeneratorBase {
public:
- explicit JavaCionUtilityGen(std::shared_ptr<Document> doc);
+ explicit JavaCionUtilityGen(std::shared_ptr<Document> doc, std::shared_ptr<tidl::Transportable> trans);
virtual ~JavaCionUtilityGen() = default;
void OnInitGen(std::ofstream& stream) override;
#include "idlc/gen_cion/cpp_cion_stub_body_gen.h"
#include "idlc/gen_cion/cpp_cion_group_header_gen.h"
#include "idlc/gen_cion/cpp_cion_group_body_gen.h"
+#include "idlc/gen_cion/plugin_loader.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_c_transportable.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_loader.h"
+
#include "idlc/options.h"
void GenerateStubCodes(std::shared_ptr<tidl::Options> options,
tidl::Parser& ps) {
if (options->IsCion()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::PluginLoader(""));
switch (options->GetLanguage()) {
case tidl::Options::LANGUAGE_TYPE_C:
{
- tidl::CCionStubHeaderGen stub_header(ps.GetDoc());
+ tidl::CCionStubHeaderGen stub_header(ps.GetDoc(), trans);
stub_header.EnableNamespace(options->HasNamespace());
stub_header.SetType(static_cast<int>(options->GetType()));
stub_header.Run(options->GetOutput() + ".h");
- tidl::CCionStubBodyGen stub_body(ps.GetDoc(), options);
+ tidl::CCionStubBodyGen stub_body(ps.GetDoc(), options, trans);
stub_body.EnableNamespace(options->HasNamespace());
stub_body.SetType(static_cast<int>(options->GetType()));
stub_body.Run(options->GetOutput() + ".c");
}
case tidl::Options::LANGUAGE_TYPE_CPP:
{
- tidl::CppCionStubHeaderGen stub_header(ps.GetDoc(), options);
+ tidl::CppCionStubHeaderGen stub_header(ps.GetDoc(), options, trans);
stub_header.Run(options->GetOutput() + ".h");
- tidl::CppCionStubBodyGen stub_body(ps.GetDoc(), options);
+ tidl::CppCionStubBodyGen stub_body(ps.GetDoc(), options, trans);
stub_body.Run(options->GetOutput() + ".cc");
break;
}
case tidl::Options::LANGUAGE_TYPE_CSHARP:
{
- tidl::CsCionStubGen stub(ps.GetDoc());
+ tidl::CsCionStubGen stub(ps.GetDoc(), trans);
stub.Run(options->GetOutput() + ".cs");
break;
}
case tidl::Options::LANGUAGE_TYPE_JAVA:
{
- tidl::JavaCionStubRepoGen repo(ps.GetDoc());
+ tidl::JavaCionStubRepoGen repo(ps.GetDoc(), trans);
repo.Run(options->GetOutput(), true);
- tidl::JavaCionStubGen view_model(ps.GetDoc());
+ tidl::JavaCionStubGen view_model(ps.GetDoc(), trans);
view_model.Run(options->GetOutput(), true);
- tidl::JavaCionUtilityGen utilities(ps.GetDoc());
+ tidl::JavaCionUtilityGen utilities(ps.GetDoc(), trans);
utilities.Run(options->GetOutput(), true);
- tidl::JavaCionStructureGen structures(ps.GetDoc());
+ tidl::JavaCionStructureGen structures(ps.GetDoc(), trans);
structures.Run(options->GetOutput(), true);
- tidl::JavaCionCommonGen cgen(ps.GetDoc());
+ tidl::JavaCionCommonGen cgen(ps.GetDoc(), trans);
cgen.Run(options->GetOutput(), true);
break;
}
break;
}
} else if (options->IsAitt()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::AIttPluginLoader(""));
switch (options->GetLanguage()) {
- case tidl::Options::LANGUAGE_TYPE_C:
- case tidl::Options::LANGUAGE_TYPE_CPP:
- case tidl::Options::LANGUAGE_TYPE_CSHARP:
- case tidl::Options::LANGUAGE_TYPE_JAVA:
- default:
- break;
+ case tidl::Options::LANGUAGE_TYPE_C:
+ {
+ tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+ internal_header.SetType(static_cast<int>(options->GetType()));
+ internal_header.Run("aitt_plugin_stub_internal.h");
+
+ tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+ internal_body.EnableNamespace(options->HasNamespace());
+ internal_body.SetType(static_cast<int>(options->GetType()));
+ internal_body.Run("aitt_plugin_stub_internal.c");
+
+ tidl::CCionStubHeaderGen stub_header(ps.GetDoc(), trans);
+ stub_header.EnableNamespace(options->HasNamespace());
+ stub_header.SetType(static_cast<int>(options->GetType()));
+ stub_header.EnableGeneratedAPI(true);
+ stub_header.Run(options->GetOutput() + ".h");
+
+ tidl::CCionStubBodyGen stub_body(ps.GetDoc(), options, trans);
+ stub_body.EnableNamespace(options->HasNamespace());
+ stub_body.SetType(static_cast<int>(options->GetType()));
+ stub_body.EnableGeneratedAPI(true);
+ stub_body.Run(options->GetOutput() + ".c");
+
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CPP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CSHARP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_JAVA:
+ {
+ break;
+ }
+
+ default:
+ break;
}
} else {
switch (options->GetLanguage()) {
void GenerateProxyCodes(std::shared_ptr<tidl::Options> options,
tidl::Parser& ps) {
if (options->IsCion()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::PluginLoader(""));
switch (options->GetLanguage()) {
case tidl::Options::LANGUAGE_TYPE_C:
{
- tidl::CCionProxyHeaderGen proxy_header(ps.GetDoc());
+ tidl::CCionProxyHeaderGen proxy_header(ps.GetDoc(), trans);
proxy_header.EnableNamespace(options->HasNamespace());
proxy_header.SetType(static_cast<int>(options->GetType()));
proxy_header.Run(options->GetOutput() + ".h");
- tidl::CCionProxyBodyGen proxy_body(ps.GetDoc(), options);
+ tidl::CCionProxyBodyGen proxy_body(ps.GetDoc(), options, trans);
proxy_body.EnableNamespace(options->HasNamespace());
proxy_body.SetType(static_cast<int>(options->GetType()));
proxy_body.Run(options->GetOutput() + ".c");
}
case tidl::Options::LANGUAGE_TYPE_CPP:
{
- tidl::CppCionProxyHeaderGen proxy_header(ps.GetDoc());
+ tidl::CppCionProxyHeaderGen proxy_header(ps.GetDoc(), trans);
proxy_header.Run(options->GetOutput() + ".h");
- tidl::CppCionProxyBodyGen proxy_body(ps.GetDoc());
+ tidl::CppCionProxyBodyGen proxy_body(ps.GetDoc(), trans);
proxy_body.Run(options->GetOutput() + ".cc");
break;
}
break;
case tidl::Options::LANGUAGE_TYPE_CSHARP:
{
- tidl::CsCionProxyGen proxy(ps.GetDoc());
+ tidl::CsCionProxyGen proxy(ps.GetDoc(), trans);
proxy.Run(options->GetOutput() + ".cs");
break;
}
case tidl::Options::LANGUAGE_TYPE_JAVA:
{
- tidl::JavaCionProxyRepoGen base_files(ps.GetDoc());
+ tidl::JavaCionProxyRepoGen base_files(ps.GetDoc(), trans);
base_files.Run(options->GetOutput(), true);
- tidl::JavaCionProxyGen view_model(ps.GetDoc());
+ tidl::JavaCionProxyGen view_model(ps.GetDoc(), trans);
view_model.Run(options->GetOutput(), true);
- tidl::JavaCionUtilityGen utilities(ps.GetDoc());
+ tidl::JavaCionUtilityGen utilities(ps.GetDoc(), trans);
utilities.Run(options->GetOutput(), true);
- tidl::JavaCionStructureGen structures(ps.GetDoc());
+ tidl::JavaCionStructureGen structures(ps.GetDoc(), trans);
structures.Run(options->GetOutput(), true);
- tidl::JavaCionCommonGen cgen(ps.GetDoc());
+ tidl::JavaCionCommonGen cgen(ps.GetDoc(), trans);
cgen.Run(options->GetOutput(), true);
break;
}
break;
}
} else if (options->IsAitt()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::AIttPluginLoader(""));
switch (options->GetLanguage()) {
- case tidl::Options::LANGUAGE_TYPE_C:
- case tidl::Options::LANGUAGE_TYPE_CPP:
- case tidl::Options::LANGUAGE_TYPE_CSHARP:
- case tidl::Options::LANGUAGE_TYPE_JAVA:
- default:
- break;
+ case tidl::Options::LANGUAGE_TYPE_C:
+ {
+ tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+ internal_header.SetType(static_cast<int>(options->GetType()));
+ internal_header.Run("aitt_plugin_proxy_internal.h");
+
+ tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+ internal_body.EnableNamespace(options->HasNamespace());
+ internal_body.SetType(static_cast<int>(options->GetType()));
+ internal_body.Run("aitt_plugin_proxy_internal.c");
+
+ tidl::CCionProxyHeaderGen proxy_header(ps.GetDoc(), trans);
+ proxy_header.EnableNamespace(options->HasNamespace());
+ proxy_header.SetType(static_cast<int>(options->GetType()));
+ proxy_header.EnableGeneratedAPI(true);
+ proxy_header.Run(options->GetOutput() + ".h");
+
+ tidl::CCionProxyBodyGen proxy_body(ps.GetDoc(), options, trans);
+ proxy_body.EnableNamespace(options->HasNamespace());
+ proxy_body.SetType(static_cast<int>(options->GetType()));
+ proxy_body.EnableGeneratedAPI(true);
+ proxy_body.Run(options->GetOutput() + ".c");
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CPP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CSHARP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_JAVA:
+ {
+ break;
+ }
+
+ default:
+ break;
}
} else {
switch (options->GetLanguage()) {
void GenerateGroupCodes(std::shared_ptr<tidl::Options> options,
tidl::Parser& ps) {
if (options->IsCion()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::PluginLoader(""));
switch (options->GetLanguage()) {
case tidl::Options::LANGUAGE_TYPE_C:
{
-
- tidl::CCionGroupHeaderGen group_header(ps.GetDoc());
+ tidl::CCionGroupHeaderGen group_header(ps.GetDoc(), trans);
group_header.EnableNamespace(options->HasNamespace());
group_header.SetType(static_cast<int>(options->GetType()));
group_header.Run(options->GetOutput() + ".h");
- tidl::CCionGroupBodyGen group_body(ps.GetDoc(), options);
+ tidl::CCionGroupBodyGen group_body(ps.GetDoc(), options, trans);
group_body.EnableNamespace(options->HasNamespace());
group_body.SetType(static_cast<int>(options->GetType()));
group_body.Run(options->GetOutput() + ".c");
}
case tidl::Options::LANGUAGE_TYPE_CPP:
{
- tidl::CppCionGroupHeaderGen group_header(ps.GetDoc());
+ tidl::CppCionGroupHeaderGen group_header(ps.GetDoc(), trans);
group_header.Run(options->GetOutput() + ".h");
- tidl::CppCionGroupBodyGen group_body(ps.GetDoc());
+ tidl::CppCionGroupBodyGen group_body(ps.GetDoc(), trans);
group_body.Run(options->GetOutput() + ".cc");
break;
}
case tidl::Options::LANGUAGE_TYPE_CSHARP:
{
- tidl::CsCionGroupGen group(ps.GetDoc());
+ tidl::CsCionGroupGen group(ps.GetDoc(), trans);
group.Run(options->GetOutput() + ".cs");
break;
}
case tidl::Options::LANGUAGE_TYPE_JAVA:
{
- tidl::JavaCionGroupRepoGen repo(ps.GetDoc());
+ tidl::JavaCionGroupRepoGen repo(ps.GetDoc(), trans);
repo.Run(options->GetOutput(), true);
- tidl::JavaCionGroupGen view_model(ps.GetDoc());
+ tidl::JavaCionGroupGen view_model(ps.GetDoc(), trans);
view_model.Run(options->GetOutput(), true);
- tidl::JavaCionUtilityGen utilities(ps.GetDoc());
+ tidl::JavaCionUtilityGen utilities(ps.GetDoc(), trans);
utilities.Run(options->GetOutput(), true);
- tidl::JavaCionStructureGen structures(ps.GetDoc());
+ tidl::JavaCionStructureGen structures(ps.GetDoc(), trans);
structures.Run(options->GetOutput(), true);
- tidl::JavaCionCommonGen cgen(ps.GetDoc());
+ tidl::JavaCionCommonGen cgen(ps.GetDoc(), trans);
cgen.Run(options->GetOutput(), true);
break;
}
+ default:
+ break;
+ }
+ } else if (options->IsAitt()) {
+ auto trans = std::shared_ptr<tidl::Transportable>(new tidl::AIttPluginLoader(""));
+ switch (options->GetLanguage()) {
+ case tidl::Options::LANGUAGE_TYPE_C:
+ {
+ tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+ internal_header.SetType(static_cast<int>(options->GetType()));
+ internal_header.Run("aitt_plugin_group_internal.h");
+
+ tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+ internal_body.EnableNamespace(options->HasNamespace());
+ internal_body.SetType(static_cast<int>(options->GetType()));
+ internal_body.Run("aitt_plugin_group_internal.c");
+
+ tidl::CCionGroupHeaderGen group_header(ps.GetDoc(), trans);
+ group_header.EnableNamespace(options->HasNamespace());
+ group_header.SetType(static_cast<int>(options->GetType()));
+ group_header.EnableGeneratedAPI(true);
+ group_header.Run(options->GetOutput() + ".h");
+
+ tidl::CCionGroupBodyGen group_body(ps.GetDoc(), options, trans);
+ group_body.EnableNamespace(options->HasNamespace());
+ group_body.SetType(static_cast<int>(options->GetType()));
+ group_body.EnableGeneratedAPI(true);
+ group_body.Run(options->GetOutput() + ".c");
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CPP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_CSHARP:
+ {
+ break;
+ }
+ case tidl::Options::LANGUAGE_TYPE_JAVA:
+ {
+ break;
+ }
+
default:
break;
}
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TIDL_BUILD_TESTS_SRCS)
SET(TIDL_GEN_SRCS
+ BufferAittPluginProxyC.c
+ BufferAittPluginStubC.c
BufferCionProxy.cc
BufferCionProxyC.c
BufferCionStub.cc
BufferProxyC.c
BufferStub.cc
BufferStubC.c
+ DataPortAittPluginProxyC.c
+ DataPortAittPluginStubC.c
DataPortCionProxy.cc
DataPortCionProxyC.c
DataPortCionStub.cc
DataPortProxyC.c
DataPortStub.cc
DataPortStubC.c
+ ExCionAittPluginProxyC.c
+ ExCionAittPluginStubC.c
ExCionCionProxy.cc
ExCionCionProxyC.c
ExCionCionStub.cc
ExProxyC.c
ExStub.cc
ExStubC.c
+ FooAittPluginProxyC.c
+ FooAittPluginStubC.c
FooCionProxy.cc
FooCionProxyC.c
FooCionStub.cc
FooProxyC.c
FooStub.cc
FooStubC.c
+ MessageAittPluginProxyC.c
+ MessageAittPluginStubC.c
MessageCionProxy.cc
MessageCionProxyC.c
MessageCionStub.cc
MessageProxy.cc
MessageProxyC.c
MessageStub.cc
+ FooPubsubAittPluginGroupC.c
FooPubsubGroup.cc
FooPubsubGroupC.c
FooPubsubCionGroup.cc
OUTPUT="${FILES_FOR_GROUP[index]}CionGroupC"
${TIDLC} -b -c -n -g -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
done
+
+ for index in ${!FILES_CION[*]}; do
+ echo "Generate ${FILES_CION[index]}"
+
+ INPUT="${FILES_CION[index]}.tidl"
+
+ OUTPUT="${FILES_CION[index]}AittPluginProxyC"
+
+ ${TIDLC} -b -p -n -a -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+
+ OUTPUT="${FILES_CION[index]}AittPluginStubC"
+ ${TIDLC} -b -s -n -a -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+ done
+
+ for index in ${!FILES_FOR_GROUP[*]}; do
+ echo "Generate ${FILES_FOR_GROUP[index]}"
+
+ INPUT="${FILES_FOR_GROUP[index]}.tidl"
+
+ OUTPUT="${FILES_FOR_GROUP[index]}AittPluginGroupC"
+ ${TIDLC} -b -a -n -g -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+ done
}
echo "############ Generate codes using TIDLC ############"