monav-0.3/ 0000755 0001750 0001750 00000000000 11554574462 012115 5 ustar vetter vetter monav-0.3/routingdaemon/ 0000755 0001750 0001750 00000000000 11554574462 014770 5 ustar vetter vetter monav-0.3/routingdaemon/main.cpp 0000644 0001750 0001750 00000004103 11522560077 016406 0 ustar vetter vetter /*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see .
*/
#include
#
#include "routingdaemon.h"
Q_IMPORT_PLUGIN( contractionhierarchiesclient );
Q_IMPORT_PLUGIN( gpsgridclient );
QtMsgHandler oldHandler = NULL;
RoutingDaemon* servicePointer = NULL;
void MessageBoxHandler( QtMsgType type, const char *msg )
{
switch (type) {
case QtDebugMsg:
servicePointer->logMessage( msg, QtServiceBase::Information );
break;
case QtWarningMsg:
servicePointer->logMessage( msg, QtServiceBase::Warning );
break;
case QtCriticalMsg:
servicePointer->logMessage( msg, QtServiceBase::Error );
break;
case QtFatalMsg:
servicePointer->logMessage( msg, QtServiceBase::Error );
exit( -1 );
break;
}
if ( oldHandler != NULL )
oldHandler( type, msg );
}
int main( int argc, char** argv )
{
if ( argc == 2 && argv[1] == QString( "--help" ) ) {
qDebug() << "usage:" << argv[0];
qDebug() << "\tstarts the service";
qDebug() << "usage:" << argv[0] << "-i | -install";
qDebug() << "\tinstalls the service";
qDebug() << "usage:" << argv[0] << "-u | -uninstall";
qDebug() << "\tuninstalls the service";
qDebug() << "usage:" << argv[0] << "-t | -terminate";
qDebug() << "\tterminates the service";
qDebug() << "usage:" << argv[0] << "-v | -version";
qDebug() << "\tdisplays version and status";
return 1;
}
RoutingDaemon service( argc, argv );
servicePointer = &service;
oldHandler = qInstallMsgHandler( MessageBoxHandler );
return service.exec();
}
monav-0.3/routingdaemon/routingdaemon.pro 0000644 0001750 0001750 00000001141 11522560077 020352 0 ustar vetter vetter TEMPLATE = app
DESTDIR = ../bin
INCLUDEPATH += ..
DEFINES+=_7ZIP_ST
TARGET = monav-daemon
QT -= gui
QT +=network
unix {
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3 \
-march=native \
-Wno-unused-function
QMAKE_CXXFLAGS_DEBUG += -Wno-unused-function
}
LIBS += -L../bin/plugins_client -lcontractionhierarchiesclient -lgpsgridclient
SOURCES += \
main.cpp \
../utils/lzma/LzmaDec.c \
../utils/directoryunpacker.cpp
HEADERS += \
signals.h \
routingdaemon.h \
../utils/lzma/LzmaDec.h \
../utils/directoryunpacker.h
include(qtservice-2.6_1-opensource/src/qtservice.pri)
monav-0.3/routingdaemon/signals.h 0000644 0001750 0001750 00000016371 11522560077 016601 0 ustar vetter vetter /*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see .
Alternatively, this file may be used under the terms of the GNU
Library General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
*/
#ifndef SIGNALS_H
#define SIGNALS_H
#include
#include
#include
#include
#include
namespace MoNav {
// has to be send before each command to identify the following command type
struct CommandType {
enum Type{
RoutingCommand = 0,
UnpackCommand = 1
} value;
void post( QIODevice* out )
{
qint32 temp = value;
out->write( ( const char* ) &temp, sizeof( qint32 ) );
}
bool read( QLocalSocket* in )
{
while ( in->bytesAvailable() < ( int ) sizeof( qint32 ) ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
qint32 temp;
in->read( ( char* ) &temp, sizeof( qint32 ) );
value = ( Type ) temp;
return true;
}
};
struct Node {
double latitude;
double longitude;
friend QDataStream& operator<< ( QDataStream& out, const Node& node )
{
out << node.latitude;
out << node.longitude;
return out;
}
friend QDataStream& operator>> ( QDataStream& in, Node& node )
{
in >> node.latitude;
in >> node.longitude;
return in;
}
};
struct Edge {
unsigned length; // length of the edge == number of edges it represents == number of nodes - 1
unsigned name; // name ID of the edge
unsigned type; // type ID of the edge
unsigned seconds; // travel time metric for the edge
bool branchingPossible; // is it possible to choose between more than one subsequent edge ( turning around on bidirectional edges does not count )
friend QDataStream& operator<< ( QDataStream& out, const Edge& edge )
{
out << edge.length;
out << edge.name;
out << edge.type;
out << edge.seconds;
out << edge.branchingPossible;
return out;
}
friend QDataStream& operator>> ( QDataStream& in, Edge& edge )
{
in >> edge.length;
in >> edge.name;
in >> edge.type;
in >> edge.seconds;
in >> edge.branchingPossible;
return in;
}
};
class RoutingCommand {
public:
RoutingCommand()
{
lookupRadius = 10000; // 10km should suffice for most applications
lookupStrings = false;
}
// waypoint edge lookup radius in meters
double lookupRadius;
// lookup street name / type strings?
bool lookupStrings;
// a valid routing module directory
QString dataDirectory;
// waypoints of the route
QVector< Node > waypoints;
void post( QIODevice* out )
{
QByteArray buffer;
QDataStream stream( &buffer, QIODevice::WriteOnly );
stream << lookupRadius;
stream << lookupStrings;
stream << dataDirectory;
stream << waypoints;
qint32 size = buffer.size();
out->write( ( const char* ) &size, sizeof( qint32 ) );
out->write( buffer.data(), size );
}
bool read( QLocalSocket* in )
{
qint32 size;
while ( in->bytesAvailable() < ( int ) sizeof( qint32 ) ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
in->read( ( char* ) &size, sizeof( quint32 ) );
while ( in->bytesAvailable() < size ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
QByteArray buffer= in->read( size );
QDataStream stream( buffer );
stream >> lookupRadius;
stream >> lookupStrings;
stream >> dataDirectory;
stream >> waypoints;
return true;
}
};
class RoutingResult {
public:
enum ResultType {
LoadFailed = 1, RouteFailed = 2, NameLookupFailed = 3, TypeLookupFailed = 4, Success = 5
} type;
double seconds;
QVector< Node > pathNodes;
QVector< Edge > pathEdges;
QStringList nameStrings;
QStringList typeStrings;
void post( QIODevice* out )
{
QByteArray buffer;
QDataStream stream( &buffer, QIODevice::WriteOnly );
stream << qint32( type );
stream << seconds;
stream << pathNodes;
stream << pathEdges;
stream << nameStrings;
stream << typeStrings;
qint32 size = buffer.size();
out->write( ( const char* ) &size, sizeof( qint32 ) );
out->write( buffer.data(), size );
}
bool read( QLocalSocket* in )
{
qint32 size;
while ( in->bytesAvailable() < ( int ) sizeof( qint32 ) ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
in->read( ( char* ) &size, sizeof( quint32 ) );
while ( in->bytesAvailable() < size ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
QByteArray buffer= in->read( size );
QDataStream stream( buffer );
qint32 temp;
stream >> temp;
type = ( ResultType ) temp;
stream >> seconds;
stream >> pathNodes;
stream >> pathEdges;
stream >> nameStrings;
stream >> typeStrings;
return true;
}
};
class UnpackCommand
{
public:
UnpackCommand()
{
deleteFile = false;
}
// MoNav Map Module file to be unpacked
// it will be unpacked in the directory of the same name
// e.g. test.mmm -> test/
QString mapModuleFile;
// delete file after unpacking?
bool deleteFile;
void post( QIODevice* out )
{
QByteArray buffer;
QDataStream stream( &buffer, QIODevice::WriteOnly );
stream << mapModuleFile;
stream << deleteFile;
qint32 size = buffer.size();
out->write( ( const char* ) &size, sizeof( qint32 ) );
out->write( buffer.data(), size );
}
bool read( QLocalSocket* in )
{
qint32 size;
while ( in->bytesAvailable() < ( int ) sizeof( qint32 ) ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
in->read( ( char* ) &size, sizeof( quint32 ) );
while ( in->bytesAvailable() < size ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
QByteArray buffer= in->read( size );
QDataStream stream( buffer );
stream >> mapModuleFile;
stream >> deleteFile;
return true;
}
};
class UnpackResult
{
public:
enum ResultType {
FailUnpacking = 1, Success = 2
} type;
void post( QIODevice* out )
{
qint32 temp = type;
out->write( ( const char* ) &temp, sizeof( qint32 ) );
}
bool read( QLocalSocket* in )
{
while ( in->bytesAvailable() < ( int ) sizeof( qint32 ) ) {
if ( in->state() != QLocalSocket::ConnectedState )
return false;
in->waitForReadyRead( 100 );
}
qint32 temp;
in->read( ( char* ) &temp, sizeof( qint32 ) );
type = ResultType( temp );
return true;
}
};
}
#endif // SIGNALS_H
monav-0.3/routingdaemon/test.cpp 0000644 0001750 0001750 00000010444 11551136577 016454 0 ustar vetter vetter /*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file. If not, see .
*/
#include "signals.h"
#include
#include
using namespace MoNav;
bool processArguments( CommandType* type, UnpackCommand* unpack, RoutingCommand* routing, int argc, char** argv ) {
if ( argc == 2 ) {
type->value = CommandType::UnpackCommand;
unpack->mapModuleFile = argv[1];
return true;
}
if ( argc < 6 || ( argc & 1 ) == 1 )
return false;
type->value = CommandType::RoutingCommand;
routing->dataDirectory = argv[1];
for ( int i = 2; i < argc; i+=2 ) {
bool ok;
Node coordinate;
coordinate.latitude = QString( argv[i] ).toDouble( &ok );
if ( !ok )
return false;
coordinate.longitude = QString( argv[i + 1] ).toDouble( &ok );
if ( !ok )
return false;
routing->waypoints.push_back( coordinate );
}
return true;
}
int main( int argc, char *argv[] ) {
CommandType commandType;
UnpackCommand unpackCommand;
RoutingCommand routingCommand;
routingCommand.lookupStrings = true;
if ( !processArguments( &commandType, &unpackCommand, &routingCommand, argc, argv ) ) {
qDebug() << "usage:" << argv[0] << "data-directory latitude1 longitude1 latitude2 longitude2 [...latitudeN longitudeN]";
qDebug() << "\tcomputes a route using between the specified waypoints";
qDebug() << "usage:" << argv[0] << "monav-map-module-file";
qDebug() << "\tunpacks a map module";
return 1;
}
QLocalSocket connection;
connection.connectToServer( "MoNavD" );
if ( !connection.waitForConnected() ) {
qDebug() << "failed to connect to daemon:" << connection.error();
return 2;
}
commandType.post( &connection );
if ( commandType.value == CommandType::UnpackCommand ) {
unpackCommand.post( &connection );
connection.flush();
UnpackResult reply;
reply.type = UnpackResult::FailUnpacking;
reply.read( &connection );
qDebug() << connection.state();
if ( reply.type == UnpackResult::FailUnpacking ) {
qDebug() << "failed to unpack map file";
return 3;
}
qDebug() << "finished unpacking map file";
return 0;
}
routingCommand.post( &connection );
connection.flush();
RoutingResult reply;
reply.read( &connection );
qDebug() << connection.state();
if ( reply.type == RoutingResult::LoadFailed ) {
qDebug() << "failed to load data directory";
return 3;
} else if ( reply.type == RoutingResult::RouteFailed ) {
qDebug() << "failed to compute route";
return 3;
} else if ( reply.type == RoutingResult::NameLookupFailed ) {
qDebug() << "failed to compute route";
return 3;
} else if ( reply.type == RoutingResult::TypeLookupFailed ) {
qDebug() << "failed to compute route";
return 3;
}else if ( reply.type == RoutingResult::Success ) {
int seconds = reply.seconds;
qDebug() << "distance:" << seconds / 60 / 60 << "h" << ( seconds / 60 ) % 60 << "m" << seconds % 60 << "s";
qDebug() << "nodes:" << reply.pathNodes.size();
qDebug() << "edges:" << reply.pathEdges.size();
unsigned node = 0;
for ( int i = 0; i < reply.pathEdges.size(); i++ ) {
QString name = reply.nameStrings[reply.pathEdges[i].name];
QString type = reply.typeStrings[reply.pathEdges[i].type];
qDebug() << "name:" << name.toUtf8() << "type:" << type << "nodes:" << reply.pathEdges[i].length + 1 << "seconds:" << reply.pathEdges[i].seconds << "branching possible:" << reply.pathEdges[i].branchingPossible;
for ( unsigned j = 0; j <= reply.pathEdges[i].length; j++ ) {
QString latitude, longitude;
latitude.setNum( reply.pathNodes[j + node].latitude, 'g', 10 );
longitude.setNum( reply.pathNodes[j + node].longitude, 'g', 10 );
qDebug() << latitude.toLatin1().data() << longitude.toLatin1().data();
}
node += reply.pathEdges[i].length;
}
} else {
qDebug() << "return value not recognized";
return 5;
}
}
monav-0.3/routingdaemon/daemontest.pro 0000644 0001750 0001750 00000000464 11522560077 017651 0 ustar vetter vetter TEMPLATE = app
DESTDIR = ../bin
INCLUDEPATH += ..
TARGET = daemon-test
QT -= gui
QT +=network
unix {
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3 \
-march=native \
-Wno-unused-function
QMAKE_CXXFLAGS_DEBUG += -Wno-unused-function
}
SOURCES += \
test.cpp
HEADERS += \
signals.h
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/ 0000755 0001750 0001750 00000000000 11554574462 021700 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/README.TXT 0000644 0001750 0001750 00000000145 11437034034 023220 0 ustar vetter vetter Service v2.6
The QtService component is useful for developing Windows services
and Unix daemons.
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/INSTALL.TXT 0000644 0001750 0001750 00000022374 11437034034 023401 0 ustar vetter vetter INSTALLATION INSTRUCTIONS
These instructions refer to the package you are installing as
some-package.tar.gz or some-package.zip. The .zip file is intended for use
on Windows.
The directory you choose for the installation will be referred to as
your-install-dir.
Note to Qt Visual Studio Integration users: In the instructions below,
instead of building from command line with nmake, you can use the menu
command 'Qt->Open Solution from .pro file' on the .pro files in the
example and plugin directories, and then build from within Visual
Studio.
Unpacking and installation
--------------------------
1. Unpacking the archive (if you have not done so already).
On Unix and Mac OS X (in a terminal window):
cd your-install-dir
gunzip some-package.tar.gz
tar xvf some-package.tar
This creates the subdirectory some-package containing the files.
On Windows:
Unpack the .zip archive by right-clicking it in explorer and
choosing "Extract All...". If your version of Windows does not
have zip support, you can use the infozip tools available
from www.info-zip.org.
If you are using the infozip tools (in a command prompt window):
cd your-install-dir
unzip some-package.zip
2. Configuring the package.
The configure script is called "configure" on unix/mac and
"configure.bat" on Windows. It should be run from a command line
after cd'ing to the package directory.
You can choose whether you want to use the component by including
its source code directly into your project, or build the component
as a dynamic shared library (DLL) that is loaded into the
application at run-time. The latter may be preferable for
technical or licensing (LGPL) reasons. If you want to build a DLL,
run the configure script with the argument "-library". Also see
the note about usage below.
(Components that are Qt plugins, e.g. styles and image formats,
are by default built as a plugin DLL.)
The configure script will prompt you in some cases for further
information. Answer these questions and carefully read the license text
before accepting the license conditions. The package cannot be used if
you do not accept the license conditions.
3. Building the component and examples (when required).
If a DLL is to be built, or if you would like to build the
examples, next give the commands
qmake
make [or nmake if your are using Microsoft Visual C++]
The example program(s) can be found in the directory called
"examples" or "example".
Components that are Qt plugins, e.g. styles and image formats, are
ready to be used as soon as they are built, so the rest of this
installation instruction can be skipped.
4. Building the Qt Designer plugin (optional).
Some of the widget components are provided with plugins for Qt
Designer. To build and install the plugin, cd into the
some-package/plugin directory and give the commands
qmake
make [or nmake if your are using Microsoft Visual C++]
Restart Qt Designer to make it load the new widget plugin.
Note: If you are using the built-in Qt Designer from the Qt Visual
Studio Integration, you will need to manually copy the plugin DLL
file, i.e. copy
%QTDIR%\plugins\designer\some-component.dll
to the Qt Visual Studio Integration plugin path, typically:
C:\Program Files\Trolltech\Qt VS Integration\plugins
Note: If you for some reason are using a Qt Designer that is built
in debug mode, you will need to build the plugin in debug mode
also. Edit the file plugin.pro in the plugin directory, changing
'release' to 'debug' in the CONFIG line, before running qmake.
Solutions components are intended to be used directly from the package
directory during development, so there is no 'make install' procedure.
Using a component in your project
---------------------------------
To use this component in your project, add the following line to the
project's .pro file (or do the equivalent in your IDE):
include(your-install-dir/some-package/src/some-package.pri)
This adds the package's sources and headers to the SOURCES and HEADERS
project variables respectively (or, if the component has been
configured as a DLL, it adds that library to the LIBS variable), and
updates INCLUDEPATH to contain the package's src
directory. Additionally, the .pri file may include some dependencies
needed by the package.
To include a header file from the package in your sources, you can now
simply use:
#include
or alternatively, in pre-Qt 4 style:
#include
Refer to the documentation to see the classes and headers this
components provides.
Install documentation (optional)
--------------------------------
The HTML documentation for the package's classes is located in the
your-install-dir/some-package/doc/html/index.html. You can open this
file and read the documentation with any web browser.
To install the documentation into Qt Assistant (for Qt version 4.4 and
later):
1. In Assistant, open the Edit->Preferences dialog and choose the
Documentation tab. Click the Add... button and select the file
your-install-dir/some-package/doc/html/some-package.qch
For Qt versions prior to 4.4, do instead the following:
1. The directory your-install-dir/some-package/doc/html contains a
file called some-package.dcf. Execute the following commands in a
shell, command prompt or terminal window:
cd your-install-dir/some-package/doc/html/
assistant -addContentFile some-package.dcf
The next time you start Qt Assistant, you can access the package's
documentation.
Removing the documentation from assistant
-----------------------------------------
If you have installed the documentation into Qt Assistant, and want to uninstall it, do as follows, for Qt version 4.4 and later:
1. In Assistant, open the Edit->Preferences dialog and choose the
Documentation tab. In the list of Registered Documentation, select
the item com.nokia.qtsolutions.some-package_version, and click
the Remove button.
For Qt versions prior to 4.4, do instead the following:
1. The directory your-install-dir/some-package/doc/html contains a
file called some-package.dcf. Execute the following commands in a
shell, command prompt or terminal window:
cd your-install-dir/some-package/doc/html/
assistant -removeContentFile some-package.dcf
Using the component as a DLL
----------------------------
1. Normal components
The shared library (DLL) is built and placed in the
some-package/lib directory. It is intended to be used directly
from there during development. When appropriate, both debug and
release versions are built, since the run-time linker will in some
cases refuse to load a debug-built DLL into a release-built
application or vice versa.
The following steps are taken by default to help the dynamic
linker to locate the DLL at run-time (during development):
Unix: The some-package.pri file will add linker instructions to
add the some-package/lib directory to the rpath of the
executable. (When distributing, or if your system does not support
rpath, you can copy the shared library to another place that is
searched by the dynamic linker, e.g. the "lib" directory of your
Qt installation.)
Mac: The full path to the library is hardcoded into the library
itself, from where it is copied into the executable at link time,
and ready by the dynamic linker at run-time. (When distributing,
you will want to edit these hardcoded paths in the same way as for
the Qt DLLs. Refer to the document "Deploying an Application on
Mac OS X" in the Qt Reference Documentation.)
Windows: the .dll file(s) are copied into the "bin" directory of
your Qt installation. The Qt installation will already have set up
that directory to be searched by the dynamic linker.
2. Plugins
For Qt Solutions plugins (e.g. image formats), both debug and
release versions of the plugin are built by default when
appropriate, since in some cases the release Qt library will not
load a debug plugin, and vice versa. The plugins are automatically
copied into the plugins directory of your Qt installation when
built, so no further setup is required.
Plugins may also be built statically, i.e. as a library that will be
linked into your application executable, and so will not need to
be redistributed as a separate plugin DLL to end users. Static
building is required if Qt itself is built statically. To do it,
just add "static" to the CONFIG variable in the plugin/plugin.pro
file before building. Refer to the "Static Plugins" section in the
chapter "How to Create Qt Plugins" for explanation of how to use a
static plugin in your application. The source code of the example
program(s) will also typically contain the relevant instructions
as comments.
Uninstalling
------------
The following command will remove any fils that have been
automatically placed outside the package directory itself during
installation and building
make distclean [or nmake if your are using Microsoft Visual C++]
If Qt Assistant documentation or Qt Designer plugins have been
installed, they can be uninstalled manually, ref. above.
Enjoy! :)
- The Qt Solutions Team.
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/qtservice.pro 0000644 0001750 0001750 00000000153 11437034034 024410 0 ustar vetter vetter TEMPLATE=subdirs
CONFIG += ordered
include(common.pri)
qtservice-uselib:SUBDIRS=buildlib
SUBDIRS+=examples
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/lib/ 0000755 0001750 0001750 00000000000 11554574462 022446 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/common.pri 0000644 0001750 0001750 00000000432 11437034034 023665 0 ustar vetter vetter infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtservice-uselib
TEMPLATE += fakelib
QTSERVICE_LIBNAME = $$qtLibraryTarget(QtSolutions_Service-2.6)
TEMPLATE -= fakelib
QTSERVICE_LIBDIR = $$PWD/lib
unix:qtservice-uselib:!qtservice-buildlib:QMAKE_RPATHDIR += $$QTSERVICE_LIBDIR
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/LICENSE.LGPL 0000644 0001750 0001750 00000063504 11437034034 023434 0 ustar vetter vetter GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/ 0000755 0001750 0001750 00000000000 11554574462 023516 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/interactive/ 0000755 0001750 0001750 00000000000 11554574462 026033 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/interactive/main.cpp 0000644 0001750 0001750 00000010545 11437034034 027452 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
#include
#include
#include
#include
#include
#include "qtservice.h"
class InteractiveService : public QtService
{
public:
InteractiveService(int argc, char **argv);
~InteractiveService();
protected:
void start();
void stop();
void pause();
void resume();
void processCommand(int code);
private:
QLabel *gui;
};
InteractiveService::InteractiveService(int argc, char **argv)
: QtService(argc, argv, "Qt Interactive Service"), gui(0)
{
setServiceDescription("A Qt service with user interface.");
setServiceFlags(QtServiceBase::CanBeSuspended);
}
InteractiveService::~InteractiveService()
{
}
void InteractiveService::start()
{
#if defined(Q_OS_WIN)
if ((QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)) {
logMessage( "Service GUI not allowed on Windows Vista. See the documentation for this example for more information.", QtServiceBase::Error );
return;
}
#endif
qApp->setQuitOnLastWindowClosed(false);
gui = new QLabel("Service", 0, Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
gui->move(QApplication::desktop()->availableGeometry().topLeft());
gui->show();
}
void InteractiveService::stop()
{
delete gui;
}
void InteractiveService::pause()
{
if (gui)
gui->hide();
}
void InteractiveService::resume()
{
if (gui)
gui->show();
}
void InteractiveService::processCommand(int code)
{
gui->setText("Command code " + QString::number(code));
gui->adjustSize();
}
int main(int argc, char **argv)
{
#if !defined(Q_WS_WIN)
// QtService stores service settings in SystemScope, which normally require root privileges.
// To allow testing this example as non-root, we change the directory of the SystemScope settings file.
QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());
#endif
InteractiveService service(argc, argv);
return service.exec();
}
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/interactive/interactive.pro 0000644 0001750 0001750 00000000132 11437034034 031050 0 ustar vetter vetter TEMPLATE = app
CONFIG += console qt
SOURCES = main.cpp
include(../../src/qtservice.pri)
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/interactive/interactive.qdoc 0000644 0001750 0001750 00000007100 11437034034 031200 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
/*! \page qtservice-example-interactive.html
\title An Interactive Service
This example implements a service with a simple user interface.
Services are usually non-interactive console applications. User
interaction, if required, is usually implemented in a separate,
normal GUI application that communicates with the service through
an IPC channel. For simple communication,
QtServiceController::sendCommand() and QtService::processCommand()
may be used, possibly in combination with a shared settings
file. For more complex, interactive communication, a custom IPC
channel should be used, e.g. based on Qt's networking classes.
However, although not recommended in the general case, in certain
circumstances a service may provide a GUI
itself. This is typically only possible if the service process is run as
the same user as the one that is logged in, so that it will have
access to the screen. Note however that on Windows Vista, service
GUIs are not allowed at all, since services run in a
diferent session than all user sessions, for security reasons.
This example demonstrates how to subclass the QtService class, the use of
start(), stop(), pause(), resume(), and how to use
processCommand() to receive control commands while running.
Here is the complete source code:
\quotefile interactive/main.cpp
*/
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/server/ 0000755 0001750 0001750 00000000000 11554574462 025024 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/server/main.cpp 0000644 0001750 0001750 00000014443 11437034034 026444 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include "qtservice.h"
// HttpDaemon is the the class that implements the simple HTTP server.
class HttpDaemon : public QTcpServer
{
Q_OBJECT
public:
HttpDaemon(quint16 port, QObject* parent = 0)
: QTcpServer(parent), disabled(false)
{
listen(QHostAddress::Any, port);
}
void incomingConnection(int socket)
{
if (disabled)
return;
// When a new client connects, the server constructs a QTcpSocket and all
// communication with the client is done over this QTcpSocket. QTcpSocket
// works asynchronously, this means that all the communication is done
// in the two slots readClient() and discardClient().
QTcpSocket* s = new QTcpSocket(this);
connect(s, SIGNAL(readyRead()), this, SLOT(readClient()));
connect(s, SIGNAL(disconnected()), this, SLOT(discardClient()));
s->setSocketDescriptor(socket);
QtServiceBase::instance()->logMessage("New Connection");
}
void pause()
{
disabled = true;
}
void resume()
{
disabled = false;
}
private slots:
void readClient()
{
if (disabled)
return;
// This slot is called when the client sent data to the server. The
// server looks if it was a get request and sends a very simple HTML
// document back.
QTcpSocket* socket = (QTcpSocket*)sender();
if (socket->canReadLine()) {
QStringList tokens = QString(socket->readLine()).split(QRegExp("[ \r\n][ \r\n]*"));
if (tokens[0] == "GET") {
QTextStream os(socket);
os.setAutoDetectUnicode(true);
os << "HTTP/1.0 200 Ok\r\n"
"Content-Type: text/html; charset=\"utf-8\"\r\n"
"\r\n"
"Nothing to see here
\n"
<< QDateTime::currentDateTime().toString() << "\n";
socket->close();
QtServiceBase::instance()->logMessage("Wrote to client");
if (socket->state() == QTcpSocket::UnconnectedState) {
delete socket;
QtServiceBase::instance()->logMessage("Connection closed");
}
}
}
}
void discardClient()
{
QTcpSocket* socket = (QTcpSocket*)sender();
socket->deleteLater();
QtServiceBase::instance()->logMessage("Connection closed");
}
private:
bool disabled;
};
class HttpService : public QtService
{
public:
HttpService(int argc, char **argv)
: QtService(argc, argv, "Qt HTTP Daemon")
{
setServiceDescription("A dummy HTTP service implemented with Qt");
setServiceFlags(QtServiceBase::CanBeSuspended);
}
protected:
void start()
{
QCoreApplication *app = application();
quint16 port = (app->argc() > 1) ?
QString::fromLocal8Bit(app->argv()[1]).toUShort() : 8080;
daemon = new HttpDaemon(port, app);
if (!daemon->isListening()) {
logMessage(QString("Failed to bind to port %1").arg(daemon->serverPort()), QtServiceBase::Error);
app->quit();
}
}
void pause()
{
daemon->pause();
}
void resume()
{
daemon->resume();
}
private:
HttpDaemon *daemon;
};
#include "main.moc"
int main(int argc, char **argv)
{
#if !defined(Q_WS_WIN)
// QtService stores service settings in SystemScope, which normally require root privileges.
// To allow testing this example as non-root, we change the directory of the SystemScope settings file.
QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());
#endif
HttpService service(argc, argv);
return service.exec();
}
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/server/server.qdoc 0000644 0001750 0001750 00000007460 11437034034 027173 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
/*! \page qtservice-example-server.html
\title A simple HTTP Server
It is a very simple implementation of a HTTP daemon that listens on
chosen port (defaultly 8080) and sends back a simple HTML page back for every GET
request it gets. After sending the page, it closes the connection.
\quotefromfile server/main.cpp
\skipto HttpDaemon
\printuntil };
The server implementation uses
the QtService::logMessage() function to send messages and status
reports to the system event log. The server also supports
a paused state in which case incoming requests are ignored.
The \c HttpService class subclasses QtService to implement the
service functionality.
\printto protected:
The constructor calls the QtService constructor instantiated with QCoreApplication
since our service will not use GUI.
The first two parameters of our constructor are passed to QtService.
The last parameter, "Qt HTTP Daemon", is the name of the service.
\printto pause()
The implementation of \c start() first checks if the user passed a port number.
If yes that port is used by server to listen on. Otherwise default 8080 port is used.
Then creates an instance of the HTTP server using operator
new, passing the application object as the parent to ensure that the object
gets destroyed.
\printto private:
\printuntil };
The implementations of pause() and resume() forward the request to the
server object.
\printuntil }
The main entry point function creates the service object and uses
the \c exec() function to execute the service.
*/
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/server/server.pro 0000644 0001750 0001750 00000000207 11437034034 027035 0 ustar vetter vetter TARGET = httpservice
TEMPLATE = app
CONFIG += console qt
QT = core network
SOURCES = main.cpp
include(../../src/qtservice.pri)
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/examples.pro 0000644 0001750 0001750 00000000114 11437034034 026034 0 ustar vetter vetter TEMPLATE = subdirs
SUBDIRS = interactive \
server \
controller
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/controller/ 0000755 0001750 0001750 00000000000 11554574462 025701 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/controller/controller.pro 0000644 0001750 0001750 00000000146 11437034034 030571 0 ustar vetter vetter TEMPLATE = app
CONFIG += console qt
QT = core
SOURCES = main.cpp
include(../../src/qtservice.pri)
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/controller/main.cpp 0000644 0001750 0001750 00000017374 11437034034 027327 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
#include
#include
#include
#include "qtservice.h"
int processArgs(int argc, char **argv)
{
if (argc > 2) {
QString arg1(argv[1]);
if (arg1 == QLatin1String("-i") ||
arg1 == QLatin1String("-install")) {
if (argc > 2) {
QString account;
QString password;
QString path(argv[2]);
if (argc > 3)
account = argv[3];
if (argc > 4)
password = argv[4];
printf("The service %s installed.\n",
(QtServiceController::install(path, account, password) ? "was" : "was not"));
return 0;
}
} else {
QString serviceName(argv[1]);
QtServiceController controller(serviceName);
QString option(argv[2]);
if (option == QLatin1String("-u") ||
option == QLatin1String("-uninstall")) {
printf("The service \"%s\" %s uninstalled.\n",
controller.serviceName().toLatin1().constData(),
(controller.uninstall() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-s") ||
option == QLatin1String("-start")) {
QStringList args;
for (int i = 3; i < argc; ++i)
args.append(QString::fromLocal8Bit(argv[i]));
printf("The service \"%s\" %s started.\n",
controller.serviceName().toLatin1().constData(),
(controller.start(args) ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-t") ||
option == QLatin1String("-terminate")) {
printf("The service \"%s\" %s stopped.\n",
controller.serviceName().toLatin1().constData(),
(controller.stop() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-p") ||
option == QLatin1String("-pause")) {
printf("The service \"%s\" %s paused.\n",
controller.serviceName().toLatin1().constData(),
(controller.pause() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-r") ||
option == QLatin1String("-resume")) {
printf("The service \"%s\" %s resumed.\n",
controller.serviceName().toLatin1().constData(),
(controller.resume() ? "was" : "was not"));
return 0;
} else if (option == QLatin1String("-c") ||
option == QLatin1String("-command")) {
if (argc > 3) {
QString codestr(argv[3]);
int code = codestr.toInt();
printf("The command %s sent to the service \"%s\".\n",
(controller.sendCommand(code) ? "was" : "was not"),
controller.serviceName().toLatin1().constData());
return 0;
}
} else if (option == QLatin1String("-v") ||
option == QLatin1String("-version")) {
bool installed = controller.isInstalled();
printf("The service\n"
"\t\"%s\"\n\n", controller.serviceName().toLatin1().constData());
printf("is %s", (installed ? "installed" : "not installed"));
printf(" and %s\n\n", (controller.isRunning() ? "running" : "not running"));
if (installed) {
printf("path: %s\n", controller.serviceFilePath().toLatin1().data());
printf("description: %s\n", controller.serviceDescription().toLatin1().data());
printf("startup: %s\n", controller.startupType() == QtServiceController::AutoStartup ? "Auto" : "Manual");
}
return 0;
}
}
}
printf("controller [-i PATH | SERVICE_NAME [-v | -u | -s | -t | -p | -r | -c CODE] | -h] [-w]\n\n"
"\t-i(nstall) PATH\t: Install the service\n"
"\t-v(ersion)\t: Print status of the service\n"
"\t-u(ninstall)\t: Uninstall the service\n"
"\t-s(tart)\t: Start the service\n"
"\t-t(erminate)\t: Stop the service\n"
"\t-p(ause)\t: Pause the service\n"
"\t-r(esume)\t: Resume the service\n"
"\t-c(ommand) CODE\t: Send a command to the service\n"
"\t-h(elp)\t\t: Print this help info\n"
"\t-w(ait)\t\t: Wait for keypress when done\n");
return 0;
}
int main(int argc, char **argv)
{
#if !defined(Q_WS_WIN)
// QtService stores service settings in SystemScope, which normally require root privileges.
// To allow testing this example as non-root, we change the directory of the SystemScope settings file.
QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());
#endif
int result = processArgs(argc, argv);
if (QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-w") ||
QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-wait")) {
printf("\nPress Enter to continue...");
QFile input;
input.open(stdin, QIODevice::ReadOnly);
input.readLine();
printf("\n");
}
return result;
}
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/examples/controller/controller.qdoc 0000644 0001750 0001750 00000007757 11437034034 030736 0 ustar vetter vetter /****************************************************************************
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of a Qt Solutions component.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions 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.
**
** 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.
**
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
****************************************************************************/
/*! \page qtservice-example-controller.html
\title A simple Service Controller
It is a very simple implementation of universal command-line
controller. This controller can install and control any service
written using QtService component. It demonstrates how to use
QtServiceController class. On Windows, this is an alternative to
using the "Services" Administrative Tool or the built-in \c sc.exe
command-line tool to control services.
A note about services on Windows Vista: Installing/uninstalling
and starting/stopping services requires security privileges. The
simplest way to achieve this is to set the "Run as Administrator"
property on the executable (right-click the executable file,
select Properties, and choose the Compatibilty tab in the
Properties dialog). This applies even if you are logged in as
Administrator. Also, the command-line shell should be started with
"Run as Administrator". Note that the service itself does not need
special privileges to run. Only if you want the service to be able
to install itself (the -i option) or similar, then the service
will need to be run as Administrator. Otherwise, the recommended
procedure is to use a controller such as this example and/or the
"Services" Administrative Tool to manage the service.
A usability hint: in some circumstances, e.g. when running this
example on Windows Vista with the "Run as Administrator" property
set, output will be sent to a shell window which will close
immediately upon termination, not leaving the user enough time to
read the output. In such cases, append the -w(ait) argument, which
will make the controller wait for a keypress before terminating.
Here is the complete source code:
\quotefile controller/main.cpp
*/
monav-0.3/routingdaemon/qtservice-2.6_1-opensource/doc/ 0000755 0001750 0001750 00000000000 11554574462 022445 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/doc/index.qdoc 0000644 0001750 0001750 00000002104 11437034034 024403 0 ustar vetter vetter /*!
\page index.html
\title Service
\section1 Description
The QtService component is useful for developing Windows
services and Unix daemons.
The project provides a QtService template class that can be used to
implement service applications, and a QtServiceController class
to control a service.
On Windows systems the implementation uses the Service Control
Manager.
On Unix systems services are implemented as daemons.
\section1 Classes
\list
\i QtServiceController \i QtServiceBase \i QtService\endlist
\section1 Examples
\list
\i \link qtservice-example-interactive.html An Interactive Service \endlink \i \link qtservice-example-server.html A simple HTTP Server \endlink \i \link qtservice-example-controller.html A simple Service Controller \endlink \endlist
\section1 Tested platforms
\list
\i Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005
\i Qt 4.4, 4.5 / Linux / gcc
\i Qt 4.4, 4.5 / MacOS X 10.5 / gcc
\endlist
*/ monav-0.3/routingdaemon/qtservice-2.6_1-opensource/doc/images/ 0000755 0001750 0001750 00000000000 11554574462 023712 5 ustar vetter vetter monav-0.3/routingdaemon/qtservice-2.6_1-opensource/doc/images/qt-logo.png 0000644 0001750 0001750 00000007753 11437034034 026000 0 ustar vetter vetter PNG
IHDR 9 C :u IDATxb? bh Jn Jn Jn Jn Jn Jn ԡ Є`r'Q(
!!N b_p??F&F 312G.yG&ޏ?}eWSSgb(~ t齸g0sVv`fcdY8E$xdUUex$xd9DDr=# gdd|Uףw9D-
2b8Ͽebddceᔐ╗SWScaB# cfd]-I\_20110`xzw/).#'˯"ǯ*˫,+')@lY @}fۯͼ
2@d$1H')'ç,ϯ*˧,#/%́X gfdOX8Y9s2GC3g@
fFff.3O|v,l