Changeset 4492
- Timestamp:
- Apr 23, 2013 10:59:52 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/build.symbian/bld.inf
r4478 r4492 33 33 //symsndtest.mmp 34 34 pjlib_test.mmp 35 ../pjsip-apps/src/pjsua/symbian/group/pjsua.mmp -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.h
r4485 r4492 20 20 #define __PJSUA_APP_CONFIG_H__ 21 21 22 #include <pjlib.h> 23 22 24 /* This file defines the default app config. It's used by pjsua 23 25 * *mobile* version only. If you're porting pjsua to new mobile … … 28 30 "--use-cli", 29 31 "--no-cli-console", 32 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN 33 /* Can't reuse address on E52 */ 34 "--cli-telnet-port=0", 35 #else 30 36 "--cli-telnet-port=2323", 31 "--no-vad", 37 #endif 32 38 "--quality=4", 33 39 #if defined(PJ_CONFIG_BB10) && PJ_CONFIG_BB10 … … 36 42 NULL }; 37 43 44 #define pjsua_app_def_argc (PJ_ARRAY_SIZE(pjsua_app_def_argv)-1) 45 38 46 39 47 #endif /* __PJSUA_APP_CONFIG_H__ */ -
pjproject/trunk/pjsip-apps/src/pjsua/symbian/group/pjsua.mmp
r4477 r4492 102 102 SOURCEPATH ..\.. 103 103 104 SOURCE pjsua_ cli.c pjsua_legacy.c105 SOURCE pjsua_app.c pjsua_ common.c pjsua_config.c104 SOURCE pjsua_app_cli.c pjsua_app_legacy.c 105 SOURCE pjsua_app.c pjsua_app_common.c pjsua_app_config.c -
pjproject/trunk/pjsip-apps/src/pjsua/symbian/src/pjsuaAppUi.cpp
r4477 r4492 24 24 25 25 #include "../../pjsua_app.h" 26 #include "../../pjsua_app_config.h" 26 27 27 28 /* Global vars */ 28 29 static CpjsuaAppUi *appui = NULL; 29 30 static pj_ioqueue_t *app_ioqueue = NULL; 30 static int restart_argc = 0; 31 static char **restart_argv = NULL; 31 static int start_argc = 0; 32 static char **start_argv = NULL; 33 34 static pj_status_t InitSymbSocket(); 35 static void DestroySymbSocket(); 32 36 33 37 /* Helper funtions to init/restart/destroy the pjsua */ 34 static void LibInitL(); 35 static void LibDestroyL(); 36 static void LibRestartL(); 38 static void PjsuaInitL(); 39 static void PjsuaDestroyL(); 37 40 38 41 /* pjsua app callbacks */ 39 static void lib_on_started(pj_status_t status, const char* title);40 static pj_bool_t lib_on_stopped(pj_bool_t restart, int argc, char** argv);41 static void lib_on_config_init(pjsua_app_config *cfg);42 static void PjsuaOnStarted(pj_status_t status, const char* title); 43 static void PjsuaOnStopped(pj_bool_t restart, int argc, char** argv); 44 static void PjsuaOnConfig(pjsua_app_config *cfg); 42 45 43 46 /* Helper class to schedule function execution */ … … 209 212 Cba()->MakeVisible(EFalse); 210 213 211 // Schedule Lib Init 212 MyTimer::NewL(100, &LibInitL); 214 if (InitSymbSocket() != PJ_SUCCESS) { 215 PutMsg("Failed to initialize Symbian network param."); 216 } else { 217 start_argc = pjsua_app_def_argc; 218 start_argv = (char**)pjsua_app_def_argv; 219 220 // Schedule Lib Init 221 MyTimer::NewL(100, &PjsuaInitL); 222 } 223 213 224 } 214 225 … … 216 227 void CpjsuaAppUi::PrepareToExit() 217 228 { 218 TRAPD(result, LibDestroyL()); 229 TRAPD(result, PjsuaDestroyL()); 230 DestroySymbSocket(); 231 CloseSTDLIB(); 219 232 CAknViewAppUi::PrepareToExit(); 220 233 } … … 232 245 233 246 /* Called when pjsua is started */ 234 void lib_on_started(pj_status_t status, const char* title) 235 { 247 void PjsuaOnStarted(pj_status_t status, const char* title) 248 { 249 char err_msg[128]; 250 251 if (status != PJ_SUCCESS || title == NULL) { 252 char err_str[PJ_ERR_MSG_SIZE]; 253 pj_strerror(status, err_str, sizeof(err_str)); 254 pj_ansi_snprintf(err_msg, sizeof(err_msg), "%s: %s", 255 (title?title:"App start error"), err_str); 256 title = err_msg; 257 } 258 236 259 appui->PutMsg(title); 237 260 } 238 261 239 262 /* Called when pjsua is stopped */ 240 pj_bool_t lib_on_stopped(pj_bool_t restart, int argc, char** argv)263 void PjsuaOnStopped(pj_bool_t restart, int argc, char** argv) 241 264 { 242 265 if (restart) { 243 restart_argc = argc;244 restart_argv = argv;266 start_argc = argc; 267 start_argv = argv; 245 268 246 269 // Schedule Lib Init 247 MyTimer::NewL(100, & LibRestartL);270 MyTimer::NewL(100, &PjsuaInitL); 248 271 } else { 249 272 /* Destroy & quit GUI, e.g: clean up window, resources */ 250 273 appui->Exit(); 251 274 } 252 253 return PJ_FALSE;254 275 } 255 276 … … 257 278 * We need to override some settings here. 258 279 */ 259 void lib_on_config_init(pjsua_app_config *cfg)280 void PjsuaOnConfig(pjsua_app_config *cfg) 260 281 { 261 282 /* Disable threading */ … … 272 293 } 273 294 274 void LibInitL() 295 // Set Symbian OS parameters in pjlib. 296 // This must be done before pj_init() is called. 297 pj_status_t InitSymbSocket() 275 298 { 276 299 pj_symbianos_params sym_params; 277 char* argv[] = {278 "",279 "--use-cli",280 "--cli-telnet-port=0",281 "--no-cli-console"282 };283 app_cfg_t app_cfg;284 pj_status_t status;285 300 TInt err; 286 301 287 302 // Initialize RSocketServ 288 303 if ((err=aSocketServer.Connect(32)) != KErrNone) { 289 status = PJ_STATUS_FROM_OS(err); 290 goto on_return; 304 return PJ_STATUS_FROM_OS(err); 291 305 } 292 306 … … 294 308 if ((err=aConn.Open(aSocketServer)) != KErrNone) { 295 309 aSocketServer.Close(); 296 status = PJ_STATUS_FROM_OS(err); 297 goto on_return; 310 return PJ_STATUS_FROM_OS(err); 298 311 } 299 312 if ((err=aConn.Start()) != KErrNone) { 300 313 aConn.Close(); 301 aSocketServer.Close(); 302 status = PJ_STATUS_FROM_OS(err); 303 goto on_return; 304 } 305 306 // Set Symbian OS parameters in pjlib. 307 // This must be done before pj_init() is called. 314 aSocketServer.Close(); 315 return PJ_STATUS_FROM_OS(err); 316 } 317 308 318 pj_bzero(&sym_params, sizeof(sym_params)); 309 319 sym_params.rsocketserv = &aSocketServer; 310 320 sym_params.rconnection = &aConn; 311 321 pj_symbianos_set_params(&sym_params); 312 322 323 return PJ_SUCCESS; 324 } 325 326 327 void DestroySymbSocket() 328 { 329 aConn.Close(); 330 aSocketServer.Close(); 331 } 332 333 334 void PjsuaInitL() 335 { 336 pjsua_app_cfg_t app_cfg; 337 pj_status_t status; 338 339 PjsuaDestroyL(); 340 313 341 pj_bzero(&app_cfg, sizeof(app_cfg)); 314 app_cfg.argc = PJ_ARRAY_SIZE(argv);315 app_cfg.argv = argv;316 app_cfg.on_started = & lib_on_started;317 app_cfg.on_stopped = & lib_on_stopped;318 app_cfg.on_config_init = & lib_on_config_init;342 app_cfg.argc = start_argc; 343 app_cfg.argv = start_argv; 344 app_cfg.on_started = &PjsuaOnStarted; 345 app_cfg.on_stopped = &PjsuaOnStopped; 346 app_cfg.on_config_init = &PjsuaOnConfig; 319 347 320 348 appui->PutMsg("Initializing.."); 321 status = app_init(&app_cfg);349 status = pjsua_app_init(&app_cfg); 322 350 if (status != PJ_SUCCESS) 323 351 goto on_return; 324 352 325 353 appui->PutMsg("Starting.."); 326 status = app_run(PJ_FALSE);354 status = pjsua_app_run(PJ_FALSE); 327 355 if (status != PJ_SUCCESS) 328 356 goto on_return; … … 333 361 } 334 362 335 void LibDestroyL()363 void PjsuaDestroyL() 336 364 { 337 365 if (app_ioqueue) { … … 339 367 app_ioqueue = NULL; 340 368 } 341 app_destroy(); 342 CloseSTDLIB(); 343 } 344 345 void LibRestartL() 346 { 347 app_cfg_t app_cfg; 348 pj_status_t status; 349 350 /* Destroy pjsua app first */ 351 352 if (app_ioqueue) { 353 pj_ioqueue_destroy(app_ioqueue); 354 app_ioqueue = NULL; 355 } 356 app_destroy(); 357 358 /* Reinit pjsua app */ 359 360 pj_bzero(&app_cfg, sizeof(app_cfg)); 361 app_cfg.argc = restart_argc; 362 app_cfg.argv = restart_argv; 363 app_cfg.on_started = &lib_on_started; 364 app_cfg.on_stopped = &lib_on_stopped; 365 app_cfg.on_config_init = &lib_on_config_init; 366 367 status = app_init(&app_cfg); 368 if (status != PJ_SUCCESS) { 369 appui->PutMsg("app_init() failed"); 370 return; 371 } 372 373 /* Run pjsua app */ 374 375 status = app_run(PJ_FALSE); 376 if (status != PJ_SUCCESS) { 377 appui->PutMsg("app_run() failed"); 378 return; 379 } 380 } 369 pjsua_app_destroy(); 370 } -
pjproject/trunk/pjsip-apps/src/pjsua/wm/main_wm.c
r4484 r4492 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <windows.h>20 21 #include <pjlib.h>22 #include <windows.h>23 19 #include <winuserm.h> 24 20 #include <aygshell.h> 25 21 #include "..\pjsua_app.h" 22 #include "..\pjsua_app_config.h" 26 23 27 24 #define MAINWINDOWCLASS TEXT("PjsuaDlg") … … 40 37 static HBITMAP g_hBmp; 41 38 42 static int restart_argc = 0; 43 static char **restart_argv = NULL; 44 45 /* Helper funtions to init/restart/destroy the pjsua */ 46 static void LibInit(); 47 static void LibDestroy(); 48 static void LibRestart(); 39 static int start_argc; 40 static char **start_argv; 41 42 /* Helper funtions to init/destroy the pjsua */ 43 static void PjsuaInit(); 44 static void PjsuaDestroy(); 49 45 50 46 /* pjsua app callbacks */ 51 static void lib_on_started(pj_status_t status, const char* title);52 static pj_bool_t lib_on_stopped(pj_bool_t restart, int argc, char** argv);53 static void lib_on_config_init(pjsua_app_config *cfg);47 static void PjsuaOnStarted(pj_status_t status, const char* title); 48 static void PjsuaOnStopped(pj_bool_t restart, int argc, char** argv); 49 static void PjsuaOnConfig(pjsua_app_config *cfg); 54 50 55 51 LRESULT CALLBACK DialogProc(const HWND hWnd, … … 86 82 87 83 case WM_APP_INIT: 88 LibInit(); 84 case WM_APP_RESTART: 85 PjsuaInit(); 89 86 break; 90 87 91 88 case WM_APP_DESTROY: 92 LibDestroy();93 89 PostQuitMessage(0); 94 break;95 96 case WM_APP_RESTART:97 LibRestart();98 90 break; 99 91 … … 108 100 /* === GUI === */ 109 101 110 pj_status_t gui_init()102 pj_status_t GuiInit() 111 103 { 112 104 WNDCLASS wc; … … 193 185 194 186 /* Create logo */ 195 g_hBmp = SHLoadDIBitmap(LOGO_PATH); / / for jpeg, uses SHLoadImageFile()187 g_hBmp = SHLoadDIBitmap(LOGO_PATH); /* for jpeg, uses SHLoadImageFile() */ 196 188 if (g_hBmp == NULL) { 197 189 DWORD err = GetLastError(); … … 228 220 229 221 230 pj_status_t gui_start()222 pj_status_t GuiStart() 231 223 { 232 224 MSG msg; … … 239 231 } 240 232 241 void gui_destroy(void)233 void GuiDestroy(void) 242 234 { 243 235 if (g_hWndMain) { … … 267 259 268 260 /* Called when pjsua is started */ 269 void lib_on_started(pj_status_t status, const char* title)261 void PjsuaOnStarted(pj_status_t status, const char* title) 270 262 { 271 263 wchar_t wtitle[128]; 272 273 PJ_UNUSED_ARG(status); 264 char err_msg[128]; 265 266 if (status != PJ_SUCCESS || title == NULL) { 267 char err_str[PJ_ERR_MSG_SIZE]; 268 pj_strerror(status, err_str, sizeof(err_str)); 269 pj_ansi_snprintf(err_msg, sizeof(err_msg), "%s: %s", 270 (title?title:"App start error"), err_str); 271 title = err_msg; 272 } 274 273 275 274 pj_ansi_to_unicode(title, strlen(title), wtitle, PJ_ARRAY_SIZE(wtitle)); … … 278 277 279 278 /* Called when pjsua is stopped */ 280 pj_bool_t lib_on_stopped(pj_bool_t restart, int argc, char** argv)279 void PjsuaOnStopped(pj_bool_t restart, int argc, char** argv) 281 280 { 282 281 if (restart) { 283 restart_argc = argc;284 restart_argv = argv;282 start_argc = argc; 283 start_argv = argv; 285 284 286 285 // Schedule Lib Restart … … 290 289 PostMessage(g_hWndMain, WM_APP_DESTROY, 0, 0); 291 290 } 292 293 return PJ_FALSE;294 291 } 295 292 296 293 /* Called before pjsua initializing config. */ 297 void lib_on_config_init(pjsua_app_config *cfg)294 void PjsuaOnConfig(pjsua_app_config *cfg) 298 295 { 299 296 PJ_UNUSED_ARG(cfg); 300 297 } 301 298 302 void LibInit() 303 { 304 char* argv[] = { 305 "", 306 "--use-cli", 307 "--cli-telnet-port=0", 308 "--no-cli-console" 309 }; 310 app_cfg_t app_cfg; 299 void PjsuaInit() 300 { 301 pjsua_app_cfg_t app_cfg; 311 302 pj_status_t status; 312 303 304 /* Destroy pjsua app first */ 305 pjsua_app_destroy(); 306 307 /* Init pjsua app */ 313 308 pj_bzero(&app_cfg, sizeof(app_cfg)); 314 app_cfg.argc = PJ_ARRAY_SIZE(argv);315 app_cfg.argv = argv;316 app_cfg.on_started = & lib_on_started;317 app_cfg.on_stopped = & lib_on_stopped;318 app_cfg.on_config_init = & lib_on_config_init;309 app_cfg.argc = start_argc; 310 app_cfg.argv = start_argv; 311 app_cfg.on_started = &PjsuaOnStarted; 312 app_cfg.on_stopped = &PjsuaOnStopped; 313 app_cfg.on_config_init = &PjsuaOnConfig; 319 314 320 315 SetWindowText(g_hWndLbl, _T("Initializing..")); 321 status = app_init(&app_cfg);316 status = pjsua_app_init(&app_cfg); 322 317 if (status != PJ_SUCCESS) 323 318 goto on_return; 324 319 325 320 SetWindowText(g_hWndLbl, _T("Starting..")); 326 status = app_run(PJ_FALSE);321 status = pjsua_app_run(PJ_FALSE); 327 322 if (status != PJ_SUCCESS) 328 323 goto on_return; … … 333 328 } 334 329 335 void LibDestroy() 336 { 337 app_destroy(); 338 } 339 340 void LibRestart() 341 { 342 app_cfg_t app_cfg; 343 pj_status_t status; 344 345 /* Destroy pjsua app first */ 346 347 app_destroy(); 348 349 /* Reinit pjsua app */ 350 351 pj_bzero(&app_cfg, sizeof(app_cfg)); 352 app_cfg.argc = restart_argc; 353 app_cfg.argv = restart_argv; 354 app_cfg.on_started = &lib_on_started; 355 app_cfg.on_stopped = &lib_on_stopped; 356 app_cfg.on_config_init = &lib_on_config_init; 357 358 status = app_init(&app_cfg); 359 if (status != PJ_SUCCESS) { 360 SetWindowText(g_hWndLbl, _T("app_init() failed")); 361 return; 362 } 363 364 /* Run pjsua app */ 365 366 status = app_run(PJ_FALSE); 367 if (status != PJ_SUCCESS) { 368 SetWindowText(g_hWndLbl, _T("app_run() failed")); 369 return; 370 } 371 } 372 330 void PjsuaDestroy() 331 { 332 pjsua_app_destroy(); 333 } 373 334 374 335 /* === MAIN === */ … … 390 351 g_hInst = hInstance; 391 352 392 status = gui_init(); 353 // Start GUI 354 status = GuiInit(); 393 355 if (status != 0) 394 356 goto on_return; 395 357 396 // Start the engine 358 // Setup args and start pjsua 359 start_argc = pjsua_app_def_argc; 360 start_argv = (char**)pjsua_app_def_argv; 397 361 PostMessage(g_hWndMain, WM_APP_INIT, 0, 0); 398 362 399 status = gui_start();363 status = GuiStart(); 400 364 401 365 on_return: 402 LibDestroy();403 gui_destroy();366 PjsuaDestroy(); 367 GuiDestroy(); 404 368 405 369 return status;
Note: See TracChangeset
for help on using the changeset viewer.