Changeset 5005


Ignore:
Timestamp:
Mar 20, 2015 10:19:12 AM (6 years ago)
Author:
nanang
Message:

Misc (re #1782): Setup log writer function on pjsua CLI (useful for debugging library initialization).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/android/jni/pjsua_app_callback.cpp

    r4496 r5005  
    2424#if defined(PJ_ANDROID) && PJ_ANDROID != 0 
    2525 
     26#include <android/log.h> 
     27 
    2628static PjsuaAppCallback* registeredCallbackObject = NULL; 
    2729static pjsua_app_cfg_t android_app_config; 
     
    3335#define THIS_FILE       "pjsua_app_callback.cpp" 
    3436 
     37extern "C" { 
     38static void log_writer(int level, const char *data, int len) 
     39{ 
     40    __android_log_write(ANDROID_LOG_INFO, "pjsua", data); 
     41} 
     42} 
     43 
     44 
    3545/** Callback wrapper **/ 
    36 void on_cli_started(pj_status_t status, const char *msg) 
     46static void on_cli_config(pjsua_app_config *cfg) 
     47{ 
     48    cfg->log_cfg.cb = &log_writer; 
     49} 
     50 
     51static void on_cli_started(pj_status_t status, const char *msg) 
    3752{ 
    3853    char errmsg[PJ_ERR_MSG_SIZE]; 
     
    4661} 
    4762 
    48 void on_cli_stopped(pj_bool_t restart, int argc, char **argv) 
     63static void on_cli_stopped(pj_bool_t restart, int argc, char **argv) 
    4964{ 
    5065    if (restart) { 
     
    8398    pj_bzero(&android_app_config, sizeof(android_app_config)); 
    8499 
     100    android_app_config.on_config_init = &on_cli_config; 
    85101    android_app_config.on_started = &on_cli_started; 
    86102    android_app_config.on_stopped = &on_cli_stopped; 
Note: See TracChangeset for help on using the changeset viewer.