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.
17 #include <AppCommon.h>
21 #define FILE_BROWSER_APP "org.tizen.file-browser-tv-ref"
22 #define FILE_BROWSER_USB_KEY "source"
23 #define FILE_BROWSER_USB_VALUE "usb"
26 CUsb::SCallback conCb;
30 bool CUsb::Create(const SCallback *cb)
40 if (!CUsbListener::Create())
41 _DBG("UsbListener creation failed");
48 void CUsb::Destroy(void)
52 if (CUsbListener::FlagCreate())
53 CUsbListener::Destroy();
59 bool CUsb::SwitchTo(void)
68 err = bundle_add(b, FILE_BROWSER_USB_KEY, FILE_BROWSER_USB_VALUE);
70 _ERR("Add bundle value failed. err:%d", err);
75 aul_launch_app(FILE_BROWSER_APP, b);
81 void CUsb::GetConnected(void)
84 SUsbHostDeviceInfo devInfo;
86 if (!CUsbListener::FlagCreate())
89 count = ConnectionCount();
90 for (int i = 0; i < count; i++) {
91 GetConnectedDevInfo(i, &devInfo);
92 m->conCb.cb(m->conCb.cookie, USB_HOST_DEV_CONNECTED, &devInfo);
96 void CUsb::OnStatusChanged(SUsbHostDeviceInfo *changedDevice,
97 SUsbHostDeviceStatus status)
99 m->conCb.cb(m->conCb.cookie, status, (void *)changedDevice);