From: Sandipan Patra Date: Tue, 29 Mar 2016 11:20:33 +0000 (+0530) Subject: [Tizen Enrollee] Removing GUI Enrollee Sample X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea6a3d218d9ebb2117be72a9cdae0a3573faba3d;p=contrib%2Fiotivity.git [Tizen Enrollee] Removing GUI Enrollee Sample Change-Id: I4c6dd1656d8ce184107e2bd5aa79a6c4b8c2475e Signed-off-by: Sandipan Patra Reviewed-on: https://gerrit.iotivity.org/gerrit/7441 Tested-by: jenkins-iotivity Reviewed-by: Hemant Mahsky Reviewed-by: Madan Lanka --- diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.cproject b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.cproject deleted file mode 100644 index 94e8845..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.cproject +++ /dev/null @@ -1,514 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.exportMap b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.exportMap deleted file mode 100644 index 43e310e..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.exportMap +++ /dev/null @@ -1,4 +0,0 @@ -{ - global: main; - local: *; -}; diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.project b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.project deleted file mode 100644 index a758cb0..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/.project +++ /dev/null @@ -1,43 +0,0 @@ - - - Enrolleesample - - - - - - 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 - - - - 0 - - 26 - - org.eclipse.ui.ide.multiFilter - 1.0-projectRelativePath-matches-false-false-*/.tpk - - - - diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/edc_resource/re_client_control.edc b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/edc_resource/re_client_control.edc deleted file mode 100644 index 8146661..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/edc_resource/re_client_control.edc +++ /dev/null @@ -1,148 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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 POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15 -#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 96 - -group -{ - name: "group_layout"; - parts - { - part - { - name: "button1"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.01 0.01; - rel2.relative: 0.5 0.09; - } - } - part - { - name: "button2"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.51 0.01; - rel2.relative: 1.0 0.09; - } - } - part - { - name: "list"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.01 0.1; - rel2.relative: 0.99 0.7; - } - } - part - { - name: "log_bg"; - type: RECT; - scale: 1; - description - { - state: "default" 0.0; - rel1.relative: 0.01 0.71; - rel2.relative: 0.98 1.0; - color: 220 220 220 255; - } - } - part - { - name: "log"; - type: SWALLOW; - scale: 1; - description - { - rel1.to: "log_bg"; - rel2.to: "log_bg"; - } - } - } -} - -group -{ - name: "popup_datetime_text"; - parts - { - part - { - name: "pad_l"; - type: SPACER; - scale: 1; - description - { - state: "default" 0.0; - min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0; - fixed: 1 0; - rel1.relative: 0.0 0.0; - rel2.relative: 0.0 1.0; - align: 0.0 0.0; - } - } - part - { - name: "pad_r"; - type: SPACER; - scale: 1; - description - { - state: "default" 0.0; - min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0; - fixed: 1 0; - rel1.relative: 1.0 0.0; - rel2.relative: 1.0 1.0; - align: 1.0 0.0; - } - } - part - { - name: "elm.swallow.content"; - type: SWALLOW; - scale: 1; - description - { - state: "default" 0.0; - min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC; - max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC; - align: 0.5 0.5; - rel1 - { - relative: 1.0 0.0; - to_x: "pad_l"; - } - rel2 - { - relative: 0.0 1.0; - to_x: "pad_r"; - } - } - } - } -} diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h deleted file mode 100644 index 1374dba..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -#ifndef ESENROLLEE_H__ -#define ESENROLLEE_H__ - -#include -#include -#include -#include -#include - -#include "OCPlatform.h" -#include "OCApi.h" -#include "stdio.h" -#include "easysetup.h" -#include "wifi.h" -#include "escommon.h" -using namespace OC; - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "TIZEN ES" - -#if !defined(PACKAGE) -#define PACKAGE "org.tizen.esenrolleesample" -#endif - -#define ELM_DEMO_EDJ "opt/usr/apps/org.tizen.esenrolleesample/res/ui_controls.edj" - -void StartEnrollee(void *data, Evas_Object *obj, void *event_info); -void *listeningFunc(void*); -static char ssid[] = "DLNA_LISMORE1";//"EasySetup1234"; // -static char passwd[] = "dlna@010203";//"EasySetup123";// -static bool g_OnBoardingSucceeded = false; -static bool g_ProvisioningSucceeded = false; - -static bool g_isInitialized = false; -#endif diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/res/ui_controls.edc b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/res/ui_controls.edc deleted file mode 100644 index 7e85384..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/res/ui_controls.edc +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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 -{ - base_scale: 1.8; - #include "../edc_resource/re_client_control.edc" -} \ No newline at end of file diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/shared/res/resampleapp.png b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/shared/res/resampleapp.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/shared/res/resampleapp.png and /dev/null differ diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp deleted file mode 100644 index 771076d..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -#include "enrollee_wifi.h" -#include - -#include "OCPlatform.h" -#include "OCApi.h" - -typedef struct appdata -{ - Evas_Object *win; - Evas_Object *conform; - Evas_Object *layout; - Evas_Object *nf; - Evas_Object *findButton; - Evas_Object *logtext; - Evas_Object *listview; -} appdata_s; - -static void win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) -{ - ui_app_exit(); -} - -static void list_selected_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *) event_info; - elm_list_item_selected_set(it, EINA_FALSE); -} - -static Eina_Bool naviframe_pop_cb(void *data, Elm_Object_Item *it) -{ - ui_app_exit(); - return EINA_FALSE; -} - -static void create_list_view(appdata_s *ad) -{ - Evas_Object *list; - Evas_Object *btn; - Evas_Object *nf = ad->nf; - Elm_Object_Item *nf_it; - - // List - list = elm_list_add(nf); - elm_list_mode_set(list, ELM_LIST_COMPRESS); - evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL); - - // Main Menu Items Here - elm_list_item_append(list, "Start Enrollee ", NULL, NULL, StartEnrollee, nf); - - elm_list_go(list); - - // This button is set for devices which doesn't have H/W back key. - btn = elm_button_add(nf); - elm_object_style_set(btn, "naviframe/end_btn/default"); - nf_it = elm_naviframe_item_push(nf, "EasySetup-Enrollee", btn, NULL, list, NULL); - elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, ad->win); -} - -static void create_base_gui(appdata_s *ad) -{ - // 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 - ad->layout = elm_layout_add(ad->conform); - evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_layout_theme_set(ad->layout, "layout", "application", "default"); - evas_object_show(ad->layout); - - elm_object_content_set(ad->conform, ad->layout); - - // Naviframe - ad->nf = elm_naviframe_add(ad->layout); - create_list_view(ad); - elm_object_part_content_set(ad->layout, "elm.swallow.content", ad->nf); - eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); - eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL); - - // Show window after base gui is set up - evas_object_show(ad->win); - -} - -// Configures the OCPlatform -static void configure_platform() -{ - try - { - PlatformConfig config - { OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos }; - - OCPlatform::Configure(config); - - dlog_print(DLOG_INFO, LOG_TAG, "#### Platform configuration done!!!!"); - } - catch (OCException &e) - { - dlog_print(DLOG_ERROR, LOG_TAG, "Exception occured! (%s)", e.what()); - } -} - -static bool app_create(void *data) -{ - /* 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 = (appdata_s *) data; - - elm_app_base_scale_set(1.8); - - create_base_gui(ad); - - configure_platform(); - - return true; -} - -static void app_control(app_control_h app_control, void *data) -{ - // Handle the launch request. -} - -static void app_pause(void *data) -{ - // Take necessary actions when application becomes invisible. -} - -static void app_resume(void *data) -{ - // Take necessary actions when application becomes visible. -} - -static void app_terminate(void *data) -{ - // Release all resources. -} - -static void ui_app_lang_changed(app_event_info_h event_info, void *user_data) -{ - // APP_EVENT_LANGUAGE_CHANGED - char *locale = NULL; - system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); - elm_language_set(locale); - free(locale); - return; -} - -static void ui_app_orient_changed(app_event_info_h event_info, void *user_data) -{ - // APP_EVENT_DEVICE_ORIENTATION_CHANGED - return; -} - -static void ui_app_region_changed(app_event_info_h event_info, void *user_data) -{ - // APP_EVENT_REGION_FORMAT_CHANGED -} - -static void ui_app_low_battery(app_event_info_h event_info, void *user_data) -{ - // APP_EVENT_LOW_BATTERY -} - -static void ui_app_low_memory(app_event_info_h event_info, void *user_data) -{ - // APP_EVENT_LOW_MEMORY -} - -int main(int argc, char *argv[]) -{ - appdata_s ad = - { 0, }; - int ret = 0; - - ui_app_lifecycle_callback_s event_callback = - { 0, }; - app_event_handler_h handlers[5] = - { NULL, }; - - 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; - - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, - ui_app_low_battery, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, - ui_app_low_memory, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], - APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, - ui_app_lang_changed, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], - APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); - ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]); - - ret = ui_app_main(argc, argv, &event_callback, &ad); - if (APP_ERROR_NONE != ret) - { - dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret); - } - return ret; -} diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp deleted file mode 100644 index 5aa59a9..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -#include "enrollee_wifi.h" -#include -#include "logger.h" -#include - -using namespace std; - -static Evas_Object *log_entry = NULL; -static Evas_Object *list = NULL; -static Evas_Object *naviframe = NULL; - -// Function to update the log in UI -void *updateGroupLog(void *data) -{ - string *log = (string *) data; - *log = *log + "
"; - // Show the log - elm_entry_entry_append(log_entry, (*log).c_str()); - elm_entry_cursor_end_set(log_entry); - return NULL; -} - -void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState) - -{ - string logmessage = "callback!!! in app"; - OIC_LOG(INFO,LOG_TAG,"callback!!! in app"); - - if (esResult == ES_OK) - { - if (!g_OnBoardingSucceeded) - { - OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded"); - logmessage += "Device is successfully OnBoarded"; - g_OnBoardingSucceeded = true; - } - else if (g_OnBoardingSucceeded & enrolleeState == ES_ON_BOARDED_STATE) - { - OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP"); - logmessage += "Device is successfully OnBoared with SoftAP"; - g_ProvisioningSucceeded = true; - } - - else if (enrolleeState == ES_PROVISIONED_STATE) - { - OIC_LOG(INFO,LOG_TAG,"Device is provisioned"); - logmessage += "Device is provisioned"; - g_ProvisioningSucceeded = true; - } - - } - else if (esResult == ES_ERROR) - { - if (g_OnBoardingSucceeded) - { - OIC_LOG_V(ERROR,LOG_TAG, - "Failure in Provisioning. \ - Current Enrollee State: %d", - enrolleeState); - logmessage += "Failure in Provisioning\n"; - g_OnBoardingSucceeded = false; - - } - else if (g_ProvisioningSucceeded) - { - OIC_LOG_V(ERROR,LOG_TAG, - "Failure in connect to target network. \ - Current Enrollee State: %d", - enrolleeState); - logmessage += "Failure in connect to target network\n"; - g_ProvisioningSucceeded = false; - } - } - - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} - -static void list_selected_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *) event_info; - elm_list_item_selected_set(it, EINA_FALSE); -} - -void copy_files() -{ - dlog_print(DLOG_DEBUG, LOG_TAG, "#####text=%s", app_get_data_path()); - FILE *source, *target; - char ch, *source_file, *target_file; - source_file = "/opt/usr/apps/org.tizen.esenrolleesample/res/oic_svr_db_server.json"; - target_file = "/opt/usr/media/Images/oic_svr_db_server.json"; - source = fopen(source_file, "r"); - - if (source == NULL) - { - dlog_print(DLOG_DEBUG, LOG_TAG, "source is null"); - } - - target = fopen(target_file, "w"); - - if (target == NULL) - { - dlog_print(DLOG_DEBUG, LOG_TAG, "target is null"); - fclose(source); - } - - while ((ch = fgetc(source)) != ';') - fputc(ch, target); - fputc(EOF, target); - dlog_print(DLOG_DEBUG, LOG_TAG, "File copied successfully.\n"); - - fclose(source); - fclose(target); -} -static void init_easysetup(void *data, Evas_Object *obj, void *event_info) -{ - - string logmessage = "Init Easysetup\n"; - copy_files(); - if (InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR) - { - OIC_LOG(ERROR,LOG_TAG,"OnBoarding Failed"); - logmessage = logmessage + "OnBoarding Failed. Connect to " + ssid + " pasword= " + passwd; - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); - return; - - } - g_isInitialized = true; - OIC_LOG_V(ERROR,LOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s", - ssid); - logmessage = logmessage + "OnBoarding succeeded. Successfully connected to ssid:" + ssid; - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} - -void StartProvisioning(void *data, Evas_Object *obj, void *event_info) -{ - OIC_LOG(INFO,LOG_TAG,"StartProvisioning"); - string logmessage = "StartProvisioning\n"; - - if (InitProvisioning() == ES_ERROR) - { - OIC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed"); - logmessage += "Init Provisioning Failed\n"; - return; - } - - pthread_t thread_handle; - - if (pthread_create(&thread_handle, NULL, listeningFunc, NULL)) - { - OIC_LOG(ERROR,LOG_TAG,"Thread creation failed"); - - } - - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} -void *listeningFunc(void*) -{ - while (true) - { - OCStackResult result; - - result = OCProcess(); - - if (result != OC_STACK_OK) - { - OIC_LOG(ERROR,LOG_TAG,"OCStack stop error"); - } - - // To minimize CPU utilization we may wish to do this with sleep - - } - return NULL; -} -static Eina_Bool naviframe_pop_cb(void *data, Elm_Object_Item *it) -{ - - if (NULL != log_entry) - { - evas_object_del(log_entry); - log_entry = NULL; - } - if (NULL != list) - { - evas_object_del(list); - list = NULL; - } - return EINA_TRUE; -} -void client_cb(void *data) -{ - Evas_Object *layout; - Evas_Object *scroller; - Evas_Object *nf = (Evas_Object *) data; - Evas_Object *button1; - Evas_Object *button2; - Elm_Object_Item *nf_it; - - naviframe = nf; - - // Scroller - scroller = elm_scroller_add(nf); - elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - - // Layout - layout = elm_layout_add(nf); - elm_layout_file_set(layout, ELM_DEMO_EDJ, "group_layout"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_object_content_set(scroller, layout); - - // Init Easysetup Discovery Button - button1 = elm_button_add(layout); - elm_object_part_content_set(layout, "button1", button1); - elm_object_text_set(button1, "Init Easysetup"); - evas_object_smart_callback_add(button1, "clicked", init_easysetup, NULL); - - // start Provisioning Discovery Button - button2 = elm_button_add(layout); - elm_object_part_content_set(layout, "button2", button2); - elm_object_text_set(button2, "start Provisioning"); - evas_object_smart_callback_add(button2, "clicked", StartProvisioning, NULL); - - // List - list = elm_list_add(layout); - elm_list_mode_set(list, ELM_LIST_COMPRESS); - evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL); - elm_object_part_content_set(layout, "list", list); - elm_list_go(list); - - // log_entry - textarea for log - log_entry = elm_entry_add(layout); - elm_entry_scrollable_set(log_entry, EINA_TRUE); - elm_entry_editable_set(log_entry, EINA_FALSE); - elm_object_part_text_set(log_entry, "elm.guide", - "Logs will be updated here!!!
Please connect to network :Easysetup before starting!!"); - evas_object_size_hint_weight_set(log_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(log_entry, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(layout, "log", log_entry); - nf_it = elm_naviframe_item_push(nf, "EasySetup-Enrollee", NULL, NULL, scroller, NULL); - elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, NULL); -} - -void StartEnrollee(void *data, Evas_Object *obj, void *event_info) -{ - client_cb(data); -} diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/tizen-manifest.xml b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/tizen-manifest.xml deleted file mode 100644 index f7f4c26..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/tizen-manifest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - resampleapp.png - - - http://tizen.org/privilege/mediastorage - http://tizen.org/privilege/network.get - http://tizen.org/privilege/systemsettings - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/network.set - http://tizen.org/privilege/bluetooth - http://tizen.org/privilege/internet - http://tizen.org/privilege/power - http://tizen.org/privilege/network.profile - http://tizen.org/privilege/externalstorage.appdata - http://tizen.org/privilege/wifidirect - http://tizen.org/privilege/externalstorage - - true - diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/edc_resource/re_client_control.edc b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/edc_resource/re_client_control.edc deleted file mode 100644 index 8146661..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/edc_resource/re_client_control.edc +++ /dev/null @@ -1,148 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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 POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15 -#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 96 - -group -{ - name: "group_layout"; - parts - { - part - { - name: "button1"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.01 0.01; - rel2.relative: 0.5 0.09; - } - } - part - { - name: "button2"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.51 0.01; - rel2.relative: 1.0 0.09; - } - } - part - { - name: "list"; - type: SWALLOW; - scale: 1; - description - { - rel1.relative: 0.01 0.1; - rel2.relative: 0.99 0.7; - } - } - part - { - name: "log_bg"; - type: RECT; - scale: 1; - description - { - state: "default" 0.0; - rel1.relative: 0.01 0.71; - rel2.relative: 0.98 1.0; - color: 220 220 220 255; - } - } - part - { - name: "log"; - type: SWALLOW; - scale: 1; - description - { - rel1.to: "log_bg"; - rel2.to: "log_bg"; - } - } - } -} - -group -{ - name: "popup_datetime_text"; - parts - { - part - { - name: "pad_l"; - type: SPACER; - scale: 1; - description - { - state: "default" 0.0; - min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0; - fixed: 1 0; - rel1.relative: 0.0 0.0; - rel2.relative: 0.0 1.0; - align: 0.0 0.0; - } - } - part - { - name: "pad_r"; - type: SPACER; - scale: 1; - description - { - state: "default" 0.0; - min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0; - fixed: 1 0; - rel1.relative: 1.0 0.0; - rel2.relative: 1.0 1.0; - align: 1.0 0.0; - } - } - part - { - name: "elm.swallow.content"; - type: SWALLOW; - scale: 1; - description - { - state: "default" 0.0; - min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC; - max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC; - align: 0.5 0.5; - rel1 - { - relative: 1.0 0.0; - to_x: "pad_l"; - } - rel2 - { - relative: 0.0 1.0; - to_x: "pad_r"; - } - } - } - } -} diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h deleted file mode 100644 index a89b4f0..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -#ifndef RECLIENTMAIN_H__ -#define RECLIENTMAIN_H__ - -#include -#include -#include -#include -#include - -#include "OCPlatform.h" -#include "OCApi.h" - -#include "easysetup.h" -#include "wifi.h" -#include "escommon.h" -using namespace OC; - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "TIZEN ES" - -#if !defined(PACKAGE) -#define PACKAGE "org.tizen.esenrolleesample" -#endif - -#define ELM_DEMO_EDJ "opt/usr/apps/org.tizen.esenrolleesample/res/ui_controls.edj" - -void StartEnrollee(void *data, Evas_Object *obj, void *event_info); -void *listeningFunc(void*); -static char ssid[] = "EasySetup123"; -static char passwd[] = "EasySetup123"; -static bool g_OnBoardingSucceeded = false; -static bool g_ProvisioningSucceeded = false; - -static bool g_isInitialized = false; -#endif // RECLIENTMAIN_H__ diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/res/ui_controls.edc b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/res/ui_controls.edc deleted file mode 100644 index 7e85384..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/res/ui_controls.edc +++ /dev/null @@ -1,25 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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 -{ - base_scale: 1.8; - #include "../edc_resource/re_client_control.edc" -} \ No newline at end of file diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/shared/res/resampleapp.png b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/shared/res/resampleapp.png deleted file mode 100644 index 9765b1b..0000000 Binary files a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/shared/res/resampleapp.png and /dev/null differ diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp deleted file mode 100644 index 92418b7..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -#include "enrollee_wifi.h" -#include -#include "logger.h" -#include - -using namespace std; - -static Evas_Object *log_entry = NULL; -static Evas_Object *list = NULL; -static Evas_Object *naviframe = NULL; - -/** - * Function to update the log in UI - */ -void *updateGroupLog(void *data) -{ - string *log = (string *) data; - *log = *log + "
"; - // Show the log - elm_entry_entry_append(log_entry, (*log).c_str()); - elm_entry_cursor_end_set(log_entry); - return NULL; -} - -/** - * EventCallback function implementation - * This callback to be used for Enrollee status change - */ -void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState) -{ - string logmessage = "callback!!! in app"; - OIC_LOG(INFO,LOG_TAG,"callback!!! in app"); - - if (esResult == ES_OK) - { - if (!g_OnBoardingSucceeded) - { - OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoarded"); - logmessage += "Device is successfully OnBoarded"; - g_OnBoardingSucceeded = true; - } - else if (g_OnBoardingSucceeded & enrolleeState == ES_ON_BOARDED_STATE) - { - OIC_LOG(INFO,LOG_TAG,"Device is successfully OnBoared with SoftAP"); - logmessage += "Device is successfully OnBoared with SoftAP"; - g_ProvisioningSucceeded = true; - } - - else if (enrolleeState == ES_PROVISIONED_STATE) - { - OIC_LOG(INFO,LOG_TAG,"Device is provisioned"); - logmessage += "Device is provisioned"; - g_ProvisioningSucceeded = true; - } - - } - else if (esResult == ES_ERROR) - { - if (g_OnBoardingSucceeded) - { - OIC_LOG_V(ERROR,LOG_TAG, - "Failure in Provisioning.Current Enrollee State: %d", enrolleeState); - logmessage += "Failure in Provisioning\n"; - g_OnBoardingSucceeded = false; - } - else if (g_ProvisioningSucceeded) - { - OIC_LOG_V(ERROR,LOG_TAG, - "Failure in connect to target network.Current Enrollee State: %d", enrolleeState); - logmessage += "Failure in connect to target network\n"; - g_ProvisioningSucceeded = false; - } - } - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} - -/** - * List_selected_cb callback - */ -static void list_selected_cb(void *data, Evas_Object *obj, void *event_info) -{ - Elm_Object_Item *it = (Elm_Object_Item *) event_info; - elm_list_item_selected_set(it, EINA_FALSE); -} - -/** - * This function initializes easysetup and does onboarding - */ -static void init_easysetup(void *data, Evas_Object *obj, void *event_info) -{ - string logmessage = "Init Easysetup\n"; - if (InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR) - { - OIC_LOG(ERROR,LOG_TAG,"OnBoarding Failed"); - logmessage = logmessage + "OnBoarding Failed. Connect to " + ssid + " pasword= " + passwd; - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); - return; - - } - g_isInitialized = true; - OIC_LOG_V(ERROR,LOG_TAGLOG_TAG, "OnBoarding succeeded. Successfully connected to ssid : %s", - ssid); - logmessage = logmessage + "OnBoarding succeeded. Successfully connected to ssid:" + ssid; - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} - -/** - * Initialises and Creates provisioning resource - */ -void StartProvisioning(void *data, Evas_Object *obj, void *event_info) -{ - OIC_LOG(INFO,LOG_TAG"StartProvisioning"); - string logmessage = "StartProvisioning\n"; - - if (InitProvisioning() == ES_ERROR) - { - OIC_LOG(ERROR,LOG_TAG,"Init Provisioning Failed"); - logmessage += "Init Provisioning Failed\n"; - return; - } - - pthread_t thread_handle; - if (pthread_create(&thread_handle, NULL, listeningFunc, NULL)) - { - OIC_LOG(ERROR,LOG_TAG,"Thread creation failed"); - } - ecore_main_loop_thread_safe_call_sync((void * (*)(void *))updateGroupLog, &logmessage); -} - -/** - * Thread to execute OCProcess in a loop - */ -void *listeningFunc(void*) -{ - OCStackResult result; - while (true) - { - result = OCProcess(); - if (result != OC_STACK_OK) - { - OIC_LOG(ERROR,LOG_TAG,"OCStack stop error"); - } - - // To minimize CPU utilization we may wish to do this with sleep - sleep(1); - } - return NULL; -} - -/** - * naviframe_pop_cb callback impl - */ -static Eina_Bool naviframe_pop_cb(void *data, Elm_Object_Item *it) -{ - if (NULL != log_entry) - { - evas_object_del(log_entry); - log_entry = NULL; - } - if (NULL != list) - { - evas_object_del(list); - list = NULL; - } - return EINA_TRUE; -} - -/** - * Client callback: client_cb impl - */ -void client_cb(void *data) -{ - Evas_Object *layout; - Evas_Object *scroller; - Evas_Object *nf = (Evas_Object *) data; - Evas_Object *button1; - Evas_Object *button2; - Elm_Object_Item *nf_it; - - naviframe = nf; - - // Scroller - scroller = elm_scroller_add(nf); - elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); - - // Layout - layout = elm_layout_add(nf); - elm_layout_file_set(layout, ELM_DEMO_EDJ, "group_layout"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_object_content_set(scroller, layout); - - // Start Discovery Button - button1 = elm_button_add(layout); - elm_object_part_content_set(layout, "button1", button1); - elm_object_text_set(button1, "Init Easysetup"); - evas_object_smart_callback_add(button1, "clicked", init_easysetup, NULL); - - // Cancel Discovery Button - button2 = elm_button_add(layout); - elm_object_part_content_set(layout, "button2", button2); - elm_object_text_set(button2, "start Provisioning"); - evas_object_smart_callback_add(button2, "clicked", StartProvisioning, NULL); - - // List - list = elm_list_add(layout); - elm_list_mode_set(list, ELM_LIST_COMPRESS); - evas_object_smart_callback_add(list, "selected", list_selected_cb, NULL); - elm_object_part_content_set(layout, "list", list); - elm_list_go(list); - - // log_entry - textarea for log - log_entry = elm_entry_add(layout); - elm_entry_scrollable_set(log_entry, EINA_TRUE); - elm_entry_editable_set(log_entry, EINA_FALSE); - elm_object_part_text_set(log_entry, "elm.guide", - "Logs will be updated here!!!
Please connect to network :Easysetup before starting!!"); - evas_object_size_hint_weight_set(log_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(log_entry, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(layout, "log", log_entry); - - nf_it = elm_naviframe_item_push(nf, "EasySetup-Enrollee", NULL, NULL, scroller, NULL); - elm_naviframe_item_pop_cb_set(nf_it, naviframe_pop_cb, NULL); -} - -/** - * Starting Enrollee - */ -void StartEnrollee(void *data, Evas_Object *obj, void *event_info) -{ - client_cb(data); -} - diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/tizen-manifest.xml b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/tizen-manifest.xml deleted file mode 100644 index 05bfb47..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/tizen-manifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - resampleapp.png - - - http://tizen.org/privilege/network.get - http://tizen.org/privilege/systemsettings - http://tizen.org/privilege/appmanager.launch - http://tizen.org/privilege/network.set - http://tizen.org/privilege/bluetooth - http://tizen.org/privilege/internet - http://tizen.org/privilege/power - http://tizen.org/privilege/network.profile - http://tizen.org/privilege/wifidirect - - true - diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Read ME.txt b/service/easy-setup/sampleapp/enrollee/tizen/Read ME.txt deleted file mode 100644 index 30ee25e..0000000 --- a/service/easy-setup/sampleapp/enrollee/tizen/Read ME.txt +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************** - * - * Copyright 2015 Samsung Electronics 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. - * - ******************************************************************/ - -********* Steps to build and run tizen enrollee sample********** - -1.Build iotitvity for tizen: - sh gbsbuild.sh - -2. Install tizen Ide-2.3.0 or 2.3.1 - -3. Download and extract the boost library - -4. Import EnrolleeSample from "service\easysetup\sampleapp\tizen\" ”.(Do not copy it into tizen workspace) -(make sure you have a full copy of iotivity) - -5. Adding Libraries: -5.1 the following libs are required: -• liboc.so -• liboctbstack.so -• libconnectivity_abstraction.so -• liboc_logger.so -• liboc_logger_core.so -• libESSDKLibrary.so -****** and support libs**** -• libboost_date_time.so -• libboost_system.so -• libboost_thread.so -• libuuid.so - -5.2 how to get the first 6 libs: - 1. Go the /GBS-ROOT/local/repos/tizen/armv7l/RPMS/ - 2. copy iotivity-0.9.2-0.armv7l.rpm & iotivity-service-0.9.2-0.armv7l.rpm (these will be generated if step-1 is successfull) - 3. Extract twice(first rpm and then cpio file) using 7-zip - 4. this will generate a "usr/lib" folder - 5. copy required libs to the lib folder to enrollee sample tizen project - -5.3 the last four libs(boost and uuid) can be found at the following path: - /GBS-ROOT/local/BUILD-ROOTS/scratch.armv7l.0/usr/lib - -6. adding boost path: - go to "EnrolleeSample->properties->C/C++ build->C++ compiler->Includes" and the path to the boost library(from step3)