diff options
author | Kai Koehne <kai.koehne@digia.com> | 2013-01-28 12:11:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-30 09:45:45 +0100 |
commit | f814eb831a8fb3d7eb958b72142ab4979ed76599 (patch) | |
tree | fdf3de0f2c6b2b2047b53d800a8161dd4182cdf8 /src/plugins | |
parent | 233e83b20512a5e3748542f1c279a5c7ec6310ad (diff) |
Debugger: Remove symbian specific plugin
Symbian isn't supported any more. We only support debugging via TCP.
Change-Id: Ie7be06eeacd4206c4c14178e24c1b33d35fc8a0c
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro | 15 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp | 150 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h | 82 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp | 220 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/qostdevice.h | 77 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_ost/usbostcomm.h | 191 |
6 files changed, 0 insertions, 735 deletions
diff --git a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro b/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro deleted file mode 100644 index 6172ee95cf..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = qmldbg_ost -QT += qml network - -PLUGIN_TYPE = qmltooling -PLUGIN_CLASS_NAME = QmlOstPlugin -load(qt_plugin) - -SOURCES += \ - qmlostplugin.cpp \ - qostdevice.cpp - -HEADERS += \ - qmlostplugin.h \ - qostdevice.h \ - usbostcomm.h diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp deleted file mode 100644 index bab33f7f44..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlostplugin.h" -#include "qostdevice.h" - -#include <private/qqmldebugserver_p.h> -#include <private/qpacketprotocol_p.h> - -QT_BEGIN_NAMESPACE - -static const TInt KQmlOstProtocolId = 0x94; - -class QmlOstPluginPrivate { -public: - QmlOstPluginPrivate(); - - QOstDevice *ost; - QPacketProtocol *protocol; - QQmlDebugServer *debugServer; -}; - -QmlOstPluginPrivate::QmlOstPluginPrivate() : - ost(0), - protocol(0), - debugServer(0) -{ -} - -QmlOstPlugin::QmlOstPlugin() : - d_ptr(new QmlOstPluginPrivate) -{ -} - -QmlOstPlugin::~QmlOstPlugin() -{ - delete d_ptr; -} - -void QmlOstPlugin::setServer(QQmlDebugServer *server) -{ - Q_D(QmlOstPlugin); - d->debugServer = server; -} - -bool QmlOstPlugin::isConnected() const -{ - Q_D(const QmlOstPlugin); - return d->ost && d->ost->isOpen(); -} - -void QmlOstPlugin::send(const QByteArray &message) -{ - Q_D(QmlOstPlugin); - - if (!isConnected()) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - //d->socket->flush(); -} - -void QmlOstPlugin::disconnect() -{ - Q_D(QmlOstPlugin); - - delete d->protocol; - d->protocol = 0; -} - -bool QmlOstPlugin::waitForMessage() -{ - Q_D(QmlOstPlugin); - return d->protocol->waitForReadyRead(-1); -} - -void QmlOstPlugin::setPort(int port, bool block, const QString &hostaddress) -{ - Q_UNUSED(port); - Q_UNUSED(block); - Q_UNUSED(hostaddress); - - Q_D(QmlOstPlugin); - - d->ost = new QOstDevice(this); - bool ok = d->ost->open(KQmlOstProtocolId); - if (!ok) { - if (d->ost->errorString().length()) - qDebug("Error from QOstDevice: %s", qPrintable(d->ost->errorString())); - qWarning("QML Debugger: Unable to listen to OST."); // This message is part of the signalling - do not change the format! - return; - } - d->protocol = new QPacketProtocol(d->ost, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - qDebug("QML Debugger: Waiting for connection via OST."); // This message is part of the signalling - do not change the format! -} - -void QmlOstPlugin::readyRead() -{ - Q_D(QmlOstPlugin); - QPacket packet = d->protocol->read(); - - QByteArray content = packet.data(); - d->debugServer->receiveMessage(content); -} - -Q_EXPORT_PLUGIN2(qmlostplugin, QmlOstPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h deleted file mode 100644 index a31cdb6b2c..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLOSTPLUGIN_H -#define QMLOSTPLUGIN_H - -#include <QtWidgets/QStylePlugin> -#include <QtQml/private/qqmldebugserverconnection_p.h> - -QT_BEGIN_NAMESPACE - -class QQmlDebugServer; -class QmlOstPluginPrivate; - -class QmlOstPlugin : public QObject, public QQmlDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlOstPlugin) - Q_DISABLE_COPY(QmlOstPlugin) - Q_INTERFACES(QQmlDebugServerConnection) - - -public: - QmlOstPlugin(); - ~QmlOstPlugin(); - - void setServer(QQmlDebugServer *server); - void setPort(int port, bool bock, const QString &hostaddress); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - bool waitForMessage(); - -private Q_SLOTS: - void readyRead(); - -private: - QmlOstPluginPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QMLOSTPLUGIN_H diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp b/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp deleted file mode 100644 index e01041bcfb..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qostdevice.h" -#include <e32base.h> - -#include "usbostcomm.h" - -class QOstDevicePrivate : public CActive -{ - QOstDevice* q_ptr; - Q_DECLARE_PUBLIC(QOstDevice) - -public: - QOstDevicePrivate() : CActive(CActive::EPriorityStandard) { - CActiveScheduler::Add(this); - } - ~QOstDevicePrivate() { - Cancel(); - } - - TInt& AoFlags() { return ((TInt*)&iStatus)[1]; } - -private: - void RunL(); - void DoCancel(); - -private: - RUsbOstComm ost; - TBuf8<4096> readBuf; - QByteArray dataBuf; - TBool inReadyRead; -}; - -QOstDevice::QOstDevice(QObject *parent) : - QIODevice(parent), d_ptr(new QOstDevicePrivate) -{ - d_ptr->q_ptr = this; -} - -QOstDevice::~QOstDevice() -{ - close(); - delete d_ptr; -} - -bool QOstDevice::open(int ostProtocolId) -{ - if (isOpen()) - return false; - - Q_D(QOstDevice); - TInt err = d->ost.Connect(); - if (!err) err = d->ost.Open(); - const TVersion KRequiredVersion(1,1,0); - TVersion version = d->ost.Version(); - if (version.iMajor < KRequiredVersion.iMajor || - (version.iMajor == KRequiredVersion.iMajor && version.iMinor < KRequiredVersion.iMinor)) { - setErrorString("CODA version too old. At least version 4.0.18 (without TRK) is required."); - return false; - } - - if (!err) err = d->ost.RegisterProtocolID((TOstProtIds)ostProtocolId, EFalse); - if (!err) { - d->ost.ReadMessage(d->iStatus, d->readBuf); - d->SetActive(); - return QIODevice::open(ReadWrite | Unbuffered); - } - return false; -} - -void QOstDevicePrivate::RunL() -{ - Q_Q(QOstDevice); - //qDebug("QOstDevice received %d bytes q=%x", readBuf.Size(), q); - if (iStatus == KErrNone) { - QByteArray data = QByteArray::fromRawData((const char*)readBuf.Ptr(), readBuf.Size()); - dataBuf.append(data); - - readBuf.Zero(); - ost.ReadMessage(iStatus, readBuf); - SetActive(); - - if (!inReadyRead) { - inReadyRead = true; - emit q->readyRead(); - inReadyRead = false; - } - } else { - q->setErrorString(QString("Error %1 from RUsbOstComm::ReadMessage()").arg(iStatus.Int())); - } - //qDebug("-QOstDevicePrivate RunL"); -} - -void QOstDevicePrivate::DoCancel() -{ - ost.ReadCancel(); -} - -void QOstDevice::close() -{ - Q_D(QOstDevice); - QIODevice::close(); - d->Cancel(); - // RDbgTrcComm::Close isn't safe to call when not open, sigh - if (d->ost.Handle()) { - d->ost.Close(); - } -} - -qint64 QOstDevice::readData(char *data, qint64 maxSize) -{ - Q_D(QOstDevice); - if (d->dataBuf.length() == 0 && !d->IsActive()) - return -1; - qint64 available = qMin(maxSize, (qint64)d->dataBuf.length()); - memcpy(data, d->dataBuf.constData(), available); - d->dataBuf.remove(0, available); - return available; -} - -static const TInt KMaxOstPacketLen = 4096; - -qint64 QOstDevice::writeData(const char *data, qint64 maxSize) -{ - Q_D(QOstDevice); - TPtrC8 ptr((const TUint8*)data, (TInt)maxSize); - while (ptr.Length()) { - TPtrC8 fragment = ptr.Left(qMin(ptr.Length(), KMaxOstPacketLen)); - //qDebug("QOstDevice writing %d bytes", fragment.Length()); - TRequestStatus stat; - d->ost.WriteMessage(stat, fragment); - User::WaitForRequest(stat); - if (stat.Int() != KErrNone) { - setErrorString(QString("Error %1 from RUsbOstComm::WriteMessage()").arg(stat.Int())); - return -1; - } - ptr.Set(ptr.Mid(fragment.Length())); - } - emit bytesWritten(maxSize); //TODO does it matter this is emitted synchronously? - //qDebug("QOstDevice wrote %d bytes", ptr.Size()); - return maxSize; -} - -qint64 QOstDevice::bytesAvailable() const -{ - Q_D(const QOstDevice); - return d->dataBuf.length(); -} - -bool QOstDevice::waitForReadyRead(int msecs) -{ - Q_D(QOstDevice); - if (msecs >= 0) { - RTimer timer; - TInt err = timer.CreateLocal(); - if (err) return false; - TRequestStatus timeoutStat; - timer.After(timeoutStat, msecs*1000); - User::WaitForRequest(timeoutStat, d->iStatus); - if (timeoutStat != KRequestPending) { - // Timed out - timer.Close(); - return false; - } else { - // We got data, so cancel timer - timer.Cancel(); - User::WaitForRequest(timeoutStat); - timer.Close(); - // And drop through - } - } else { - // Just wait forever for data - User::WaitForRequest(d->iStatus); - } - - // If we get here we have data - TInt err = d->iStatus.Int(); - d->AoFlags() &= ~3; // This is necessary to clean up the scheduler as you're not supposed to bypass it like this - TRAP_IGNORE(d->RunL()); - return err == KErrNone; -} diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h deleted file mode 100644 index 0ddcdb0e61..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QOSTDEVICE_H -#define QOSTDEVICE_H - -#include <QtCore/QIODevice> - -QT_BEGIN_NAMESPACE - -class QOstDevicePrivate; - -class QOstDevice : public QIODevice -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QOstDevice) - Q_DISABLE_COPY(QOstDevice) - -public: - explicit QOstDevice(QObject *parent=0); - ~QOstDevice(); - - bool open(int ostProtocolId); - void close(); - - bool waitForReadyRead(int msecs); - qint64 bytesAvailable() const; - -protected: - qint64 readData(char *data, qint64 maxSize); - qint64 writeData(const char *data, qint64 maxSize); - -private: - QOstDevicePrivate* d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QOSTDEVICE_H diff --git a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h b/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h deleted file mode 100644 index 6fa47bfc07..0000000000 --- a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef USBHOSTCOMM_H -#define USBHOSTCOMM_H - -// Based on the official usbostrouter header, modified to remove dependancy on -// the client DLL - -#include <e32base.h> - -typedef int TOstProtIds; - -class RUsbOstComm : public RSessionBase -{ -public: - RUsbOstComm(); - TInt Connect(); - TInt Disconnect(); - TInt Open(); - TInt Close(); - TInt RegisterProtocolID(TOstProtIds aId, TBool aNeedHeader); - void ReadMessage(TRequestStatus& aStatus, TDes8& aDes); - TInt ReadCancel(); - void WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader=EFalse); - TVersion Version() const; - -private: - enum TUsbOstCmdCode - { - EUsbOstCmdCodeFirst, - EUsbOstCmdConnect, - EUsbOstCmdDisconnect, - EUsbOstCmdCodeGetAcmConfig, - EUsbOstCmdCodeSetAcmConfig, - EUsbOstCmdCodeOpen, - EUsbOstCmdCodeClose, - EUsbOstCmdCodeRegisterId, - EUsbOstCmdCodeRegisterIds, - EUsbOstCmdCodeUnRegisterId, - EUsbOstCmdCodeUnRegisterIds, - EUsbOstCmdCodeReadMsg, - EUsbOstCmdCodeReadCancel, - EUsbOstCmdCodeWriteMsg, - EUsbOstCmdCodeWriteCancel, - EUsbOstCmdCodeLast - }; -}; - -RUsbOstComm::RUsbOstComm() -{ -} - -TInt RUsbOstComm::Connect() -{ - _LIT(KUsbOstServerName, "!UsbOstRouter"); - _LIT(KUsbOstServerImageName, "usbostrouter"); - const TUid KUsbOstServerUid = { 0x200170BE }; - TInt startupAttempts = 2; - for(;;) { - TInt ret = CreateSession(KUsbOstServerName, TVersion(1,0,0)); - if (ret != KErrNotFound && ret != KErrServerTerminated) { - return ret; - } - - if (startupAttempts-- == 0) { - return ret; - } - - RProcess server; - ret = server.Create(KUsbOstServerImageName, KNullDesC, KUsbOstServerUid); - if (ret != KErrNone) - return ret; - - TRequestStatus serverDiedRequestStatus; - server.Rendezvous(serverDiedRequestStatus); - - if (serverDiedRequestStatus != KRequestPending) { - // Abort startup - server.Kill(KErrNone); - } else { - // Logon OK - start the server - server.Resume(); - } - User::WaitForRequest(serverDiedRequestStatus); - ret = (server.ExitType() == EExitPanic) ? KErrGeneral : serverDiedRequestStatus.Int(); - server.Close(); - - if (ret != KErrNone && ret != KErrAlreadyExists) { - return ret; - } - } -} - -TInt RUsbOstComm::Disconnect() -{ - return SendReceive(EUsbOstCmdDisconnect); -} - -TInt RUsbOstComm::Open() -{ - return SendReceive(EUsbOstCmdCodeOpen); -} - -TInt RUsbOstComm::Close() -{ - TInt err = SendReceive(EUsbOstCmdCodeClose); - RHandleBase::Close(); - return err; -} - -TInt RUsbOstComm::RegisterProtocolID(const TOstProtIds aId, TBool aNeedHeader) -{ - TIpcArgs args(aId, aNeedHeader); - return SendReceive(EUsbOstCmdCodeRegisterId, args); -} - -void RUsbOstComm::ReadMessage(TRequestStatus& aStatus, TDes8& aDes) -{ - TIpcArgs args(aDes.MaxLength(), &aDes); - SendReceive(EUsbOstCmdCodeReadMsg, args, aStatus); -} - -TInt RUsbOstComm::ReadCancel() -{ - return SendReceive(EUsbOstCmdCodeReadCancel); -} - -void RUsbOstComm::WriteMessage(TRequestStatus& aStatus, const TDesC8& aDes, TBool aHasHeader) -{ - TIpcArgs args(aHasHeader, aDes.Length(), &aDes); - SendReceive(EUsbOstCmdCodeWriteMsg, args, aStatus); -} - -typedef TVersion (*TVersionFunction)(const RUsbOstComm*); -const TInt KVersionOrdinal = 17; - -TVersion RUsbOstComm::Version() const -{ - // This function has to go to the DLL, unfortunately - TVersion result; // Return 0.0.0 on any error - RLibrary lib; - TInt err = lib.Load(_L("usbostcomm")); - if (err) return result; - - TLibraryFunction fn = lib.Lookup(KVersionOrdinal); - if (fn) - result = ((TVersionFunction)fn)(this); - lib.Close(); - return result; -} - -#endif //USBHOSTCOMM_H |