git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@4491 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
7d5141cf95
commit
5bc861686b
|
@ -5,10 +5,10 @@ CONFIG += qt warn_on cascades10
|
|||
include(config.pri)
|
||||
|
||||
SOURCES += ../../pjsua_app.c \
|
||||
../../pjsua_cli.c \
|
||||
../../pjsua_common.c \
|
||||
../../pjsua_config.c \
|
||||
../../pjsua_legacy.c
|
||||
../../pjsua_app_cli.c \
|
||||
../../pjsua_app_common.c \
|
||||
../../pjsua_app_config.c \
|
||||
../../pjsua_app_legacy.c
|
||||
|
||||
device {
|
||||
CONFIG(debug, debug|release) {
|
||||
|
|
|
@ -40,8 +40,8 @@ void ApplicationUI::pjsuaOnStartedCb(pj_status_t status, const char* msg)
|
|||
}
|
||||
|
||||
|
||||
pj_bool_t ApplicationUI::pjsuaOnStoppedCb(pj_bool_t restart,
|
||||
int argc, char** argv)
|
||||
void ApplicationUI::pjsuaOnStoppedCb(pj_bool_t restart,
|
||||
int argc, char** argv)
|
||||
{
|
||||
PJ_LOG(3,("ipjsua", "CLI %s request", (restart? "restart" : "shutdown")));
|
||||
if (restart) {
|
||||
|
@ -56,8 +56,6 @@ pj_bool_t ApplicationUI::pjsuaOnStoppedCb(pj_bool_t restart,
|
|||
bb::cascades::Application *app = bb::cascades::Application::instance();
|
||||
app->quit();
|
||||
}
|
||||
|
||||
return PJ_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +64,7 @@ void ApplicationUI::pjsuaOnAppConfigCb(pjsua_app_config *cfg)
|
|||
PJ_UNUSED_ARG(cfg);
|
||||
}
|
||||
|
||||
|
||||
void ApplicationUI::extRestartRequest(int argc, char **argv)
|
||||
{
|
||||
restartArgc = argc;
|
||||
|
@ -74,12 +73,13 @@ void ApplicationUI::extRestartRequest(int argc, char **argv)
|
|||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
void ApplicationUI::pjsuaStart()
|
||||
{
|
||||
// TODO: read from config?
|
||||
const char **argv = pjsua_app_def_argv;
|
||||
int argc = PJ_ARRAY_SIZE(pjsua_app_def_argv) -1;
|
||||
app_cfg_t app_cfg;
|
||||
pjsua_app_cfg_t app_cfg;
|
||||
pj_status_t status;
|
||||
|
||||
isShuttingDown = false;
|
||||
|
@ -97,21 +97,21 @@ void ApplicationUI::pjsuaStart()
|
|||
app_cfg.on_stopped = &pjsuaOnStoppedCb;
|
||||
app_cfg.on_config_init = &pjsuaOnAppConfigCb;
|
||||
|
||||
status = app_init(&app_cfg);
|
||||
status = pjsua_app_init(&app_cfg);
|
||||
if (status != PJ_SUCCESS) {
|
||||
char errmsg[PJ_ERR_MSG_SIZE];
|
||||
pj_strerror(status, errmsg, sizeof(errmsg));
|
||||
displayMsg(QString("Init error:") + errmsg);
|
||||
app_destroy();
|
||||
pjsua_app_destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
status = app_run(PJ_FALSE);
|
||||
status = pjsua_app_run(PJ_FALSE);
|
||||
if (status != PJ_SUCCESS) {
|
||||
char errmsg[PJ_ERR_MSG_SIZE];
|
||||
pj_strerror(status, errmsg, sizeof(errmsg));
|
||||
displayMsg(QString("Error:") + errmsg);
|
||||
app_destroy();
|
||||
pjsua_app_destroy();
|
||||
}
|
||||
|
||||
restartArgv = NULL;
|
||||
|
@ -120,9 +120,10 @@ void ApplicationUI::pjsuaStart()
|
|||
|
||||
void ApplicationUI::pjsuaDestroy()
|
||||
{
|
||||
app_destroy();
|
||||
pjsua_app_destroy();
|
||||
}
|
||||
|
||||
|
||||
ApplicationUI::ApplicationUI(bb::cascades::Application *app)
|
||||
: QObject(app), isShuttingDown(false), restartArgv(NULL), restartArgc(0)
|
||||
{
|
||||
|
@ -138,16 +139,19 @@ ApplicationUI::ApplicationUI(bb::cascades::Application *app)
|
|||
pjsuaStart();
|
||||
}
|
||||
|
||||
|
||||
ApplicationUI::~ApplicationUI()
|
||||
{
|
||||
instance_ = NULL;
|
||||
}
|
||||
|
||||
|
||||
ApplicationUI* ApplicationUI::instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
||||
void ApplicationUI::aboutToQuit()
|
||||
{
|
||||
if (!isShuttingDown) {
|
||||
|
@ -157,6 +161,7 @@ void ApplicationUI::aboutToQuit()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ApplicationUI::displayMsg(const QString &msg)
|
||||
{
|
||||
bb::cascades::Application *app = bb::cascades::Application::instance();
|
||||
|
@ -166,6 +171,7 @@ void ApplicationUI::displayMsg(const QString &msg)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void ApplicationUI::restartPjsua()
|
||||
{
|
||||
pjsuaDestroy();
|
||||
|
|
|
@ -45,9 +45,9 @@ private:
|
|||
void pjsuaDestroy();
|
||||
|
||||
/* pjsua app callbacks */
|
||||
static void pjsuaOnStartedCb(pj_status_t status, const char* msg);
|
||||
static pj_bool_t pjsuaOnStoppedCb(pj_bool_t restart, int argc, char** argv);
|
||||
static void pjsuaOnAppConfigCb(pjsua_app_config *cfg);
|
||||
static void pjsuaOnStartedCb(pj_status_t status, const char* msg);
|
||||
static void pjsuaOnStoppedCb(pj_bool_t restart, int argc, char** argv);
|
||||
static void pjsuaOnAppConfigCb(pjsua_app_config *cfg);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue