2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file StBluetoothForm.cpp
19 * @brief This is the implementation file for BluetoothForm class.
23 #include "StBluetoothForm.h"
24 #include "StResourceManager.h"
25 #include "StSettingScenesList.h"
28 using namespace Tizen::App;
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Graphics;
32 using namespace Tizen::Net::Bluetooth;
33 using namespace Tizen::System;
34 using namespace Tizen::Ui;
35 using namespace Tizen::Ui::Controls;
36 using namespace Tizen::Ui::Scenes;
38 static const char APPCONTROL_REQUEST_DEFAULT = 0x00;
39 static const char APPCONTROL_REQUEST_BLUETOOTH = 0x20;
41 static const int ID_BLUETOOTH_COUNT_DEFAULT = 1;
42 static const int ID_BLUETOOTH_TABLEVIEW_ITEM_SPECIFIED_INPUT_PARMETER = -1;
43 static const int ID_FOOTER_ITEM_INDEX_1 = 0;
45 static const int IDA_BLUETOOTH_FOOTER_BASE = 100;
46 static const int IDA_BLUETOOTH_FOOTER_SCAN = IDA_BLUETOOTH_FOOTER_BASE + 1;
47 static const int IDA_BLUETOOTH_FOOTER_CANCEL = IDA_BLUETOOTH_FOOTER_BASE + 2;
49 static const int X_IN_PROGRESS_ANIMATION = 600;
50 static const int Y_IN_PROGRESS_ANIMATION = 31;
51 static const int W_IN_PROGRESS_ANIMATION = 62;
52 static const int H_IN_PROGRESS_ANIMATION = 62;
53 static const int ID_IN_PROGRESS_DURATION = 500;
54 static const int ID_IN_PROGRESS_FRAME_COUNT = 30;
55 static const int ID_IN_PROGRESS__REPEAT_COUNT = 1000;
57 static const int ID_BLUETOOTH_VISIBLE_GROUP_ITEM_CONUNT = 5;
58 static const int SEARCH_ICON_FILE_PATH_NAME_LENGTH_MAX = 100;
60 enum BluetoothTurnOnOffStatusItem
62 BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_BASE,
63 BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_TOGGLE = BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_BASE,
64 BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_VISIBLE_STATUS,
65 BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_MAX
68 enum BluetoothGroupItem
70 BLUETOOTH_GROUP_ITEM_BASE,
71 BLUETOOTH_GROUP_ITEM_TURN_ON_OFF_STATUS,
72 BLUETOOTH_GROUP_ITEM_VISIBLE,
73 BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES,
74 BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES,
75 BLUETOOTH_GROUP_ITEM_MAX
78 enum BluetoothGroupIndex
80 BLUETOOTH_GROUP_INDEX_BASE,
81 BLUETOOTH_GROUP_INDEX_0 = BLUETOOTH_GROUP_INDEX_BASE,
82 BLUETOOTH_GROUP_INDEX_1,
83 BLUETOOTH_GROUP_INDEX_2,
84 BLUETOOTH_GROUP_INDEX_3,
85 BLUETOOTH_GROUP_INDEX_MAX
88 BluetoothForm::BluetoothForm(void)
89 : __pBluetoothPresentationModelInstance(null)
90 , __pPendingEventReceivedForm(null)
91 , __pAnimationFrameList(null)
92 , __isVisibleGroupExpanded(false)
93 , __isAppControlRequest(APPCONTROL_REQUEST_DEFAULT)
94 , __categoryCheck(L"")
96 InitStateChangedTabviewItemTag();
99 BluetoothForm::~BluetoothForm(void)
104 BluetoothForm::CreateFooter(void)
106 Footer* pFooter = GetFooter();
109 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
111 FooterItem footerScan;
112 footerScan.Construct(IDA_BLUETOOTH_FOOTER_SCAN);
113 footerScan.SetText(ResourceManager::GetString(L"IDS_ST_BODY_SCAN"));
115 pFooter->AddItem(footerScan);
116 pFooter->AddActionEventListener(*this);
117 pFooter->SetItemEnabled(ID_FOOTER_ITEM_INDEX_1, false);
119 SetFormBackEventListener(this);
123 BluetoothForm::OnInitializing(void)
125 SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER | FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE);
126 CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_BLUETOOTH"));
129 CreateSearchAnimationFrame();
131 bool EnableStatus = false;
132 if (0)//SystemInfo::GetValue(SYSTEM_INFO_KEY_BLUETOOTH, EnableStatus) != E_SUCCESS)
134 AppLogDebug("Bluetooth is not supported");
138 result r = E_FAILURE;
139 if (EnableStatus == true)
141 r = BluetoothPresentationModelInit();
144 AppLogDebug("BluetoothPresentationModelInit fail [%s]", GetErrorMessage(r));
148 SetUserPendingEventReceivedForm(this);
151 RefreshGroupIndexTranslateTable();
153 if (EnableStatus == true)
155 if (__pBluetoothPresentationModelInstance->IsBluetoothActivated() == true)
161 __pTableView->UpdateTableView();
162 __pTableView->CollapseGroup(BLUETOOTH_GROUP_INDEX_1);
167 BluetoothForm::OnTerminating(void)
169 __pBluetoothPresentationModelInstance = null;
171 __pPendingEventReceivedForm = null;
173 DestorySearchAnimationFrame();
175 SetFormBackEventListener(null);
180 BluetoothForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
182 if (__pBluetoothPresentationModelInstance == null)
186 __categoryCheck = static_cast<String*>(pArgs->GetAt(0))->GetPointer();
188 if (__categoryCheck.CompareTo(L"http://tizen.org/appcontrol/data/bluetooth/visibility") == 0)
190 __isAppControlRequest = APPCONTROL_REQUEST_BLUETOOTH;
195 __pTableView->SetItemEnabled(BLUETOOTH_GROUP_INDEX_0, BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_VISIBLE_STATUS, false);
199 if (previousSceneId.Equals(String(IDSCN_BLUETOOTH_DETAIL)))
201 __pBluetoothPresentationModelInstance->SetEventListener(this);
203 RefreshGroupIndexTranslateTable();
206 else if (pArgs != null)
208 __categoryCheck = static_cast<String*>(pArgs->GetAt(0))->GetPointer();
210 if (__categoryCheck.CompareTo(L"http://tizen.org/appcontrol/data/bluetooth/visibility") == 0)
212 __isAppControlRequest = APPCONTROL_REQUEST_BLUETOOTH;
217 __pTableView->UpdateTableView();
221 BluetoothForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
226 BluetoothForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
228 SceneManager* pSceneManager = SceneManager::GetInstance();
229 AppAssert(pSceneManager);
231 __pTableView->CollapseGroup(BLUETOOTH_GROUP_INDEX_1);
232 if (__pBluetoothPresentationModelInstance != null)
234 __pBluetoothPresentationModelInstance->SetBluetoothEventInProgress(BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_EXIT);
235 __pBluetoothPresentationModelInstance->CancelBluetoothDiscovery();
238 if (__isAppControlRequest != APPCONTROL_REQUEST_DEFAULT)
240 UiApp* pApp = UiApp::GetInstance();
242 AppControlBluetoothResult();
247 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
252 BluetoothForm::GetGroupCount(void)
254 return __groupIndexTranslateTable[ID_GROUP_TOTAL_COUNT];
258 BluetoothForm::GetItemCount(int groupIndex)
264 case BLUETOOTH_GROUP_INDEX_0:
266 itemCount = __groupItemCount[BLUETOOTH_GROUP_INDEX_0];
270 case BLUETOOTH_GROUP_INDEX_1:
272 itemCount = __groupItemCount[BLUETOOTH_GROUP_INDEX_1];
276 case BLUETOOTH_GROUP_INDEX_2:
278 itemCount = __groupItemCount[BLUETOOTH_GROUP_INDEX_2];
282 case BLUETOOTH_GROUP_INDEX_3:
284 itemCount = __groupItemCount[BLUETOOTH_GROUP_INDEX_3];
292 AppLogDebug("[groupIndex:%d]GetItemCount %d", groupIndex, itemCount);
297 BluetoothForm::CreateGroupItem(int groupIndex, int itemWidth)
299 int itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
300 Rectangle itemRectangle(X_GROUP_ITEM_DEFAULT_LABEL, Y_GROUP_ITEM_DEFAULT_LABEL, itemWidth, itemHeight);
303 TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
306 AppLogDebug("__pBluetoothPresentationModelInstance or pItem is null");
310 switch (__groupIndexTranslateTable[groupIndex])
312 case BLUETOOTH_GROUP_ITEM_VISIBLE:
314 itemRectangle.y = H_GROUP_INDEX_TITLE_TEXT;
315 itemHeight = itemRectangle.height = 0;
317 __pTableView->CollapseGroup(groupIndex);
321 case BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES:
323 groupText = ResourceManager::GetString(L"IDS_BT_BODY_PAIRED_DEVICES");
324 itemHeight = H_GROUP_INDEX_DEFAULT;
325 itemRectangle.y = H_GROUP_INDEX_TITLE_TEXT;
326 itemRectangle.height = H_GROUP_INDEX_DEFAULT - H_GROUP_INDEX_TITLE_TEXT;
330 case BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES:
332 groupText = ResourceManager::GetString(L"IDS_ST_HEADER_AVAILABLE_DEVICES");
333 itemHeight = H_GROUP_INDEX_DEFAULT;
334 itemRectangle.y = H_GROUP_INDEX_TITLE_TEXT;
335 itemRectangle.height = H_GROUP_INDEX_DEFAULT - H_GROUP_INDEX_TITLE_TEXT;
343 RelativeLayout relativeLayout;
344 relativeLayout.Construct();
346 result r = pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
349 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
354 Label* pLabel = new (std::nothrow) Label();
357 AppLogDebug("pLabel is null");
361 r = pLabel->Construct(itemRectangle, groupText);
364 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
369 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
370 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
371 pLabel->SetTextConfig(FONT_SIZE_GROUP_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
372 pLabel->SetTextColor(COLOR_GROUP_TITLE_TEXT);
373 pLabel->SetName(groupText);
375 pItem->AddControl(pLabel);
376 relativeLayout.SetMargin(*pLabel, itemRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
377 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
378 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
379 pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
380 pItem->SetEnabled(false);
382 if ((__groupIndexTranslateTable[ID_GROUP_TOTAL_COUNT] == groupIndex + ID_BLUETOOTH_COUNT_DEFAULT)
383 && (__groupItemCount[groupIndex] == 0))
385 ToggleGroupExpanded(BLUETOOTH_GROUP_INDEX_1, __isVisibleGroupExpanded);
392 BluetoothForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
394 bool isCreateIcon = false;
395 bool isTwoLineItemText = false;
396 int itemHeight = H_GROUP_ITEM_DEFAULT;
397 int fontSize = GetFontSize();
398 Rectangle itemRectangle;
399 Rectangle itemRectSecondLabel;
400 Rectangle itemIconRect;
403 String itemTextTwoLine;
406 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
407 Bitmap* pBitmap = null;
409 TableViewItem* pItem = new (std::nothrow) TableViewItem();
415 switch (__groupIndexTranslateTable[groupIndex])
417 case BLUETOOTH_GROUP_ITEM_TURN_ON_OFF_STATUS:
419 if (itemIndex == BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_TOGGLE)
421 if (__pBluetoothPresentationModelInstance == null)
423 itemText = ResourceManager::GetString(L"IDS_ST_BODY_BLUETOOTH");
424 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
425 __pTableView->SetItemChecked(groupIndex, itemIndex, false);
427 isTwoLineItemText = true;
428 itemTextTwoLine = L"";
429 ItemTypeTwoLine(itemRectangle, itemRectSecondLabel, fontSize);
430 itemHeight = (itemRectangle.height + itemRectSecondLabel.height);
434 BluetoothPresentationModelEvent lastBluetoothEvent = __pBluetoothPresentationModelInstance->GetBluetoothEventInProgress();
435 if (lastBluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_ACTIVATING)
437 itemText = ResourceManager::GetString(L"IDS_BT_BODY_TURNING_ON_BLUETOOTH_ING");
438 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
440 else if (lastBluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DEACTIVATING)
442 itemText = ResourceManager::GetString(L"IDS_BT_BODY_TURNING_OFF_BLUETOOTH_ING");
443 style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
447 itemText = ResourceManager::GetString(L"IDS_ST_BODY_BLUETOOTH");
448 style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
451 if (__pBluetoothPresentationModelInstance->IsBluetoothActivated() == true)
453 __pTableView->SetItemChecked(groupIndex, itemIndex, true);
456 isTwoLineItemText = true;
457 itemTextTwoLine = __pBluetoothPresentationModelInstance->GetBluetoothLocalDeviceName();
458 ItemTypeTwoLine(itemRectangle, itemRectSecondLabel, fontSize);
459 itemHeight = (itemRectangle.height + itemRectSecondLabel.height);
463 itemText = ResourceManager::GetString(L"IDS_BT_BODY_VISIBLE");
464 if (__pBluetoothPresentationModelInstance == null)
466 itemTextTwoLine = ResourceManager::GetString(L"IDS_ST_BODY_OFF");
470 itemTextTwoLine = __pBluetoothPresentationModelInstance->GetBluetoothRemainingVisibleTime();
472 itemSetname.Append(itemText);
473 isTwoLineItemText = true;
474 ItemTypeTwoLine(itemRectangle, itemRectSecondLabel, fontSize);
475 itemHeight = (itemRectangle.height + itemRectSecondLabel.height);
480 case BLUETOOTH_GROUP_ITEM_VISIBLE:
484 case BLUETOOTH_VISIBLE_MODE_OFF:
486 if (__pBluetoothPresentationModelInstance == null)
488 __pTableView->SetItemChecked(groupIndex, itemIndex, true);
490 itemText = ResourceManager::GetString(L"IDS_ST_BODY_OFF");
494 case BLUETOOTH_VISIBLE_MDOE_2_MINUTES:
496 itemText = ResourceManager::GetString(L"IDS_ST_BODY_2_MINUTES");
500 case BLUETOOTH_VISIBLE_MODE_5_MINUTES:
502 itemText = ResourceManager::GetString(L"IDS_ST_BODY_5_MINUTES");
506 case BLUETOOTH_VISIBLE_MODE_1_HOUR:
508 itemText = ResourceManager::GetString(L"IDS_BT_BODY_1_HOUR");
512 case BLUETOOTH_VISIBLE_MODE_ALWAYS_ON:
514 itemText = ResourceManager::GetString(L"IDS_ST_BODY_ALWAYS_ON");
522 if (__pBluetoothPresentationModelInstance != null)
524 if (itemIndex == static_cast<int>(__pBluetoothPresentationModelInstance->GetBluetoothVisibleMode()))
526 __pTableView->SetItemChecked(groupIndex, itemIndex, true);
530 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
531 ItemTypeOneLine(itemRectangle);
535 case BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES:
537 itemText = __pBluetoothPresentationModelInstance->GetPairedDeviceNameAt(itemIndex);
538 if (itemText.IsEmpty() == true)
540 AppLogDebug("GetFoundDeviceListAt[%d] fail", itemIndex);
545 pBitmap = GetMajorDeviceClassTypeInPairedDeviceAtBitmapN(itemIndex);
551 isTwoLineItemText = true;
552 style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
553 itemTextTwoLine = ResourceManager::GetString(L"IDS_BT_BODY_PAIRED");
555 ItemTypeIconAndTwoLine(itemIconRect, itemRectangle, itemRectSecondLabel, fontSize);
556 itemHeight = (itemRectangle.height + itemRectSecondLabel.height);
560 case BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES:
562 if (__pBluetoothPresentationModelInstance->GetFoundRemoteDeviceListCount() == 0)
564 itemText = ResourceManager::GetString(L"IDS_BT_BODY_NO_BLUETOOTH_DEVICE_FOUND");
565 ItemTypeOneLine(itemRectangle);
569 itemText = __pBluetoothPresentationModelInstance->GetFoundDeviceListAt(itemIndex);
570 if (itemText.IsEmpty() == true)
572 AppLogDebug("GetFoundDeviceListAt[%d] fail", itemIndex);
577 pBitmap = GetMajorDeviceClassTypeInFoundDeviceAtBitmapN(itemIndex);
583 ItemTypeIconAndOneLine(itemIconRect, itemRectangle);
591 RelativeLayout relativeLayout;
592 relativeLayout.Construct();
594 result r = pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight), style);
597 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
602 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
606 Label* pLabel = new (std::nothrow) Label();
609 AppLogDebug("pLabel is null");
613 pLabel->Construct(itemIconRect, L"");
616 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
621 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
622 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
623 pLabel->SetBackgroundBitmap(*pBitmap);
625 pItem->AddControl(pLabel);
626 relativeLayout.SetMargin(*pLabel, itemIconRect.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
627 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
628 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
633 Label* pLabel = new (std::nothrow) Label();
636 AppLogDebug("pLabel is null");
640 r = pLabel->Construct(itemRectangle, itemText);
643 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
648 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
649 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
650 pLabel->SetTextColor(COLOR_MAIN_TEXT);
652 pItem->AddControl(pLabel);
653 if (style == TABLE_VIEW_ANNEX_STYLE_RADIO)
655 relativeLayout.SetMargin(*pLabel, RELATIVE_LAYOUT_LEFT_MARGIN, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
657 else if (style == TABLE_VIEW_ANNEX_STYLE_DETAILED)
659 relativeLayout.SetMargin(*pLabel, itemRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN_DETAIL_BUTTON, 0, 0);
663 relativeLayout.SetMargin(*pLabel, itemRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
665 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
666 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
668 if (isTwoLineItemText == true)
670 Label* pSecondLabel = new (std::nothrow) Label();
671 if (pSecondLabel == null)
673 AppLogDebug("pLabel is null");
677 r = pSecondLabel->Construct(itemRectSecondLabel, itemTextTwoLine);
680 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
685 pSecondLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
686 pSecondLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
687 pSecondLabel->SetTextColor(COLOR_SUB_TEXT);
688 pSecondLabel->SetName(itemSetname);
690 pItem->AddControl(pSecondLabel);
691 relativeLayout.SetMargin(*pSecondLabel, itemRectSecondLabel.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
692 relativeLayout.SetRelation(*pSecondLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
693 relativeLayout.SetRelation(*pSecondLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
696 if ((__groupIndexTranslateTable[ID_GROUP_TOTAL_COUNT] == groupIndex + ID_BLUETOOTH_COUNT_DEFAULT)
697 && (__groupItemCount[groupIndex] == itemIndex + ID_BLUETOOTH_COUNT_DEFAULT))
699 ToggleGroupExpanded(BLUETOOTH_GROUP_INDEX_1, __isVisibleGroupExpanded);
706 BluetoothForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
708 AppLogDebug("ENTER");
717 BluetoothForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
719 AppLogDebug("ENTER");
728 BluetoothForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
730 SceneManager* pSceneManager = SceneManager::GetInstance();
731 AppAssert(pSceneManager);
733 if (__pBluetoothPresentationModelInstance != null)
735 __pBluetoothPresentationModelInstance->CancelBluetoothDiscovery();
738 switch (__groupIndexTranslateTable[groupIndex])
740 case BLUETOOTH_GROUP_ITEM_TURN_ON_OFF_STATUS:
744 case BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_TOGGLE:
746 if (__pBluetoothPresentationModelInstance == null)
748 __pTableView->SetItemChecked(groupIndex, itemIndex, false);
749 // Not supported in the Emulator
750 ShowMessageBox(ResourceManager::GetString(L"IDS_EMAIL_POP_ALERT"), ResourceManager::GetString(L"IDS_ST_POP_NOT_SUPPORTED"));
753 BluetoothPresentationModelEvent lastBluetoothEvent = __pBluetoothPresentationModelInstance->GetBluetoothEventInProgress();
754 if ((lastBluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_ACTIVATING)
755 || (lastBluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DEACTIVATING))
757 AppLogDebug("Bluetooth is status of Activating or Deactivating");
761 if (tableView.IsItemChecked(groupIndex, itemIndex) == false)
763 result r = __pBluetoothPresentationModelInstance->DeactivateBluetooth();
766 AppLogDebug("BluetoothDeactivate fail [%s]", GetErrorMessage(r));
772 result r = __pBluetoothPresentationModelInstance->ActivateBluetooth();
775 AppLogDebug("BluetoothActivate fail [%s]", GetErrorMessage(r));
780 RefreshGroupIndexTranslateTable();
786 case BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_VISIBLE_STATUS:
788 if (__pBluetoothPresentationModelInstance == null)
790 // Not supported in the Emulator
791 ShowMessageBox(ResourceManager::GetString(L"IDS_EMAIL_POP_ALERT"), ResourceManager::GetString(L"IDS_ST_POP_NOT_SUPPORTED"));
794 if (__isVisibleGroupExpanded == true)
796 __isVisibleGroupExpanded = false;
797 ToggleGroupExpanded(BLUETOOTH_GROUP_INDEX_1, __isVisibleGroupExpanded);
801 __isVisibleGroupExpanded = true;
802 ToggleGroupExpanded(BLUETOOTH_GROUP_INDEX_1, __isVisibleGroupExpanded);
813 case BLUETOOTH_GROUP_ITEM_VISIBLE:
815 if (__pBluetoothPresentationModelInstance == null)
817 __pTableView->SetItemChecked(groupIndex, itemIndex, false);
818 __pTableView->SetItemChecked(ID_BLUETOOTH_COUNT_DEFAULT, 0, true);
819 // Not supported in the Emulator
820 ShowMessageBox(ResourceManager::GetString(L"IDS_EMAIL_POP_ALERT"), ResourceManager::GetString(L"IDS_ST_POP_NOT_SUPPORTED"));
823 result r = __pBluetoothPresentationModelInstance->SetBluetoothVisibleMode(static_cast<BluetoothVisibleMode>(itemIndex));
826 SingleSelectAnnexStyleRadio(groupIndex, itemIndex);
827 SetStateChangedTableviewItemTag(groupIndex, itemIndex);
832 case BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES:
834 // if (status == TABLE_VIEW_ITEM_STATUS_MORE)
836 ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
839 AppLogDebug("pArgs is null");
843 result r = pArgs->Construct();
848 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
852 pArgs->Add(*(new (std::nothrow) String(Integer::ToString(itemIndex))));
853 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BLUETOOTH_DETAIL, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
858 case BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES:
860 if (__pBluetoothPresentationModelInstance != null)
862 if (__pBluetoothPresentationModelInstance->GetBluetoothEventInProgress() == BLUETOOTH_PRESENTATION_MODEL_EVENT_PAIRING)
864 result r = __pBluetoothPresentationModelInstance->CancelBluetoothPair();
867 AppLogDebug("BluetoothCancelPair fail [%s]", GetErrorMessage(r));
871 ModifyTableViewItem(groupIndex, itemIndex);
874 result r = __pBluetoothPresentationModelInstance->PairToFoundBluetoothDeviceAt(itemIndex);
877 AppLogDebug("BluetoothPairToFoundDeviceList fail [%s]", GetErrorMessage(r));
881 SetStateChangedTableviewItemTag(groupIndex, itemIndex);
882 ModifyTableViewItem(groupIndex, itemIndex);
886 AppLogDebug("__pBluetoothPresentationModelInstance is null.");
897 BluetoothForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
899 if (__pBluetoothPresentationModelInstance == null)
901 AppLogDebug("__pBluetoothPresentationModelInstance is null");
907 case IDA_BLUETOOTH_FOOTER_SCAN:
909 result r = __pBluetoothPresentationModelInstance->StartBluetoothDiscovery();
912 AppLogDebug("BluetoothStartDiscovery fail [%s]", GetErrorMessage(r));
920 case IDA_BLUETOOTH_FOOTER_CANCEL:
922 result r = __pBluetoothPresentationModelInstance->CancelBluetoothDiscovery();
925 AppLogDebug("BluetoothStartDiscovery fail [%s]", GetErrorMessage(r));
939 BluetoothForm::DisableScanFooter(void)
941 Footer* pFooter = GetFooter();
944 pFooter->SetItemEnabled(0, false);
945 pFooter->Invalidate(false);
949 BluetoothForm::EnableScanFooter(void)
951 Footer* pFooter = GetFooter();
954 pFooter->SetItemEnabled(0, true);
955 pFooter->Invalidate(true);
959 BluetoothForm::SetFooterText(const int actionId, Tizen::Base::String itemText)
961 Footer* pFooter = GetFooter();
964 FooterItem footerItem;
965 footerItem.Construct(actionId);
966 footerItem.SetText(itemText);
968 pFooter->RemoveItemAt(0);
969 pFooter->InsertItemAt(0, footerItem);
973 BluetoothForm::ShowMessageBox(const Tizen::Base::String& title, const Tizen::Base::String& text)
975 MessageBox messageBox;
976 int result = E_SUCCESS;
978 messageBox.Construct(title, text, MSGBOX_STYLE_NONE, MESSAGEBOX_DISPLAY_TIME_2_SEC);
979 messageBox.ShowAndWait(result);
983 BluetoothForm::BluetoothPresentationModelInit(void)
985 __pBluetoothPresentationModelInstance = BluetoothPresentationModel::GetInstance();
986 if (__pBluetoothPresentationModelInstance == null)
988 AppLogDebug("__pBluetoothPresentationModelInstance is null");
992 __pBluetoothPresentationModelInstance->SetEventListener(this);
996 Tizen::Graphics::Bitmap*
997 BluetoothForm::GetMajorDeviceClassTypeInPairedDeviceAtBitmapN(int pairedDeviceListIndex, bool isConnected)
999 if (__pBluetoothPresentationModelInstance == null)
1001 AppLogDebug("__pBluetoothPresentationModelInstance is null");
1005 Bitmap* pBitmap = null;
1006 BluetoothMajorDeviceClassType majorType = __pBluetoothPresentationModelInstance->GetMajorDeviceClassTypeInPairedDeviceAt(pairedDeviceListIndex);
1008 if (IsFailed(GetLastResult()))
1010 AppLogDebug("GetMajorDeviceClassTypeInPairedDeviceListAt fail [%s]", GetErrorMessage(GetLastResult()));
1016 case BT_COD_MAJ_DEV_CLS_COMPUTER:
1018 if (isConnected == true)
1020 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_COMPUTER_CONNECT);
1024 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_COMPUTER);
1029 case BT_COD_MAJ_DEV_CLS_PHONE:
1031 if (isConnected == true)
1033 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_MOBILE_CONNECT);
1037 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_MOBILE);
1042 case BT_COD_MAJ_DEV_CLS_MISC:
1044 case BT_COD_MAJ_DEV_CLS_LAN_ACCESS_POINT:
1046 case BT_COD_MAJ_DEV_CLS_AUDIO:
1048 case BT_COD_MAJ_DEV_CLS_PERIPHERAL:
1050 case BT_COD_MAJ_DEV_CLS_IMAGING:
1052 case BT_COD_MAJ_DEV_CLS_UNCLASSIFIED:
1054 if (isConnected == true)
1056 pBitmap = ResourceManager::GetBitmapN(IDB_BT_BUTTON_UNKNOWN_CONNECT);
1060 pBitmap = ResourceManager::GetBitmapN(IDB_BT_BUTTON_UNKNOWN);
1072 Tizen::Graphics::Bitmap*
1073 BluetoothForm::GetMajorDeviceClassTypeInFoundDeviceAtBitmapN(int foundDeviceListIndex)
1075 if (__pBluetoothPresentationModelInstance == null)
1077 AppLogDebug("__pBluetoothPresentationModelInstance is null");
1081 Bitmap* pBitmap = null;
1082 BluetoothMajorDeviceClassType majorType = __pBluetoothPresentationModelInstance->GetMajorDeviceClasstypeInFoundDeviceAt(foundDeviceListIndex);
1084 if (IsFailed(GetLastResult()))
1086 AppLogDebug("GetMajorDeviceClasstypeInFoundDeviceListAt fail [%s]", GetErrorMessage(GetLastResult()));
1092 case BT_COD_MAJ_DEV_CLS_COMPUTER:
1094 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_COMPUTER);
1098 case BT_COD_MAJ_DEV_CLS_PHONE:
1100 pBitmap = ResourceManager::GetBitmapN(IDB_BT_DEVICE_MOBILE);
1104 case BT_COD_MAJ_DEV_CLS_MISC:
1106 case BT_COD_MAJ_DEV_CLS_LAN_ACCESS_POINT:
1108 case BT_COD_MAJ_DEV_CLS_AUDIO:
1110 case BT_COD_MAJ_DEV_CLS_PERIPHERAL:
1112 case BT_COD_MAJ_DEV_CLS_IMAGING:
1114 case BT_COD_MAJ_DEV_CLS_UNCLASSIFIED:
1116 pBitmap = ResourceManager::GetBitmapN(IDB_BT_BUTTON_UNKNOWN);
1128 BluetoothForm::SetUserPendingEventReceivedForm(Tizen::Ui::Controls::Form* pEventReveivedForm)
1130 __pPendingEventReceivedForm = pEventReveivedForm;
1134 BluetoothForm::SendToUserPendingEvent(RequestId requestId)
1136 if (__pPendingEventReceivedForm)
1138 __pPendingEventReceivedForm->SendUserEvent(requestId, null);
1143 BluetoothForm::CreateSearchAnimationFrame(void)
1146 long duration = ID_IN_PROGRESS_DURATION / ID_IN_PROGRESS_FRAME_COUNT;
1148 Bitmap* pBitmap = null;
1149 AnimationFrame* pAniFrame = null;
1151 __pAnimationFrameList = new (std::nothrow) ArrayList();
1152 __pAnimationFrameList->Construct();
1154 for (count = ID_BLUETOOTH_COUNT_DEFAULT; count <= ID_IN_PROGRESS_FRAME_COUNT; count++)
1156 String searchIconFilePath;
1157 searchIconFilePath.Format(SEARCH_ICON_FILE_PATH_NAME_LENGTH_MAX, IDB_SEARCH_ICON_SIZE_LAGER_IMAGE_PATH_FORMAT, count);
1158 AppLogDebug("%ls", searchIconFilePath.GetPointer());
1159 pBitmap = ResourceManager::GetBitmapN(searchIconFilePath);
1160 if (pBitmap == null)
1162 AppLogDebug("GetBitmapN fail");
1165 pAniFrame = new (std::nothrow) AnimationFrame(*pBitmap, duration);
1166 __pAnimationFrameList->Add(*pAniFrame);
1172 BluetoothForm::DestorySearchAnimationFrame(void)
1174 if (__pAnimationFrameList != null)
1176 __pAnimationFrameList->RemoveAll();
1177 delete __pAnimationFrameList;
1178 __pAnimationFrameList = null;
1183 BluetoothForm::AddTableViewItemInSpecificGroupItem(int groupItem)
1185 if (__pTableView == null)
1187 AppLogDebug("__pTableView is null");
1191 bool isFoundGroupItem = false;
1193 for (groupIndex = 0; groupIndex < ID_GROUP_TOTAL_COUNT; groupIndex++)
1195 if (__groupIndexTranslateTable[groupIndex] == groupItem)
1197 isFoundGroupItem = true;
1202 if (isFoundGroupItem == false)
1204 AppLogDebug("gorup item is not found");
1208 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
1212 BluetoothForm::ModifyTableViewItem(int groupIndex, int itemIndex)
1214 if (__pTableView == null)
1216 AppLogDebug("__pTableView is null");
1220 __pTableView->RefreshItem(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1224 BluetoothForm::ModifyTableViewSpecificGroupItem(int groupItem)
1226 if (__pTableView == null)
1228 AppLogDebug("__pTableView is null");
1232 bool isFoundGroupItem = false;
1234 for (groupIndex = 0; groupIndex < ID_GROUP_TOTAL_COUNT; groupIndex++)
1236 if (__groupIndexTranslateTable[groupIndex] == groupItem)
1238 isFoundGroupItem = true;
1243 if (isFoundGroupItem == false)
1245 AppLogDebug("gorup item is not found");
1249 __pTableView->RefreshItem(groupIndex, ID_BLUETOOTH_TABLEVIEW_ITEM_SPECIFIED_INPUT_PARMETER, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1253 BluetoothForm::RefreshGroupIndexTranslateTable(void)
1255 if (__pTableView == null)
1257 AppLogDebug("__pBluetoothMgr or __pTableView is null");
1264 __groupItemCount[groupIndex] = BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_MAX;
1265 __groupIndexTranslateTable[groupIndex] = BLUETOOTH_GROUP_ITEM_TURN_ON_OFF_STATUS;
1266 groupIndex = groupIndex + ID_BLUETOOTH_COUNT_DEFAULT;
1268 __groupItemCount[groupIndex] = ID_BLUETOOTH_VISIBLE_GROUP_ITEM_CONUNT;
1269 __groupIndexTranslateTable[groupIndex] = BLUETOOTH_GROUP_ITEM_VISIBLE;
1270 groupIndex = groupIndex + ID_BLUETOOTH_COUNT_DEFAULT;
1272 if (__pBluetoothPresentationModelInstance == null)
1274 __groupIndexTranslateTable[ID_GROUP_TOTAL_COUNT] = groupIndex;
1278 itemCount = __pBluetoothPresentationModelInstance->GetPairedDeviceListCount();
1281 __groupItemCount[groupIndex] = itemCount;
1282 __groupIndexTranslateTable[groupIndex] = BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES;
1283 groupIndex = groupIndex + ID_BLUETOOTH_COUNT_DEFAULT;
1286 itemCount = __pBluetoothPresentationModelInstance->GetFoundRemoteDeviceListCount();
1287 BluetoothPresentationModelEvent lastbluetoothEvent = __pBluetoothPresentationModelInstance->GetBluetoothEventInProgress();
1289 if ((itemCount != 0)
1290 || (lastbluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_STARTED)
1291 || (lastbluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_CANCELED)
1292 || (lastbluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_DONE))
1294 __groupIndexTranslateTable[groupIndex] = BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES;
1297 __groupItemCount[groupIndex] = itemCount;
1299 else if (lastbluetoothEvent == BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_DONE)
1301 __groupItemCount[groupIndex] = ID_BLUETOOTH_COUNT_DEFAULT;
1305 __groupItemCount[groupIndex] = 0;
1307 groupIndex = groupIndex + ID_BLUETOOTH_COUNT_DEFAULT;
1310 __groupIndexTranslateTable[ID_GROUP_TOTAL_COUNT] = groupIndex;
1314 BluetoothForm::ToggleGroupExpanded(int groupIndex, bool isExpand)
1316 if (__pTableView == null)
1318 AppLogDebug("__pTableView is null");
1322 if (isExpand == true)
1324 if (__pTableView->IsGroupExpanded(groupIndex) == false)
1326 __pTableView->ExpandGroup(groupIndex);
1331 if (__pTableView->IsGroupExpanded(groupIndex) == true)
1333 __pTableView->CollapseGroup(groupIndex);
1339 BluetoothForm::SingleSelectAnnexStyleRadio(int groupIndex, int itemIndex)
1341 if (__pTableView == null)
1343 AppLogDebug("__pTableView is null");
1347 int itemCount = __pTableView->GetItemCountAt(groupIndex);
1348 for (int i = 0; i < itemCount; i++)
1352 __pTableView->SetItemChecked(groupIndex, i, false);
1356 __pTableView->SetItemChecked(groupIndex, i, true);
1359 __pTableView->RequestRedraw(true);
1363 BluetoothForm::InitStateChangedTabviewItemTag(void)
1365 __stateChangedTableViewItemTag.groupIndex = ID_BLUETOOTH_TABLEVIEW_ITEM_SPECIFIED_INPUT_PARMETER;
1366 __stateChangedTableViewItemTag.itemIndex = ID_BLUETOOTH_TABLEVIEW_ITEM_SPECIFIED_INPUT_PARMETER;
1370 BluetoothForm::SetStateChangedTableviewItemTag(int groupIndex, int itemIndex)
1372 __stateChangedTableViewItemTag.groupIndex = groupIndex;
1373 __stateChangedTableViewItemTag.itemIndex = itemIndex;
1377 BluetoothForm::UpdateTableView(void)
1379 if (__pTableView == null)
1381 AppLogDebug("__pTableView is null");
1384 __pTableView->UpdateTableView();
1388 Tizen::Base::Collection::IList*
1389 BluetoothForm::ResultBluetoothDeviceFromAppControlRequestN(void)
1391 BluetoothForm* pBluetoothForm = null;
1392 ArrayList* pDataList = null;
1393 BluetoothDevice* pDevice = null;
1395 pDataList = new (std::nothrow) ArrayList();
1397 if (__pStaticBluetoothMgr != null)
1399 delete __pStaticBluetoothMgr;
1400 __pStaticBluetoothMgr = null;
1403 __pStaticBluetoothMgr = new (std::nothrow) BluetoothManager();
1405 pBluetoothForm = new (std::nothrow) BluetoothForm();
1407 __pStaticBluetoothMgr->Construct(*pBluetoothForm);
1409 pDevice = const_cast<BluetoothDevice*>(__pStaticBluetoothMgr->GetLocalDevice());
1411 pDataList->Add(*(new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED)));
1412 pDataList->Add(*(new (std::nothrow) String(__pStaticBluetoothMgr->GetLocalDeviceName())));
1413 pDataList->Add(*(new (std::nothrow) String(__pStaticBluetoothMgr->GetLocalDeviceAddress())));
1414 pDataList->Add(*(new (std::nothrow) String(Integer::ToString(pDevice->GetMajorDeviceClassType()))));
1415 pDataList->Add(*(new (std::nothrow) String(Integer::ToString(pDevice->GetMinorDeviceClassType()))));
1416 pDataList->Add(*(new (std::nothrow) String(Integer::ToString(pDevice->GetServiceClassList()))));
1417 pDataList->Add(*(new (std::nothrow) String(Integer::ToString(pDevice->GetServiceList()))));
1421 delete __pStaticBluetoothMgr;
1422 __pStaticBluetoothMgr = null;
1423 delete pBluetoothForm;
1424 pBluetoothForm = null;
1431 BluetoothForm::GetDefaultGroupItemHeight(void)
1433 return H_GROUP_INDEX_NO_TITLE_DEFAULT;
1437 BluetoothForm::GetDefaultItemHeight(void)
1439 return H_GROUP_ITEM_DEFAULT;
1443 BluetoothForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
1445 if (__pBluetoothPresentationModelInstance == null)
1447 AppLogDebug("__pBluetoothPresentationModelInstance is null");
1451 switch (__groupIndexTranslateTable[groupIndex])
1453 case BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES:
1455 Label* pLabel = static_cast<Label*>(pItem->GetControl(ResourceManager::GetString(L"IDS_ST_HEADER_AVAILABLE_DEVICES")));
1458 AppLogDebug("pLabel is null");
1462 if (__pBluetoothPresentationModelInstance->GetFoundRemoteDeviceListCount() == 0)
1464 pLabel->SetText(ResourceManager::GetString(L"IDS_BT_BODY_BLUETOOTH_DEVICES"));
1468 pLabel->SetText(ResourceManager::GetString(L"IDS_ST_HEADER_AVAILABLE_DEVICES"));
1470 pLabel->Invalidate(false);
1474 case BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES:
1488 BluetoothForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1491 || (__pBluetoothPresentationModelInstance == null))
1493 AppLogDebug("pItem or __pBluetoothPresentationModelInstance is null");
1497 switch (__groupIndexTranslateTable[groupIndex])
1499 case BLUETOOTH_GROUP_ITEM_TURN_ON_OFF_STATUS:
1501 if (itemIndex != BLUETOOTH_TURN_ON_OFF_STATUS_ITEM_VISIBLE_STATUS)
1506 Label* pLabel = static_cast<Label*>(pItem->GetControl(ResourceManager::GetString(L"IDS_BT_BODY_VISIBLE")));
1509 AppLogDebug("pLabel is null");
1513 pLabel->SetText( __pBluetoothPresentationModelInstance->GetBluetoothRemainingVisibleTime());
1514 pLabel->Invalidate(false);
1518 case BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES:
1520 if (__pBluetoothPresentationModelInstance->GetBluetoothEventInProgress() == BLUETOOTH_PRESENTATION_MODEL_EVENT_PAIRING)
1522 Rectangle itemAnimationRect(X_IN_PROGRESS_ANIMATION, Y_IN_PROGRESS_ANIMATION, W_IN_PROGRESS_ANIMATION, H_IN_PROGRESS_ANIMATION);
1524 Animation* pAnimation = new (std::nothrow) Animation();
1525 result r = pAnimation->Construct(itemAnimationRect, *__pAnimationFrameList);
1528 AppLogDebug("Construct fail [%s]", GetErrorMessage(r));
1533 pAnimation->SetRepeatCount(ID_IN_PROGRESS__REPEAT_COUNT);
1534 pAnimation->SetName(L"SearchAnimation");
1535 pAnimation->SetShowState(true);
1536 pItem->AddControl(pAnimation);
1541 Animation* pAnimation = static_cast<Animation*>(pItem->GetControl(L"SearchAnimation"));
1542 if (pAnimation == null)
1544 AppLogDebug("pAnimation is null");
1547 pItem->RemoveControl(pAnimation);
1552 case BLUETOOTH_GROUP_ITEM_PAIRED_DEVICES:
1566 BluetoothForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1571 BluetoothForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1576 BluetoothForm::AppControlBluetoothResult(void)
1579 RequestId reqId = 0;
1580 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
1582 HashMap* hashMap = new (std::nothrow) HashMap();
1583 hashMap->Construct();
1585 if (__isAppControlRequest & APPCONTROL_REQUEST_BLUETOOTH)
1587 hashMap->Add(*(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/visibility")), *(new (std::nothrow) String(L"Off")));
1589 pAppManager->SendAppControlResult(reqId, APP_CTRL_RESULT_SUCCEEDED, hashMap);
1591 hashMap->RemoveAll();
1596 BluetoothForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1601 BluetoothForm::OnBluetoothPresentationModelEventCompletedN(BluetoothPresentationModelEvent bluetoothEvent, result r, Tizen::Net::Bluetooth::BluetoothDevice* pDevice)
1603 if (__pBluetoothPresentationModelInstance == null)
1605 AppLogDebug("__pBluetoothPresentationModelInstance is null");
1609 switch (bluetoothEvent)
1611 case BLUETOOTH_PRESENTATION_MODEL_EVENT_ACTIVATED:
1615 AppLogDebug("result fail [%s]", GetErrorMessage(r));
1619 result r = __pBluetoothPresentationModelInstance->StartBluetoothDiscovery();
1622 AppLogDebug("BluetoothStartDiscovery fail [%s]", GetErrorMessage(r));
1627 DisableScanFooter();
1631 case BLUETOOTH_PRESENTATION_MODEL_EVENT_DEACTIVATED:
1635 AppLogDebug("result fail [%s]", GetErrorMessage(r));
1640 SetFooterText(IDA_BLUETOOTH_FOOTER_SCAN, ResourceManager::GetString(L"IDS_ST_BODY_SCAN"));
1641 DisableScanFooter();
1643 RefreshGroupIndexTranslateTable();
1648 case BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_DONE:
1650 case BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_CANCELED:
1652 SetFooterText(IDA_BLUETOOTH_FOOTER_SCAN, ResourceManager::GetString(L"IDS_ST_BODY_SCAN"));
1655 RefreshGroupIndexTranslateTable();
1656 int itemCount = __pBluetoothPresentationModelInstance->GetFoundRemoteDeviceListCount();
1659 ModifyTableViewSpecificGroupItem(BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES);
1660 AddTableViewItemInSpecificGroupItem(BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES);
1665 case BLUETOOTH_PRESENTATION_MODEL_EVENT_DISCOVERY_STARTED:
1669 AppLogDebug("result fail [%s]", GetErrorMessage(r));
1674 SetFooterText(IDA_BLUETOOTH_FOOTER_CANCEL, ResourceManager::GetString(L"IDS_COM_BODY_STOP"));
1677 RefreshGroupIndexTranslateTable();
1682 case BLUETOOTH_PRESENTATION_MODEL_EVENT_PAIRED:
1684 RefreshGroupIndexTranslateTable();
1689 case BLUETOOTH_PRESENTATION_MODEL_EVENT_PAIRING_FAILED:
1691 ModifyTableViewItem(__stateChangedTableViewItemTag.groupIndex, __stateChangedTableViewItemTag.itemIndex);
1692 InitStateChangedTabviewItemTag();
1696 case BLUETOOTH_PRESENTATION_MODEL_EVENT_REMOTE_DEVICE_FOUND:
1700 AppLogDebug("BLUETOOTH_PRESENTATION_MODEL_EVENT_REMOTE_DEVICE_FOUND fail [%s]", GetErrorMessage(r));
1703 AddTableViewItemInSpecificGroupItem(BLUETOOTH_GROUP_ITEM_AVAILABLE_DEVICES);
1707 case BLUETOOTH_PRESENTATION_MODEL_EVENT_VISIBLE_MODE_CHANGED:
1709 ModifyTableViewItem(__stateChangedTableViewItemTag.groupIndex, __stateChangedTableViewItemTag.itemIndex);
1710 InitStateChangedTabviewItemTag();
1714 case BLUETOOTH_PRESENTATION_MODEL_EVENT_UNPAIRED:
1716 RefreshGroupIndexTranslateTable();