summaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_ost
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_ost')
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro21
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp149
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h82
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp220
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qostdevice.h77
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/usbostcomm.h191
6 files changed, 0 insertions, 740 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 27488894..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/qmldbg_ost.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TARGET = qmldbg_ost
-QT += declarative network
-
-include(../../qpluginbase.pri)
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmltooling
-QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)"
-
-SOURCES += \
- qmlostplugin.cpp \
- qostdevice.cpp
-
-HEADERS += \
- qmlostplugin.h \
- qostdevice.h \
- usbostcomm.h
-
-target.path += $$[QT_INSTALL_PLUGINS]/qmltooling
-INSTALLS += target
-
-symbian:TARGET.UID3=0x20031E92
diff --git a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp b/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
deleted file mode 100644
index d999de43..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmlostplugin.h"
-#include "qostdevice.h"
-
-#include <private/qdeclarativedebugserver_p.h>
-#include <private/qpacketprotocol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static const TInt KQmlOstProtocolId = 0x94;
-
-class QmlOstPluginPrivate {
-public:
- QmlOstPluginPrivate();
-
- QOstDevice *ost;
- QPacketProtocol *protocol;
- QDeclarativeDebugServer *debugServer;
-};
-
-QmlOstPluginPrivate::QmlOstPluginPrivate() :
- ost(0),
- protocol(0),
- debugServer(0)
-{
-}
-
-QmlOstPlugin::QmlOstPlugin() :
- d_ptr(new QmlOstPluginPrivate)
-{
-}
-
-QmlOstPlugin::~QmlOstPlugin()
-{
- delete d_ptr;
-}
-
-void QmlOstPlugin::setServer(QDeclarativeDebugServer *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)
-{
- Q_UNUSED(port);
- Q_UNUSED(block);
-
- 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("QDeclarativeDebugServer: Unable to listen on 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()));
- qWarning("QDeclarativeDebugServer: 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 dc32e2e7..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/qmlostplugin.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLOSTPLUGIN_H
-#define QMLOSTPLUGIN_H
-
-#include <QtGui/QStylePlugin>
-#include <QtDeclarative/private/qdeclarativedebugserverconnection_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeDebugServer;
-class QmlOstPluginPrivate;
-
-class QmlOstPlugin : public QObject, public QDeclarativeDebugServerConnection
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlOstPlugin)
- Q_DISABLE_COPY(QmlOstPlugin)
- Q_INTERFACES(QDeclarativeDebugServerConnection)
-
-
-public:
- QmlOstPlugin();
- ~QmlOstPlugin();
-
- void setServer(QDeclarativeDebugServer *server);
- void setPort(int port, bool bock);
-
- 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 31030585..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $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 0601bc3b..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $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 552543bf..00000000
--- a/src/plugins/qmltooling/qmldbg_ost/usbostcomm.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $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