2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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 #include <AppCommon.h>
22 #define FILE_BROWSER_APP "org.tizen.file-browser-tv-ref"
23 #define FILE_BROWSER_USB_KEY "source"
24 #define FILE_BROWSER_USB_VALUE "usb"
27 CUsb::SCallback conCb;
31 bool CUsb::Create(const SCallback *cb)
41 if (!CUsbListener::Create())
42 _DBG("UsbListener creation failed");
49 void CUsb::Destroy(void)
53 if (CUsbListener::FlagCreate())
54 CUsbListener::Destroy();
60 bool CUsb::SwitchTo(void)
69 err = bundle_add(b, FILE_BROWSER_USB_KEY, FILE_BROWSER_USB_VALUE);
71 _ERR("Add bundle value failed. err:%d", err);
76 aul_launch_app(FILE_BROWSER_APP, b);
82 void CUsb::GetConnected(void)
85 SUsbHostDeviceInfo devInfo;
87 if (!CUsbListener::FlagCreate())
90 count = ConnectionCount();
91 for (int i = 0; i < count; i++) {
92 GetConnectedDevInfo(i, &devInfo);
93 m->conCb.cb(m->conCb.cookie, USB_HOST_DEV_CONNECTED, &devInfo);
97 void CUsb::OnStatusChanged(SUsbHostDeviceInfo *changedDevice,
98 SUsbHostDeviceStatus status)
100 m->conCb.cb(m->conCb.cookie, status, (void *)changedDevice);