std::string getDate::getInfo(int types) { std::string retInfo; switch(types) { case cpuInfo: retInfo = getCpuInfo(); break; case memInfo: retInfo = getMemInfo(); break; case netInfo: retInfo = getNetInfo(); break; case diskInfo: retInfo = getDiskInfo(); break; } return retInfo; }
int uac_init(const char *conf) { if(conf==NULL) conf=DEFAULT_CFG; if(check_conf(conf)<1) { printf("check_conf error\n"); return 0; } user_type=0; call_type=0; invite_user_type=0; invite_type=0; RegisterCon=(RegisterContext*)malloc(sizeof(RegisterContext)); init_Contextconf(device_info.cfgFile); //对注册上下文结构的初始化,在opensips中它同样存在 csenn_eXosip_launch(); static char eXosip_server_id[CHARLEN];// = "34020000001180000002"; static char eXosip_server_ip[CHARLEN];// = "192.168.17.127";//"123456";// static char eXosip_server_port[CHARLEN];// = "5060"; static char eXosip_ipc_id[CHARLEN];// = "11111";//"34020000001180000002";// static char eXosip_ipc_pwd[CHARLEN];// = "123456";//"12345678";// static char eXosip_ipc_ip[CHARLEN];// = "192.168.171.128"; static char eXosip_ipc_port[CHARLEN];// = "5060"; static char radius_id[CHARLEN];// = "5060"; //static char sipserver_id[50];// = "5060"; get_conf_value( "radius_id" , radius_id , device_info.cfgFile); get_conf_value( "server_id" , eXosip_server_id , device_info.cfgFile); get_conf_value( "server_ip" , eXosip_server_ip , device_info.cfgFile); get_conf_value( "server_port" , eXosip_server_port , device_info.cfgFile); get_conf_value( "self_id" , eXosip_ipc_id , device_info.cfgFile); get_conf_value( "self_password" , eXosip_ipc_pwd , device_info.cfgFile); getNetInfo( eXosip_ipc_ip , NULL ); get_conf_value( "self_port" , eXosip_ipc_port , device_info.cfgFile); char user_type_temp[CHARLEN]; get_conf_value("self_type",user_type_temp,device_info.cfgFile); if(strcmp(user_type_temp,"IPC")==0) { user_type=USER_TYPE_IPC; } else if(strcmp(user_type_temp,"CLIENT")==0) { user_type=USER_TYPE_CLIENT; } else if(strcmp(user_type_temp,"NVR")==0) { user_type=USER_TYPE_NVR; } device_info.server_id = eXosip_server_id; device_info.server_ip = eXosip_server_ip; device_info.server_port = eXosip_server_port; device_info.ipc_id = eXosip_ipc_id; device_info.ipc_pwd = eXosip_ipc_pwd; device_info.ipc_ip = eXosip_ipc_ip; device_info.ipc_port = eXosip_ipc_port; device_info.radius_id = radius_id; //auth_request_packet_data=NULL; //csenn_eXosip_callback.csenn_eXosip_getDeviceInfo(&device_info); while (csenn_eXosip_init()); return 1; }
//----------------------------------------------------------------------------- NetConnectInfo* ServerNetApplyManager::getServerNetInfo() { return getNetInfo(mServerDriver); }
//----------------------------------------------------------------------------- NetConnectInfo* ServerNetApplyManager::getClientNetInfo() { return getNetInfo(mClientDriver); }
void play( const char *fileE, int ) { if ( Type != 0 && Type != 2 ) return ERROR2( "Wtyczka obsługuje tylko odczyt plików i strumienia internetowego!" ); if ( Type == 2 ) { QString tmp = loadCURL(); if ( !CURLloaded ) return ERROR2( "Nie można załadować biblioteki: "+QMPInternetf+libExt+"\n"+tmp ); } if ( fileE != curF ) clrPos(); clrSet(); QString BLAD; if ( Type == 0 ) BLAD = "Błąd odczytu pliku!"; else if ( Type == 2 ) BLAD = "Nie można otworzyć strumienia internetowego!"; musicfile = mpg123_new(NULL, NULL); if ( Type == 0 ) { fd = qmp_open( fileE, O_RDONLY|O_BINARY ); mpg123_open_fd( musicfile, fd ); } if ( Type == 2 ) { title = "Czekaj, trwa otwieranie..."; mpg123_open_feed( musicfile ); f = url_fopen(fileE,0,1); if ( !f ) return ERROR(BLAD); if ( !getDataBuff( f, url_fread, _DATA_BUFF, &data, &bolStop ) ) return ERROR(BLAD); url_fread(data+10, 1, _DATA_BUFF-10, f); if ( getNetInfo( f, FILE_SIZE ) > 0.0 ) knownSize = true; mpg123_decode( musicfile, (const unsigned char*)data, _DATA_BUFF, 0,0,0 ); } if ( !musicfile ) return ERROR(BLAD); curF = fileE; if ( !MP3Update() ) return ERROR(BLAD); if ( Type == 2 && title.isEmpty() ) title = fileE; if ( Type == 2 || ( Type == 0 && fileE[0] == '/' && fileE[1] == '/' ) ) QOut->useQMPBuffer(); QOut->Init( AudioInfo( rate, 16, chn ), true, 0, fileE, /*title*/Title ); if ( *QOut->PlErr ) { *QOut->PlErr = false; return ERROR("Błąd zwraca wtyczka wyjściowa!"); } IsPlaying = true; size_t bDecoded = 0; audio_buffer = new char[BUF_SIZE]; TMPint = 0; int musErr = 0; for(;;) { if ( bolStop ) break; if ( !IsPaused ) { if ( !*QOut->mustReset ) { if ( doSeek ) { mpg123_seek( musicfile, doSeek, SEEK_SET ); QOut->control( QOUT_NEXT_READ ); doSeek = 0; } musErr = mpg123_read( musicfile, (unsigned char*)audio_buffer, BUF_SIZE, &bDecoded ); if ( musErr == MPG123_DONE ) break; if ( musErr == MPG123_ERR && !searchParts ) break; QOut->Play( audio_buffer, bDecoded, pltime, false ); MP3Update2( bDecoded ); if ( musErr == MPG123_NEED_MORE && Type != 0 ) { int bread = url_fread( data, 1, _DATA_BUFF, f ); if ( ( !bread && !wait4Data ) || ( !bread && url_feof(f) ) ) break; else if ( !bread ) MYsleep( 25 ); mpg123_decode( musicfile, (const unsigned char*)data, bread, NULL, 0, NULL ); } } else QOut->Play(0,0,pltime,true); } else QOut->Play(0,0,pltime,true); } STOP(); }