mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
25 lines
805 B
C++
25 lines
805 B
C++
#include "ptime.h"
|
|
|
|
using namespace std;
|
|
|
|
PtimeCommand::PtimeCommand() :
|
|
DaemonCommand("ptime", "ptime <ms>", "Set the if ms is defined, otherwise return the ptime.") {
|
|
}
|
|
void PtimeCommand::exec(Daemon *app, const char *args) {
|
|
int ms;
|
|
int ret = sscanf(args, "%d", &ms);
|
|
if (ret <= 0) {
|
|
ostringstream ostr;
|
|
ms = linphone_core_get_upload_ptime(app->getCore());
|
|
ostr << "Ptime: " << ms << "\n";
|
|
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
|
|
} else if (ret == 1) {
|
|
ostringstream ostr;
|
|
linphone_core_set_upload_ptime(app->getCore(), ms);
|
|
ms = linphone_core_get_upload_ptime(app->getCore());
|
|
ostr << "Ptime: " << ms << "\n";
|
|
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
|
|
} else {
|
|
app->sendResponse(Response("Missing/Incorrect parameter(s)."));
|
|
}
|
|
}
|