1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #include "androiddevice.h"
27 #include "androidconstants.h"
28 #include "androidsignaloperation.h"
29 #include "androidconfigurations.h"
30 #include "androidmanager.h"
31 
32 #include <projectexplorer/runconfiguration.h>
33 
34 #include <utils/url.h>
35 
36 #include <QLoggingCategory>
37 
38 using namespace ProjectExplorer;
39 
40 namespace Android {
41 namespace Internal {
42 
AndroidDevice()43 AndroidDevice::AndroidDevice()
44 {
45     setupId(IDevice::AutoDetected, Constants::ANDROID_DEVICE_ID);
46     setType(Constants::ANDROID_DEVICE_TYPE);
47     setDefaultDisplayName(tr("Run on Android"));
48     setDisplayType(tr("Android"));
49     setMachineType(IDevice::Hardware);
50     setOsType(Utils::OsTypeOtherUnix);
51 
52     setDeviceState(DeviceReadyToUse);
53 }
54 
deviceInformation() const55 IDevice::DeviceInfo AndroidDevice::deviceInformation() const
56 {
57     return IDevice::DeviceInfo();
58 }
59 
createWidget()60 IDeviceWidget *AndroidDevice::createWidget()
61 {
62     return nullptr;
63 }
64 
canAutoDetectPorts() const65 bool AndroidDevice::canAutoDetectPorts() const
66 {
67     return true;
68 }
69 
signalOperation() const70 DeviceProcessSignalOperation::Ptr AndroidDevice::signalOperation() const
71 {
72     return DeviceProcessSignalOperation::Ptr(new AndroidSignalOperation());
73 }
74 
toolControlChannel(const ControlChannelHint &) const75 QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const
76 {
77     QUrl url;
78     url.setScheme(Utils::urlTcpScheme());
79     url.setHost("localhost");
80     return url;
81 }
82 
83 
84 // Factory
85 
AndroidDeviceFactory()86 AndroidDeviceFactory::AndroidDeviceFactory()
87     : ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE)
88 {
89     setDisplayName(AndroidDevice::tr("Android Device"));
90     setCombinedIcon(":/android/images/androiddevicesmall.png",
91                     ":/android/images/androiddevice.png");
92     setConstructionFunction(&AndroidDevice::create);
93 }
94 
95 } // namespace Internal
96 } // namespace Android
97