forked from qt-creator/qt-creator
CODA: Rename TCF, TCF TRK to CODA
Change-Id: I92d9bc873f62d04c149e7347145701d8a11c232c Reviewed-on: http://codereview.qt.nokia.com/119 Reviewed-by: Paweł Polański <jaggernod@gmail.com>
This commit is contained in:
committed by
Paweł Polański
parent
be48bfb2fe
commit
536664b0c1
@@ -100,14 +100,14 @@ static inline QString startMsg(const trk::Session &session)
|
||||
/* -------------- CodaGdbAdapter:
|
||||
* Startup-sequence:
|
||||
* - startAdapter connects both sockets/devices
|
||||
* - In the TCF Locator Event, gdb is started and the engine is notified
|
||||
* - In the CODA Locator Event, gdb is started and the engine is notified
|
||||
* that the adapter has started.
|
||||
* - Engine calls setupInferior(), which starts the process.
|
||||
* - Initial TCF module load suspended event is emitted (process is suspended).
|
||||
* - Initial CODA module load suspended event is emitted (process is suspended).
|
||||
* In the event handler, gdb is connected to the remote target. In the
|
||||
* gdb answer to conntect remote, inferiorStartPrepared() is emitted.
|
||||
* - Engine sets up breakpoints,etc and calls inferiorStartPhase2(), which
|
||||
* resumes the suspended TCF process via gdb 'continue'.
|
||||
* resumes the suspended CODA process via gdb 'continue'.
|
||||
* Thread handling (30.06.2010):
|
||||
* TRK does not report thread creation/termination. So, if we receive
|
||||
* a stop in a different thread, we store an additional thread in snapshot.
|
||||
@@ -155,7 +155,7 @@ void CodaGdbAdapter::setupTrkDeviceSignals()
|
||||
this, SLOT(codaDeviceError(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(logMessage(QString)),
|
||||
this, SLOT(codaLogMessage(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)),
|
||||
connect(m_codaDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)),
|
||||
this, SLOT(codaEvent(Coda::CodaEvent)));
|
||||
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
|
||||
this, SLOT(codaDeviceRemoved(SymbianUtils::SymbianDevice)));
|
||||
@@ -338,7 +338,7 @@ void CodaGdbAdapter::codaEvent(const CodaEvent &e)
|
||||
case CodaEvent::RunControlContextRemoved: // Thread/process removed
|
||||
foreach (const QByteArray &id,
|
||||
static_cast<const CodaRunControlContextRemovedEvent &>(e).ids())
|
||||
switch (RunControlContext::typeFromTcfId(id)) {
|
||||
switch (RunControlContext::typeFromCodaId(id)) {
|
||||
case RunControlContext::Thread:
|
||||
m_snapshot.removeThread(RunControlContext::threadIdFromTcdfId(id));
|
||||
break;
|
||||
@@ -712,7 +712,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
|
||||
arg(QString::fromAscii(data.toHex())));
|
||||
m_codaDevice->sendMemorySetCommand(
|
||||
CodaCallback(this, &CodaGdbAdapter::handleWriteMemory),
|
||||
m_tcfProcessId, addrLength.first, data);
|
||||
m_codaProcessId, addrLength.first, data);
|
||||
}
|
||||
|
||||
else if (cmd.startsWith('p')) {
|
||||
@@ -1024,7 +1024,7 @@ void CodaGdbAdapter::gdbSetCurrentThread(const QByteArray &cmd, const char *why)
|
||||
|
||||
void CodaGdbAdapter::interruptInferior()
|
||||
{
|
||||
m_codaDevice->sendRunControlSuspendCommand(CodaCallback(), m_tcfProcessId);
|
||||
m_codaDevice->sendRunControlSuspendCommand(CodaCallback(), m_codaProcessId);
|
||||
}
|
||||
|
||||
void CodaGdbAdapter::startAdapter()
|
||||
@@ -1032,7 +1032,7 @@ void CodaGdbAdapter::startAdapter()
|
||||
m_snapshot.fullReset();
|
||||
m_session.reset();
|
||||
m_firstResumableExeLoadedEvent = true;
|
||||
m_tcfProcessId.clear();
|
||||
m_codaProcessId.clear();
|
||||
m_firstHelloEvent = true;
|
||||
|
||||
// Retrieve parameters.
|
||||
@@ -1143,7 +1143,7 @@ void CodaGdbAdapter::addThread(unsigned id)
|
||||
}
|
||||
// We cannot retrieve register values unless the registers of that
|
||||
// thread have been retrieved (Coda oddity).
|
||||
const QByteArray contextId = RunControlContext::tcfId(m_session.pid, id);
|
||||
const QByteArray contextId = RunControlContext::codaId(m_session.pid, id);
|
||||
m_codaDevice->sendRegistersGetChildrenCommand(
|
||||
CodaCallback(this, &CodaGdbAdapter::handleRegisterChildren),
|
||||
contextId, QVariant(contextId));
|
||||
@@ -1167,7 +1167,7 @@ void CodaGdbAdapter::handleCreateProcess(const CodaCommandResult &result)
|
||||
logMessage(ctx.toString());
|
||||
|
||||
m_session.pid = ctx.processId();
|
||||
m_tcfProcessId = RunControlContext::tcfId(m_session.pid);
|
||||
m_codaProcessId = RunControlContext::codaId(m_session.pid);
|
||||
if (const unsigned threadId = ctx.threadId())
|
||||
addThread(threadId);
|
||||
// See ModuleLoadSuspendedEvent for the rest.
|
||||
@@ -1592,12 +1592,12 @@ void CodaGdbAdapter::handleWriteMemory(const CodaCommandResult &result)
|
||||
|
||||
QByteArray CodaGdbAdapter::mainThreadContextId() const
|
||||
{
|
||||
return RunControlContext::tcfId(m_session.pid, m_session.mainTid);
|
||||
return RunControlContext::codaId(m_session.pid, m_session.mainTid);
|
||||
}
|
||||
|
||||
QByteArray CodaGdbAdapter::currentThreadContextId() const
|
||||
{
|
||||
return RunControlContext::tcfId(m_session.pid, m_session.tid);
|
||||
return RunControlContext::codaId(m_session.pid, m_session.tid);
|
||||
}
|
||||
|
||||
void CodaGdbAdapter::sendTrkContinue()
|
||||
@@ -1606,7 +1606,7 @@ void CodaGdbAdapter::sendTrkContinue()
|
||||
// at the next stop.
|
||||
if (m_snapshot.threadInfo.size() > 1)
|
||||
m_snapshot.threadInfo.remove(1, m_snapshot.threadInfo.size() - 1);
|
||||
m_codaDevice->sendRunControlResumeCommand(CodaCallback(), m_tcfProcessId);
|
||||
m_codaDevice->sendRunControlResumeCommand(CodaCallback(), m_codaProcessId);
|
||||
}
|
||||
|
||||
void CodaGdbAdapter::sendTrkStepRange()
|
||||
|
||||
@@ -196,7 +196,7 @@ private:
|
||||
bool m_firstResumableExeLoadedEvent;
|
||||
// gdb wants registers, but we don't have the names yet. Continue in handler for names
|
||||
bool m_registerRequestPending;
|
||||
QByteArray m_tcfProcessId;
|
||||
QByteArray m_codaProcessId;
|
||||
LocalGdbProcess m_gdbProc;
|
||||
bool m_firstHelloEvent;
|
||||
};
|
||||
|
||||
@@ -135,7 +135,7 @@ bool CodaRunControl::setupLauncher()
|
||||
this, SLOT(deviceRemoved(SymbianUtils::SymbianDevice)));
|
||||
connect(m_codaDevice.data(), SIGNAL(error(QString)), this, SLOT(slotError(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(logMessage(QString)), this, SLOT(slotTrkLogMessage(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)));
|
||||
connect(m_codaDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)));
|
||||
connect(m_codaDevice.data(), SIGNAL(serialPong(QString)), this, SLOT(slotSerialPong(QString)));
|
||||
m_state = StateConnecting;
|
||||
m_codaDevice->sendSerialPing(false);
|
||||
@@ -144,7 +144,7 @@ bool CodaRunControl::setupLauncher()
|
||||
m_codaDevice = QSharedPointer<Coda::CodaDevice>(new Coda::CodaDevice, &QObject::deleteLater); // finishRunControl, which deletes m_codaDevice, can get called from within a coda callback, so need to use deleteLater
|
||||
connect(m_codaDevice.data(), SIGNAL(error(QString)), this, SLOT(slotError(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(logMessage(QString)), this, SLOT(slotTrkLogMessage(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)));
|
||||
connect(m_codaDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)));
|
||||
|
||||
const QSharedPointer<QTcpSocket> codaSocket(new QTcpSocket);
|
||||
m_codaDevice->setDevice(codaSocket);
|
||||
@@ -257,9 +257,9 @@ void CodaRunControl::handleContextRemoved(const CodaEvent &event)
|
||||
|
||||
void CodaRunControl::handleContextAdded(const CodaEvent &event)
|
||||
{
|
||||
typedef CodaRunControlContextAddedEvent TcfAddedEvent;
|
||||
typedef CodaRunControlContextAddedEvent CodaAddedEvent;
|
||||
|
||||
const TcfAddedEvent &me = static_cast<const TcfAddedEvent &>(event);
|
||||
const CodaAddedEvent &me = static_cast<const CodaAddedEvent &>(event);
|
||||
foreach (const RunControlContext &context, me.contexts()) {
|
||||
if (context.parentId == "root") //is the created context a process
|
||||
m_runningProcessId = QLatin1String(context.id);
|
||||
@@ -268,16 +268,16 @@ void CodaRunControl::handleContextAdded(const CodaEvent &event)
|
||||
|
||||
void CodaRunControl::handleContextSuspended(const CodaEvent &event)
|
||||
{
|
||||
typedef CodaRunControlContextSuspendedEvent TcfSuspendEvent;
|
||||
typedef CodaRunControlContextSuspendedEvent CodaSuspendEvent;
|
||||
|
||||
const TcfSuspendEvent &me = static_cast<const TcfSuspendEvent &>(event);
|
||||
const CodaSuspendEvent &me = static_cast<const CodaSuspendEvent &>(event);
|
||||
|
||||
switch (me.reason()) {
|
||||
case TcfSuspendEvent::Other:
|
||||
case TcfSuspendEvent::Crash:
|
||||
case CodaSuspendEvent::Other:
|
||||
case CodaSuspendEvent::Crash:
|
||||
appendMessage(tr("Thread has crashed: %1\n").arg(QString::fromLatin1(me.message())), Utils::ErrorMessageFormat);
|
||||
|
||||
if (me.reason() == TcfSuspendEvent::Crash)
|
||||
if (me.reason() == CodaSuspendEvent::Crash)
|
||||
stop();
|
||||
else
|
||||
m_codaDevice->sendRunControlResumeCommand(CodaCallback(), me.id()); //TODO: Should I resume automatically
|
||||
@@ -292,9 +292,9 @@ void CodaRunControl::handleContextSuspended(const CodaEvent &event)
|
||||
void CodaRunControl::handleModuleLoadSuspended(const CodaEvent &event)
|
||||
{
|
||||
// Debug mode start: Continue:
|
||||
typedef CodaRunControlModuleLoadContextSuspendedEvent TcfModuleLoadSuspendedEvent;
|
||||
typedef CodaRunControlModuleLoadContextSuspendedEvent CodaModuleLoadSuspendedEvent;
|
||||
|
||||
const TcfModuleLoadSuspendedEvent &me = static_cast<const TcfModuleLoadSuspendedEvent &>(event);
|
||||
const CodaModuleLoadSuspendedEvent &me = static_cast<const CodaModuleLoadSuspendedEvent &>(event);
|
||||
if (me.info().requireResume)
|
||||
m_codaDevice->sendRunControlResumeCommand(CodaCallback(), me.id());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ const char * const DEVICE_ADDRESS_KEY("Qt4ProjectManager.S60DeployConfiguration.
|
||||
const char * const DEVICE_PORT_KEY("Qt4ProjectManager.S60DeployConfiguration.DevicePort");
|
||||
const char * const COMMUNICATION_CHANNEL_KEY("Qt4ProjectManager.S60DeployConfiguration.CommunicationChannel");
|
||||
|
||||
const char * const DEFAULT_TCF_TRK_TCP_PORT("65029");
|
||||
const char * const DEFAULT_CODA_TCP_PORT("65029");
|
||||
|
||||
QString pathFromId(const QString &id)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ S60DeployConfiguration::S60DeployConfiguration(Target *parent) :
|
||||
#endif
|
||||
m_installationDrive('C'),
|
||||
m_silentInstall(true),
|
||||
m_devicePort(QLatin1String(DEFAULT_TCF_TRK_TCP_PORT)),
|
||||
m_devicePort(QLatin1String(DEFAULT_CODA_TCP_PORT)),
|
||||
m_communicationChannel(CommunicationTrkSerialConnection)
|
||||
{
|
||||
ctor();
|
||||
@@ -332,7 +332,7 @@ bool S60DeployConfiguration::fromMap(const QVariantMap &map)
|
||||
.toChar().toAscii();
|
||||
m_silentInstall = map.value(QLatin1String(SILENT_INSTALL_KEY), QVariant(true)).toBool();
|
||||
m_deviceAddress = map.value(QLatin1String(DEVICE_ADDRESS_KEY)).toString();
|
||||
m_devicePort = map.value(QLatin1String(DEVICE_PORT_KEY), QString(QLatin1String(DEFAULT_TCF_TRK_TCP_PORT))).toString();
|
||||
m_devicePort = map.value(QLatin1String(DEVICE_PORT_KEY), QString(QLatin1String(DEFAULT_CODA_TCP_PORT))).toString();
|
||||
m_communicationChannel = static_cast<CommunicationChannel>(map.value(QLatin1String(COMMUNICATION_CHANNEL_KEY),
|
||||
QVariant(CommunicationTrkSerialConnection)).toInt());
|
||||
|
||||
@@ -404,7 +404,7 @@ void S60DeployConfiguration::setDevicePort(const QString &port)
|
||||
{
|
||||
if (m_devicePort != port) {
|
||||
if (port.isEmpty()) //setup the default CODA's port
|
||||
m_devicePort = QLatin1String(DEFAULT_TCF_TRK_TCP_PORT);
|
||||
m_devicePort = QLatin1String(DEFAULT_CODA_TCP_PORT);
|
||||
else
|
||||
m_devicePort = port;
|
||||
emit devicePortChanged();
|
||||
|
||||
@@ -596,7 +596,7 @@ void S60DeployConfigurationWidget::updateDeviceInfo()
|
||||
} else if(m_deployConfiguration->communicationChannel() == S60DeployConfiguration::CommunicationCodaTcpConnection) {
|
||||
// collectingInfoFinished, which deletes m_codaDevice, can get called from within a coda callback, so need to use deleteLater
|
||||
m_codaInfoDevice = QSharedPointer<Coda::CodaDevice>(new Coda::CodaDevice, &QObject::deleteLater);
|
||||
connect(m_codaInfoDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)), this, SLOT(codaEvent(Coda::CodaEvent)));
|
||||
connect(m_codaInfoDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(codaEvent(Coda::CodaEvent)));
|
||||
|
||||
const QSharedPointer<QTcpSocket> codaSocket(new QTcpSocket);
|
||||
m_codaInfoDevice->setDevice(codaSocket);
|
||||
|
||||
@@ -355,7 +355,7 @@ void S60DeployStep::setupConnections()
|
||||
} else {
|
||||
connect(m_codaDevice.data(), SIGNAL(error(QString)), this, SLOT(slotError(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(logMessage(QString)), this, SLOT(slotTrkLogMessage(QString)));
|
||||
connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)), Qt::DirectConnection);
|
||||
connect(m_codaDevice.data(), SIGNAL(codaEvent(Coda::CodaEvent)), this, SLOT(slotCodaEvent(Coda::CodaEvent)), Qt::DirectConnection);
|
||||
connect(m_codaDevice.data(), SIGNAL(serialPong(QString)), this, SLOT(slotSerialPong(QString)));
|
||||
connect(this, SIGNAL(manualInstallation()), this, SLOT(showManualInstallationInfo()));
|
||||
}
|
||||
|
||||
@@ -127,17 +127,17 @@ void CodaCommandError::clear()
|
||||
alternativeOrganization.clear();
|
||||
}
|
||||
|
||||
QDateTime CodaCommandResult::tcfTimeToQDateTime(quint64 tcfTimeMS)
|
||||
QDateTime CodaCommandResult::codaTimeToQDateTime(quint64 codaTimeMS)
|
||||
{
|
||||
const QDateTime time(QDate(1970, 1, 1));
|
||||
return time.addMSecs(tcfTimeMS);
|
||||
return time.addMSecs(codaTimeMS);
|
||||
}
|
||||
|
||||
void CodaCommandError::write(QTextStream &str) const
|
||||
{
|
||||
if (isError()) {
|
||||
if (debug && timeMS)
|
||||
str << CodaCommandResult::tcfTimeToQDateTime(timeMS).toString(Qt::ISODate) << ": ";
|
||||
str << CodaCommandResult::codaTimeToQDateTime(timeMS).toString(Qt::ISODate) << ": ";
|
||||
str << "'" << format << '\'' //for symbian the format is the real error message
|
||||
<< " Code: " << code;
|
||||
if (!alternativeOrganization.isEmpty())
|
||||
@@ -232,7 +232,7 @@ CodaCommandResult::CodaCommandResult(char typeChar, Services s,
|
||||
type = commandError.parse(values) ? CommandErrorReply : SuccessReply;
|
||||
break;
|
||||
default:
|
||||
qWarning("Unknown TCF reply type '%c'", typeChar);
|
||||
qWarning("Unknown CODA's reply type '%c'", typeChar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ QPair<int, int> CodaDevice::findSerialHeader(QByteArray &in)
|
||||
const int length = trk::extractShort(in.constData() + 2);
|
||||
return QPair<int, int>(4, length);
|
||||
} else if (in.at(0) == header1 && in.at(1) >= validProtocolIdStart && in.at(1) <= validProtocolIdEnd) {
|
||||
// We recognise it but it's not a TCF message - emit it for any interested party to handle
|
||||
// We recognise it but it's not a CODA message - emit it for any interested party to handle
|
||||
const int length = trk::extractShort(in.constData() + 2);
|
||||
if (4 + length <= in.size()) {
|
||||
// We have all the data
|
||||
@@ -580,8 +580,8 @@ void CodaDevice::deviceReadyReadTcp()
|
||||
if (messageEndPos == -1)
|
||||
break;
|
||||
if (messageEndPos == 0) {
|
||||
// TCF TRK 4.0.5 emits empty messages on errors.
|
||||
emitLogMessage(QString::fromLatin1("An empty TCF TRK message has been received."));
|
||||
// CODA 4.0.5 emits empty messages on errors.
|
||||
emitLogMessage(QString::fromLatin1("An empty Coda message has been received."));
|
||||
} else {
|
||||
processMessage(d->m_readBuffer.left(messageEndPos));
|
||||
}
|
||||
@@ -622,7 +622,7 @@ static inline QVector<QByteArray> splitMessage(const QByteArray &message)
|
||||
int CodaDevice::parseMessage(const QByteArray &message)
|
||||
{
|
||||
if (d->m_verbose)
|
||||
emitLogMessage(debugMessage(message, "TCF ->"));
|
||||
emitLogMessage(debugMessage(message, "CODA ->"));
|
||||
// Special JSON parse error message or protocol format error.
|
||||
// The port is usually closed after receiving it.
|
||||
// "\3\2{"Time":1276096098255,"Code":3,"Format": "Protocol format error"}"
|
||||
@@ -639,11 +639,11 @@ int CodaDevice::parseMessage(const QByteArray &message)
|
||||
const QVector<QByteArray> tokens = splitMessage(message);
|
||||
switch (type) {
|
||||
case 'E':
|
||||
return parseTcfEvent(tokens);
|
||||
return parseCodaEvent(tokens);
|
||||
case 'R': // Command replies
|
||||
case 'N':
|
||||
case 'P':
|
||||
return parseTcfCommandReply(type, tokens);
|
||||
return parseCodaCommandReply(type, tokens);
|
||||
default:
|
||||
emitLogMessage(QString::fromLatin1("Unhandled message type: %1").arg(debugMessage(message)));
|
||||
return 756;
|
||||
@@ -651,7 +651,7 @@ int CodaDevice::parseMessage(const QByteArray &message)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CodaDevice::parseTcfCommandReply(char type, const QVector<QByteArray> &tokens)
|
||||
int CodaDevice::parseCodaCommandReply(char type, const QVector<QByteArray> &tokens)
|
||||
{
|
||||
typedef CodaDevicePrivate::TokenWrittenMessageMap::iterator TokenWrittenMessageMapIterator;
|
||||
// Find the corresponding entry in the written messages hash.
|
||||
@@ -700,7 +700,7 @@ int CodaDevice::parseTcfCommandReply(char type, const QVector<QByteArray> &token
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CodaDevice::parseTcfEvent(const QVector<QByteArray> &tokens)
|
||||
int CodaDevice::parseCodaEvent(const QVector<QByteArray> &tokens)
|
||||
{
|
||||
// Event: Ignore the periodical heartbeat event, answer 'Hello',
|
||||
// emit signal for the rest
|
||||
@@ -723,9 +723,9 @@ int CodaDevice::parseTcfEvent(const QVector<QByteArray> &tokens)
|
||||
if (knownEvent->type() == CodaEvent::LocatorHello)
|
||||
if (!d->m_serialFrame)
|
||||
writeMessage(QByteArray(locatorAnswerC, sizeof(locatorAnswerC)));
|
||||
emit tcfEvent(*knownEvent);
|
||||
emit codaEvent(*knownEvent);
|
||||
}
|
||||
emit genericTcfEvent(service, tokens.at(1), values);
|
||||
emit genericCodaEvent(service, tokens.at(1), values);
|
||||
|
||||
if (debug || d->m_verbose) {
|
||||
QString msg;
|
||||
@@ -846,7 +846,7 @@ void CodaDevice::writeMessage(QByteArray data, bool ensureTerminating0)
|
||||
}
|
||||
|
||||
if (d->m_verbose)
|
||||
emitLogMessage(debugMessage(data, "TCF <-"));
|
||||
emitLogMessage(debugMessage(data, "CODA <-"));
|
||||
|
||||
// Ensure \0-termination which easily gets lost in QByteArray CT.
|
||||
if (ensureTerminating0 && !data.endsWith('\0'))
|
||||
@@ -952,9 +952,9 @@ void CodaDevice::sendProcessStartCommand(const CodaCallback &callBack,
|
||||
<< ']';
|
||||
sendCodaMessage(
|
||||
#if 1
|
||||
MessageWithReply, // TCF TRK 4.0.5 onwards
|
||||
MessageWithReply, // CODA 4.0.5 onwards
|
||||
#else
|
||||
MessageWithoutReply, // TCF TRK 4.0.2
|
||||
MessageWithoutReply, // CODA 4.0.2
|
||||
#endif
|
||||
SettingsService, "set", setData);
|
||||
|
||||
@@ -993,9 +993,9 @@ void CodaDevice::sendSettingsEnableLogCommand()
|
||||
<< ']';
|
||||
sendCodaMessage(
|
||||
#if 1
|
||||
MessageWithReply, // TCF TRK 4.0.5 onwards
|
||||
MessageWithReply, // CODA 4.0.5 onwards
|
||||
#else
|
||||
MessageWithoutReply, // TCF TRK 4.0.2
|
||||
MessageWithoutReply, // CODA 4.0.2
|
||||
#endif
|
||||
SettingsService, "set", setData);
|
||||
}
|
||||
@@ -1198,10 +1198,10 @@ CodaStatResponse CodaDevice::parseStat(const CodaCommandResult &r)
|
||||
rc.size = v.data().toULongLong();
|
||||
} else if (v.name() == "ATime") {
|
||||
if (const quint64 atime = v.data().toULongLong())
|
||||
rc.accessTime = CodaCommandResult::tcfTimeToQDateTime(atime);
|
||||
rc.accessTime = CodaCommandResult::codaTimeToQDateTime(atime);
|
||||
} else if (v.name() == "MTime") {
|
||||
if (const quint64 mtime = v.data().toULongLong())
|
||||
rc.modTime = CodaCommandResult::tcfTimeToQDateTime(mtime);
|
||||
rc.modTime = CodaCommandResult::codaTimeToQDateTime(mtime);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace Coda {
|
||||
struct CodaDevicePrivate;
|
||||
struct Breakpoint;
|
||||
|
||||
/* Command error handling in TCF:
|
||||
/* Command error handling in CODA:
|
||||
* 1) 'Severe' errors (JSON format, parameter format): Trk emits a
|
||||
* nonstandard message (\3\2 error parameters) and closes the connection.
|
||||
* 2) Protocol errors: 'N' without error message is returned.
|
||||
* 3) Errors in command execution: 'R' with a TCF error hash is returned
|
||||
* 3) Errors in command execution: 'R' with a CODA error hash is returned
|
||||
* (see CodaCommandError). */
|
||||
|
||||
/* Error code return in 'R' reply to command
|
||||
@@ -81,7 +81,7 @@ struct SYMBIANUTILS_EXPORT CodaCommandError {
|
||||
qint64 alternativeCode;
|
||||
};
|
||||
|
||||
/* Answer to a Tcf command passed to the callback. */
|
||||
/* Answer to a CODA command passed to the callback. */
|
||||
struct SYMBIANUTILS_EXPORT CodaCommandResult {
|
||||
enum Type
|
||||
{
|
||||
@@ -101,7 +101,7 @@ struct SYMBIANUTILS_EXPORT CodaCommandResult {
|
||||
QString errorString() const;
|
||||
operator bool() const { return type == SuccessReply || type == ProgressReply; }
|
||||
|
||||
static QDateTime tcfTimeToQDateTime(quint64 tcfTimeMS);
|
||||
static QDateTime codaTimeToQDateTime(quint64 codaTimeMS);
|
||||
|
||||
Type type;
|
||||
Services service;
|
||||
@@ -123,8 +123,8 @@ struct SYMBIANUTILS_EXPORT CodaStatResponse
|
||||
|
||||
typedef trk::Callback<const CodaCommandResult &> CodaCallback;
|
||||
|
||||
/* CodaDevice: TCF communication helper using an asynchronous QIODevice
|
||||
* implementing the TCF protocol according to:
|
||||
/* CodaDevice: CODA communication helper using an asynchronous QIODevice
|
||||
* implementing the CODA protocol according to:
|
||||
http://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/trunk/docs/TCF%20Specification.html
|
||||
http://dev.eclipse.org/svnroot/dsdp/org.eclipse.tm.tcf/trunk/docs/TCF%20Services.html
|
||||
* Commands can be sent along with callbacks that are passed a
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
QStringList arguments = QStringList(),
|
||||
const QVariant &cookie = QVariant());
|
||||
|
||||
// Preferred over Processes:Terminate by TCF TRK.
|
||||
// Preferred over Processes:Terminate by CODA.
|
||||
void sendRunControlTerminateCommand(const CodaCallback &callBack,
|
||||
const QByteArray &id,
|
||||
const QVariant &cookie = QVariant());
|
||||
@@ -385,8 +385,8 @@ public:
|
||||
static CodaStatResponse parseStat(const CodaCommandResult &r);
|
||||
|
||||
signals:
|
||||
void genericTcfEvent(int service, const QByteArray &name, const QVector<JsonValue> &value);
|
||||
void tcfEvent(const Coda::CodaEvent &knownEvent);
|
||||
void genericCodaEvent(int service, const QByteArray &name, const QVector<JsonValue> &value);
|
||||
void codaEvent(const Coda::CodaEvent &knownEvent);
|
||||
void unknownEvent(uchar protocolId, const QByteArray& data);
|
||||
void serialPong(const QString &codaVersion);
|
||||
|
||||
@@ -412,8 +412,8 @@ private:
|
||||
inline int parseMessage(const QByteArray &);
|
||||
void processMessage(const QByteArray &message);
|
||||
inline void processSerialMessage(const QByteArray &message);
|
||||
int parseTcfCommandReply(char type, const QVector<QByteArray> &tokens);
|
||||
int parseTcfEvent(const QVector<QByteArray> &tokens);
|
||||
int parseCodaCommandReply(char type, const QVector<QByteArray> &tokens);
|
||||
int parseCodaEvent(const QVector<QByteArray> &tokens);
|
||||
|
||||
private:
|
||||
QPair<int, int> findSerialHeader(QByteArray &in);
|
||||
|
||||
@@ -140,7 +140,7 @@ void RunControlContext::clear()
|
||||
parentId.clear();
|
||||
}
|
||||
|
||||
RunControlContext::Type RunControlContext::typeFromTcfId(const QByteArray &id)
|
||||
RunControlContext::Type RunControlContext::typeFromCodaId(const QByteArray &id)
|
||||
{
|
||||
// "p12" or "p12.t34"?
|
||||
return id.contains(".t") ? Thread : Process;
|
||||
@@ -172,7 +172,7 @@ unsigned RunControlContext::threadIdFromTcdfId(const QByteArray &id)
|
||||
return tPos != -1 ? id.mid(tPos + 2).toUInt() : uint(0);
|
||||
}
|
||||
|
||||
QByteArray RunControlContext::tcfId(unsigned processId, unsigned threadId /* = 0 */)
|
||||
QByteArray RunControlContext::codaId(unsigned processId, unsigned threadId /* = 0 */)
|
||||
{
|
||||
QByteArray rc("p");
|
||||
rc += QByteArray::number(processId);
|
||||
@@ -185,7 +185,7 @@ QByteArray RunControlContext::tcfId(unsigned processId, unsigned threadId /* =
|
||||
|
||||
RunControlContext::Type RunControlContext::type() const
|
||||
{
|
||||
return RunControlContext::typeFromTcfId(id);
|
||||
return RunControlContext::typeFromCodaId(id);
|
||||
}
|
||||
|
||||
bool RunControlContext::parse(const JsonValue &val)
|
||||
@@ -303,7 +303,7 @@ Breakpoint::Breakpoint(quint64 loc) :
|
||||
|
||||
void Breakpoint::setContextId(unsigned processId, unsigned threadId)
|
||||
{
|
||||
contextIds = QVector<QByteArray>(1, RunControlContext::tcfId(processId, threadId));
|
||||
contextIds = QVector<QByteArray>(1, RunControlContext::codaId(processId, threadId));
|
||||
}
|
||||
|
||||
QByteArray Breakpoint::idFromLocation(quint64 loc)
|
||||
|
||||
@@ -104,11 +104,11 @@ struct SYMBIANUTILS_EXPORT RunControlContext {
|
||||
void format(QTextStream &str) const;
|
||||
QString toString() const;
|
||||
|
||||
// Helper for converting the TCF ids ("p12" or "p12.t34")
|
||||
static Type typeFromTcfId(const QByteArray &id);
|
||||
// Helper for converting the CODA ids ("p12" or "p12.t34")
|
||||
static Type typeFromCodaId(const QByteArray &id);
|
||||
static unsigned processIdFromTcdfId(const QByteArray &id);
|
||||
static unsigned threadIdFromTcdfId(const QByteArray &id);
|
||||
static QByteArray tcfId(unsigned processId, unsigned threadId = 0);
|
||||
static QByteArray codaId(unsigned processId, unsigned threadId = 0);
|
||||
|
||||
unsigned flags;
|
||||
unsigned resumeFlags;
|
||||
|
||||
@@ -271,15 +271,15 @@ struct SymbianDeviceManagerPrivate {
|
||||
bool m_initialized;
|
||||
SymbianDeviceManager::SymbianDeviceList m_devices;
|
||||
QMutex m_devicesLock; // Used for protecting access to m_devices and serialising getCodaDevice/delayedClosePort
|
||||
// The following 2 variables are needed to manage requests for a TCF port not coming from the main thread
|
||||
int m_constructTcfPortEventType;
|
||||
// The following 2 variables are needed to manage requests for a CODA port not coming from the main thread
|
||||
int m_constructCodaPortEventType;
|
||||
QMutex m_codaPortWaitMutex;
|
||||
};
|
||||
|
||||
class QConstructTcfPortEvent : public QEvent
|
||||
class QConstructCodaPortEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
QConstructTcfPortEvent(QEvent::Type eventId, const QString &portName, CodaDevicePtr *device, QWaitCondition *waiter) :
|
||||
QConstructCodaPortEvent(QEvent::Type eventId, const QString &portName, CodaDevicePtr *device, QWaitCondition *waiter) :
|
||||
QEvent(eventId), m_portName(portName), m_device(device), m_waiter(waiter)
|
||||
{}
|
||||
|
||||
@@ -293,7 +293,7 @@ SymbianDeviceManager::SymbianDeviceManager(QObject *parent) :
|
||||
QObject(parent),
|
||||
d(new SymbianDeviceManagerPrivate)
|
||||
{
|
||||
d->m_constructTcfPortEventType = QEvent::registerEventType();
|
||||
d->m_constructCodaPortEventType = QEvent::registerEventType();
|
||||
}
|
||||
|
||||
SymbianDeviceManager::~SymbianDeviceManager()
|
||||
@@ -381,7 +381,7 @@ CodaDevicePtr SymbianDeviceManager::getCodaDevice(const QString &port)
|
||||
// SymbianDeviceManager is owned by the main thread
|
||||
d->m_codaPortWaitMutex.lock();
|
||||
QWaitCondition waiter;
|
||||
QCoreApplication::postEvent(this, new QConstructTcfPortEvent((QEvent::Type)d->m_constructTcfPortEventType, port, &devicePtr, &waiter));
|
||||
QCoreApplication::postEvent(this, new QConstructCodaPortEvent((QEvent::Type)d->m_constructCodaPortEventType, port, &devicePtr, &waiter));
|
||||
waiter.wait(&d->m_codaPortWaitMutex);
|
||||
// When the wait returns (due to the wakeAll in SymbianDeviceManager::customEvent), the CodaDevice will be fully set up
|
||||
d->m_codaPortWaitMutex.unlock();
|
||||
@@ -415,8 +415,8 @@ void SymbianDeviceManager::constructCodaPort(CodaDevicePtr& device, const QStrin
|
||||
|
||||
void SymbianDeviceManager::customEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == d->m_constructTcfPortEventType) {
|
||||
QConstructTcfPortEvent* constructEvent = static_cast<QConstructTcfPortEvent*>(event);
|
||||
if (event->type() == d->m_constructCodaPortEventType) {
|
||||
QConstructCodaPortEvent* constructEvent = static_cast<QConstructCodaPortEvent*>(event);
|
||||
constructCodaPort(*constructEvent->m_device, constructEvent->m_portName);
|
||||
constructEvent->m_waiter->wakeAll(); // Should only ever be one thing waiting on this
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
// Acquire a TRK device for use. Assuming the port is found, equivalent to devices()[findByPortName(port)].acquireDevice(). See also releaseDevice().
|
||||
TrkDevicePtr acquireDevice(const QString &port);
|
||||
|
||||
//// The TCF code prefers to set up the CodaDevice object itself, so we let it and just handle opening the underlying QIODevice and keeping track of the CodaDevice
|
||||
//// The CODA code prefers to set up the CodaDevice object itself, so we let it and just handle opening the underlying QIODevice and keeping track of the CodaDevice
|
||||
//// Returns true if port was opened successfully.
|
||||
|
||||
// Gets the CodaDevice, which may or may not be open depending on what other clients have already acquired it.
|
||||
|
||||
Reference in New Issue
Block a user