Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
dd7b0fcf
Commit
dd7b0fcf
authored
Nov 04, 2010
by
Friedemann Kleint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugger: Remove obsolete trk testing playground.
Acked-By: hjk
parent
d626a8fa
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
0 additions
and
1945 deletions
+0
-1945
tests/manual/trk/README
tests/manual/trk/README
+0
-47
tests/manual/trk/run.pl
tests/manual/trk/run.pl
+0
-164
tests/manual/trk/runner.cpp
tests/manual/trk/runner.cpp
+0
-241
tests/manual/trk/runner.pro
tests/manual/trk/runner.pro
+0
-24
tests/manual/trk/swapendian.cpp
tests/manual/trk/swapendian.cpp
+0
-23
tests/manual/trk/swapendian.pro
tests/manual/trk/swapendian.pro
+0
-9
tests/manual/trk/trk.pro
tests/manual/trk/trk.pro
+0
-7
tests/manual/trk/trklauncher.pri
tests/manual/trk/trklauncher.pri
+0
-15
tests/manual/trk/trkolddevice.cpp
tests/manual/trk/trkolddevice.cpp
+0
-690
tests/manual/trk/trkolddevice.h
tests/manual/trk/trkolddevice.h
+0
-202
tests/manual/trk/trkserver.cpp
tests/manual/trk/trkserver.cpp
+0
-513
tests/manual/trk/trkserver.pro
tests/manual/trk/trkserver.pro
+0
-10
No files found.
tests/manual/trk/README
deleted
100644 → 0
View file @
d626a8fa
Run ./run.sh in one terminal.
Run ./welsh-gdb or ./symbianelf-gdb in a second terminal.
Note that welsh-gdb does not handle 'set remote noack-packet on'
The following items "work":
- "stop" at E32Main
- manual relocation on the gdb side using
add-symbol-file filebrowseapp.sym 0x786A4000
- disassembly at stopped location
- p <functionname>
- p $pc
- one level of 'bt'
To do:
- figure out why the result of the qOffsets query is not honoured
_or_ how to have gdb doing the relocation automatically
- setting breakpoints by filename:line
- signaling of stopped/single step end. SIGTRAP? SIGSTOP?
- run it against the red brick
Setting up TRK on Linux with Bluetooth
Enter the following commands in a terminal (all as root, adjust device
permissions as required to work as user):
sdptool add SP # announce Serial Port Profile via Service Discovery Protocol
sudo mknod --mode=666 /dev/rfcomm0 c 216 0 # Creates a Bluetooth Serial Device
rfcomm listen /dev/rfcomm0 1 $PWD/trklauncher -v -f {}
#This should print the Trk/CPU versions. The option -f tells the command to
#disable the serial frames message encapsulation for BlueTooth.
#The same with the debug adapter:
rfcomm listen /dev/rfcomm0 1 $PWD/run.pl -af -av -w {}
rfcomm listen /dev/rfcomm0 1 $PWD/runner -af -av -w {}
#Important options: -w wait for adapter, -af omit serial frame.
cp /data5/dev/debugger/symbian-codesourcery-welsh/cs-gdb/build/gdb/gdb cs-gdb
cp /data5/dev/trk/filebrowseapp* .
cp /home/f*/dev/creator/tests/manual/trk/*.bin .
tests/manual/trk/run.pl
deleted
100755 → 0
View file @
d626a8fa
#!/usr/bin/perl -w
use
strict
;
use
English
;
# gives us $OSNAME
use
File::
Temp
;
use
File::
Spec
;
use
Cwd
;
my
@ADAPTER_OPTIONS
=
();
my
@TRKSERVEROPTIONS
=
();
my
$DUMP_POSTFIX
=
'
.bin
';
my
$ENDIANESS
=
'
little
';
my
$isUnix
=
$OSNAME
eq
'
linux
'
?
1
:
0
;
my
$MAKE
=
$isUnix
?
'
make
'
:
'
nmake
';
my
$trkservername
;
my
$runTrkServer
=
1
;
my
$waitAdapter
=
0
;
my
$usage
=
<<EOF;
Usage: run.pl -w -av -aq -au -tv -tq -l [COM]
Options:
-av Adapter verbose
-aq Adapter quiet
-au Adapter turn off buffered memory read
-af Adapter turn off serial frame
-w Wait for termination of Adapter (Bluetooth)
-tv TrkServer verbose
-tq TrkServer quiet
trkserver simulator will be run unless COM is specified
Bluetooth:
rfcomm listen /dev/rfcomm0 1 \$PWD/run.pl -av -af -w {}
EOF
# ------- Parse arguments
my
$argCount
=
scalar
(
@ARGV
);
for
(
my
$i
=
0
;
$i
<
$argCount
;
$i
++
)
{
my
$a
=
$ARGV
[
$i
];
if
(
$a
=~
/^-/
)
{
if
(
$a
eq
'
-av
')
{
push
(
@ADAPTER_OPTIONS
,
'
-v
');
}
elsif
(
$a
eq
'
-aq
')
{
push
(
@ADAPTER_OPTIONS
,
'
-q
');
}
elsif
(
$a
eq
'
-af
')
{
push
(
@ADAPTER_OPTIONS
,
'
-f
');
}
elsif
(
$a
eq
'
-au
')
{
push
(
@ADAPTER_OPTIONS
,
'
-u
');
}
elsif
(
$a
eq
'
-w
')
{
$waitAdapter
=
1
;
}
elsif
(
$a
eq
'
-tv
')
{
push
(
@TRKSERVEROPTIONS
,
'
-v
');
}
elsif
(
$a
eq
'
-tq
')
{
push
(
@TRKSERVEROPTIONS
,
'
-q
');
}
elsif
(
$a
eq
'
-h
')
{
print
$usage
;
exit
(
0
);
}
else
{
print
$usage
;
exit
(
1
);
}
}
else
{
$trkservername
=
$a
;
$runTrkServer
=
0
;
}
}
# ------- Ensure build is up to date
print
"
### Building
\n
";
system
(
$MAKE
);
die
('
Make failed:
'
.
$!
)
unless
$?
==
0
;
if
(
$isUnix
!=
0
)
{
system
('
killall
',
'
-s
',
'
USR1
',
'
adapter
',
'
trkserver
');
system
('
killall
',
'
adapter
',
'
trkserver
');
}
my
$userid
=
$>
;
$trkservername
=
('
TRKSERVER-
'
.
$userid
)
unless
defined
$trkservername
;
my
$gdbserverip
=
'
127.0.0.1
';
my
$gdbserverport
=
2222
+
$userid
;
print
"
Serverport:
$gdbserverport
\n
"
;
system
('
fuser
',
'
-n
',
'
tcp
',
'
-k
',
$gdbserverport
)
if
(
$isUnix
);
# Who writes that?
my
$tempFile
=
File::
Spec
->
catfile
(
File::Temp::
tempdir
(),
$trkservername
);
unlink
(
$tempFile
)
if
-
f
$tempFile
;
# ------- Launch trkserver
if
(
$runTrkServer
)
{
my
$MEMORYDUMP
=
'
TrkDump-78-6a-40-00
'
.
$DUMP_POSTFIX
;
my
@ADDITIONAL_DUMPS
=
('
0x00402000
'
.
$DUMP_POSTFIX
,
'
0x786a4000
'
.
$DUMP_POSTFIX
,
'
0x00600000
'
.
$DUMP_POSTFIX
);
my
@TRKSERVER_ARGS
;
if
(
$isUnix
)
{
push
(
@TRKSERVER_ARGS
,
File::
Spec
->
catfile
(
File::
Spec
->
curdir
(),
'
trkserver
'));
}
else
{
push
(
@TRKSERVER_ARGS
,
'
cmd.exe
',
'
/c
',
'
start
',
File::
Spec
->
catfile
(
File::
Spec
->
curdir
(),
'
debug
',
'
trkserver.exe
'));
}
push
(
@TRKSERVER_ARGS
,
@TRKSERVEROPTIONS
,
$trkservername
,
$MEMORYDUMP
,
@ADDITIONAL_DUMPS
);
print
'
### Executing:
',
join
('
',
@TRKSERVER_ARGS
),
"
\n
";
my
$trkserverpid
=
fork
();
if
(
$trkserverpid
==
0
)
{
exec
(
@TRKSERVER_ARGS
);
exit
(
0
);
}
push
(
@ADAPTER_OPTIONS
,
'
-s
');
sleep
(
1
);
}
# ------- Launch adapter
my
@ADAPTER_ARGS
;
if
(
$isUnix
)
{
push
(
@ADAPTER_ARGS
,
File::
Spec
->
catfile
(
File::
Spec
->
curdir
(),
'
adapter
'));
}
else
{
push
(
@ADAPTER_ARGS
,
'
cmd.exe
',
'
/c
',
'
start
',
File::
Spec
->
catfile
(
File::
Spec
->
curdir
(),
'
debug
',
'
adapter.exe
'));
}
push
(
@ADAPTER_ARGS
,
@ADAPTER_OPTIONS
,
$trkservername
,
$gdbserverip
.
'
:
'
.
$gdbserverport
);
print
'
### Executing:
',
join
('
',
@ADAPTER_ARGS
),
"
\n
";
my
$adapterpid
=
fork
();
if
(
$adapterpid
==
0
)
{
exec
(
@ADAPTER_ARGS
);
exit
(
0
);
}
die
('
Unable to launch adapter
')
if
$adapterpid
==
-
1
;
if
(
$waitAdapter
>
0
)
{
print
'
### kill -USR1
',
$adapterpid
,"
\n
";
waitpid
(
$adapterpid
,
0
);
}
# ------- Write out .gdbinit
my
$gdbInit
=
<<EOF;
# This is generated. Changes will be lost.
#set remote noack-packet on
set confirm off
set endian $ENDIANESS
#set debug remote 1
#target remote $gdbserverip:$gdbserverport
target extended-remote $gdbserverip:$gdbserverport
#file filebrowseapp.sym
add-symbol-file filebrowseapp.sym 0x786A4000
symbol-file filebrowseapp.sym
print E32Main
break E32Main
#continue
#info files
#file filebrowseapp.sym -readnow
#add-symbol-file filebrowseapp.sym 0x786A4000
EOF
my
$gdbInitFile
=
'
.gdbinit
';
print
'
### Writing:
',
$gdbInitFile
,
"
\n
";
open
(
GDB_INIT
,
'
>
'
.
$gdbInitFile
)
or
die
('
Cannot write to
'
.
$gdbInitFile
.
'
'
.
$!
);
print
GDB_INIT
$gdbInit
;
close
(
GDB_INIT
);
tests/manual/trk/runner.cpp
deleted
100755 → 0
View file @
d626a8fa
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "trkgdbadapter.h"
#include "trkoptions.h"
#include <QtCore/QDebug>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QKeyEvent>
#include <QtGui/QTextBlock>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtCore/QSharedPointer>
#include <QtCore/QTimer>
#include <QtCore/QDir>
///////////////////////////////////////////////////////////////////////
//
// RunnerGui
//
///////////////////////////////////////////////////////////////////////
class
TextEdit
:
public
QTextEdit
{
Q_OBJECT
signals:
void
executeCommand
(
QString
);
public
slots
:
void
handleOutput
(
const
QString
&
str0
)
{
QString
str
=
str0
;
str
.
replace
(
"
\\
t"
,
QString
(
QChar
(
0x09
)));
str
.
replace
(
"
\\
n"
,
QString
(
"
\n
"
));
append
(
str
);
QTextCursor
tc
=
textCursor
();
tc
.
movePosition
(
QTextCursor
::
End
);
setTextCursor
(
tc
);
/*
int pos1 = str.indexOf("#");
int pos2 = str.indexOf(")", pos1);
if (pos1 != -1 && pos2 != -1)
str = str.left(pos1) + "<b>" + str.mid(pos1, pos2 - pos1 + 1)
+ "</b> " + str.mid(pos2 + 1);
insertHtml(str + "\n");
*/
setCurrentCharFormat
(
QTextCharFormat
());
ensureCursorVisible
();
}
void
keyPressEvent
(
QKeyEvent
*
ev
)
{
if
(
ev
->
modifiers
()
==
Qt
::
ControlModifier
&&
ev
->
key
()
==
Qt
::
Key_Return
)
emit
executeCommand
(
textCursor
().
block
().
text
());
else
QTextEdit
::
keyPressEvent
(
ev
);
}
};
///////////////////////////////////////////////////////////////////////
//
// RunnerGui
//
///////////////////////////////////////////////////////////////////////
using
namespace
Debugger
::
Internal
;
class
RunnerGui
:
public
QMainWindow
{
Q_OBJECT
public:
RunnerGui
(
TrkGdbAdapter
*
adapter
);
private
slots
:
void
executeStepICommand
()
{
executeCommand
(
"-exec-step-instruction"
);
}
void
executeStepCommand
()
{
executeCommand
(
"-exec-step"
);
}
void
executeNextICommand
()
{
executeCommand
(
"-exec-next-instruction"
);
}
void
executeNextCommand
()
{
executeCommand
(
"-exec-next"
);
}
void
executeContinueCommand
()
{
executeCommand
(
"-exec-continue"
);
}
void
executeDisassICommand
()
{
executeCommand
(
"disass $pc $pc+4"
);
}
void
executeStopCommand
()
{
executeCommand
(
"I"
);
}
void
handleReadyReadStandardError
();
void
handleReadyReadStandardOutput
();
void
run
();
void
started
();
private:
void
executeCommand
(
const
QString
&
cmd
)
{
m_adapter
->
executeCommand
(
cmd
);
}
void
connectAction
(
QAction
*&
,
QString
name
,
const
char
*
slot
);
TrkGdbAdapter
*
m_adapter
;
TextEdit
m_textEdit
;
QToolBar
m_toolBar
;
QAction
*
m_stopAction
;
QAction
*
m_stepIAction
;
QAction
*
m_stepAction
;
QAction
*
m_nextIAction
;
QAction
*
m_nextAction
;
QAction
*
m_disassIAction
;
QAction
*
m_continueAction
;
};
RunnerGui
::
RunnerGui
(
TrkGdbAdapter
*
adapter
)
:
m_adapter
(
adapter
)
{
resize
(
1200
,
1000
);
setCentralWidget
(
&
m_textEdit
);
addToolBar
(
&
m_toolBar
);
connectAction
(
m_stepIAction
,
"Step Inst"
,
SLOT
(
executeStepICommand
()));
connectAction
(
m_stepAction
,
"Step"
,
SLOT
(
executeStepCommand
()));
connectAction
(
m_nextIAction
,
"Next Inst"
,
SLOT
(
executeNextICommand
()));
connectAction
(
m_nextAction
,
"Next"
,
SLOT
(
executeNextCommand
()));
connectAction
(
m_disassIAction
,
"Disass Inst"
,
SLOT
(
executeDisassICommand
()));
connectAction
(
m_continueAction
,
"Continue"
,
SLOT
(
executeContinueCommand
()));
connectAction
(
m_stopAction
,
"Stop"
,
SLOT
(
executeStopCommand
()));
connect
(
adapter
,
SIGNAL
(
output
(
QString
)),
&
m_textEdit
,
SLOT
(
handleOutput
(
QString
)));
connect
(
&
m_textEdit
,
SIGNAL
(
executeCommand
(
QString
)),
m_adapter
,
SLOT
(
executeCommand
(
QString
)));
connect
(
adapter
,
SIGNAL
(
readyReadStandardError
()),
this
,
SLOT
(
handleReadyReadStandardError
()));
connect
(
adapter
,
SIGNAL
(
readyReadStandardOutput
()),
this
,
SLOT
(
handleReadyReadStandardOutput
()));
connect
(
adapter
,
SIGNAL
(
started
()),
this
,
SLOT
(
started
()));
}
void
RunnerGui
::
connectAction
(
QAction
*&
action
,
QString
name
,
const
char
*
slot
)
{
action
=
new
QAction
(
this
);
action
->
setText
(
name
);
m_toolBar
.
addAction
(
action
);
connect
(
action
,
SIGNAL
(
triggered
()),
this
,
slot
);
}
void
RunnerGui
::
handleReadyReadStandardError
()
{
QByteArray
ba
=
m_adapter
->
readAllStandardError
();
qDebug
()
<<
ba
;
m_textEdit
.
handleOutput
(
ba
);
}
void
RunnerGui
::
handleReadyReadStandardOutput
()
{
QByteArray
ba
=
m_adapter
->
readAllStandardOutput
();
qDebug
()
<<
ba
;
m_textEdit
.
handleOutput
(
"-> GDB: "
+
ba
);
}
void
RunnerGui
::
run
()
{
m_adapter
->
run
();
}
void
RunnerGui
::
started
()
{
qDebug
()
<<
"
\n
STARTED
\n
"
;
executeCommand
(
"set confirm off"
);
// confirm potentially dangerous operations?
executeCommand
(
"set endian little"
);
executeCommand
(
"set remotebreak on"
);
executeCommand
(
"set breakpoint pending on"
);
executeCommand
(
"set trust-readonly-sections on"
);
//executeCommand("mem 0 ~0ll rw 8 cache");
// FIXME: "remote noack" does not seem to be supported on cs-gdb?
//executeCommand("set remote noack-packet");
// FIXME: creates a lot of noise a la '&"putpkt: Junk: Ack " &'
// even though the communication seems sane
//executeCommand("set debug remote 1"); // creates l
executeCommand
(
"add-symbol-file filebrowseapp.sym "
+
trk
::
hexxNumber
(
m_adapter
->
session
().
codeseg
));
executeCommand
(
"symbol-file filebrowseapp.sym"
);
//executeCommand("info address CFileBrowseAppUi::HandleCommandL",
// GdbCB(handleInfoMainAddress));
executeCommand
(
"-break-insert filebrowseappui.cpp:39"
);
executeCommand
(
"target remote "
+
m_adapter
->
gdbServerName
());
executeCommand
(
"-exec-continue"
);
}
///////////////////////////////////////////////////////////////////////
//
// main
//
///////////////////////////////////////////////////////////////////////
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
app
(
argc
,
argv
);
QSharedPointer
<
TrkOptions
>
options
(
new
TrkOptions
);
options
->
gdb
=
QDir
::
currentPath
()
+
QLatin1String
(
"/cs-gdb"
);
TrkGdbAdapter
adapter
(
options
);
adapter
.
setVerbose
(
2
);
RunnerGui
gui
(
&
adapter
);
gui
.
show
();
QTimer
::
singleShot
(
0
,
&
gui
,
SLOT
(
run
()));
return
app
.
exec
();
}
#include "runner.moc"
tests/manual/trk/runner.pro
deleted
100644 → 0
View file @
d626a8fa
TEMPLATE
=
app
TRK_DIR
=../../../
src
/
shared
/
trk
include
(
$$
TRK_DIR
/
trk
.
pri
)
DEBUGGERHOME
=
..
/../../
src
/
plugins
/
debugger
/
gdb
INCLUDEPATH
*=
$$
TRK_DIR
INCLUDEPATH
*=
$$
DEBUGGERHOME
DEFINES
+=
STANDALONE_RUNNER
QT
+=
network
win32
:
CONFIG
+=
console
HEADERS
+=
\
$$
DEBUGGERHOME
/
abstractgdbadapter
.
h
\
$$
DEBUGGERHOME
/
trkoptions
.
h
\
$$
DEBUGGERHOME
/
trkgdbadapter
.
h
\
SOURCES
+=
\
$$
DEBUGGERHOME
/
trkgdbadapter
.
cpp
\
$$
DEBUGGERHOME
/
trkoptions
.
cpp
\
$$
PWD
/
runner
.
cpp
\
tests/manual/trk/swapendian.cpp
deleted
100644 → 0
View file @
d626a8fa
#include <QtCore>
int
main
(
int
argc
,
char
*
argv
[])
{
QFile
file1
(
argv
[
1
]);
file1
.
open
(
QIODevice
::
ReadOnly
);
QByteArray
ba
=
file1
.
readAll
();
file1
.
close
();
for
(
int
i
=
0
;
i
<
ba
.
size
();
i
+=
4
)
{
char
c
=
ba
[
i
];
ba
[
i
]
=
ba
[
i
+
3
];
ba
[
i
+
3
]
=
c
;
c
=
ba
[
i
+
1
];
ba
[
i
+
1
]
=
ba
[
i
+
2
];
ba
[
i
+
2
]
=
c
;
}
QFile
file2
(
argv
[
2
]);
file2
.
open
(
QIODevice
::
WriteOnly
);
file2
.
write
(
ba
);
file2
.
close
();
}
tests/manual/trk/swapendian.pro
deleted
100644 → 0
View file @
d626a8fa
TEMPLATE
=
app
MAKEFILE
=
Makefile
.
swapendian
QT
=
core
HEADERS
+=
\
SOURCES
+=
\
swapendian
.
cpp
tests/manual/trk/trk.pro
deleted
100644 → 0
View file @
d626a8fa
TEMPLATE
=
subdirs
SUBDIRS
=
trkserver
swapendian
runner
.
pro
trkserver
.
file
=
trkserver
.
pro
swapendian
.
file
=
swapendian
.
pro
tests/manual/trk/trklauncher.pri
deleted
100644 → 0
View file @
d626a8fa
DEFINES += DEBUG_TRK=0
TRK_DIR = ../../../src/plugins/debugger/gdb
INCLUDEPATH *= $$PWD $$TRK_DIR
SOURCES += \
$$TRK_DIR/trkutils.cpp \
$$PWD/trkdevice.cpp \
$$PWD/launcher.cpp \
HEADERS += \
$$TRK_DIR/trkutils.h \
$$TRK_DIR/callback.h \
$$PWD/trkdevice.h \
$$PWD/launcher.h
tests/manual/trk/trkolddevice.cpp
deleted
100644 → 0
View file @
d626a8fa
This diff is collapsed.
Click to expand it.
tests/manual/trk/trkolddevice.h
deleted
100644 → 0
View file @
d626a8fa
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef TRKOLDDEVICE_H
#define TRKOLDDEVICE_H
#include "callback.h"
#include <QtCore/QObject>
#include <QtCore/QVariant>
#include <QtCore/QByteArray>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
class
QIODevice
;
QT_END_NAMESPACE
namespace
trk
{
struct
TrkResult
;
}
namespace
trkold
{
struct
TrkMessage
;
struct
TrkDevicePrivate
;
class
TrkWriteQueue
;
struct
TrkWriteQueueIODevicePrivate
;
/* TrkDevice: Implements a Windows COM or Linux device for
* Trk communications. Provides synchronous write and asynchronous
* read operation.
* The serialFrames property specifies whether packets are encapsulated in
* "0x90 <length>" frames, which is currently the case for serial ports. */
class
TrkDevice
:
public
QObject
{
Q_DISABLE_COPY
(
TrkDevice
)
Q_OBJECT
Q_PROPERTY
(
bool
serialFrame
READ
serialFrame
WRITE
setSerialFrame
)
Q_PROPERTY
(
bool
verbose
READ
verbose
WRITE
setVerbose
)
public:
explicit
TrkDevice
(
QObject
*
parent
=
0
);
virtual
~
TrkDevice
();
bool
open
(
const
QString
&
port
,
QString
*
errorMessage
);
bool
isOpen
()
const
;
void
close
();
QString
errorString
()
const
;
bool
serialFrame
()
const
;
void
setSerialFrame
(
bool
f
);
bool
verbose
()
const
;
void
setVerbose
(
bool
b
);
bool
write
(
const
QByteArray
&
data
,
QString
*
errorMessage
);
signals:
void
messageReceived
(
const
trk
::
TrkResult
&
result
);
// Emitted with the contents of messages enclosed in 07e, not for log output
void
rawDataReceived
(
const
QByteArray
&
data
);
void
error
(
const
QString
&
msg
);
void
logMessage
(
const
QString
&
msg
);
protected:
void
emitError
(
const
QString
&
msg
);
virtual
void
timerEvent
(
QTimerEvent
*
ev
);
private:
void
tryTrkRead
();
TrkDevicePrivate
*
d
;
};
/* TrkWriteQueueDevice: Extends TrkDevice by write message queue allowing
* for queueing messages with a notification callback. If the message receives
* an ACK, the callback is invoked.