From: nibha2 Date: Tue, 29 May 2018 12:28:05 +0000 (+0530) Subject: [TBT][All][Non-ACR][5.0 tbt porting] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ff5c81610967d9bc0e311e44f63c9d31aead68e;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][All][Non-ACR][5.0 tbt porting] Change-Id: I897eec32a96028477e6f86c819debecc9d2c49f8 Signed-off-by: nibha2 --- diff --git a/coretbt_dataprovider/.cproject b/coretbt_dataprovider/.cproject new file mode 100644 index 0000000..8bab333 --- /dev/null +++ b/coretbt_dataprovider/.cproject @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coretbt_dataprovider/.exportMap b/coretbt_dataprovider/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/coretbt_dataprovider/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/coretbt_dataprovider/.package-stamp b/coretbt_dataprovider/.package-stamp new file mode 100644 index 0000000..40cbe59 --- /dev/null +++ b/coretbt_dataprovider/.package-stamp @@ -0,0 +1 @@ +TPK \ No newline at end of file diff --git a/coretbt_dataprovider/.project b/coretbt_dataprovider/.project new file mode 100644 index 0000000..9b3b3ca --- /dev/null +++ b/coretbt_dataprovider/.project @@ -0,0 +1,26 @@ + + + coretbt_dataprovider + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/coretbt_dataprovider/.sdk_delta.info b/coretbt_dataprovider/.sdk_delta.info new file mode 100644 index 0000000..9772391 Binary files /dev/null and b/coretbt_dataprovider/.sdk_delta.info differ diff --git a/coretbt_dataprovider/.tproject b/coretbt_dataprovider/.tproject new file mode 100644 index 0000000..ccab492 --- /dev/null +++ b/coretbt_dataprovider/.tproject @@ -0,0 +1,12 @@ + + + + + wearable-5.0 + + + + + + + diff --git a/coretbt_dataprovider/inc/coretbt_dataprovider.h b/coretbt_dataprovider/inc/coretbt_dataprovider.h new file mode 100644 index 0000000..dc1888d --- /dev/null +++ b/coretbt_dataprovider/inc/coretbt_dataprovider.h @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + + +/** + * @file coretbt_dataprovider.h + * @brief service app to handle data provider request + * creates database, receives request to manipulate database as per request and sends response of successfully accomplished tasks + * @since_tizen 2.3 + * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) + * @date October, 2014 + * @bug no known bug + * @credit Tizen SDK Version 2.3.0 Sample Example + * + * */ +#ifndef __coretbt_dataprovider_H__ +#define TIZEN_DEBUG_ENABLE 1 + +#include +#include +#include +#include +#include + +#include "logger.h" + +char DB_PATH[255]; +#define PROVIDER_ID "http://coretbt_dataprovider.com/datacontrol/provider/coretbt_dataprovider" +#define DATA_ID "provider" + +static data_control_provider_sql_cb sql_callback; +static data_control_provider_map_cb map_provider_callback; +sqlite3 *db; +bundle *MapRepository; + +void Initialize_datacontrol_provider(); +void initialize_map_data_control_provider(); + + +#endif /* __coretbt_dataprovider_H__ */ diff --git a/coretbt_dataprovider/inc/logger.h b/coretbt_dataprovider/inc/logger.h new file mode 100644 index 0000000..2d92688 --- /dev/null +++ b/coretbt_dataprovider/inc/logger.h @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file logger.h + * @brief This file provide necessary macro for logging information. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ + +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include + +#define LOG_TAG_CORE "[coretbt_dataprovider]_" + +#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) +#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) +#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) + +#define RETM_IF(expr, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return; \ + } \ +} + +#define RETVM_IF(expr, val, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ +} + +#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; + +#endif /* __LOGGER_H__ */ diff --git a/coretbt_dataprovider/project_def.prop b/coretbt_dataprovider/project_def.prop new file mode 100644 index 0000000..dd23d3a --- /dev/null +++ b/coretbt_dataprovider/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = coretbt_dataprovider + +type = app +profile = wearable-2.3.1 + +USER_SRCS = src/coretbt_dataprovider.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = diff --git a/coretbt_dataprovider/shared/res/coretbt_dataprovider.png b/coretbt_dataprovider/shared/res/coretbt_dataprovider.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/coretbt_dataprovider/shared/res/coretbt_dataprovider.png differ diff --git a/coretbt_dataprovider/src/coretbt_dataprovider.c b/coretbt_dataprovider/src/coretbt_dataprovider.c new file mode 100644 index 0000000..57feb58 --- /dev/null +++ b/coretbt_dataprovider/src/coretbt_dataprovider.c @@ -0,0 +1,680 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + + +/** + * @file coretbt_dataprovider.c + * @brief service app to handle data provider request + * creates database, receives request to manipulate database as per request and sends response of successfully accomplished tasks + * + * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) + * @date October, 2014 + * @bug no known bug + * @credit Tizen SDK Version 2.3.0 Sample Example + * + * */ + +#include +#include +#include "coretbt_dataprovider.h" + + +/** + * @function get_data_control_error + * @since_tizen 2.3 + * @description Get Data Control Error + * @parameter int: Int + * @return static char* + */ +static char* get_data_control_error(int err_code) +{ + char* error = NULL; + switch (err_code) { + case DATA_CONTROL_ERROR_NONE: + error = "DATA_CONTROL_ERROR_NONE"; + break; + case DATA_CONTROL_ERROR_IO_ERROR: + error = "DATA_CONTROL_ERROR_IO_ERROR"; + break; + case DATA_CONTROL_ERROR_OUT_OF_MEMORY: + error = "DATA_CONTROL_ERROR_OUT_OF_MEMORY"; + break; + case DATA_CONTROL_ERROR_INVALID_PARAMETER: + error = "DATA_CONTROL_ERROR_INVALID_PARAMETER"; + break; + case DATA_CONTROL_ERROR_PERMISSION_DENIED: + error = "DATA_CONTROL_ERROR_PERMISSION_DENIED"; + break; + case DATA_CONTROL_ERROR_MAX_EXCEEDED: + error = "DATA_CONTROL_ERROR_MAX_EXCEEDED"; + break; + default: + error = "Unknown Error"; + break; + } + + return error; +} + + +/** + * @function insert_request_cb + * @since_tizen 2.3 + * @description Insert Request Cb + * @parameter int: Int, bundle*: Bundle Pointer + * @return static void + */ +static void insert_request_cb(int request_id, data_control_h provider, bundle *insert_data) +{ + char* pszAppId =NULL; + int nRet = 0; + bool bMatch = false; + DBG("Inside insert request cb"); + + nRet = data_control_provider_get_client_appid(request_id, &pszAppId); + if (nRet != DATA_CONTROL_ERROR_NONE) + { + ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); + }else{ + DBG("data_control_provider_get_client_appid Successed"); + } + + DBG("Insert request from Client with App Id: %s" , pszAppId); + + bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); + if(!bMatch) + { + ERR("data_control_provider_match_provider_id failed"); + int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); + if(status == DATA_CONTROL_ERROR_NONE){ + DBG("data_control_provider_send_error Successed"); + }else{ + ERR("data_control_provider_send_error failed %s", get_data_control_error(status)); + } + + free(pszAppId); + pszAppId = NULL; + return; + + }else{ + DBG("data_control_provider_match_provider_id Successed"); + } + + bMatch = data_control_provider_match_data_id(provider,DATA_ID ); + + if(!bMatch) + { + ERR("data_control_provider_match_data_id failed"); + int status = data_control_provider_send_error(request_id,"Data Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s", get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + char* command = data_control_provider_create_insert_statement(provider, insert_data); + if(command){ + DBG("command: %s" , command); + }else{ + ERR("data_control_provider_create_insert_statement failed "); + } + int ret = sqlite3_exec(db, command, NULL, NULL, NULL); + + long long inserted_row_id = sqlite3_last_insert_rowid(db); + + ret = data_control_provider_send_insert_result(request_id, inserted_row_id); + if (ret != DATA_CONTROL_ERROR_NONE) + { + ERR("insert_send_result failed with error: %s",get_data_control_error(ret)); + } + + free(command); + free(pszAppId); + pszAppId = NULL; + +} + + +/** + * @function delete_request_cb + * @since_tizen 2.3 + * @description Delete Request Cb + * @parameter int: Int, const char*: Const char Pointer + * @return static void + */ +static void delete_request_cb(int request_id, data_control_h provider, const char *where) +{ + char* pszAppId =NULL; + int nRet = 0; + bool bMatch = false; + DBG("Inside delete request cb"); + + nRet = data_control_provider_get_client_appid(request_id, &pszAppId); + if (nRet != DATA_CONTROL_ERROR_NONE) + { + ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); + } + + DBG("Delete request from Client with App Id: %s" , pszAppId); + + bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); + if(!bMatch) + { + ERR("data_control_provider_match_provider_id failed"); + int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + bMatch = data_control_provider_match_data_id(provider,DATA_ID); + if(!bMatch) + { + ERR("data_control_provider_match_data_id failed"); + int status = data_control_provider_send_error(request_id,"Data Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + char* command = data_control_provider_create_delete_statement(provider, where); + DBG("command: %s" , command); + if(command){ + DBG("command: %s" , command); + }else{ + ERR("data_control_provider_create_delete_statement failed "); + } + int ret = sqlite3_exec(db, command, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + ERR("data_control_provider_create_delete_statement failed"); + int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(command); + free(pszAppId); + pszAppId = NULL; + return; + } + + ret = data_control_provider_send_delete_result(request_id); + if (ret != DATA_CONTROL_ERROR_NONE) + { + ERR("delete_send_result failed with error: %s",get_data_control_error(ret)); + } + + free(command); + free(pszAppId); + pszAppId = NULL; + +} + + +/** + * @function select_request_cb + * @since_tizen 2.3 + * @description Select Request Cb + * @parameter int: Int, const char*: Const char Pointer, const char*: Const char Pointer + * @return static void + */ +static void select_request_cb(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order) +{ + char* pszAppId =NULL; + int nRet = 0; + bool bMatch = false; + DBG("Inside select request cb"); + + nRet = data_control_provider_get_client_appid(request_id, &pszAppId); + if (nRet != DATA_CONTROL_ERROR_NONE) + { + ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); + } + + DBG("Select request from Client with App Id: %s" , pszAppId); + + bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); + if(!bMatch) + { + ERR("data_control_provider_match_provider_id failed"); + int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + bMatch = data_control_provider_match_data_id(provider,DATA_ID ); + if(!bMatch) + { + ERR("data_control_provider_match_data_id failed"); + int status = data_control_provider_send_error(request_id,"Data Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + sqlite3_stmt* sql_stmt = NULL; + + char* command = data_control_provider_create_select_statement(provider, column_list, column_count, where, order); + if(command) + { + DBG("command: %s" , command); + } + else + { + ERR("data_control_provider_create_select_statement failed"); + return; + } + int ret = sqlite3_prepare_v2(db, command, strlen(command), &sql_stmt, NULL); + if (ret != SQLITE_OK) + { + int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(command); + free(pszAppId); + pszAppId = NULL; + return; + } + + ret = data_control_provider_send_select_result(request_id, (void *)sql_stmt); + if (ret != DATA_CONTROL_ERROR_NONE) + { + ERR("select_send_result failed with error: %s",get_data_control_error(ret)); + } + + sqlite3_finalize(sql_stmt); + free(command); + free(pszAppId); + pszAppId = NULL; +} + + +/** + * @function update_request_cb + * @since_tizen 2.3 + * @description Update Request Cb + * @parameter int: Int, bundle*: Bundle Pointer, const char*: Const char Pointer + * @return static void + */ +static void update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where) +{ + char* pszAppId =NULL; + int nRet = 0; + bool bMatch = false; + DBG("Inside update request cb"); + + nRet = data_control_provider_get_client_appid(request_id, &pszAppId); + if (nRet != DATA_CONTROL_ERROR_NONE) + { + ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); + } + + DBG("Update request from Client with App Id: %s" , pszAppId); + + bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); + if(!bMatch) + { + ERR("data_control_provider_match_provider_id failed"); + int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + bMatch = data_control_provider_match_data_id(provider,DATA_ID ); + if(!bMatch) + { + ERR("data_control_provider_match_data_id failed"); + int status = data_control_provider_send_error(request_id,"Data Id Does not match"); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(pszAppId); + pszAppId = NULL; + return; + + } + + char* command = data_control_provider_create_update_statement(provider, update_data, where); + if(command){ + DBG("command: %s" , command); + }else{ + ERR("data_control_provider_create_update_statement failed"); + } + int ret = sqlite3_exec(db, command, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + ERR("sqlite3_exec failed with error : %s",get_data_control_error(ret)); + int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); + ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); + free(command); + free(pszAppId); + pszAppId = NULL; + return; + } + + ret = data_control_provider_send_update_result(request_id); + if (ret != DATA_CONTROL_ERROR_NONE) + { + ERR("update_send_result failed with error: %d",ret); + } + + free(command); + free(pszAppId); + pszAppId = NULL; +} + + +/** + * @function get_value_request_cb + * @since_tizen 2.3 + * @description Get Value Request Cb + * @parameter int: Int, const char*: Const char Pointer + * @return void + */ +void get_value_request_cb(int request_id, data_control_h provider, const char *key) +{ + int len = 0; + char message[50]; + memset(message,0,50); + DBG("Inside Get response Lenght od the result: %s",key); + char **str_arr=(char**)bundle_get_str_array(MapRepository,key,&len); + RETM_IF(len < 0,"bundle_get_str_array returns array lenth negative!"); + DBG("Inside Get response Lenght od the result: %d",len); + int i; + for( i = 0 ; iset_cb = set_value_request_cb; + + result = data_control_provider_map_register_cb(&map_provider_callback,NULL); + if (result != DATA_CONTROL_ERROR_NONE) + { + ERR("data_control_provider_map_cb failed with error: %s",get_data_control_error(result)); + } +} + + +/** + * @function service_app_create + * @since_tizen 2.3 + * @description Service App Create + * @parameter void*: Void Pointer + * @return bool + */ +bool service_app_create(void *data) +{ + // Todo: add your code here. + Initialize_datacontrol_provider(); + initialize_map_data_control_provider(); + return true; +} + + +/** + * @function service_app_terminate + * @since_tizen 2.3 + * @description Service App Terminate + * @parameter void*: Void Pointer + * @return void + */ +void service_app_terminate(void *data) +{ + // Todo: add your code here. + bundle_free(MapRepository); + int ret = data_control_provider_sql_unregister_cb(); + ERR("data_control_provider_sql_unregister_cb %s",(ret<0?"failed":"Passed")); + ret = data_control_provider_map_unregister_cb(); + ERR("data_control_provider_map_unregister_cb %s",(ret<0?"failed":"Passed")); + //free(map_provider_callback); + //free(sql_callback); + return; +} + + +/** + * @function service_app_control + * @since_tizen 2.3 + * @description Service App Control + * @parameter app_control_h: App Control H, void*: Void Pointer + * @return void + */ +void service_app_control(app_control_h app_control, void *data) +{ + // Todo: add your code here. + return; +} + + +/** + * @function service_app_lang_changed + * @since_tizen 2.3 + * @description Service App Lang Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_lang_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LANGUAGE_CHANGED*/ + return; +} + + +/** + * @function service_app_orient_changed + * @since_tizen 2.3 + * @description Service App Orient Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_orient_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/ + return; +} + + +/** + * @function service_app_region_changed + * @since_tizen 2.3 + * @description Service App Region Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_region_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_REGION_FORMAT_CHANGED*/ +} + + +/** + * @function service_app_low_battery + * @since_tizen 2.3 + * @description Service App Low Battery + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_low_battery(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LOW_BATTERY*/ +} + + +/** + * @function service_app_low_memory + * @since_tizen 2.3 + * @description Service App Low Memory + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_low_memory(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LOW_MEMORY*/ +} + + +/** + * @function main + * @since_tizen 2.3 + * @description Main + * @parameter int: Int, char*: Char Pointer + * @return int + */ +int main(int argc, char* argv[]) +{ + char ad[50] = {0,}; + service_app_lifecycle_callback_s event_callback; + app_event_handler_h handlers[5] = {NULL, }; + + event_callback.create = service_app_create; + event_callback.terminate = service_app_terminate; + event_callback.app_control = service_app_control; + + service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, service_app_orient_changed, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); + + return service_app_main(argc, argv, &event_callback, ad); +} diff --git a/coretbt_dataprovider/tizen-manifest.xml b/coretbt_dataprovider/tizen-manifest.xml new file mode 100644 index 0000000..b41aea0 --- /dev/null +++ b/coretbt_dataprovider/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + coretbt_dataprovider.png + + + + + http://tizen.org/privilege/datasharing + http://tizen.org/privilege/externalstorage.appdata + + true + diff --git a/coretbt_serviceapp/.cproject b/coretbt_serviceapp/.cproject new file mode 100644 index 0000000..6aa19f3 --- /dev/null +++ b/coretbt_serviceapp/.cproject @@ -0,0 +1,579 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coretbt_serviceapp/.exportMap b/coretbt_serviceapp/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/coretbt_serviceapp/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/coretbt_serviceapp/.package-stamp b/coretbt_serviceapp/.package-stamp new file mode 100644 index 0000000..40cbe59 --- /dev/null +++ b/coretbt_serviceapp/.package-stamp @@ -0,0 +1 @@ +TPK \ No newline at end of file diff --git a/coretbt_serviceapp/.project b/coretbt_serviceapp/.project new file mode 100644 index 0000000..287ad58 --- /dev/null +++ b/coretbt_serviceapp/.project @@ -0,0 +1,26 @@ + + + coretbt_serviceapp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/coretbt_serviceapp/.sdk_delta.info b/coretbt_serviceapp/.sdk_delta.info new file mode 100644 index 0000000..eda2ddd Binary files /dev/null and b/coretbt_serviceapp/.sdk_delta.info differ diff --git a/coretbt_serviceapp/.tproject b/coretbt_serviceapp/.tproject new file mode 100644 index 0000000..ccab492 --- /dev/null +++ b/coretbt_serviceapp/.tproject @@ -0,0 +1,12 @@ + + + + + wearable-5.0 + + + + + + + diff --git a/coretbt_serviceapp/inc/coretbt_serviceapp.h b/coretbt_serviceapp/inc/coretbt_serviceapp.h new file mode 100644 index 0000000..b8720b6 --- /dev/null +++ b/coretbt_serviceapp/inc/coretbt_serviceapp.h @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file coretbt_serviceapp.h + * @brief service app that will be used by TBT for view/pick operation + * @since_tizen 2.3 + * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) + * @date October, 2014 + * @bug no known bug + * @credit Tizen SDK Version 2.3.0 Sample Example + * + * */ +#ifndef __coretbt_serviceapp_H__ + + +#ifndef TIZEN_DEBUG_ENABLE +#define TIZEN_DEBUG_ENABLE +#endif + + +#include "logger.h" + + +#endif /* __coretbt_serviceapp_H__ */ diff --git a/coretbt_serviceapp/inc/logger.h b/coretbt_serviceapp/inc/logger.h new file mode 100644 index 0000000..93e6a02 --- /dev/null +++ b/coretbt_serviceapp/inc/logger.h @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file logger.h + * @brief This file provide necessary macro for logging information. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include + +#define LOG_TAG_CORE "[coretbt_serviceapp]_" + +#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) +#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) +#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) + +#define RETM_IF(expr, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return; \ + } \ +} + +#define RETVM_IF(expr, val, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ +} + +#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; + +#endif /* __LOGGER_H__ */ diff --git a/coretbt_serviceapp/project_def.prop b/coretbt_serviceapp/project_def.prop new file mode 100644 index 0000000..6794026 --- /dev/null +++ b/coretbt_serviceapp/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = coretbt_serviceapp + +type = app +profile = wearable-2.3.1 + +USER_SRCS = src/coretbt_serviceapp.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = diff --git a/coretbt_serviceapp/shared/res/coretbt_serviceapp.png b/coretbt_serviceapp/shared/res/coretbt_serviceapp.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/coretbt_serviceapp/shared/res/coretbt_serviceapp.png differ diff --git a/coretbt_serviceapp/src/coretbt_serviceapp.c b/coretbt_serviceapp/src/coretbt_serviceapp.c new file mode 100644 index 0000000..44f9c53 --- /dev/null +++ b/coretbt_serviceapp/src/coretbt_serviceapp.c @@ -0,0 +1,259 @@ +/******************************************************************************* + * Copyright (c) 2014 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 +#include +#include "coretbt_serviceapp.h" + + +/** + * @function service_app_create + * @since_tizen 2.3 + * @description Service App Create + * @parameter void*: Void Pointer + * @return bool + */ +bool service_app_create(void *data) +{ + // Todo: add your code here. + DBG("Service app creating..."); + return true; +} + + +/** + * @function service_app_terminate + * @since_tizen 2.3 + * @description Service App Terminate + * @parameter void*: Void Pointer + * @return void + */ +void service_app_terminate(void *data) +{ + // Todo: add your code here. + DBG("Service app terminating..."); + return; +} + + +/** + * @function get_app_control_error + * @since_tizen 2.3 + * @description Get App Control Error + * @parameter int: Int + * @return char* + */ +char* get_app_control_error(int ret) +{ + char* error = NULL; + switch (ret) { + case APP_CONTROL_ERROR_NONE: + error = "APP_CONTROL_ERROR_NONE"; + break; + case APP_CONTROL_ERROR_INVALID_PARAMETER: + error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; + break; + case APP_CONTROL_ERROR_OUT_OF_MEMORY: + error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; + break; + case APP_CONTROL_ERROR_APP_NOT_FOUND: + error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_NOT_FOUND: + error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_REJECTED: + error = "APP_CONTROL_ERROR_KEY_REJECTED"; + break; + case APP_CONTROL_ERROR_INVALID_DATA_TYPE: + error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; + break; + case APP_CONTROL_ERROR_LAUNCH_REJECTED: + error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; + break; + case APP_CONTROL_ERROR_PERMISSION_DENIED: + error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; + break; + case APP_CONTROL_ERROR_LAUNCH_FAILED: + error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; + break; + case APP_CONTROL_ERROR_TIMED_OUT: + error = "APP_CONTROL_ERROR_TIMED_OUT"; + break; + //case APP_CONTROL_ERROR_IO_ERROR: + //return "APP_CONTROL_ERROR_IO_ERROR"; + default: + error = "Unknown Error"; + break; + } + return error; +} + + +/** + * @function service_app_control + * @since_tizen 2.3 + * @description Service App Control + * @parameter app_control_h: App Control H, void*: Void Pointer + * @return void + */ +void service_app_control(app_control_h control, void *data) +{ + // Todo: add your code here. + int status_1,status_2,status_3; + + + /* Handle the launch request. */ + DBG("app_control"); + + char *category; + status_1 = app_control_get_operation(control,&category); + DBG("app_control_get_operation status=%d Categoty=%s",status_1,category); + RETM_IF(NULL==category, "app_control_get_operation category NULL"); + RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_get_operation fails: %s", get_app_control_error(status_1)); + + char *chCaller; + status_3=app_control_get_caller(control,&chCaller); + DBG("app_control_get_caller %d ",status_3); + RETM_IF(NULL==chCaller, "app_control_get_caller chCaller NULL"); + RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_get_caller fails: %s", get_app_control_error(status_1)); + + char *chTypeStr; + status_1 = app_control_get_extra_data(control,"type",&chTypeStr); + if(NULL==chTypeStr) + { + DBG("app_control_get_extra_data chTypeStr NULL. app_control_get_extra_data fails: %s", get_app_control_error(status_1)); + } + + bool was_requested; + status_1=app_control_is_reply_requested(control,&was_requested); + RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_is_reply_requested fails: %s", get_app_control_error(status_1)); + DBG("app_control_is_reply_requested %d",status_1); + + app_control_h reply; + status_1 = app_control_create (&reply); + DBG("app_control_create=%s",get_app_control_error(status_1)); + + // lets echo back result + status_1 = app_control_add_extra_data ( reply, "from", chCaller); + DBG("app_control_add_extra_data=%s",get_app_control_error(status_1)); + status_1 = app_control_add_extra_data ( reply, "replyRequested", was_requested?"yes":"no"); + DBG("app_control_add_extra_data=%s",get_app_control_error(status_1)); + + //APP_CONTROL_RESULT_SUCCEEDED + app_control_result_e res=APP_CONTROL_RESULT_SUCCEEDED; + status_1 = app_control_reply_to_launch_request(reply,control,res); + DBG("app_control_reply_to_launch_request=%s",get_app_control_error(status_1)); + return; +} + + +/** + * @function service_app_lang_changed + * @since_tizen 2.3 + * @description Service App Lang Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_lang_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LANGUAGE_CHANGED*/ + return; +} + + +/** + * @function service_app_orient_changed + * @since_tizen 2.3 + * @description Service App Orient Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_orient_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/ + return; +} + + +/** + * @function service_app_region_changed + * @since_tizen 2.3 + * @description Service App Region Changed + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_region_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_REGION_FORMAT_CHANGED*/ +} + + +/** + * @function service_app_low_battery + * @since_tizen 2.3 + * @description Service App Low Battery + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_low_battery(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LOW_BATTERY*/ + DBG("Service app running on low battery. app_exiting..."); + service_app_exit(); +} + + +/** + * @function service_app_low_memory + * @since_tizen 2.3 + * @description Service App Low Memory + * @parameter app_event_info_h: App Event Info H, void*: Void Pointer + * @return static void + */ +static void service_app_low_memory(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LOW_MEMORY*/ + service_app_exit(); +} + + +/** + * @function main + * @since_tizen 2.3 + * @description Main + * @parameter int: Int, char*: Char Pointer + * @return int + */ +int main(int argc, char* argv[]) +{ + char ad[50] = {0,}; + service_app_lifecycle_callback_s event_callback; + app_event_handler_h handlers[5] = {NULL, }; + + event_callback.create = service_app_create; + event_callback.terminate = service_app_terminate; + event_callback.app_control = service_app_control; + + service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, service_app_orient_changed, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); + service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); + + return service_app_main(argc, argv, &event_callback, ad); +} diff --git a/coretbt_serviceapp/tizen-manifest.xml b/coretbt_serviceapp/tizen-manifest.xml new file mode 100644 index 0000000..5554eb8 --- /dev/null +++ b/coretbt_serviceapp/tizen-manifest.xml @@ -0,0 +1,9 @@ + + + + + + coretbt_serviceapp.png + + true + diff --git a/coretbt_uiapp/.cproject b/coretbt_uiapp/.cproject new file mode 100644 index 0000000..b1cb769 --- /dev/null +++ b/coretbt_uiapp/.cproject @@ -0,0 +1,571 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coretbt_uiapp/.exportMap b/coretbt_uiapp/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/coretbt_uiapp/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/coretbt_uiapp/.package-stamp b/coretbt_uiapp/.package-stamp new file mode 100644 index 0000000..40cbe59 --- /dev/null +++ b/coretbt_uiapp/.package-stamp @@ -0,0 +1 @@ +TPK \ No newline at end of file diff --git a/coretbt_uiapp/.project b/coretbt_uiapp/.project new file mode 100644 index 0000000..b9a6bcb --- /dev/null +++ b/coretbt_uiapp/.project @@ -0,0 +1,32 @@ + + + coretbt_uiapp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + org.tizen.nativecore.apichecker.core.builder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecore.apichecker.core.tizenCppNature + + diff --git a/coretbt_uiapp/.rds_delta b/coretbt_uiapp/.rds_delta new file mode 100644 index 0000000..3e38782 --- /dev/null +++ b/coretbt_uiapp/.rds_delta @@ -0,0 +1,17 @@ +#delete +#add +res/edje/2.3.1/ +res/edje/2.3.1/wearable_216_432/ +res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edj +res/edje/2.3.1/wearable_320_320/ +res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edj +res/edje/2.3.1/wearable_360_360/ +res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edj +res/edje/2.3.1/ +res/edje/2.3.1/wearable_216_432/ +res/edje/2.3.1/wearable_320_320/ +res/edje/2.3.1/wearable_360_360/ +#modify +author-signature.xml +signature1.xml +bin/coretbt_uiapp diff --git a/coretbt_uiapp/.sdk_delta.info b/coretbt_uiapp/.sdk_delta.info new file mode 100644 index 0000000..e7544bd Binary files /dev/null and b/coretbt_uiapp/.sdk_delta.info differ diff --git a/coretbt_uiapp/.tproject b/coretbt_uiapp/.tproject new file mode 100644 index 0000000..ccab492 --- /dev/null +++ b/coretbt_uiapp/.tproject @@ -0,0 +1,12 @@ + + + + + wearable-5.0 + + + + + + + diff --git a/coretbt_uiapp/inc/coretbt_uiapp.h b/coretbt_uiapp/inc/coretbt_uiapp.h new file mode 100644 index 0000000..9d06581 --- /dev/null +++ b/coretbt_uiapp/inc/coretbt_uiapp.h @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file coretbt_uiapp.h + * @brief ui app that will be used by TBT for view/pick operation + * @since_tizen 2.3 + * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) + * @date October, 2014 + * @bug no known bug + * @credit Tizen SDK Version 2.3.0 Sample Example + * + * */ + +#ifndef __coretbt_uiapp_H__ + +#ifndef TIZEN_DEBUG_ENABLE +#define TIZEN_DEBUG_ENABLE +#endif + +#include +#include +#include +//#include +#include "efl_extension_events.h" +#include +#include +#include "logger.h" + +#if !defined(PACKAGE) +#define PACKAGE "org.tizen.coretbt_uiapp" +#endif + +//#define EDJ_FILE_MOBILE "edje/coretbt_uiapp.edj" +//#define EDJ_FILE_WEARABLE "edje/wearable_coretbt_uiapp.edj" + +#define GRP_MAIN "main" + +#define KEY_END "XF86Stop" + +#define MAX_LENGTH 1024 + +#define USE_GENLIST + +typedef enum { + DEVICE_WEARABLE, + DEVICE_MOBILE, + DEVICE_WEARABLE_360_X_480, + DEVICE_WEARABLE_360_360, + DEVICE_WEARABLE_216_432, + DEVICE_WEARABLE_320_320, + + DEVICE_NONE, + DEVICE_MAX +}device_type_e; + +static inline device_type_e get_device_type() +{ + int width, height; + device_type_e device_type = DEVICE_NONE; + + system_info_get_platform_int("tizen.org/feature/screen.width", &width); + system_info_get_platform_int("tizen.org/feature/screen.height", &height); + + if(width == 360 && height == 360) + { + //circle + device_type = DEVICE_WEARABLE_360_360; + } + else if(width == 216 && height == 432) + { + device_type = DEVICE_WEARABLE_216_432; + } + else if(width == 360 && height == 480) + { + device_type = DEVICE_WEARABLE_360_X_480; + } + else if(width == 320 && height == 320) + { + device_type = DEVICE_WEARABLE_320_320; + } + else + { + device_type = DEVICE_WEARABLE_320_320; + } + return device_type; + +} + +static void app_get_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + free(res_path); + } +} + +static inline const char *get_edje_path(const char *file_name) +{ + char absolute_path[MAX_LENGTH] = {'\0'}; + char file_path[MAX_LENGTH] = {'\0'}; + + if(get_device_type() == DEVICE_WEARABLE_216_432) + { + strncat(file_path, "edje/2.3.1/wearable_216_432/", sizeof("edje/2.3.1/wearable_216_432/")); + } + else if(get_device_type() == DEVICE_WEARABLE_320_320) + { + strncat(file_path, "edje/2.3.1/wearable_320_320/", sizeof("edje/2.3.1/wearable_320_320/")); + } + else if(get_device_type() == DEVICE_WEARABLE_360_X_480) + { + strncat(file_path, "edje/2.3.1/wearable_360_x_480/", sizeof("edje/2.3.1/wearable_360_x_480/")); + } + else if(get_device_type() == DEVICE_WEARABLE_360_360) + { + strncat(file_path, "edje/2.3.1/wearable_360_360/", sizeof("edje/2.3.1/wearable_360_360/")); + } + + int num = strlen(file_name); + if(strlen(file_path)+strlen(file_name) <= MAX_LENGTH) + { + num = strlen(file_name); + } + else + { + num = MAX_LENGTH-strlen(file_path); + } + + strncat(file_path,file_name, num); + app_get_resource(file_path, absolute_path, (int)MAX_LENGTH); + return strdup(absolute_path); + +} + + + +#endif /* __coretbt_uiapp_H__ */ diff --git a/coretbt_uiapp/inc/logger.h b/coretbt_uiapp/inc/logger.h new file mode 100644 index 0000000..7d985b8 --- /dev/null +++ b/coretbt_uiapp/inc/logger.h @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2014 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. + * + *******************************************************************************/ + +/** + * @file logger.h + * @brief This file provide necessary macro for logging information. + * @since_tizen 2.3 + * @author Amlan Chowdhury (amlan.c@samsung.com) + * @date October, 2014 + * @bug + * @credit + */ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include + +#define LOG_TAG_CORE "[coretbt_uiapp]_" + +#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) +#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) +#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) + +#define RETM_IF(expr, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return; \ + } \ +} + +#define RETVM_IF(expr, val, fmt, arg...) \ +{ \ + if (expr) \ + { \ + ERR(fmt, ##arg); \ + return (val); \ + } \ +} + +#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; + +#endif /* __LOGGER_H__ */ diff --git a/coretbt_uiapp/project_def.prop b/coretbt_uiapp/project_def.prop new file mode 100644 index 0000000..3273382 --- /dev/null +++ b/coretbt_uiapp/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = coretbt_uiapp + +type = app +profile = wearable-2.3.1 + +USER_SRCS = src/coretbt_uiapp.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = res/edje/coretbt_uiapp.edc diff --git a/coretbt_uiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc b/coretbt_uiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc new file mode 100644 index 0000000..45d45bb --- /dev/null +++ b/coretbt_uiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ + +collections { + group { name: "main"; + + parts { + + part { name: "txt_title"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.05; } + rel2 { relative: 1.0 0.12; } + text { font: "Tizen:style=regular"; size: 20; min: 1 1; } + color: 0 0 0 255; + } + } + + part { name: "txt_title2"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.12; } + rel2 { relative: 1.0 0.19; } + text { font: "Tizen:style=regular"; size: 20; min: 1 1; } + color: 0 0 0 255; + } + } + + + part { name: "list"; + type: SWALLOW; + mouse_events: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.19; } + rel2 { relative: 1.0 0.75; } + color: 255 0 0 255; + } + } + + part { name: "padding"; + type: SPACER; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.75; } + rel2 { relative: 1.0 0.80; } + fixed: 1 0; + } + } + + + + part { name: "button"; + type: SWALLOW; + mouse_events: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.80; } + rel2 { relative: 1.0 0.95; } + color: 255 0 0 255; + } + } + + + } + } +} diff --git a/coretbt_uiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc b/coretbt_uiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc new file mode 100644 index 0000000..ee3c9c6 --- /dev/null +++ b/coretbt_uiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +#define HEADER_HIGHT 0.0 + +collections { + group { name: "main"; + + parts { + + part { name: "txt_title"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.0; } + rel2 { relative: 1.0 0.08; } + text { font: "Tizen:style=regular"; size: 20; min: 1 1; } + color: 0 0 0 255; + } + } + + part { name: "txt_title2"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.08; } + rel2 { relative: 1.0 0.16; } + text { font: "Tizen:style=regular"; size: 20; min: 1 1; } + color: 0 0 0 255; + } + } + + + part { name: "list"; + type: SWALLOW; + mouse_events: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.16; } + rel2 { relative: 1.0 0.64; } + color: 255 0 0 255; + } + } + + part { name: "padding2"; + type: SPACER; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.64; } + rel2 { relative: 1.0 0.65; } + fixed: 1 0; + } + } + + + + part { name: "button"; + type: SWALLOW; + mouse_events: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { relative: 0.0 0.65; } + rel2 { relative: 1.0 1.00; } + color: 255 0 0 255; + } + } + + + } + } +} diff --git a/coretbt_uiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc b/coretbt_uiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc new file mode 100644 index 0000000..7bc68ac --- /dev/null +++ b/coretbt_uiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ + +collections { + group { name: "main"; + + parts { + + part { name: "txt_title"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.0; } + rel2 {relative: 1.0 0.10; } + } + } + + part { name: "txt_title2"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.10; } + rel2 {relative: 1.0 0.20; } + } + } + + + part { name: "list"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 0.20; + } + rel2 { + relative: 1.0 0.70; + } + visible: 1; + } + } + + part { name: "padding2"; + type: SPACER; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.70; } + rel2 { relative: 1.0 1.0; } + fixed: 1 0; + } + } + + + part { name: "button"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 { + relative: 0.0 1.0; + } + rel2 { + relative: 1.0 1.0; + } + visible: 1; + } + } + + + } + } +} diff --git a/coretbt_uiapp/shared/res/coretbt_uiapp.png b/coretbt_uiapp/shared/res/coretbt_uiapp.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/coretbt_uiapp/shared/res/coretbt_uiapp.png differ diff --git a/coretbt_uiapp/src/coretbt_uiapp.c b/coretbt_uiapp/src/coretbt_uiapp.c new file mode 100644 index 0000000..0492cc5 --- /dev/null +++ b/coretbt_uiapp/src/coretbt_uiapp.c @@ -0,0 +1,692 @@ +/******************************************************************************* + * Copyright (c) 2014 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 "coretbt_uiapp.h" + + + +typedef struct appdata{ + Evas_Object* win; + Evas_Object* layout; + Evas_Object* conform; + + int mode; + int selectionMode; + app_control_h request; + + Evas_Object *list; + Evas_Object *button; + + char **items; + int itemCount; + + char *title1; + char *title2; + + +} appdata_s; + + +#ifdef USE_GENLIST +typedef struct +{ + int index; + Elm_Object_Item *item; + char* text; +}item_data; + +static void _gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED); +static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part); +Elm_Object_Item* _elm_genlist_item_append(appdata_s *this, char *item_text, void* data); +#endif + +static bool has_request=false; +static app_control_h _control; +static char *type_str=NULL; +static bool was_requested; +static int status_1,status_2; +static char *caller; + + +#ifdef USE_GENLIST +static void _gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + DBG("_gl_del_cb"); + item_data *id = data; + RETM_IF(!id, "item is NULL"); + SAFE_DELETE(id); +} + +static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part) +{ + DBG("_gl_text_get_cb"); + item_data *id = data; + //const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(id->item); + + //if(itc->item_style && !strcmp(itc->item_style, "default")) + { + + if(part && !strcmp(part, "elm.text")) + { + char buf[1024]; + snprintf(buf, 1023, id->text); + return strdup(buf); + } + } + return NULL; +} + +static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + Elm_Object_Item *it = event_info; + //Un-highlight item + elm_genlist_item_selected_set(it, EINA_TRUE); +} + +Elm_Object_Item* _elm_genlist_item_append(appdata_s *this, char *item_text, void* data) +{ + + DBG("_elm_genlist_item_append%s:", item_text); + static int index = 1; + Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); + + itc->item_style = "default"; + itc->func.text_get = _gl_text_get_cb; + itc->func.content_get = NULL; + itc->func.del = _gl_del_cb; + + item_data *id = calloc(sizeof(item_data), 1); + id->index = index++; + id->text = strdup(item_text); + + elm_scroller_single_direction_set(this->list, ELM_SCROLLER_SINGLE_DIRECTION_HARD); + + //HOMOGENEOUS MODE + //If item height is same when each style name is same, Use homogeneous mode. + elm_genlist_homogeneous_set(this->list, EINA_TRUE); + + //COMPRESS MODE + //For the Mobile view, because it has full window, compresse mode should be used. + elm_genlist_mode_set(this->list, ELM_LIST_COMPRESS); + + Elm_Object_Item *item = elm_genlist_item_append(this->list, itc,id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + id->item = item; + + elm_genlist_item_class_free(itc); + + return item; +} +#endif +/** + * @function get_app_control_error + * @since_tizen 2.3 + * @description Get App Control Error + * @parameter int: Int + * @return static char* + */ +static char* get_app_control_error(int ret) +{ + char* error = NULL; + + switch (ret) { + case APP_CONTROL_ERROR_NONE: + error = "APP_CONTROL_ERROR_NONE"; + break; + case APP_CONTROL_ERROR_INVALID_PARAMETER: + error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; + break; + case APP_CONTROL_ERROR_OUT_OF_MEMORY: + error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; + break; + case APP_CONTROL_ERROR_APP_NOT_FOUND: + error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_NOT_FOUND: + error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; + break; + case APP_CONTROL_ERROR_KEY_REJECTED: + error = "APP_CONTROL_ERROR_KEY_REJECTED"; + break; + case APP_CONTROL_ERROR_INVALID_DATA_TYPE: + error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; + break; + case APP_CONTROL_ERROR_LAUNCH_REJECTED: + error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; + break; + case APP_CONTROL_ERROR_PERMISSION_DENIED: + error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; + break; + case APP_CONTROL_ERROR_LAUNCH_FAILED: + error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; + break; + case APP_CONTROL_ERROR_TIMED_OUT: + error = "APP_CONTROL_ERROR_TIMED_OUT"; + break; + //case APP_CONTROL_ERROR_IO_ERROR: + //error = "APP_CONTROL_ERROR_IO_ERROR"; + //break; + default: + error = "Unknown Error"; + break; + } + return error; +} + + +/** + * @function layout_back_cb + * @since_tizen 2.3 + * @description Layout Back Cb + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata_s *ad = data; + /* Let window go to hide state. */ + elm_win_lower(ad->win); +} + + +/** + * @function app_get_resource + * @since_tizen 2.3 + * @description App Get Resource + * @parameter const char*: Const char Pointer, char*: Char Pointer + * @return static void + */ + + + +/** + * @function win_delete_request_cb + * @since_tizen 2.3 + * @description Win Delete Request Cb + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void win_delete_request_cb(void *data , Evas_Object *obj , void *event_info) +{ + DBG("win_delete_request_cb"); + + ui_app_exit(); +} + + +/** + * @function update_info + * @since_tizen 2.3 + * @description Update Info + * @parameter appdata_s*: Appdata S Pointer + * @return static void + */ +static void update_info(appdata_s *ad) +{ + DBG("update_info"); + + elm_object_part_text_set(ad->layout, "txt_title", ad->title1); + elm_object_part_text_set(ad->layout, "txt_title2", ad->title2); + + if(ad->mode==0) + { + elm_object_text_set(ad->button, "Return"); + } + else if(ad->mode==1) + { +#ifdef USE_GENLIST + elm_genlist_multi_select_set (ad->list, ad->selectionMode==0?EINA_FALSE:EINA_TRUE); +#else + elm_list_multi_select_set (ad->list, ad->selectionMode==0?EINA_FALSE:EINA_TRUE); +#endif + + elm_object_text_set(ad->button, ad->selectionMode==0?"Select Single":"Select Multiple"); + + } +} + + +/** + * @function on_return_button_clicked + * @since_tizen 2.3 + * @description On Return Button Clicked + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void on_return_button_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + DBG("on_return_button_clicked"); + + int nStatus; + appdata_s *ad=data; + + + + if(was_requested) + { + DBG("on_return_button_clicked Reply Requested"); + + app_control_h reply; + nStatus = app_control_create (&reply); + DBG("app_control_create=%s",get_app_control_error(nStatus)); + if(!reply) + { + DBG("reply is Null"); + } + // lets craete reply dta + const Eina_List *items,*l; + Elm_Object_Item *list_it; + + + int selectionCount=0; + DBG("Getting List Items"); + +#ifdef USE_GENLIST + items = elm_genlist_selected_items_get(ad->list); +#else + items = elm_list_selected_items_get(ad->list); +#endif + + DBG("Got List Items"); + + EINA_LIST_FOREACH(items, l, list_it) + { + char *value = NULL; +#ifdef USE_GENLIST + value=(char*)elm_object_item_part_text_get(list_it, "elm.text"); +#else + value=(char*)elm_object_item_text_get(list_it); +#endif + if(value) { + DBG("SELECTED %s",value); + selectionCount++; + } + } + + char countStr[32]; + snprintf(countStr, sizeof(countStr), "%d",selectionCount); + nStatus = app_control_add_extra_data ( reply, "count", countStr); + DBG("app_control_add_extra_data=%s",get_app_control_error(nStatus)); + + + char *values[selectionCount]; + int now=0; + + + EINA_LIST_FOREACH(items, l, list_it) + { + char *value = NULL; +#ifdef USE_GENLIST + value=(char*)elm_object_item_part_text_get(list_it, "elm.text"); +#else + value=(char*)elm_object_item_text_get(list_it); +#endif + if(value) { + values[now++]=value; + } + + } + nStatus = app_control_add_extra_data_array ( reply, "values", (const char**)values,selectionCount); + DBG("app_control_add_extra_data_array=%s",get_app_control_error(nStatus)); + + + // ************************************ + //APP_CONTROL_RESULT_SUCCEEDED + + app_control_result_e res=APP_CONTROL_RESULT_SUCCEEDED; + nStatus = app_control_reply_to_launch_request(reply,_control,res); + DBG("app_control_reply_to_launch_request=%s",get_app_control_error(nStatus)); + } + + DBG("No reply! Quitting..."); + ui_app_exit(); + + +} + + +/** + * @function create_base_gui + * @since_tizen 2.3 + * @description Create Base Gui + * @parameter appdata_s*: Appdata S Pointer + * @return static void + */ +static void create_base_gui(appdata_s *ad) +{ + DBG("create_base_gui"); + + + //char edj_path[PATH_MAX] = {0, }; + + /* Window */ + ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); + elm_win_conformant_set(ad->win, EINA_TRUE); + elm_win_autodel_set(ad->win, EINA_TRUE); + + if (elm_win_wm_rotation_supported_get(ad->win)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + } + + evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); + + /* Conformant */ + ad->conform = elm_conformant_add(ad->win); + evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->win, ad->conform); + evas_object_show(ad->conform); + + /* Base Layout */ + //app_get_resource(EDJ_FILE_WEARABLE, edj_path, (int)PATH_MAX); + + + ad->layout = elm_layout_add(ad->win); + elm_layout_file_set(ad->layout,get_edje_path("wearable_coretbt_uiapp.edj"), GRP_MAIN); + + evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(ad->conform, ad->layout); + + elm_object_part_text_set(ad->layout, "txt_title", "App Test Control"); + elm_object_part_text_set(ad->layout, "txt_title2", "Sample Data : "); + + + // lets create dummy data :D + char *data[]={"Artcell", "Dream Theater", "Pink Floyd","Iron Maiden","SOAD","Prisoners","Poets Of The Fall","Endless River","No room for looser!"}; + ad->items=data; + ad->itemCount=9; + + + + // create list +#ifdef USE_GENLIST + ad->list = elm_genlist_add(ad->layout); + evas_object_size_hint_weight_set(ad->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ad->list, EVAS_HINT_FILL, EVAS_HINT_FILL); + + + elm_genlist_select_mode_set(ad->list,ELM_OBJECT_SELECT_MODE_ALWAYS); + int i; + for (i = 0; iitemCount; ++i) { + DBG("[%d] data is %d %s ",ad->itemCount,i,data[i]); + _elm_genlist_item_append(ad, data[i], ad->win); + } + +#else + ad->list = elm_list_add(ad->layout); + evas_object_size_hint_weight_set(ad->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ad->list, EVAS_HINT_FILL, EVAS_HINT_FILL); + + + elm_list_select_mode_set(ad->list,ELM_OBJECT_SELECT_MODE_ALWAYS); + int i; + for (i = 0; iitemCount; ++i) { + DBG("[%d] data is %d %s ",ad->itemCount,i,data[i]); + elm_list_item_append(ad->list, data[i], NULL, NULL, NULL, ad->win); + } + + elm_list_go(ad->list); +#endif + + elm_object_part_content_set(ad->layout, "list", ad->list); + + evas_object_show(ad->layout); + evas_object_show(ad->list); + + + + // add button + ad->button = elm_button_add(ad->layout); + evas_object_size_hint_align_set(ad->button, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(ad->button, "Return"); + elm_object_part_content_set(ad->layout, "button", ad->button); + evas_object_show(ad->button); + evas_object_smart_callback_add(ad->button, "clicked", on_return_button_clicked, ad); + if(get_device_type() == DEVICE_WEARABLE_360_360) + { + elm_object_style_set(ad->button, "bottom"); + } + + evas_object_show(ad->win); + + eext_object_event_callback_add(ad->layout, EEXT_CALLBACK_BACK, layout_back_cb, ad); + + update_info(ad); +} + + +/** + * @function app_create + * @since_tizen 2.3 + * @description App Create + * @parameter void*: Void Pointer + * @return static bool + */ +static bool app_create(void *data) +{ + DBG("app_create"); + /* Hook to take necessary actions before main event loop starts + Initialize UI resources and application's data + If this function returns true, the main loop of application starts + If this function returns false, the application is terminated */ + appdata_s *ad = data; + + create_base_gui(ad); + + return true; +} + + +/** + * @function app_control + * @since_tizen 2.3 + * @description App Control + * @parameter app_control_h: App Control H, void*: Void Pointer + * @return static void + */ +static void app_control(app_control_h control, void *data) +{ + appdata_s *ad=data; + + int nStatus=-1; + has_request=false; + + /* Handle the launch request. */ + DBG("app_control"); + + char *category; + nStatus = app_control_get_operation(control,&category); + DBG("app_control_get_operation=%s",get_app_control_error(nStatus)); + if(!category) + { + ERR("category is Null"); + return; + } + ad->title2="Dummy Items : "; + if(strcmp(category,APP_CONTROL_OPERATION_VIEW)==0) + { + ad->mode=0; + // load view mode + ad->title1="View Operation"; + } + else if(strcmp(category,APP_CONTROL_OPERATION_DEFAULT)==0) + { + ad->mode=0; + // load view mode + ad->title1="Default Operation"; + } + else if(strcmp(category,APP_CONTROL_OPERATION_PICK)==0) + { + // load pick mode + ad->mode=1; + ad->title1="Pick Operation"; + + char *selection; + //check for selection mode + nStatus = app_control_get_extra_data(control,APP_CONTROL_DATA_SELECTION_MODE,&selection); + DBG("app_control_get_extra_data=%s",get_app_control_error(nStatus)); + if(!selection) + { + ERR("selection is Null"); + return; + } + + if(nStatus==0 && strcmp(selection,"single")==0) + { + ad->selectionMode=0; + } + else if(nStatus==0 && strcmp(selection,"multiple")==0) + { + ad->selectionMode=1; + } + else + { + ad->selectionMode=0; + ad->title1 = "Pick Operation Unknown"; + } + + } + else + { + ad->mode=0; + + char str[MAX_LENGTH]; + snprintf(str, sizeof(str), "%s%s", "Operation: ", category); + ad->title1 = str; + + } + + ad->request=control; + + caller=NULL; + status_2=app_control_get_caller(control,&caller); + DBG("app_control_get_caller=%s",get_app_control_error(nStatus)); + if(!caller) + { + DBG("caller is Null"); + } + + + if(status_2==0) + { + ad->title2="Caller App : "; + } + + + nStatus = app_control_get_extra_data(control,"type",&type_str); + DBG("app_control_get_extra_data=%s",get_app_control_error(nStatus)); + if(!type_str) + { + DBG("caller is Null"); + } + + status_1=app_control_is_reply_requested(control,&was_requested); + DBG("app_control_is_reply_requested=%s",get_app_control_error(nStatus)); + + + has_request=true; + nStatus=app_control_clone (&_control, control); + DBG("app_control_clone=%s",get_app_control_error(nStatus)); + if(!_control) + { + DBG("_control is Null"); + } + + + update_info(ad); +} + + +/** + * @function app_pause + * @since_tizen 2.3 + * @description App Pause + * @parameter void*: Void Pointer + * @return static void + */ +static void app_pause(void *data) +{ + /* Take necessary actions when application becomes invisible. */ + DBG("app_pause"); +} + + +/** + * @function app_resume + * @since_tizen 2.3 + * @description App Resume + * @parameter void*: Void Pointer + * @return static void + */ +static void app_resume(void *data) +{ + /* Take necessary actions when application becomes visible. */ + DBG("app_resume"); +} + + +/** + * @function app_terminate + * @since_tizen 2.3 + * @description App Terminate + * @parameter void*: Void Pointer + * @return static void + */ +static void app_terminate(void *data) +{ + /* Release all resources. */ + DBG("app_terminate"); + type_str=NULL; + + has_request=false; +} + + +/** + * @function main + * @since_tizen 2.3 + * @description Main + * @parameter int: Int, char*: Char Pointer + * @return int + */ +int main(int argc, char *argv[]) +{ + DBG("main"); + + has_request=false; + + appdata_s ad = {0,}; + int ret = 0; + + ui_app_lifecycle_callback_s event_callback = {0,}; + + + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.pause = app_pause; + event_callback.resume = app_resume; + event_callback.app_control = app_control; + + + DBG("main loop starting..."); + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main is failed. err = %d", ret); + } + + DBG("main_end"); + + return ret;} diff --git a/coretbt_uiapp/tizen-manifest.xml b/coretbt_uiapp/tizen-manifest.xml new file mode 100644 index 0000000..b3b1943 --- /dev/null +++ b/coretbt_uiapp/tizen-manifest.xml @@ -0,0 +1,9 @@ + + + + + + coretbt_uiapp.png + + true + diff --git a/coretbtdataprovider/.cproject b/coretbtdataprovider/.cproject deleted file mode 100644 index 03ecf6d..0000000 --- a/coretbtdataprovider/.cproject +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/coretbtdataprovider/.exportMap b/coretbtdataprovider/.exportMap deleted file mode 100644 index 43e310e..0000000 --- a/coretbtdataprovider/.exportMap +++ /dev/null @@ -1,4 +0,0 @@ -{ - global: main; - local: *; -}; diff --git a/coretbtdataprovider/.package-stamp b/coretbtdataprovider/.package-stamp deleted file mode 100644 index 40cbe59..0000000 --- a/coretbtdataprovider/.package-stamp +++ /dev/null @@ -1 +0,0 @@ -TPK \ No newline at end of file diff --git a/coretbtdataprovider/.project b/coretbtdataprovider/.project deleted file mode 100644 index fa1b1ff..0000000 --- a/coretbtdataprovider/.project +++ /dev/null @@ -1,26 +0,0 @@ - - - coretbtdataprovider - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/coretbtdataprovider/.sdk_delta.info b/coretbtdataprovider/.sdk_delta.info deleted file mode 100644 index 9772391..0000000 Binary files a/coretbtdataprovider/.sdk_delta.info and /dev/null differ diff --git a/coretbtdataprovider/.tproject b/coretbtdataprovider/.tproject deleted file mode 100644 index dd94734..0000000 --- a/coretbtdataprovider/.tproject +++ /dev/null @@ -1,12 +0,0 @@ - - - - - wearable-4.0 - - - - - - - diff --git a/coretbtdataprovider/inc/coretbt_dataprovider.h b/coretbtdataprovider/inc/coretbt_dataprovider.h deleted file mode 100644 index dc1888d..0000000 --- a/coretbtdataprovider/inc/coretbt_dataprovider.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - - -/** - * @file coretbt_dataprovider.h - * @brief service app to handle data provider request - * creates database, receives request to manipulate database as per request and sends response of successfully accomplished tasks - * @since_tizen 2.3 - * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) - * @date October, 2014 - * @bug no known bug - * @credit Tizen SDK Version 2.3.0 Sample Example - * - * */ -#ifndef __coretbt_dataprovider_H__ -#define TIZEN_DEBUG_ENABLE 1 - -#include -#include -#include -#include -#include - -#include "logger.h" - -char DB_PATH[255]; -#define PROVIDER_ID "http://coretbt_dataprovider.com/datacontrol/provider/coretbt_dataprovider" -#define DATA_ID "provider" - -static data_control_provider_sql_cb sql_callback; -static data_control_provider_map_cb map_provider_callback; -sqlite3 *db; -bundle *MapRepository; - -void Initialize_datacontrol_provider(); -void initialize_map_data_control_provider(); - - -#endif /* __coretbt_dataprovider_H__ */ diff --git a/coretbtdataprovider/inc/logger.h b/coretbtdataprovider/inc/logger.h deleted file mode 100644 index 2d92688..0000000 --- a/coretbtdataprovider/inc/logger.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - -/** - * @file logger.h - * @brief This file provide necessary macro for logging information. - * @since_tizen 2.3 - * @author Amlan Chowdhury (amlan.c@samsung.com) - * @date October, 2014 - * @bug - * @credit - */ - -#ifndef __LOGGER_H__ -#define __LOGGER_H__ - -#include - -#define LOG_TAG_CORE "[coretbt_dataprovider]_" - -#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) -#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) -#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) - -#define RETM_IF(expr, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return; \ - } \ -} - -#define RETVM_IF(expr, val, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return (val); \ - } \ -} - -#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; - -#endif /* __LOGGER_H__ */ diff --git a/coretbtdataprovider/project_def.prop b/coretbtdataprovider/project_def.prop deleted file mode 100644 index dd23d3a..0000000 --- a/coretbtdataprovider/project_def.prop +++ /dev/null @@ -1,11 +0,0 @@ -APPNAME = coretbt_dataprovider - -type = app -profile = wearable-2.3.1 - -USER_SRCS = src/coretbt_dataprovider.c -USER_DEFS = -USER_INC_DIRS = inc -USER_OBJS = -USER_LIBS = -USER_EDCS = diff --git a/coretbtdataprovider/shared/res/coretbt_dataprovider.png b/coretbtdataprovider/shared/res/coretbt_dataprovider.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/coretbtdataprovider/shared/res/coretbt_dataprovider.png and /dev/null differ diff --git a/coretbtdataprovider/src/coretbt_dataprovider.c b/coretbtdataprovider/src/coretbt_dataprovider.c deleted file mode 100644 index 57feb58..0000000 --- a/coretbtdataprovider/src/coretbt_dataprovider.c +++ /dev/null @@ -1,680 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - - -/** - * @file coretbt_dataprovider.c - * @brief service app to handle data provider request - * creates database, receives request to manipulate database as per request and sends response of successfully accomplished tasks - * - * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) - * @date October, 2014 - * @bug no known bug - * @credit Tizen SDK Version 2.3.0 Sample Example - * - * */ - -#include -#include -#include "coretbt_dataprovider.h" - - -/** - * @function get_data_control_error - * @since_tizen 2.3 - * @description Get Data Control Error - * @parameter int: Int - * @return static char* - */ -static char* get_data_control_error(int err_code) -{ - char* error = NULL; - switch (err_code) { - case DATA_CONTROL_ERROR_NONE: - error = "DATA_CONTROL_ERROR_NONE"; - break; - case DATA_CONTROL_ERROR_IO_ERROR: - error = "DATA_CONTROL_ERROR_IO_ERROR"; - break; - case DATA_CONTROL_ERROR_OUT_OF_MEMORY: - error = "DATA_CONTROL_ERROR_OUT_OF_MEMORY"; - break; - case DATA_CONTROL_ERROR_INVALID_PARAMETER: - error = "DATA_CONTROL_ERROR_INVALID_PARAMETER"; - break; - case DATA_CONTROL_ERROR_PERMISSION_DENIED: - error = "DATA_CONTROL_ERROR_PERMISSION_DENIED"; - break; - case DATA_CONTROL_ERROR_MAX_EXCEEDED: - error = "DATA_CONTROL_ERROR_MAX_EXCEEDED"; - break; - default: - error = "Unknown Error"; - break; - } - - return error; -} - - -/** - * @function insert_request_cb - * @since_tizen 2.3 - * @description Insert Request Cb - * @parameter int: Int, bundle*: Bundle Pointer - * @return static void - */ -static void insert_request_cb(int request_id, data_control_h provider, bundle *insert_data) -{ - char* pszAppId =NULL; - int nRet = 0; - bool bMatch = false; - DBG("Inside insert request cb"); - - nRet = data_control_provider_get_client_appid(request_id, &pszAppId); - if (nRet != DATA_CONTROL_ERROR_NONE) - { - ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); - }else{ - DBG("data_control_provider_get_client_appid Successed"); - } - - DBG("Insert request from Client with App Id: %s" , pszAppId); - - bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); - if(!bMatch) - { - ERR("data_control_provider_match_provider_id failed"); - int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); - if(status == DATA_CONTROL_ERROR_NONE){ - DBG("data_control_provider_send_error Successed"); - }else{ - ERR("data_control_provider_send_error failed %s", get_data_control_error(status)); - } - - free(pszAppId); - pszAppId = NULL; - return; - - }else{ - DBG("data_control_provider_match_provider_id Successed"); - } - - bMatch = data_control_provider_match_data_id(provider,DATA_ID ); - - if(!bMatch) - { - ERR("data_control_provider_match_data_id failed"); - int status = data_control_provider_send_error(request_id,"Data Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s", get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - char* command = data_control_provider_create_insert_statement(provider, insert_data); - if(command){ - DBG("command: %s" , command); - }else{ - ERR("data_control_provider_create_insert_statement failed "); - } - int ret = sqlite3_exec(db, command, NULL, NULL, NULL); - - long long inserted_row_id = sqlite3_last_insert_rowid(db); - - ret = data_control_provider_send_insert_result(request_id, inserted_row_id); - if (ret != DATA_CONTROL_ERROR_NONE) - { - ERR("insert_send_result failed with error: %s",get_data_control_error(ret)); - } - - free(command); - free(pszAppId); - pszAppId = NULL; - -} - - -/** - * @function delete_request_cb - * @since_tizen 2.3 - * @description Delete Request Cb - * @parameter int: Int, const char*: Const char Pointer - * @return static void - */ -static void delete_request_cb(int request_id, data_control_h provider, const char *where) -{ - char* pszAppId =NULL; - int nRet = 0; - bool bMatch = false; - DBG("Inside delete request cb"); - - nRet = data_control_provider_get_client_appid(request_id, &pszAppId); - if (nRet != DATA_CONTROL_ERROR_NONE) - { - ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); - } - - DBG("Delete request from Client with App Id: %s" , pszAppId); - - bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); - if(!bMatch) - { - ERR("data_control_provider_match_provider_id failed"); - int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - bMatch = data_control_provider_match_data_id(provider,DATA_ID); - if(!bMatch) - { - ERR("data_control_provider_match_data_id failed"); - int status = data_control_provider_send_error(request_id,"Data Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - char* command = data_control_provider_create_delete_statement(provider, where); - DBG("command: %s" , command); - if(command){ - DBG("command: %s" , command); - }else{ - ERR("data_control_provider_create_delete_statement failed "); - } - int ret = sqlite3_exec(db, command, NULL, NULL, NULL); - if (ret != SQLITE_OK) - { - ERR("data_control_provider_create_delete_statement failed"); - int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(command); - free(pszAppId); - pszAppId = NULL; - return; - } - - ret = data_control_provider_send_delete_result(request_id); - if (ret != DATA_CONTROL_ERROR_NONE) - { - ERR("delete_send_result failed with error: %s",get_data_control_error(ret)); - } - - free(command); - free(pszAppId); - pszAppId = NULL; - -} - - -/** - * @function select_request_cb - * @since_tizen 2.3 - * @description Select Request Cb - * @parameter int: Int, const char*: Const char Pointer, const char*: Const char Pointer - * @return static void - */ -static void select_request_cb(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order) -{ - char* pszAppId =NULL; - int nRet = 0; - bool bMatch = false; - DBG("Inside select request cb"); - - nRet = data_control_provider_get_client_appid(request_id, &pszAppId); - if (nRet != DATA_CONTROL_ERROR_NONE) - { - ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); - } - - DBG("Select request from Client with App Id: %s" , pszAppId); - - bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); - if(!bMatch) - { - ERR("data_control_provider_match_provider_id failed"); - int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - bMatch = data_control_provider_match_data_id(provider,DATA_ID ); - if(!bMatch) - { - ERR("data_control_provider_match_data_id failed"); - int status = data_control_provider_send_error(request_id,"Data Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - sqlite3_stmt* sql_stmt = NULL; - - char* command = data_control_provider_create_select_statement(provider, column_list, column_count, where, order); - if(command) - { - DBG("command: %s" , command); - } - else - { - ERR("data_control_provider_create_select_statement failed"); - return; - } - int ret = sqlite3_prepare_v2(db, command, strlen(command), &sql_stmt, NULL); - if (ret != SQLITE_OK) - { - int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(command); - free(pszAppId); - pszAppId = NULL; - return; - } - - ret = data_control_provider_send_select_result(request_id, (void *)sql_stmt); - if (ret != DATA_CONTROL_ERROR_NONE) - { - ERR("select_send_result failed with error: %s",get_data_control_error(ret)); - } - - sqlite3_finalize(sql_stmt); - free(command); - free(pszAppId); - pszAppId = NULL; -} - - -/** - * @function update_request_cb - * @since_tizen 2.3 - * @description Update Request Cb - * @parameter int: Int, bundle*: Bundle Pointer, const char*: Const char Pointer - * @return static void - */ -static void update_request_cb(int request_id, data_control_h provider, bundle *update_data, const char *where) -{ - char* pszAppId =NULL; - int nRet = 0; - bool bMatch = false; - DBG("Inside update request cb"); - - nRet = data_control_provider_get_client_appid(request_id, &pszAppId); - if (nRet != DATA_CONTROL_ERROR_NONE) - { - ERR("data_control_provider_get_client_appid failed with error: %s",get_data_control_error(nRet)); - } - - DBG("Update request from Client with App Id: %s" , pszAppId); - - bMatch = data_control_provider_match_provider_id (provider, PROVIDER_ID); - if(!bMatch) - { - ERR("data_control_provider_match_provider_id failed"); - int status = data_control_provider_send_error(request_id,"Provider Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - bMatch = data_control_provider_match_data_id(provider,DATA_ID ); - if(!bMatch) - { - ERR("data_control_provider_match_data_id failed"); - int status = data_control_provider_send_error(request_id,"Data Id Does not match"); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(pszAppId); - pszAppId = NULL; - return; - - } - - char* command = data_control_provider_create_update_statement(provider, update_data, where); - if(command){ - DBG("command: %s" , command); - }else{ - ERR("data_control_provider_create_update_statement failed"); - } - int ret = sqlite3_exec(db, command, NULL, NULL, NULL); - if (ret != SQLITE_OK) - { - ERR("sqlite3_exec failed with error : %s",get_data_control_error(ret)); - int status = data_control_provider_send_error(request_id, sqlite3_errmsg(db)); - ERR("data_control_provider_send_error failed with error : %s",get_data_control_error(status)); - free(command); - free(pszAppId); - pszAppId = NULL; - return; - } - - ret = data_control_provider_send_update_result(request_id); - if (ret != DATA_CONTROL_ERROR_NONE) - { - ERR("update_send_result failed with error: %d",ret); - } - - free(command); - free(pszAppId); - pszAppId = NULL; -} - - -/** - * @function get_value_request_cb - * @since_tizen 2.3 - * @description Get Value Request Cb - * @parameter int: Int, const char*: Const char Pointer - * @return void - */ -void get_value_request_cb(int request_id, data_control_h provider, const char *key) -{ - int len = 0; - char message[50]; - memset(message,0,50); - DBG("Inside Get response Lenght od the result: %s",key); - char **str_arr=(char**)bundle_get_str_array(MapRepository,key,&len); - RETM_IF(len < 0,"bundle_get_str_array returns array lenth negative!"); - DBG("Inside Get response Lenght od the result: %d",len); - int i; - for( i = 0 ; iset_cb = set_value_request_cb; - - result = data_control_provider_map_register_cb(&map_provider_callback,NULL); - if (result != DATA_CONTROL_ERROR_NONE) - { - ERR("data_control_provider_map_cb failed with error: %s",get_data_control_error(result)); - } -} - - -/** - * @function service_app_create - * @since_tizen 2.3 - * @description Service App Create - * @parameter void*: Void Pointer - * @return bool - */ -bool service_app_create(void *data) -{ - // Todo: add your code here. - Initialize_datacontrol_provider(); - initialize_map_data_control_provider(); - return true; -} - - -/** - * @function service_app_terminate - * @since_tizen 2.3 - * @description Service App Terminate - * @parameter void*: Void Pointer - * @return void - */ -void service_app_terminate(void *data) -{ - // Todo: add your code here. - bundle_free(MapRepository); - int ret = data_control_provider_sql_unregister_cb(); - ERR("data_control_provider_sql_unregister_cb %s",(ret<0?"failed":"Passed")); - ret = data_control_provider_map_unregister_cb(); - ERR("data_control_provider_map_unregister_cb %s",(ret<0?"failed":"Passed")); - //free(map_provider_callback); - //free(sql_callback); - return; -} - - -/** - * @function service_app_control - * @since_tizen 2.3 - * @description Service App Control - * @parameter app_control_h: App Control H, void*: Void Pointer - * @return void - */ -void service_app_control(app_control_h app_control, void *data) -{ - // Todo: add your code here. - return; -} - - -/** - * @function service_app_lang_changed - * @since_tizen 2.3 - * @description Service App Lang Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_lang_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LANGUAGE_CHANGED*/ - return; -} - - -/** - * @function service_app_orient_changed - * @since_tizen 2.3 - * @description Service App Orient Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_orient_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/ - return; -} - - -/** - * @function service_app_region_changed - * @since_tizen 2.3 - * @description Service App Region Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_region_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_REGION_FORMAT_CHANGED*/ -} - - -/** - * @function service_app_low_battery - * @since_tizen 2.3 - * @description Service App Low Battery - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_low_battery(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_BATTERY*/ -} - - -/** - * @function service_app_low_memory - * @since_tizen 2.3 - * @description Service App Low Memory - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_low_memory(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_MEMORY*/ -} - - -/** - * @function main - * @since_tizen 2.3 - * @description Main - * @parameter int: Int, char*: Char Pointer - * @return int - */ -int main(int argc, char* argv[]) -{ - char ad[50] = {0,}; - service_app_lifecycle_callback_s event_callback; - app_event_handler_h handlers[5] = {NULL, }; - - event_callback.create = service_app_create; - event_callback.terminate = service_app_terminate; - event_callback.app_control = service_app_control; - - service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, service_app_orient_changed, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); - - return service_app_main(argc, argv, &event_callback, ad); -} diff --git a/coretbtdataprovider/tizen-manifest.xml b/coretbtdataprovider/tizen-manifest.xml deleted file mode 100644 index 05fa170..0000000 --- a/coretbtdataprovider/tizen-manifest.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - coretbt_dataprovider.png - - - - - http://tizen.org/privilege/datasharing - http://tizen.org/privilege/externalstorage.appdata - - true - diff --git a/coretbtserviceapp/.cproject b/coretbtserviceapp/.cproject deleted file mode 100644 index de1ca40..0000000 --- a/coretbtserviceapp/.cproject +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/coretbtserviceapp/.exportMap b/coretbtserviceapp/.exportMap deleted file mode 100644 index 43e310e..0000000 --- a/coretbtserviceapp/.exportMap +++ /dev/null @@ -1,4 +0,0 @@ -{ - global: main; - local: *; -}; diff --git a/coretbtserviceapp/.package-stamp b/coretbtserviceapp/.package-stamp deleted file mode 100644 index 40cbe59..0000000 --- a/coretbtserviceapp/.package-stamp +++ /dev/null @@ -1 +0,0 @@ -TPK \ No newline at end of file diff --git a/coretbtserviceapp/.project b/coretbtserviceapp/.project deleted file mode 100644 index 669f836..0000000 --- a/coretbtserviceapp/.project +++ /dev/null @@ -1,26 +0,0 @@ - - - coretbtserviceapp - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/coretbtserviceapp/.sdk_delta.info b/coretbtserviceapp/.sdk_delta.info deleted file mode 100644 index eda2ddd..0000000 Binary files a/coretbtserviceapp/.sdk_delta.info and /dev/null differ diff --git a/coretbtserviceapp/.tproject b/coretbtserviceapp/.tproject deleted file mode 100644 index dd94734..0000000 --- a/coretbtserviceapp/.tproject +++ /dev/null @@ -1,12 +0,0 @@ - - - - - wearable-4.0 - - - - - - - diff --git a/coretbtserviceapp/inc/coretbt_serviceapp.h b/coretbtserviceapp/inc/coretbt_serviceapp.h deleted file mode 100644 index b8720b6..0000000 --- a/coretbtserviceapp/inc/coretbt_serviceapp.h +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - -/** - * @file coretbt_serviceapp.h - * @brief service app that will be used by TBT for view/pick operation - * @since_tizen 2.3 - * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) - * @date October, 2014 - * @bug no known bug - * @credit Tizen SDK Version 2.3.0 Sample Example - * - * */ -#ifndef __coretbt_serviceapp_H__ - - -#ifndef TIZEN_DEBUG_ENABLE -#define TIZEN_DEBUG_ENABLE -#endif - - -#include "logger.h" - - -#endif /* __coretbt_serviceapp_H__ */ diff --git a/coretbtserviceapp/inc/logger.h b/coretbtserviceapp/inc/logger.h deleted file mode 100644 index 93e6a02..0000000 --- a/coretbtserviceapp/inc/logger.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - -/** - * @file logger.h - * @brief This file provide necessary macro for logging information. - * @since_tizen 2.3 - * @author Amlan Chowdhury (amlan.c@samsung.com) - * @date October, 2014 - * @bug - * @credit - */ -#ifndef __LOGGER_H__ -#define __LOGGER_H__ - -#include - -#define LOG_TAG_CORE "[coretbt_serviceapp]_" - -#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) -#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) -#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) - -#define RETM_IF(expr, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return; \ - } \ -} - -#define RETVM_IF(expr, val, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return (val); \ - } \ -} - -#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; - -#endif /* __LOGGER_H__ */ diff --git a/coretbtserviceapp/project_def.prop b/coretbtserviceapp/project_def.prop deleted file mode 100644 index 6794026..0000000 --- a/coretbtserviceapp/project_def.prop +++ /dev/null @@ -1,11 +0,0 @@ -APPNAME = coretbt_serviceapp - -type = app -profile = wearable-2.3.1 - -USER_SRCS = src/coretbt_serviceapp.c -USER_DEFS = -USER_INC_DIRS = inc -USER_OBJS = -USER_LIBS = -USER_EDCS = diff --git a/coretbtserviceapp/shared/res/coretbt_serviceapp.png b/coretbtserviceapp/shared/res/coretbt_serviceapp.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/coretbtserviceapp/shared/res/coretbt_serviceapp.png and /dev/null differ diff --git a/coretbtserviceapp/src/coretbt_serviceapp.c b/coretbtserviceapp/src/coretbt_serviceapp.c deleted file mode 100644 index 44f9c53..0000000 --- a/coretbtserviceapp/src/coretbt_serviceapp.c +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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 -#include -#include "coretbt_serviceapp.h" - - -/** - * @function service_app_create - * @since_tizen 2.3 - * @description Service App Create - * @parameter void*: Void Pointer - * @return bool - */ -bool service_app_create(void *data) -{ - // Todo: add your code here. - DBG("Service app creating..."); - return true; -} - - -/** - * @function service_app_terminate - * @since_tizen 2.3 - * @description Service App Terminate - * @parameter void*: Void Pointer - * @return void - */ -void service_app_terminate(void *data) -{ - // Todo: add your code here. - DBG("Service app terminating..."); - return; -} - - -/** - * @function get_app_control_error - * @since_tizen 2.3 - * @description Get App Control Error - * @parameter int: Int - * @return char* - */ -char* get_app_control_error(int ret) -{ - char* error = NULL; - switch (ret) { - case APP_CONTROL_ERROR_NONE: - error = "APP_CONTROL_ERROR_NONE"; - break; - case APP_CONTROL_ERROR_INVALID_PARAMETER: - error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; - break; - case APP_CONTROL_ERROR_OUT_OF_MEMORY: - error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; - break; - case APP_CONTROL_ERROR_APP_NOT_FOUND: - error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; - break; - case APP_CONTROL_ERROR_KEY_NOT_FOUND: - error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; - break; - case APP_CONTROL_ERROR_KEY_REJECTED: - error = "APP_CONTROL_ERROR_KEY_REJECTED"; - break; - case APP_CONTROL_ERROR_INVALID_DATA_TYPE: - error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; - break; - case APP_CONTROL_ERROR_LAUNCH_REJECTED: - error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; - break; - case APP_CONTROL_ERROR_PERMISSION_DENIED: - error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; - break; - case APP_CONTROL_ERROR_LAUNCH_FAILED: - error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; - break; - case APP_CONTROL_ERROR_TIMED_OUT: - error = "APP_CONTROL_ERROR_TIMED_OUT"; - break; - //case APP_CONTROL_ERROR_IO_ERROR: - //return "APP_CONTROL_ERROR_IO_ERROR"; - default: - error = "Unknown Error"; - break; - } - return error; -} - - -/** - * @function service_app_control - * @since_tizen 2.3 - * @description Service App Control - * @parameter app_control_h: App Control H, void*: Void Pointer - * @return void - */ -void service_app_control(app_control_h control, void *data) -{ - // Todo: add your code here. - int status_1,status_2,status_3; - - - /* Handle the launch request. */ - DBG("app_control"); - - char *category; - status_1 = app_control_get_operation(control,&category); - DBG("app_control_get_operation status=%d Categoty=%s",status_1,category); - RETM_IF(NULL==category, "app_control_get_operation category NULL"); - RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_get_operation fails: %s", get_app_control_error(status_1)); - - char *chCaller; - status_3=app_control_get_caller(control,&chCaller); - DBG("app_control_get_caller %d ",status_3); - RETM_IF(NULL==chCaller, "app_control_get_caller chCaller NULL"); - RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_get_caller fails: %s", get_app_control_error(status_1)); - - char *chTypeStr; - status_1 = app_control_get_extra_data(control,"type",&chTypeStr); - if(NULL==chTypeStr) - { - DBG("app_control_get_extra_data chTypeStr NULL. app_control_get_extra_data fails: %s", get_app_control_error(status_1)); - } - - bool was_requested; - status_1=app_control_is_reply_requested(control,&was_requested); - RETM_IF(status_1 != APP_CONTROL_ERROR_NONE, "app_control_is_reply_requested fails: %s", get_app_control_error(status_1)); - DBG("app_control_is_reply_requested %d",status_1); - - app_control_h reply; - status_1 = app_control_create (&reply); - DBG("app_control_create=%s",get_app_control_error(status_1)); - - // lets echo back result - status_1 = app_control_add_extra_data ( reply, "from", chCaller); - DBG("app_control_add_extra_data=%s",get_app_control_error(status_1)); - status_1 = app_control_add_extra_data ( reply, "replyRequested", was_requested?"yes":"no"); - DBG("app_control_add_extra_data=%s",get_app_control_error(status_1)); - - //APP_CONTROL_RESULT_SUCCEEDED - app_control_result_e res=APP_CONTROL_RESULT_SUCCEEDED; - status_1 = app_control_reply_to_launch_request(reply,control,res); - DBG("app_control_reply_to_launch_request=%s",get_app_control_error(status_1)); - return; -} - - -/** - * @function service_app_lang_changed - * @since_tizen 2.3 - * @description Service App Lang Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_lang_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LANGUAGE_CHANGED*/ - return; -} - - -/** - * @function service_app_orient_changed - * @since_tizen 2.3 - * @description Service App Orient Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_orient_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/ - return; -} - - -/** - * @function service_app_region_changed - * @since_tizen 2.3 - * @description Service App Region Changed - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_region_changed(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_REGION_FORMAT_CHANGED*/ -} - - -/** - * @function service_app_low_battery - * @since_tizen 2.3 - * @description Service App Low Battery - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_low_battery(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_BATTERY*/ - DBG("Service app running on low battery. app_exiting..."); - service_app_exit(); -} - - -/** - * @function service_app_low_memory - * @since_tizen 2.3 - * @description Service App Low Memory - * @parameter app_event_info_h: App Event Info H, void*: Void Pointer - * @return static void - */ -static void service_app_low_memory(app_event_info_h event_info, void *user_data) -{ - /*APP_EVENT_LOW_MEMORY*/ - service_app_exit(); -} - - -/** - * @function main - * @since_tizen 2.3 - * @description Main - * @parameter int: Int, char*: Char Pointer - * @return int - */ -int main(int argc, char* argv[]) -{ - char ad[50] = {0,}; - service_app_lifecycle_callback_s event_callback; - app_event_handler_h handlers[5] = {NULL, }; - - event_callback.create = service_app_create; - event_callback.terminate = service_app_terminate; - event_callback.app_control = service_app_control; - - service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, service_app_orient_changed, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); - service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); - - return service_app_main(argc, argv, &event_callback, ad); -} diff --git a/coretbtserviceapp/tizen-manifest.xml b/coretbtserviceapp/tizen-manifest.xml deleted file mode 100644 index b4a9edc..0000000 --- a/coretbtserviceapp/tizen-manifest.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - coretbt_serviceapp.png - - true - diff --git a/coretbtuiapp/.cproject b/coretbtuiapp/.cproject deleted file mode 100644 index abe2c2e..0000000 --- a/coretbtuiapp/.cproject +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/coretbtuiapp/.exportMap b/coretbtuiapp/.exportMap deleted file mode 100644 index 43e310e..0000000 --- a/coretbtuiapp/.exportMap +++ /dev/null @@ -1,4 +0,0 @@ -{ - global: main; - local: *; -}; diff --git a/coretbtuiapp/.package-stamp b/coretbtuiapp/.package-stamp deleted file mode 100644 index 40cbe59..0000000 --- a/coretbtuiapp/.package-stamp +++ /dev/null @@ -1 +0,0 @@ -TPK \ No newline at end of file diff --git a/coretbtuiapp/.project b/coretbtuiapp/.project deleted file mode 100644 index 0704e47..0000000 --- a/coretbtuiapp/.project +++ /dev/null @@ -1,32 +0,0 @@ - - - coretbtuiapp - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - org.tizen.nativecore.apichecker.core.builder - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.tizen.nativecore.apichecker.core.tizenCppNature - - diff --git a/coretbtuiapp/.rds_delta b/coretbtuiapp/.rds_delta deleted file mode 100644 index 3e38782..0000000 --- a/coretbtuiapp/.rds_delta +++ /dev/null @@ -1,17 +0,0 @@ -#delete -#add -res/edje/2.3.1/ -res/edje/2.3.1/wearable_216_432/ -res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edj -res/edje/2.3.1/wearable_320_320/ -res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edj -res/edje/2.3.1/wearable_360_360/ -res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edj -res/edje/2.3.1/ -res/edje/2.3.1/wearable_216_432/ -res/edje/2.3.1/wearable_320_320/ -res/edje/2.3.1/wearable_360_360/ -#modify -author-signature.xml -signature1.xml -bin/coretbt_uiapp diff --git a/coretbtuiapp/.sdk_delta.info b/coretbtuiapp/.sdk_delta.info deleted file mode 100644 index e7544bd..0000000 Binary files a/coretbtuiapp/.sdk_delta.info and /dev/null differ diff --git a/coretbtuiapp/.tproject b/coretbtuiapp/.tproject deleted file mode 100644 index dd94734..0000000 --- a/coretbtuiapp/.tproject +++ /dev/null @@ -1,12 +0,0 @@ - - - - - wearable-4.0 - - - - - - - diff --git a/coretbtuiapp/inc/coretbt_uiapp.h b/coretbtuiapp/inc/coretbt_uiapp.h deleted file mode 100644 index 9d06581..0000000 --- a/coretbtuiapp/inc/coretbt_uiapp.h +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - -/** - * @file coretbt_uiapp.h - * @brief ui app that will be used by TBT for view/pick operation - * @since_tizen 2.3 - * @author golam kayes(g.kayes@samsung.com), salman rahman(salman.ran) and sheikh jakir hossain(sk.jakir) - * @date October, 2014 - * @bug no known bug - * @credit Tizen SDK Version 2.3.0 Sample Example - * - * */ - -#ifndef __coretbt_uiapp_H__ - -#ifndef TIZEN_DEBUG_ENABLE -#define TIZEN_DEBUG_ENABLE -#endif - -#include -#include -#include -//#include -#include "efl_extension_events.h" -#include -#include -#include "logger.h" - -#if !defined(PACKAGE) -#define PACKAGE "org.tizen.coretbt_uiapp" -#endif - -//#define EDJ_FILE_MOBILE "edje/coretbt_uiapp.edj" -//#define EDJ_FILE_WEARABLE "edje/wearable_coretbt_uiapp.edj" - -#define GRP_MAIN "main" - -#define KEY_END "XF86Stop" - -#define MAX_LENGTH 1024 - -#define USE_GENLIST - -typedef enum { - DEVICE_WEARABLE, - DEVICE_MOBILE, - DEVICE_WEARABLE_360_X_480, - DEVICE_WEARABLE_360_360, - DEVICE_WEARABLE_216_432, - DEVICE_WEARABLE_320_320, - - DEVICE_NONE, - DEVICE_MAX -}device_type_e; - -static inline device_type_e get_device_type() -{ - int width, height; - device_type_e device_type = DEVICE_NONE; - - system_info_get_platform_int("tizen.org/feature/screen.width", &width); - system_info_get_platform_int("tizen.org/feature/screen.height", &height); - - if(width == 360 && height == 360) - { - //circle - device_type = DEVICE_WEARABLE_360_360; - } - else if(width == 216 && height == 432) - { - device_type = DEVICE_WEARABLE_216_432; - } - else if(width == 360 && height == 480) - { - device_type = DEVICE_WEARABLE_360_X_480; - } - else if(width == 320 && height == 320) - { - device_type = DEVICE_WEARABLE_320_320; - } - else - { - device_type = DEVICE_WEARABLE_320_320; - } - return device_type; - -} - -static void app_get_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) -{ - char *res_path = app_get_resource_path(); - if (res_path) { - snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); - free(res_path); - } -} - -static inline const char *get_edje_path(const char *file_name) -{ - char absolute_path[MAX_LENGTH] = {'\0'}; - char file_path[MAX_LENGTH] = {'\0'}; - - if(get_device_type() == DEVICE_WEARABLE_216_432) - { - strncat(file_path, "edje/2.3.1/wearable_216_432/", sizeof("edje/2.3.1/wearable_216_432/")); - } - else if(get_device_type() == DEVICE_WEARABLE_320_320) - { - strncat(file_path, "edje/2.3.1/wearable_320_320/", sizeof("edje/2.3.1/wearable_320_320/")); - } - else if(get_device_type() == DEVICE_WEARABLE_360_X_480) - { - strncat(file_path, "edje/2.3.1/wearable_360_x_480/", sizeof("edje/2.3.1/wearable_360_x_480/")); - } - else if(get_device_type() == DEVICE_WEARABLE_360_360) - { - strncat(file_path, "edje/2.3.1/wearable_360_360/", sizeof("edje/2.3.1/wearable_360_360/")); - } - - int num = strlen(file_name); - if(strlen(file_path)+strlen(file_name) <= MAX_LENGTH) - { - num = strlen(file_name); - } - else - { - num = MAX_LENGTH-strlen(file_path); - } - - strncat(file_path,file_name, num); - app_get_resource(file_path, absolute_path, (int)MAX_LENGTH); - return strdup(absolute_path); - -} - - - -#endif /* __coretbt_uiapp_H__ */ diff --git a/coretbtuiapp/inc/logger.h b/coretbtuiapp/inc/logger.h deleted file mode 100644 index 7d985b8..0000000 --- a/coretbtuiapp/inc/logger.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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. - * - *******************************************************************************/ - -/** - * @file logger.h - * @brief This file provide necessary macro for logging information. - * @since_tizen 2.3 - * @author Amlan Chowdhury (amlan.c@samsung.com) - * @date October, 2014 - * @bug - * @credit - */ -#ifndef __LOGGER_H__ -#define __LOGGER_H__ - -#include - -#define LOG_TAG_CORE "[coretbt_uiapp]_" - -#define DLOG(prio, fmt, arg...) dlog_print(prio, LOG_TAG_CORE, "%s (Line: %d) > " fmt, __func__, __LINE__, ##arg) -#define DBG(fmt, arg...) DLOG(DLOG_DEBUG, fmt, ##arg) -#define ERR(fmt, arg...) DLOG(DLOG_ERROR, fmt, ##arg) - -#define RETM_IF(expr, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return; \ - } \ -} - -#define RETVM_IF(expr, val, fmt, arg...) \ -{ \ - if (expr) \ - { \ - ERR(fmt, ##arg); \ - return (val); \ - } \ -} - -#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL; - -#endif /* __LOGGER_H__ */ diff --git a/coretbtuiapp/project_def.prop b/coretbtuiapp/project_def.prop deleted file mode 100644 index 3273382..0000000 --- a/coretbtuiapp/project_def.prop +++ /dev/null @@ -1,11 +0,0 @@ -APPNAME = coretbt_uiapp - -type = app -profile = wearable-2.3.1 - -USER_SRCS = src/coretbt_uiapp.c -USER_DEFS = -USER_INC_DIRS = inc -USER_OBJS = -USER_LIBS = -USER_EDCS = res/edje/coretbt_uiapp.edc diff --git a/coretbtuiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc b/coretbtuiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc deleted file mode 100644 index 45d45bb..0000000 --- a/coretbtuiapp/res/edje/2.3.1/wearable_216_432/wearable_coretbt_uiapp.edc +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ - -collections { - group { name: "main"; - - parts { - - part { name: "txt_title"; - type: TEXT; - mouse_events: 0; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.05; } - rel2 { relative: 1.0 0.12; } - text { font: "Tizen:style=regular"; size: 20; min: 1 1; } - color: 0 0 0 255; - } - } - - part { name: "txt_title2"; - type: TEXT; - mouse_events: 0; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.12; } - rel2 { relative: 1.0 0.19; } - text { font: "Tizen:style=regular"; size: 20; min: 1 1; } - color: 0 0 0 255; - } - } - - - part { name: "list"; - type: SWALLOW; - mouse_events: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.19; } - rel2 { relative: 1.0 0.75; } - color: 255 0 0 255; - } - } - - part { name: "padding"; - type: SPACER; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.75; } - rel2 { relative: 1.0 0.80; } - fixed: 1 0; - } - } - - - - part { name: "button"; - type: SWALLOW; - mouse_events: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.80; } - rel2 { relative: 1.0 0.95; } - color: 255 0 0 255; - } - } - - - } - } -} diff --git a/coretbtuiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc b/coretbtuiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc deleted file mode 100644 index ee3c9c6..0000000 --- a/coretbtuiapp/res/edje/2.3.1/wearable_320_320/wearable_coretbt_uiapp.edc +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ -#define HEADER_HIGHT 0.0 - -collections { - group { name: "main"; - - parts { - - part { name: "txt_title"; - type: TEXT; - mouse_events: 0; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.08; } - text { font: "Tizen:style=regular"; size: 20; min: 1 1; } - color: 0 0 0 255; - } - } - - part { name: "txt_title2"; - type: TEXT; - mouse_events: 0; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.08; } - rel2 { relative: 1.0 0.16; } - text { font: "Tizen:style=regular"; size: 20; min: 1 1; } - color: 0 0 0 255; - } - } - - - part { name: "list"; - type: SWALLOW; - mouse_events: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.16; } - rel2 { relative: 1.0 0.64; } - color: 255 0 0 255; - } - } - - part { name: "padding2"; - type: SPACER; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.64; } - rel2 { relative: 1.0 0.65; } - fixed: 1 0; - } - } - - - - part { name: "button"; - type: SWALLOW; - mouse_events: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - rel1 { relative: 0.0 0.65; } - rel2 { relative: 1.0 1.00; } - color: 255 0 0 255; - } - } - - - } - } -} diff --git a/coretbtuiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc b/coretbtuiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc deleted file mode 100644 index 7bc68ac..0000000 --- a/coretbtuiapp/res/edje/2.3.1/wearable_360_360/wearable_coretbt_uiapp.edc +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ - -collections { - group { name: "main"; - - parts { - - part { name: "txt_title"; - type: SWALLOW; - description{ - state: "default" 0.0; - align: 0.0 0.0; - visible: 1; - rel1 {relative: 0.0 0.0; } - rel2 {relative: 1.0 0.10; } - } - } - - part { name: "txt_title2"; - type: SWALLOW; - description{ - state: "default" 0.0; - align: 0.0 0.0; - visible: 1; - rel1 {relative: 0.0 0.10; } - rel2 {relative: 1.0 0.20; } - } - } - - - part { name: "list"; - type: SWALLOW; - description { - state: "default" 0.0; - rel1 { - relative: 0.0 0.20; - } - rel2 { - relative: 1.0 0.70; - } - visible: 1; - } - } - - part { name: "padding2"; - type: SPACER; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.70; } - rel2 { relative: 1.0 1.0; } - fixed: 1 0; - } - } - - - part { name: "button"; - type: SWALLOW; - description { - state: "default" 0.0; - rel1 { - relative: 0.0 1.0; - } - rel2 { - relative: 1.0 1.0; - } - visible: 1; - } - } - - - } - } -} diff --git a/coretbtuiapp/shared/res/coretbt_uiapp.png b/coretbtuiapp/shared/res/coretbt_uiapp.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/coretbtuiapp/shared/res/coretbt_uiapp.png and /dev/null differ diff --git a/coretbtuiapp/src/coretbt_uiapp.c b/coretbtuiapp/src/coretbt_uiapp.c deleted file mode 100644 index 0492cc5..0000000 --- a/coretbtuiapp/src/coretbt_uiapp.c +++ /dev/null @@ -1,692 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 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 "coretbt_uiapp.h" - - - -typedef struct appdata{ - Evas_Object* win; - Evas_Object* layout; - Evas_Object* conform; - - int mode; - int selectionMode; - app_control_h request; - - Evas_Object *list; - Evas_Object *button; - - char **items; - int itemCount; - - char *title1; - char *title2; - - -} appdata_s; - - -#ifdef USE_GENLIST -typedef struct -{ - int index; - Elm_Object_Item *item; - char* text; -}item_data; - -static void _gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED); -static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part); -Elm_Object_Item* _elm_genlist_item_append(appdata_s *this, char *item_text, void* data); -#endif - -static bool has_request=false; -static app_control_h _control; -static char *type_str=NULL; -static bool was_requested; -static int status_1,status_2; -static char *caller; - - -#ifdef USE_GENLIST -static void _gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED) -{ - DBG("_gl_del_cb"); - item_data *id = data; - RETM_IF(!id, "item is NULL"); - SAFE_DELETE(id); -} - -static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part) -{ - DBG("_gl_text_get_cb"); - item_data *id = data; - //const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(id->item); - - //if(itc->item_style && !strcmp(itc->item_style, "default")) - { - - if(part && !strcmp(part, "elm.text")) - { - char buf[1024]; - snprintf(buf, 1023, id->text); - return strdup(buf); - } - } - return NULL; -} - -static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) -{ - Elm_Object_Item *it = event_info; - //Un-highlight item - elm_genlist_item_selected_set(it, EINA_TRUE); -} - -Elm_Object_Item* _elm_genlist_item_append(appdata_s *this, char *item_text, void* data) -{ - - DBG("_elm_genlist_item_append%s:", item_text); - static int index = 1; - Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new(); - - itc->item_style = "default"; - itc->func.text_get = _gl_text_get_cb; - itc->func.content_get = NULL; - itc->func.del = _gl_del_cb; - - item_data *id = calloc(sizeof(item_data), 1); - id->index = index++; - id->text = strdup(item_text); - - elm_scroller_single_direction_set(this->list, ELM_SCROLLER_SINGLE_DIRECTION_HARD); - - //HOMOGENEOUS MODE - //If item height is same when each style name is same, Use homogeneous mode. - elm_genlist_homogeneous_set(this->list, EINA_TRUE); - - //COMPRESS MODE - //For the Mobile view, because it has full window, compresse mode should be used. - elm_genlist_mode_set(this->list, ELM_LIST_COMPRESS); - - Elm_Object_Item *item = elm_genlist_item_append(this->list, itc,id, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - id->item = item; - - elm_genlist_item_class_free(itc); - - return item; -} -#endif -/** - * @function get_app_control_error - * @since_tizen 2.3 - * @description Get App Control Error - * @parameter int: Int - * @return static char* - */ -static char* get_app_control_error(int ret) -{ - char* error = NULL; - - switch (ret) { - case APP_CONTROL_ERROR_NONE: - error = "APP_CONTROL_ERROR_NONE"; - break; - case APP_CONTROL_ERROR_INVALID_PARAMETER: - error = "APP_CONTROL_ERROR_INVALID_PARAMETER"; - break; - case APP_CONTROL_ERROR_OUT_OF_MEMORY: - error = "APP_CONTROL_ERROR_OUT_OF_MEMORY"; - break; - case APP_CONTROL_ERROR_APP_NOT_FOUND: - error = "APP_CONTROL_ERROR_APP_NOT_FOUND"; - break; - case APP_CONTROL_ERROR_KEY_NOT_FOUND: - error = "APP_CONTROL_ERROR_KEY_NOT_FOUND"; - break; - case APP_CONTROL_ERROR_KEY_REJECTED: - error = "APP_CONTROL_ERROR_KEY_REJECTED"; - break; - case APP_CONTROL_ERROR_INVALID_DATA_TYPE: - error = "APP_CONTROL_ERROR_INVALID_DATA_TYPE"; - break; - case APP_CONTROL_ERROR_LAUNCH_REJECTED: - error = "APP_CONTROL_ERROR_LAUNCH_REJECTED"; - break; - case APP_CONTROL_ERROR_PERMISSION_DENIED: - error = "APP_CONTROL_ERROR_PERMISSION_DENIED"; - break; - case APP_CONTROL_ERROR_LAUNCH_FAILED: - error = "APP_CONTROL_ERROR_LAUNCH_FAILED"; - break; - case APP_CONTROL_ERROR_TIMED_OUT: - error = "APP_CONTROL_ERROR_TIMED_OUT"; - break; - //case APP_CONTROL_ERROR_IO_ERROR: - //error = "APP_CONTROL_ERROR_IO_ERROR"; - //break; - default: - error = "Unknown Error"; - break; - } - return error; -} - - -/** - * @function layout_back_cb - * @since_tizen 2.3 - * @description Layout Back Cb - * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer - * @return static void - */ -static void layout_back_cb(void *data, Evas_Object *obj, void *event_info) -{ - appdata_s *ad = data; - /* Let window go to hide state. */ - elm_win_lower(ad->win); -} - - -/** - * @function app_get_resource - * @since_tizen 2.3 - * @description App Get Resource - * @parameter const char*: Const char Pointer, char*: Char Pointer - * @return static void - */ - - - -/** - * @function win_delete_request_cb - * @since_tizen 2.3 - * @description Win Delete Request Cb - * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer - * @return static void - */ -static void win_delete_request_cb(void *data , Evas_Object *obj , void *event_info) -{ - DBG("win_delete_request_cb"); - - ui_app_exit(); -} - - -/** - * @function update_info - * @since_tizen 2.3 - * @description Update Info - * @parameter appdata_s*: Appdata S Pointer - * @return static void - */ -static void update_info(appdata_s *ad) -{ - DBG("update_info"); - - elm_object_part_text_set(ad->layout, "txt_title", ad->title1); - elm_object_part_text_set(ad->layout, "txt_title2", ad->title2); - - if(ad->mode==0) - { - elm_object_text_set(ad->button, "Return"); - } - else if(ad->mode==1) - { -#ifdef USE_GENLIST - elm_genlist_multi_select_set (ad->list, ad->selectionMode==0?EINA_FALSE:EINA_TRUE); -#else - elm_list_multi_select_set (ad->list, ad->selectionMode==0?EINA_FALSE:EINA_TRUE); -#endif - - elm_object_text_set(ad->button, ad->selectionMode==0?"Select Single":"Select Multiple"); - - } -} - - -/** - * @function on_return_button_clicked - * @since_tizen 2.3 - * @description On Return Button Clicked - * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer - * @return static void - */ -static void on_return_button_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) -{ - DBG("on_return_button_clicked"); - - int nStatus; - appdata_s *ad=data; - - - - if(was_requested) - { - DBG("on_return_button_clicked Reply Requested"); - - app_control_h reply; - nStatus = app_control_create (&reply); - DBG("app_control_create=%s",get_app_control_error(nStatus)); - if(!reply) - { - DBG("reply is Null"); - } - // lets craete reply dta - const Eina_List *items,*l; - Elm_Object_Item *list_it; - - - int selectionCount=0; - DBG("Getting List Items"); - -#ifdef USE_GENLIST - items = elm_genlist_selected_items_get(ad->list); -#else - items = elm_list_selected_items_get(ad->list); -#endif - - DBG("Got List Items"); - - EINA_LIST_FOREACH(items, l, list_it) - { - char *value = NULL; -#ifdef USE_GENLIST - value=(char*)elm_object_item_part_text_get(list_it, "elm.text"); -#else - value=(char*)elm_object_item_text_get(list_it); -#endif - if(value) { - DBG("SELECTED %s",value); - selectionCount++; - } - } - - char countStr[32]; - snprintf(countStr, sizeof(countStr), "%d",selectionCount); - nStatus = app_control_add_extra_data ( reply, "count", countStr); - DBG("app_control_add_extra_data=%s",get_app_control_error(nStatus)); - - - char *values[selectionCount]; - int now=0; - - - EINA_LIST_FOREACH(items, l, list_it) - { - char *value = NULL; -#ifdef USE_GENLIST - value=(char*)elm_object_item_part_text_get(list_it, "elm.text"); -#else - value=(char*)elm_object_item_text_get(list_it); -#endif - if(value) { - values[now++]=value; - } - - } - nStatus = app_control_add_extra_data_array ( reply, "values", (const char**)values,selectionCount); - DBG("app_control_add_extra_data_array=%s",get_app_control_error(nStatus)); - - - // ************************************ - //APP_CONTROL_RESULT_SUCCEEDED - - app_control_result_e res=APP_CONTROL_RESULT_SUCCEEDED; - nStatus = app_control_reply_to_launch_request(reply,_control,res); - DBG("app_control_reply_to_launch_request=%s",get_app_control_error(nStatus)); - } - - DBG("No reply! Quitting..."); - ui_app_exit(); - - -} - - -/** - * @function create_base_gui - * @since_tizen 2.3 - * @description Create Base Gui - * @parameter appdata_s*: Appdata S Pointer - * @return static void - */ -static void create_base_gui(appdata_s *ad) -{ - DBG("create_base_gui"); - - - //char edj_path[PATH_MAX] = {0, }; - - /* Window */ - ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); - elm_win_conformant_set(ad->win, EINA_TRUE); - elm_win_autodel_set(ad->win, EINA_TRUE); - - if (elm_win_wm_rotation_supported_get(ad->win)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); - } - - evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); - - /* Conformant */ - ad->conform = elm_conformant_add(ad->win); - evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(ad->win, ad->conform); - evas_object_show(ad->conform); - - /* Base Layout */ - //app_get_resource(EDJ_FILE_WEARABLE, edj_path, (int)PATH_MAX); - - - ad->layout = elm_layout_add(ad->win); - elm_layout_file_set(ad->layout,get_edje_path("wearable_coretbt_uiapp.edj"), GRP_MAIN); - - evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_object_content_set(ad->conform, ad->layout); - - elm_object_part_text_set(ad->layout, "txt_title", "App Test Control"); - elm_object_part_text_set(ad->layout, "txt_title2", "Sample Data : "); - - - // lets create dummy data :D - char *data[]={"Artcell", "Dream Theater", "Pink Floyd","Iron Maiden","SOAD","Prisoners","Poets Of The Fall","Endless River","No room for looser!"}; - ad->items=data; - ad->itemCount=9; - - - - // create list -#ifdef USE_GENLIST - ad->list = elm_genlist_add(ad->layout); - evas_object_size_hint_weight_set(ad->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->list, EVAS_HINT_FILL, EVAS_HINT_FILL); - - - elm_genlist_select_mode_set(ad->list,ELM_OBJECT_SELECT_MODE_ALWAYS); - int i; - for (i = 0; iitemCount; ++i) { - DBG("[%d] data is %d %s ",ad->itemCount,i,data[i]); - _elm_genlist_item_append(ad, data[i], ad->win); - } - -#else - ad->list = elm_list_add(ad->layout); - evas_object_size_hint_weight_set(ad->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(ad->list, EVAS_HINT_FILL, EVAS_HINT_FILL); - - - elm_list_select_mode_set(ad->list,ELM_OBJECT_SELECT_MODE_ALWAYS); - int i; - for (i = 0; iitemCount; ++i) { - DBG("[%d] data is %d %s ",ad->itemCount,i,data[i]); - elm_list_item_append(ad->list, data[i], NULL, NULL, NULL, ad->win); - } - - elm_list_go(ad->list); -#endif - - elm_object_part_content_set(ad->layout, "list", ad->list); - - evas_object_show(ad->layout); - evas_object_show(ad->list); - - - - // add button - ad->button = elm_button_add(ad->layout); - evas_object_size_hint_align_set(ad->button, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_text_set(ad->button, "Return"); - elm_object_part_content_set(ad->layout, "button", ad->button); - evas_object_show(ad->button); - evas_object_smart_callback_add(ad->button, "clicked", on_return_button_clicked, ad); - if(get_device_type() == DEVICE_WEARABLE_360_360) - { - elm_object_style_set(ad->button, "bottom"); - } - - evas_object_show(ad->win); - - eext_object_event_callback_add(ad->layout, EEXT_CALLBACK_BACK, layout_back_cb, ad); - - update_info(ad); -} - - -/** - * @function app_create - * @since_tizen 2.3 - * @description App Create - * @parameter void*: Void Pointer - * @return static bool - */ -static bool app_create(void *data) -{ - DBG("app_create"); - /* Hook to take necessary actions before main event loop starts - Initialize UI resources and application's data - If this function returns true, the main loop of application starts - If this function returns false, the application is terminated */ - appdata_s *ad = data; - - create_base_gui(ad); - - return true; -} - - -/** - * @function app_control - * @since_tizen 2.3 - * @description App Control - * @parameter app_control_h: App Control H, void*: Void Pointer - * @return static void - */ -static void app_control(app_control_h control, void *data) -{ - appdata_s *ad=data; - - int nStatus=-1; - has_request=false; - - /* Handle the launch request. */ - DBG("app_control"); - - char *category; - nStatus = app_control_get_operation(control,&category); - DBG("app_control_get_operation=%s",get_app_control_error(nStatus)); - if(!category) - { - ERR("category is Null"); - return; - } - ad->title2="Dummy Items : "; - if(strcmp(category,APP_CONTROL_OPERATION_VIEW)==0) - { - ad->mode=0; - // load view mode - ad->title1="View Operation"; - } - else if(strcmp(category,APP_CONTROL_OPERATION_DEFAULT)==0) - { - ad->mode=0; - // load view mode - ad->title1="Default Operation"; - } - else if(strcmp(category,APP_CONTROL_OPERATION_PICK)==0) - { - // load pick mode - ad->mode=1; - ad->title1="Pick Operation"; - - char *selection; - //check for selection mode - nStatus = app_control_get_extra_data(control,APP_CONTROL_DATA_SELECTION_MODE,&selection); - DBG("app_control_get_extra_data=%s",get_app_control_error(nStatus)); - if(!selection) - { - ERR("selection is Null"); - return; - } - - if(nStatus==0 && strcmp(selection,"single")==0) - { - ad->selectionMode=0; - } - else if(nStatus==0 && strcmp(selection,"multiple")==0) - { - ad->selectionMode=1; - } - else - { - ad->selectionMode=0; - ad->title1 = "Pick Operation Unknown"; - } - - } - else - { - ad->mode=0; - - char str[MAX_LENGTH]; - snprintf(str, sizeof(str), "%s%s", "Operation: ", category); - ad->title1 = str; - - } - - ad->request=control; - - caller=NULL; - status_2=app_control_get_caller(control,&caller); - DBG("app_control_get_caller=%s",get_app_control_error(nStatus)); - if(!caller) - { - DBG("caller is Null"); - } - - - if(status_2==0) - { - ad->title2="Caller App : "; - } - - - nStatus = app_control_get_extra_data(control,"type",&type_str); - DBG("app_control_get_extra_data=%s",get_app_control_error(nStatus)); - if(!type_str) - { - DBG("caller is Null"); - } - - status_1=app_control_is_reply_requested(control,&was_requested); - DBG("app_control_is_reply_requested=%s",get_app_control_error(nStatus)); - - - has_request=true; - nStatus=app_control_clone (&_control, control); - DBG("app_control_clone=%s",get_app_control_error(nStatus)); - if(!_control) - { - DBG("_control is Null"); - } - - - update_info(ad); -} - - -/** - * @function app_pause - * @since_tizen 2.3 - * @description App Pause - * @parameter void*: Void Pointer - * @return static void - */ -static void app_pause(void *data) -{ - /* Take necessary actions when application becomes invisible. */ - DBG("app_pause"); -} - - -/** - * @function app_resume - * @since_tizen 2.3 - * @description App Resume - * @parameter void*: Void Pointer - * @return static void - */ -static void app_resume(void *data) -{ - /* Take necessary actions when application becomes visible. */ - DBG("app_resume"); -} - - -/** - * @function app_terminate - * @since_tizen 2.3 - * @description App Terminate - * @parameter void*: Void Pointer - * @return static void - */ -static void app_terminate(void *data) -{ - /* Release all resources. */ - DBG("app_terminate"); - type_str=NULL; - - has_request=false; -} - - -/** - * @function main - * @since_tizen 2.3 - * @description Main - * @parameter int: Int, char*: Char Pointer - * @return int - */ -int main(int argc, char *argv[]) -{ - DBG("main"); - - has_request=false; - - appdata_s ad = {0,}; - int ret = 0; - - ui_app_lifecycle_callback_s event_callback = {0,}; - - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.pause = app_pause; - event_callback.resume = app_resume; - event_callback.app_control = app_control; - - - DBG("main loop starting..."); - ret = ui_app_main(argc, argv, &event_callback, &ad); - if (ret != APP_ERROR_NONE) { - dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main is failed. err = %d", ret); - } - - DBG("main_end"); - - return ret;} diff --git a/coretbtuiapp/tizen-manifest.xml b/coretbtuiapp/tizen-manifest.xml deleted file mode 100644 index 515cd30..0000000 --- a/coretbtuiapp/tizen-manifest.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - coretbt_uiapp.png - - true - diff --git a/coretbtwidgetapp/.cproject b/coretbtwidgetapp/.cproject index 3e7764f..f26ca4d 100644 --- a/coretbtwidgetapp/.cproject +++ b/coretbtwidgetapp/.cproject @@ -26,7 +26,7 @@