mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 10:19:23 +00:00
Add the version command.
This commit is contained in:
parent
dc00f66f82
commit
0ab22a41ae
4 changed files with 39 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ linphone_daemon_SOURCES=daemon.cc \
|
|||
commands/terminate.cc \
|
||||
commands/unregister.cc \
|
||||
commands/quit.cc \
|
||||
commands/version.cc \
|
||||
daemon.h \
|
||||
commands/adaptive-jitter-compensation.h \
|
||||
commands/answer.h \
|
||||
|
|
@ -53,7 +54,8 @@ linphone_daemon_SOURCES=daemon.cc \
|
|||
commands/register-status.h \
|
||||
commands/terminate.h \
|
||||
commands/unregister.h \
|
||||
commands/quit.h
|
||||
commands/quit.h \
|
||||
commands/version.h
|
||||
|
||||
linphone_daemon_pipetest_SOURCES=daemon-pipetest.c
|
||||
|
||||
|
|
|
|||
22
daemon/commands/version.cc
Normal file
22
daemon/commands/version.cc
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "version.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class VersionResponse : public Response {
|
||||
public:
|
||||
VersionResponse(LinphoneCore *core);
|
||||
};
|
||||
|
||||
VersionResponse::VersionResponse(LinphoneCore *core) : Response() {
|
||||
ostringstream ost;
|
||||
ost << "Version: " << linphone_core_get_version();
|
||||
setBody(ost.str().c_str());
|
||||
}
|
||||
|
||||
VersionCommand::VersionCommand() :
|
||||
DaemonCommand("version", "version", "Get the version number.") {
|
||||
}
|
||||
|
||||
void VersionCommand::exec(Daemon *app, const char *args) {
|
||||
app->sendResponse(VersionResponse(app->getCore()));
|
||||
}
|
||||
12
daemon/commands/version.h
Normal file
12
daemon/commands/version.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef COMMAND_VERSION_H_
|
||||
#define COMMAND_VERSION_H_
|
||||
|
||||
#include "../daemon.h"
|
||||
|
||||
class VersionCommand: public DaemonCommand {
|
||||
public:
|
||||
VersionCommand();
|
||||
virtual void exec(Daemon *app, const char *args);
|
||||
};
|
||||
|
||||
#endif //COMMAND_VERSION_H_
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
#include "commands/terminate.h"
|
||||
#include "commands/unregister.h"
|
||||
#include "commands/quit.h"
|
||||
#include "commands/version.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -350,6 +351,7 @@ void Daemon::initCommands() {
|
|||
mCommands.push_back(new MediaEncryptionCommand());
|
||||
mCommands.push_back(new PortCommand());
|
||||
mCommands.push_back(new AdaptiveBufferCompensationCommand());
|
||||
mCommands.push_back(new VersionCommand());
|
||||
mCommands.push_back(new QuitCommand());
|
||||
mCommands.push_back(new HelpCommand());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue