static void JSONSettings(const KVPairs & key_value_pairs, FILE * stream_file) { ServeHeader(stream_file, 200, "OK", false, "text/plain"); IPAddress ip; fprintf(stream_file, "{\n"); #ifdef ARDUINO ip = GetIP(); fprintf_P(stream_file, PSTR("\t\"ip\" : \"%d.%d.%d.%d\",\n"), ip[0], ip[1], ip[2], ip[3]); ip = GetNetmask(); fprintf_P(stream_file, PSTR("\t\"netmask\" : \"%d.%d.%d.%d\",\n"), ip[0], ip[1], ip[2], ip[3]); ip = GetGateway(); fprintf_P(stream_file, PSTR("\t\"gateway\" : \"%d.%d.%d.%d\",\n"), ip[0], ip[1], ip[2], ip[3]); ip = GetNTPIP(); fprintf_P(stream_file, PSTR("\t\"NTPip\" : \"%d.%d.%d.%d\",\n"), ip[0], ip[1], ip[2], ip[3]); fprintf_P(stream_file, PSTR("\t\"NTPoffset\" : \"%d\",\n"), GetNTPOffset()); #endif fprintf_P(stream_file, PSTR("\t\"webport\" : \"%u\",\n"), GetWebPort()); fprintf_P(stream_file, PSTR("\t\"ot\" : \"%d\",\n"), GetOT()); ip = GetWUIP(); fprintf_P(stream_file, PSTR("\t\"wuip\" : \"%d.%d.%d.%d\",\n"), ip[0], ip[1], ip[2], ip[3]); fprintf_P(stream_file, PSTR("\t\"wutype\" : \"%s\",\n"), GetUsePWS() ? "pws" : "zip"); fprintf_P(stream_file, PSTR("\t\"zip\" : \"%ld\",\n"), (long) GetZip()); fprintf_P(stream_file, PSTR("\t\"sadj\" : \"%ld\",\n"), (long) GetSeasonalAdjust()); char ak[17]; GetApiKey(ak); fprintf_P(stream_file, PSTR("\t\"apikey\" : \"%s\",\n"), ak); GetPWS(ak); ak[11] = 0; fprintf_P(stream_file, PSTR("\t\"pws\" : \"%s\"\n"), ak); fprintf(stream_file, "}"); }
//eth0 ,eth0:1 //获取实际网口的网络信息 int sys_get_network(int eth, unsigned int *ip, unsigned int *gateway, unsigned int *netmask) { if(eth != ETH0 && eth != ETH0_1) { ERR_PRN("eth %d is invaild\n", eth); return -1; } int dhcp = 0; dhcp = g_network_info.dhcp[eth]; //static ip info if(dhcp == 0) { *ip = g_network_info.dwAddr[eth]; *gateway = g_network_info.dwGateWay[eth]; *netmask = g_network_info.dwNetMask[eth]; return 0; } else if(dhcp == 1) { //just eht0 have dhcp if(eth != ETH0) { ERR_PRN("eth %d is invaild\n", eth); return -1; } *ip = GetIPaddr("eth0"); *netmask = GetNetmask("eth0"); *gateway = GetBroadcast("eth0"); return 0; } return -1; }
String IPV4IFInformation::print(void) const { String retval, holdvar; Uint32 hold_int; char render_uint32[10]; /* big enough to hold a uint32 in decimal, plus * a few bytes */ retval = "Interface \"" + GetInterface() + "\": " + GetEncapsulation(); if (GetHWAddr() != "") retval.append(" on hardware address " + GetHWAddr()); retval.append("."); if (address.is_valid()) { retval.append(" Configured on address " + GetAddress()); if (bcast.is_valid()) { retval.append(" with broadcast address " + GetBcast()); } else { retval.append(" with no broadcast address "); } retval.append(" and netmask " + GetNetmask() + "."); } retval.append(" MTU is "); try { hold_int = GetMTU(); sprintf(render_uint32, "%u.", hold_int); holdvar.append(render_uint32); } catch (AccessedInvalidData &e) { holdvar = "unset."; } retval.append(holdvar); holdvar = ""; try { hold_int = GetInterrupt(); sprintf(render_uint32, "%u", hold_int); holdvar = " Configured on interrupt " + String(render_uint32) + "."; } catch (AccessedInvalidData &e) { } retval.append(holdvar); holdvar = ""; try { hold_int = GetBaseAddr(); sprintf(render_uint32, "%x", hold_int); holdvar = " Located at base address 0x" + String(render_uint32) + "."; } catch (AccessedInvalidData &e) { } retval.append(holdvar); return retval; }
void GetRouterLocal(char *dev) { struct ifreq ifr; int fd; fd = CreateSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); memcpy(ifr.ifr_name, dev, IFNAMSIZ); src_mac = GetMac(fd, dev); src_ip = GetIp(fd, dev); netmask = GetNetmask(fd, dev); router_ip = GetRouterIp(); broadcast = GetBroadcast(fd, dev); }
/* ############################################## ##Int ModuleResize(Int argc, Char *argv[]) ############################################## */ Int ModuleResize(Int argc, Char *argv[]) { Uns initMask = 0; Int status = EXIT_SUCCESS; Rendezvous_Attrs rzvAttrs = Rendezvous_Attrs_DEFAULT; Fifo_Attrs fAttrs = Fifo_Attrs_DEFAULT; Rendezvous_Handle hRendezvousInit = NULL; Rendezvous_Handle hRendezvousWriter = NULL; Rendezvous_Handle hRendezvousCleanup = NULL; Int numThreads = 0; pthread_t id_listen[5] = {0}; Void *ret; char devicebuf[16] = {0}; CaptureEnv captureEnv; WriterEnv writerEnv; WriterEnv writerLowRateEnv; DetectEnv detectEnv; VideoEnv videoEnv; VideoEnv videoLowRateEnv;//dd VideoEnv LowRateResize; AudioEnv audioEnv; CtrlEnv ctrlEnv; char box_version[64] = {0}; OutputVideoInfo outputhandle; textinfo *texthandle; int DHCPVAL = 0, tmp = 0; char gateway[255] = {0}; struct sched_param schedParam; pthread_t captureThread; pthread_t detectThread; pthread_t writerThread; pthread_t writerLowThread; pthread_t videoThread; pthread_t audioThread; pthread_t videoLowThread; pthread_t resizeLowThread; #ifdef DSS_ENC_1100_1200 pthread_t webListenThread; #endif pthread_attr_t attr; int index = 0; int result = 0; char ts_version[128] = {0}; /* Zero out the thread environments */ Dmai_clear(captureEnv); Dmai_clear(writerEnv); Dmai_clear(videoEnv); Dmai_clear(audioEnv); Dmai_clear(ctrlEnv); mid_task_init(); trace_init(); open_gpio_port(); ts_build_get_version(ts_version, sizeof(ts_version)); strcpy(box_version, BOX_VER); strcat(box_version, CODE_TYPE); strcat(box_version, DEUBG); printf("[%s] Module Encode Program %s V%s\n", CODE_COND, BOARD_TYPE, box_version); printf("the build time is %s,the git vesion is %s.the ts version is %s\n\n", g_make_build_date, _VERSION, ts_version); initMutexPthread(); InitgblCommonMutex(); InitSysParams(); initOutputVideoParam(); InitHVTable(&gHVTable); // webgetDHCPFlag(tmp, &DHCPVAL); // readDHCPValue(DHCPCONFIG_FILE, &DHCPVAL); // setDHCPFlag(DHCPVAL); gLogoinfo = initLogoMod(); initTextinfo(); ReadEncodeParamTable(CONFIG_NAME, &gSysParaT); DHCPVAL = gSysParaT.sysPara.nTemp[0]; printf("----mic=%x:%x:%x:%x:%x:%x\n",gSysParaT.sysPara.szMacAddr[0],gSysParaT.sysPara.szMacAddr[1],gSysParaT.sysPara.szMacAddr[2], gSysParaT.sysPara.szMacAddr[3],gSysParaT.sysPara.szMacAddr[4],gSysParaT.sysPara.szMacAddr[5]); ReadLowbitParamTable(LOWBIT_PARAM, &gSysParaT); memset(&outputhandle, 0, sizeof(OutputVideoInfo)); getOutputvideohandle(&outputhandle); readOutputVideoParam(VIDEOENCODE_FILE, &outputhandle); setOutputvideohandle(&outputhandle); //sleep(10); ReadLogoinfo(LOGOCONFIGNAME, gLogoinfo); //setLogoInfoHandle(logoEnv); //sleep(10); texthandle = getTextInfoHandle(); readTextFromfile(ADDTEXT_FILE, texthandle); // DEBUG(DL_DEBUG, "%d,%d,%d,%d,%d,%d,%s\n", DHCPVAL, texthandle->xpos, texthandle->ypos, // texthandle->enable, texthandle->showtime, texthandle->alpha, texthandle->msgtext); // sleep(10); #ifdef DSS_ENC_1100_1200 ReadProtocolIni(PROTOCOL_NAME, &gProtocol); #endif ReadRemoteCtrlIndex(REMOTE_NAME, &index); /*Read I frames Interval*/ ReadIframeInterval(IFRAMES_NAME); /*green Save Module*/ app_init_green_adjust_module(); #ifdef CL4000_DVI app_init_screen_adjust_module(); #endif gblSetRemoteIndex(index); ReadHVTable(&gHVTable, 0); ReadHVTable(&gHVTable, 1); #ifdef CL4000_DVI_SDI ReadIPParamTable(IP_PARAM, &gSysParaT); #endif if(DHCPVAL) { printf("i will set dhcp.\n"); #if 1 system("kill -1 `cat /var/run/dhcpcd-eth0.pid`"); system("/sbin/dhcpcd eth0"); system("ifconfig eth0"); #endif gSysParaT.sysPara.dwNetMark = GetNetmask("eth0"); gSysParaT.sysPara.dwAddr = GetIPaddr("eth0"); get_gateway(gateway); gSysParaT.sysPara.dwGateWay = get_gateway(gateway); DEBUG(DL_DEBUG, "gateway =%s\n", gateway); } else { printf("i will set static ip.\n"); SetEthConfigIP(gSysParaT.sysPara.dwAddr, gSysParaT.sysPara.dwNetMark); SetEthConfigGW(gSysParaT.sysPara.dwGateWay); } system("ifconfig"); strcpy(gSysParaT.sysPara.strVer, box_version); initSetParam(); DEBUG(DL_DEBUG, "logo=%d text=%d ,texthandle->enable=%d,texthandle->showtime=%d\n", outputhandle.logo_show, outputhandle.text_show, texthandle->enable, texthandle->showtime); #ifdef DSS_ENC_1100_1200 /*open lcd initial*/ OpenLCDCom(); //matchbox ++ gblLoadIDX(); //matchbox ++ if(-2 == ReadDeviceType(DTYPECONFIG_NAME, 1)) { ReadDeviceType(DTYPECONFIG_NAME, 0); } GetDeviceType(devicebuf); DEBUG(DL_DEBUG, "DTYPECONFIG_NAME gDeviceType = %s\n", devicebuf); #endif /*取消PIPE坏的信号*/ Signal(SIGPIPE, SIG_IGN); /* Set the priority of this whole process to max (requires root) */ setpriority(PRIO_PROCESS, 0, -20); /*初始化高码流视频编码库参数*/ InitVideoEncParams(&gSysParaT.videoPara[PORT_ONE]); /*初始化低码流视频编码库参数*/ InitLowRateParams(&gSysParaT.videoPara[PORT_TWO]); /*初始化音频编码库参数*/ InitAudioEncParams(&gSysParaT.audioPara[PORT_ONE]); /* Initialize the mutex which protects the global data */ pthread_mutex_init(&gbl.mutex, NULL); /* Initialize Codec Engine runtime */ CERuntime_init(); /* Initialize Davinci Multimedia Application Interface */ Dmai_init(); closeWatchDog(); mid_timer_init(); initWatchDog(); #ifdef CL4000_DVI_SDI if(gblGetRemoteIndex() < MAX_FAR_CTRL_NUM) { result = InitRemoteStruct(gblGetRemoteIndex()); } gRemoteFD = CameraCtrlInit(PORT_COM2); if(gRemoteFD <= 0) { DEBUG(DL_ERROR, "Initial CameraCtrlInit() Error\n"); } #else #ifndef ENABLE_DEUBG if(gblGetRemoteIndex() < MAX_FAR_CTRL_NUM) { result = InitRemoteStruct(gblGetRemoteIndex()); } gRemoteFD = CameraCtrlInit(PORT_COM1); if(gRemoteFD <= 0) { DEBUG(DL_ERROR, "Initial CameraCtrlInit() Error\n"); } #endif #endif CreateTCPTask(id_listen); /* Initialize the logs. Must be done after CERuntime_init() */ /* if(TraceUtil_start(engine->engineName) != TRACEUTIL_SUCCESS) { ERR("Failed to TraceUtil_start\n"); cleanup(EXIT_FAILURE); } */ //initMask |= LOGSINITIALIZED; app_set_logoshow_flag(outputhandle.logo_show); app_set_textshow_flag(outputhandle.text_show) ; //setShowLogoTextFlag(outputhandle->logotext); addtextdisplay(texthandle); /* Determine the number of threads needing synchronization */ numThreads = 1; /*视频线程个数*/ numThreads += 7; /*音频线程个数*/ numThreads += 1; /* Create the objects which synchronizes the thread init and cleanup */ hRendezvousInit = Rendezvous_create(numThreads, &rzvAttrs); hRendezvousCleanup = Rendezvous_create(numThreads, &rzvAttrs); hRendezvousWriter = Rendezvous_create(3, &rzvAttrs); if(hRendezvousInit == NULL || hRendezvousCleanup == NULL || hRendezvousWriter == NULL) { ERR("Failed to create Rendezvous objects\n"); cleanup(EXIT_FAILURE); } /* Initialize the thread attributes */ if(pthread_attr_init(&attr)) { ERR("Failed to initialize thread attrs\n"); cleanup(EXIT_FAILURE); } /* Force the thread to use custom scheduling attributes */ if(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) { ERR("Failed to set schedule inheritance attribute\n"); cleanup(EXIT_FAILURE); } /* Set the thread to be fifo real time scheduled */ if(pthread_attr_setschedpolicy(&attr, SCHED_FIFO)) { ERR("Failed to set FIFO scheduling policy\n"); cleanup(EXIT_FAILURE); } /* Create the capture fifos */ captureEnv.to_video_c = Fifo_create(&fAttrs); captureEnv.from_video_c = Fifo_create(&fAttrs); captureEnv.to_resize_c = Fifo_create(&fAttrs); captureEnv.from_resize_c = Fifo_create(&fAttrs); if(captureEnv.to_video_c == NULL || captureEnv.from_video_c == NULL || captureEnv.to_resize_c == NULL || captureEnv.from_resize_c == NULL) { ERR("Failed to open display fifos\n"); cleanup(EXIT_FAILURE); } LowRateResize.to_videoresize_c = Fifo_create(&fAttrs); LowRateResize.from_videoresize_c = Fifo_create(&fAttrs); if(LowRateResize.to_videoresize_c == NULL || LowRateResize.from_videoresize_c == NULL) { ERR("Failed to open Resize fifos\n"); cleanup(EXIT_FAILURE); } /* Set the capture thread priority */ schedParam.sched_priority = CAPTURE_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } /* Create the capture thread */ captureEnv.hRendezvousInit = hRendezvousInit; captureEnv.hRendezvousCleanup = hRendezvousCleanup; DEBUG(DL_DEBUG, "captureThrFxn thread!!!!\n"); if(pthread_create(&captureThread, &attr, captureThrFxn, &captureEnv)) { ERR("Failed to create capture thread\n"); cleanup(EXIT_FAILURE); } /* Create the writer fifos */ writerEnv.to_video_c = Fifo_create(&fAttrs); writerEnv.from_video_c = Fifo_create(&fAttrs); writerLowRateEnv.to_writelow_c = Fifo_create(&fAttrs); writerLowRateEnv.from_writelow_c = Fifo_create(&fAttrs); if(writerEnv.to_video_c == NULL || writerEnv.from_video_c == NULL || writerLowRateEnv.to_writelow_c == NULL || writerLowRateEnv.from_writelow_c == NULL) { ERR("Failed to open display fifos\n"); cleanup(EXIT_FAILURE); } initMask |= CAPTURETHREADCREATED ; /*detect thread*/ detectEnv.hRendezvousInit = hRendezvousInit; detectEnv.hRendezvousCleanup = hRendezvousCleanup; /* Set the video thread priority */ schedParam.sched_priority = DETECT_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } if(pthread_create(&detectThread, &attr, detectThrFxn, &detectEnv)) { ERR("Failed to create detect thread\n"); cleanup(EXIT_FAILURE); } initMask |= DETECTTHREADCREATED ; /* Set the video thread priority */ schedParam.sched_priority = VIDEO_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } DEBUG(DL_DEBUG, "videoThrFxn thread!!!!\n"); /* Create the video thread */ videoEnv.hRendezvousInit = hRendezvousInit; videoEnv.hRendezvousCleanup = hRendezvousCleanup; videoEnv.hRendezvousWriter = hRendezvousWriter; videoEnv.to_capture = captureEnv.from_video_c; videoEnv.from_capture = captureEnv.to_video_c; videoEnv.to_writer = writerEnv.from_video_c; videoEnv.from_writer = writerEnv.to_video_c; videoEnv.videoEncoder = engine->videoEncoders->codecName; videoEnv.engineName = engine->engineName; if(pthread_create(&videoThread, &attr, videoThrFxn, &videoEnv)) { ERR("Failed to create video thread\n"); cleanup(EXIT_FAILURE); } initMask |= VIDEOTHREADCREATED; /* Create the videoResize thread */ videoLowRateEnv.hRendezvousInit = hRendezvousInit; videoLowRateEnv.hRendezvousCleanup = hRendezvousCleanup; videoLowRateEnv.hRendezvousWriter = hRendezvousWriter; videoLowRateEnv.to_resize = LowRateResize.from_videoresize_c; videoLowRateEnv.from_resize = LowRateResize.to_videoresize_c; videoLowRateEnv.from_writer = writerLowRateEnv.to_writelow_c; videoLowRateEnv.to_writer = writerLowRateEnv.from_writelow_c; videoLowRateEnv.videoEncoder = engine->videoEncoders->codecName; videoLowRateEnv.engineName = engine->engineName; DEBUG(DL_DEBUG, "videoLowRateThrFxn thread!!!!\n"); if(pthread_create(&videoLowThread, &attr, videoLowRateThrFxn, &videoLowRateEnv)) { ERR("Failed to create video thread\n"); cleanup(EXIT_FAILURE); } initMask |= VIDEOLOWRATETHREAD; /* Create the video thread */ LowRateResize.hRendezvousInit = hRendezvousInit; LowRateResize.hRendezvousCleanup = hRendezvousCleanup; LowRateResize.hRendezvousWriter = hRendezvousWriter; LowRateResize.from_capture = captureEnv.to_resize_c; LowRateResize.to_capture = captureEnv.from_resize_c; LowRateResize.videoEncoder = engine->videoEncoders->codecName; LowRateResize.engineName = engine->engineName; /* Set the video thread priority */ schedParam.sched_priority = VIDEO_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } DEBUG(DL_DEBUG, "ResizeLowThrFxn thread!!!!\n"); if(pthread_create(&resizeLowThread, &attr, ResizeLowThrFxn, &LowRateResize)) { ERR("Failed to create video thread\n"); cleanup(EXIT_FAILURE); } initMask |= RESIZELOWRATETHREAD; Rendezvous_meet(hRendezvousWriter); /* Set the writer thread priority */ schedParam.sched_priority = WRITER_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } /* Create the writer thread */ writerEnv.hRendezvousInit = hRendezvousInit; writerEnv.hRendezvousCleanup = hRendezvousCleanup; writerEnv.outBufSize = videoEnv.outBufSize; DEBUG(DL_DEBUG, "writerThrFxn thread!!!!\n"); if(pthread_create(&writerThread, &attr, writerThrFxn, &writerEnv)) { ERR("Failed to create writer thread\n"); cleanup(EXIT_FAILURE); } initMask |= WRITERTHREADCREATED; /* Create the writer thread */ writerLowRateEnv.hRendezvousInit = hRendezvousInit; writerLowRateEnv.hRendezvousCleanup = hRendezvousCleanup; writerLowRateEnv.outBufSize = videoLowRateEnv.outBufSize; DEBUG(DL_DEBUG, "writerLowThrFxn thread!!!!\n"); if(pthread_create(&writerLowThread, &attr, writerLowThrFxn, &writerLowRateEnv)) { ERR("Failed to create writerResize thread\n"); cleanup(EXIT_FAILURE); } initMask |= WRITELOWRATETHREAD; /* Set the thread priority */ schedParam.sched_priority = AUDIO_THREAD_PRIORITY; if(pthread_attr_setschedparam(&attr, &schedParam)) { ERR("Failed to set scheduler parameters\n"); cleanup(EXIT_FAILURE); } DEBUG(DL_DEBUG, "Audio thread Function!!!!\n"); /* Create the audio thread */ audioEnv.hRendezvousInit = hRendezvousInit; audioEnv.hRendezvousCleanup = hRendezvousCleanup; audioEnv.engineName = engine->engineName; audioEnv.audioEncoder = engine->audioEncoders->codecName; if(pthread_create(&audioThread, &attr, audioThrFxn, &audioEnv)) { ERR("Failed to create speech thread\n"); cleanup(EXIT_FAILURE); } initMask |= AUDIOTHREADCREATED; #ifdef DSS_ENC_1100_1200 if(pthread_create(&webListenThread, &attr, weblistenThrFxn, NULL)) { ERR("Failed to create web listen thread\n"); cleanup(EXIT_FAILURE); } initMask |= WEBLISTENCREATED; #endif /* Main thread becomes the control thread */ ctrlEnv.hRendezvousInit = hRendezvousInit; ctrlEnv.hRendezvousCleanup = hRendezvousCleanup; ctrlEnv.engineName = engine->engineName; ret = ctrlThrFxn(&ctrlEnv); if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } DEBUG(DL_DEBUG, "Exit All Thread!!\n"); cleanup: /* Make sure the other threads aren't waiting for init to complete */ if(hRendezvousWriter) { Rendezvous_force(hRendezvousWriter); } if(hRendezvousInit) { Rendezvous_force(hRendezvousInit); } DEBUG(DL_DEBUG, "EXIT Common Mutex!!!\n"); DestorygblCommonMutex(); DEBUG(DL_DEBUG, "EXIT pthread Mutex!!!\n"); DestroyMutexPthread(); if(initMask & AUDIOTHREADCREATED) { if(pthread_join(audioThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } DEBUG(DL_DEBUG, "EXIT audio pThread!!!\n"); if(initMask & VIDEOTHREADCREATED) { if(pthread_join(videoThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } DEBUG(DL_DEBUG, "EXIT video pThread!!!\n"); if(initMask & WRITERTHREADCREATED) { if(pthread_join(writerThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } DEBUG(DL_DEBUG, "EXIT write pThread!!!\n"); if(initMask & CAPTURETHREADCREATED) { if(pthread_join(captureThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } DEBUG(DL_DEBUG, "EXIT capture pThread!!!\n"); if(initMask & VIDEOLOWRATETHREAD) { if(pthread_join(videoLowThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } if(initMask & RESIZELOWRATETHREAD) { if(pthread_join(resizeLowThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } if(initMask & WRITELOWRATETHREAD) { if(pthread_join(writerLowThread, &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } } if(pthread_join(id_listen[PORT_ONE], &ret) == 0) { if(ret == THREAD_FAILURE) { status = EXIT_FAILURE; } } if(captureEnv.to_video_c) { Fifo_delete(captureEnv.to_video_c); } if(captureEnv.from_video_c) { Fifo_delete(captureEnv.from_video_c); } if(captureEnv.to_resize_c) { Fifo_delete(captureEnv.to_resize_c); } if(captureEnv.from_resize_c) { Fifo_delete(captureEnv.from_resize_c); } if(writerEnv.to_video_c) { Fifo_delete(writerEnv.to_video_c); } if(writerEnv.from_video_c) { Fifo_delete(writerEnv.from_video_c); } if(writerLowRateEnv.from_writelow_c) { Fifo_delete(writerLowRateEnv.from_video_c); } if(writerLowRateEnv.to_writelow_c) { Fifo_delete(writerLowRateEnv.to_writelow_c); } if(LowRateResize.to_videoresize_c) { Fifo_delete(LowRateResize.to_videoresize_c); } if(LowRateResize.from_videoresize_c) { Fifo_delete(LowRateResize.from_videoresize_c); } DEBUG(DL_DEBUG, "EXIT Rendezvous cleanup pThread!!!\n"); if(hRendezvousCleanup) { Rendezvous_delete(hRendezvousCleanup); } DEBUG(DL_DEBUG, "EXIT Rendezvous init pThread!!!\n"); if(hRendezvousInit) { Rendezvous_delete(hRendezvousInit); } DEBUG(DL_DEBUG, "EXIT Rendezvous cleanup pThread!!!\n"); /* if (initMask & LOGSINITIALIZED) { TraceUtil_stop(); } */ DEBUG(DL_DEBUG, "EXIT TraceUtil_stop !!!\n"); pthread_mutex_destroy(&gbl.mutex); DEBUG(DL_DEBUG, "process EXIT!!!\n"); exit(1); }
/** * @brief Send commands. * Send commands to system server. * @param field [I ] command. * @param *data [I ] pointer to data needed for command. * @param len [I ] Data size. * @return Function to excute command. * @retval -1 Fail to send command. */ int ControlSystemData(unsigned int field, void *data, unsigned int len) { int ret = 0; if(len == 0 || data == NULL) return -1; switch(field){ case SFIELD_GET_DHCPC_ENABLE: ret = GetDhcpEn(data, len); break; case SFIELD_GET_HTTPPORT: ret = GetHttpPort(data, len); break; case SFIELD_GET_SNTP_FQDN: ret = GetSntpFqdn(data, len); break; case SFIELD_GET_DEVICE_TYPE: ret = GetDeviceType(data, len); break; case SFIELD_GET_TITLE: ret = GetTitle(data, len); break; case SFIELD_GET_REGUSR: ret = GetRegUsr(data, len); break; case SFIELD_GET_OSDTEXT: ret = GetOSDText(data, len); break; case SFIELD_GET_MAC: ret = GetMAC(data, len); break; case SFIELD_GET_IP: ret = GetIP(data, len); break; case SFIELD_GET_GATEWAY: ret = GetGateway(data, len); break; case SFIELD_GET_NETMASK: ret = GetNetmask(data, len); break; case SFIELD_GET_FTP_SERVER_IP: ret = GetFtpServerIp(data, len); break; case SFIELD_GET_FTP_USERNAME: ret = GetFtpUsername(data, len); break; case SFIELD_GET_FTP_PASSWORD: ret = GetFtpPassword(data, len); break; case SFIELD_GET_FTP_FOLDNAME: ret = GetFtpFoldername(data, len); break; case SFIELD_GET_FTP_IMAGEAMOUNT: ret = GetFtpImageAmount(data, len); break; case SFIELD_GET_FTP_PID: ret = GetFtpPid(data, len); break; case SFIELD_GET_FTP_PORT: ret = GetSysFtpPort(data, len); break; case SFIELD_GET_SMTP_SERVER_IP: ret = GetSmtpServerIp(data, len); break; case SFIELD_GET_SMTP_PORT: ret = GetSmtpServerPort(data, len); break; case SFIELD_GET_SMTP_AUTHENTICATION: ret = GetSmtpAuthentication(data, len); break; case SFIELD_GET_SMTP_USERNAME: ret = GetsmtpUsername(data, len); break; case SFIELD_GET_SMTP_PASSWORD: ret = GetSmtpPassword(data, len); break; case SFIELD_GET_SMTP_SENDER_EMAIL_ADDRESS: ret = GetSmtpSenderEmail(data, len); break; case SFIELD_GET_SMTP_RECEIVER_EMAIL_ADDRESS: ret = GetSmtpReceiverEmail(data, len); break; case SFIELD_GET_SMTP_CC: ret = GetSmtpCC(data, len); break; case SFIELD_GET_SD_FILE_NAME: ret = SysGetSdFileName(data, len); break; case SFIELD_GET_SMTP_SUBJECT: ret = GetSmtpSubject(data, len); break; case SFIELD_GET_SMTP_TEXT: ret = GetSmtpText(data, len); break; case SFIELD_GET_SMTP_ATTACHMENTS: ret = GetSmtpAttachments(data, len); break; case SFIELD_GET_SMTP_VIEW: ret = GetSmtpView(data, len); break; /*case SFIELD_GET_UPNP_PORT: ret = GetSysUpnpPort(data, len); break;*/ case SFIELD_SET_NETMASK: ret = SetNetMask(data, len); break; case SFIELD_SET_TIMEFORMAT: ret = SetSysTimeFormat(data, len); break; case SFIELD_SET_DAYLIGHT: ret = SetSysDaylight(data, len); break; case SFIELD_SET_TIMEZONE: ret = SetSysTimeZone(data, len); break; case SFIELD_SET_IP: ret = SetIp(data, len); break; case SFIELD_SET_HTTPPORT: ret = SetHttpPort(data, len); break; case SFIELD_SET_TITLE: ret = SetTitle(data, len); break; case SFIELD_SET_REGUSR: ret = SetRegUsr(data, len); break; case SFIELD_SET_OSDTEXT: ret = SetOSDText(data, len); break; case SFIELD_SET_GATEWAY: ret = SetGateway(data, len); break; case SFIELD_SET_DHCPC_ENABLE: ret = SetDhcpEnable(data, len); break; case SFIELD_SET_FTP_SERVER_IP: ret = SetSysFtpFqdn(data, len); break; case SFIELD_SET_FTP_USERNAME: ret = SetFtpUsername(data, len); break; case SFIELD_SET_FTP_PASSWORD: ret = SetFtpPassword(data, len); break; case SFIELD_SET_FTP_FOLDNAME: ret = SetFtpFoldname(data, len); break; case SFIELD_SET_FTP_IMAGEAMOUNT: ret = SetFtpImageacount(data, len); break; case SFIELD_SET_FTP_PID: ret = SetFtpPid(data, len); break; case SFIELD_SET_FTP_PORT: ret = SetSysFtpPort(data, len); break; case SFIELD_SET_SMTP_SERVER_IP: ret = SetSmtpServerIp(data, len); break; case SFIELD_SET_SMTP_PORT: ret = SetSmtpServerPort(data, len); break; case SFIELD_SET_SMTP_AUTHENTICATION: ret = SetSmtpAuthentication(data, len); break; case SFIELD_SET_SMTP_USERNAME: ret = SetSmtpUsername(data, len); break; case SFIELD_SET_SMTP_PASSWORD: ret = SetSmtpPassword(data, len); break; case SFIELD_SET_SMTP_SENDER_EMAIL_ADDRESS: ret = SetSmtpSenderEmail(data, len); break; case SFIELD_SET_SMTP_RECEIVER_EMAIL_ADDRESS: ret = SetSmtpReceiverEmail(data, len); break; case SFIELD_SET_SMTP_CC: ret = SetSmtpCC(data, len); break; case SFIELD_SET_SMTP_SUBJECT: ret = SetSmtpSubject(data, len); break; case SFIELD_SET_SMTP_TEXT: ret = SetSmtpText(data, len); break; case SFIELD_SET_SMTP_ATTACHMENTS: ret = SetSmtpAttachments(data, len); break; case SFIELD_SET_SMTP_VIEW: ret = SetSmtpView(data, len); break; case SFIELD_GET_DNS: ret = GetDns(data, len); break; case SFIELD_SET_DNS: ret = SetDns(data, len); break; case SFIELD_SET_SNTP_SERVER: ret = SetSntpServer(data, len); break; case SFIELD_SET_DAY_NIGHT: ret = SetSysDayNight(data, len); break; case SFIELD_SET_WHITE_BALANCE: ret = SetSysWhiteBalance(data, len); break; case SFIELD_SET_BACKLIGHT: ret = SetSysBacklight(data, len); break; case SFIELD_SET_BRIGHTNESS: ret = SetSysBrightness(data, len); break; case SFIELD_SET_CONTRAST: ret = SetSysContrast(data, len); break; case SFIELD_SET_SATURATION: ret = SetSysSaturation(data, len); break; case SFIELD_SET_SHARPNESS: ret = SetSysSharpness(data, len); break; case SFIELD_SET_VSTAB: ret = SetSysCommon(data, len, SYS_MSG_SET_VSTAB); break; case SFIELD_SET_LDC: ret = SetSysCommon(data, len, SYS_MSG_SET_LDC); break; case SFIELD_SET_SNF: ret = SetSysCommon(data, len, SYS_MSG_SET_SNF); break; case SFIELD_SET_TNF: ret = SetSysCommon(data, len, SYS_MSG_SET_TNF); break; case SFIELD_SET_MAXEXPOSURE: ret = SetSysCommon(data, len, SYS_MSG_SET_MAXEXPOSURE); break; case SFIELD_SET_MAXGAIN: ret = SetSysCommon(data, len, SYS_MSG_SET_MAXGAIN); break; case SFIELD_SET_EXPPRIORITY: ret = SetSysCommon(data, len, SYS_MSG_SET_EXPPRIORITY); break; case SFIELD_SET_AUDIOMODE: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIOMODE); break; case SFIELD_SET_AUDIO_ENCODE: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIO_ENCODE); break; case SFIELD_SET_AUDIO_SAMPLERATE: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIO_SAMPLERATE); break; case SFIELD_SET_AUDIO_BITRATE: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIO_BITRATE); break; case SFIELD_SET_AUDIO_ALARMLEVEL: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIO_ALARMLEVEL); break; case SFIELD_SET_AUDIOOUTVOLUME: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIOOUTVOLUME); break; case SFIELD_SET_AUDIORECEIVERENABLE: ret = SetSysAudioReceiverEnable(data, len); break; case SFIELD_SET_AUDIOSERVERIP: ret = SetSysAudioServerIp(data, len); break; case SFIELD_SET_DEFAULT: ret = SetSysCommon(data, len, SYS_MSG_SET_DEFAULT); break; case SFIELD_SET_CLEARSYSLOG: ret = SetSysClearSysLog(data, len); break; case SFIELD_SET_CLEARACCESSLOG: ret = SetSysClearAccessLog(data, len); break; case SFIELD_SET_JQUALITY: ret = SetSysJpegQuality(data, len); break; case SFIELD_SET_FDETECT: ret = SetSysfdetect(data, len); break; case SFIELD_SET_FDX: ret = SetSysfdx(data, len); break; case SFIELD_SET_FDY: ret = SetSysfdy(data, len); break; case SFIELD_SET_FDW: ret = SetSysfdw(data, len); break; case SFIELD_SET_FDH: ret = SetSysfdh(data, len); break; case SFIELD_SET_FDCONF_LEVEL: ret = SetSysfdconf(data, len); break; case SFIELD_SET_FD_DIRECTION: ret = SetSysfddir(data, len); break; case SFIELD_SET_FRECOGNITION: ret = SetSysfrecog(data, len); break; case SFIELD_SET_FRCONF_LEVEL: ret = SetSysfrconf(data, len); break; case SFIELD_SET_FR_DATABASE: ret = SetSysfrdbase(data, len); break; case SFIELD_SET_PRIVACY_MASK: ret = SetSyspmask(data, len); break; case SFIELD_SET_MASK_OPTIONS: ret = SetSyspmaskopt(data, len); break; case SFIELD_SET_ADVMODE: ret = SetSysAdvMode(data, len); break; case SFIELD_SET_MIRROR: ret = SetSysMirror(data, len); break; case SFIELD_SET_DEMOCFG: ret = SetSysDemoCfg(data, len); break; case SFIELD_SET_OSDWIN: ret = SetSysOSDWin(data, len); break; case SFIELD_SET_HISTOGRAM: ret = SetSysHistogram(data, len); break; case SFIELD_SET_DYNRANGE: ret = SetSysDynRange(data, len); break; case SFIELD_SET_OSDWINNUM: ret = SetSysOSDWinNum(data, len); break; case SFIELD_SET_OSDSTREAM: ret = SetSysOSDStream(data, len); break; case SFIELD_SET_VIDEO_MODE: ret = SetSysVideoMode(data, len); break; case SFIELD_SET_VIDEOCODECCOMBO: ret = SetSysVideoCodecCombo(data, len); break; case SFIELD_SET_VIDEOCODECRES: ret = SetSysVideoCodecRes(data, len); break; case SFIELD_SET_IMAGESOURCE: ret = SetSysImageSource(data, len); break; case SFIELD_SET_SCHEDULE: ret = SetSysSchedule(data, len); break; case SFIELD_SET_IMAGEFORMAT: ret = SetSysIMGFormat(data, len); break; case SFIELD_SET_RESOLUTION: ret = SetSysResolution(data, len); break; case SFIELD_SET_MPEG4_RES: ret = SetSysMPEG4Res(data, len); break; case SFIELD_SET_MPEG42_RES: ret = SetSysMPEG42Res(data, len); break; case SFIELD_SET_LOSTALARM: ret = SetSysLostAlarm(data, len); break; case SFIELD_SET_SDAENABLE: ret = SetSysSDAlarmEnable(data, len); break; case SFIELD_SET_AFTPENABLE: ret = SetSysFtpAlarmEnable(data, len); break; case SFIELD_SET_ASMTPENABLE: ret = SetSysSmtpAlarmEnable(data, len); break; case SFIELD_SET_ALARMDURATION: ret = SetSysAlarmDuration(data, len); break; case SFIELD_SET_AVIDURATION: ret = SetAVIDuration(data, len); break; case SFIELD_SET_AVIFORMAT: ret = SetAVIFormat(data, len); break; case SFIELD_SET_FTPFILEFORMAT: ret = SetFTPFileFormat(data, len); break; case SFIELD_SET_SDFILEFORMAT: ret = SetSDFileFormat(data, len); break; case SFIELD_SET_ATTFILEFORMAT: ret = SetAttFileFormat(data, len); break; case SFIELD_SET_AUDIOENABLE: ret = SetAudioEnable(data, len); break; case SFIELD_SET_ASMTPATTACH: ret = SetASmtpAttach(data, len); break; case SFIELD_SET_FTP_RFTPENABLE: ret = SetRftpEnable(data, len); break; case SFIELD_SET_SD_SDRENABLE: ret = SetSdReEnable(data, len); break; case SFIELD_SET_MOTIONENABLE: ret = SetMotionEnable(data, len); break; case SFIELD_SET_MOTIONCENABLE: ret = SetMotionCEnable(data, len); break; case SFIELD_SET_MOTIONLEVEL: ret = SetMotionLevel(data, len); break; case SFIELD_SET_MOTIONCVALUE: ret = SetMotionCValue(data, len); break; case SFIELD_SET_MOTIONBLOCK: ret = SetMotionBlock(data, len); break; case SFIELD_GET_DHCP_CONFIG: ret = GetSysDhcpConfig(data, len); break; case SFIELD_DEL_SCHEDULE: ret = DelSysSchedule(data, len); break; case SFIELD_SET_IMAGE2A: ret = SetSysImage2A(data, len); break; case SFIELD_SET_IMAGE2ATYPE: ret = SetSysImage2AType(data, len); break; case SFIELD_SET_BINNING: ret = SetSysBinning(data, len); break; case SFIELD_SET_BLC: ret = SetSysBLC(data, len); break; case SFIELD_SET_MPEG41_BITRATE: ret = SetMPEG41Bitrate(data, len); break; case SFIELD_SET_MPEG42_BITRATE: ret = SetMPEG42Bitrate(data, len); break; case SFIELD_SET_CLICK_SNAP_FILENAME : ret = SetSysClickSnapFilename(data, len); break; case SFIELD_SET_CLICK_SNAP_STORAGE : ret = SetSysClickSnapStorage(data, len); break; case SFIELD_SET_RATE_CONTROL1: ret = SetSysRateControl1(data, len); break; case SFIELD_SET_RATE_CONTROL2: ret = SetSysRateControl2(data, len); break; case SFIELD_SET_DSTAMPENABLE1: ret = SetSysDateStampEnable1(data, len); break; case SFIELD_SET_DSTAMPENABLE2: ret = SetSysDateStampEnable2(data, len); break; case SFIELD_SET_DSTAMPENABLE3: ret = SetSysDateStampEnable3(data, len); break; case SFIELD_SET_TSTAMPENABLE1: ret = SetSysTimeStampEnable1(data, len); break; case SFIELD_SET_TSTAMPENABLE2: ret = SetSysTimeStampEnable2(data, len); break; case SFIELD_SET_TSTAMPENABLE3: ret = SetSysTimeStampEnable3(data, len); break; case SFIELD_SET_LOGOENABLE1: ret = SetSysLogoEnable1(data, len); break; case SFIELD_SET_LOGOENABLE2: ret = SetSysLogoEnable2(data, len); break; case SFIELD_SET_LOGOENABLE3: ret = SetSysLogoEnable3(data, len); break; case SFIELD_SET_LOGO_POSITION1: ret = SetSysLogoPosition1(data, len); break; case SFIELD_SET_LOGO_POSITION2: ret = SetSysLogoPosition2(data, len); break; case SFIELD_SET_LOGO_POSITION3: ret = SetSysLogoPosition3(data, len); break; case SFIELD_SET_TEXTENABLE1: ret = SetSysTextEnable1(data, len); break; case SFIELD_SET_TEXTENABLE2: ret = SetSysTextEnable2(data, len); break; case SFIELD_SET_TEXTENABLE3: ret = SetSysTextEnable3(data, len); break; case SFIELD_SET_TEXT_POSITION1: ret = SetSysTextPosition1(data, len); break; case SFIELD_SET_TEXT_POSITION2: ret = SetSysTextPosition2(data, len); break; case SFIELD_SET_TEXT_POSITION3: ret = SetSysTextPosition3(data, len); break; case SFIELD_SET_OVERLAY_TEXT1: ret = SetSysOverlayText1(data, len); break; case SFIELD_SET_OVERLAY_TEXT2: ret = SetSysOverlayText2(data, len); break; case SFIELD_SET_OVERLAY_TEXT3: ret = SetSysOverlayText3(data, len); break; case SFIELD_SET_DETAIL_INFO1: ret = SetSysCommon(data, len, SYS_MSG_SET_DETAIL_INFO1); break; case SFIELD_SET_DETAIL_INFO2: ret = SetSysCommon(data, len, SYS_MSG_SET_DETAIL_INFO2); break; case SFIELD_SET_DETAIL_INFO3: ret = SetSysCommon(data, len, SYS_MSG_SET_DETAIL_INFO3); break; case SFIELD_SET_ALARMLOCAL: ret = SetSysCommon(data, len, SYS_MSG_SET_ALARMLOCAL); break; case SFIELD_SET_RECORDLOCAL: ret = SetSysCommon(data, len, SYS_MSG_SET_RECORDLOCAL); break; case SFIELD_SET_ENCRYPT_VIDEO: ret = SetSysEncryptVideo(data, len); break; case SFIELD_SET_LOCAL_DISPLAY: ret = SetSysLocalDisplay(data, len); break; case SFIELD_SET_IPRATIO1: ret = SetSysIpratio1(data, len); break; case SFIELD_SET_IPRATIO2: ret = SetSysIpratio2(data, len); break; case SFIELD_SET_IPRATIO3: ret = SetSysIpratio3(data, len); break; case SFIELD_SET_FORCE_IFRAME1: ret = SetSysForceIframe1(data, len); break; case SFIELD_SET_FORCE_IFRAME2: ret = SetSysForceIframe2(data, len); break; case SFIELD_SET_FORCE_IFRAME3: ret = SetSysForceIframe3(data, len); break; case SFIELD_SET_QPINIT1: ret = SetSysQPInit1(data, len); break; case SFIELD_SET_QPINIT2: ret = SetSysQPInit2(data, len); break; case SFIELD_SET_QPINIT3: ret = SetSysQPInit3(data, len); break; case SFIELD_SET_QPMIN1: ret = SetSysQPMin1(data, len); break; case SFIELD_SET_QPMIN2: ret = SetSysQPMin2(data, len); break; case SFIELD_SET_QPMIN3: ret = SetSysQPMin3(data, len); break; case SFIELD_SET_QPMAX1: ret = SetSysQPMax1(data, len); break; case SFIELD_SET_QPMAX2: ret = SetSysQPMax2(data, len); break; case SFIELD_SET_QPMAX3: ret = SetSysQPMax3(data, len); break; case SFIELD_SET_MECONFIG1: ret = SetSysMEConfig1(data, len); break; case SFIELD_SET_MECONFIG2: ret = SetSysMEConfig2(data, len); break; case SFIELD_SET_MECONFIG3: ret = SetSysMEConfig3(data, len); break; case SFIELD_SET_PACKETSIZE1: ret = SetSysPacketSize1(data, len); break; case SFIELD_SET_PACKETSIZE2: ret = SetSysPacketSize2(data, len); break; case SFIELD_SET_PACKETSIZE3: ret = SetSysPacketSize3(data, len); break; case SFIELD_SET_ROI_ENABLE1: ret = SetSysROIEnable1(data, len); break; case SFIELD_SET_ROI_ENABLE2: ret = SetSysROIEnable2(data, len); break; case SFIELD_SET_ROI_ENABLE3: ret = SetSysROIEnable3(data, len); break; case SFIELD_SET_STR1X1: ret = SetSysStr1X1(data, len); break; case SFIELD_SET_STR1Y1: ret = SetSysStr1Y1(data, len); break; case SFIELD_SET_STR1W1: ret = SetSysStr1W1(data, len); break; case SFIELD_SET_STR1H1: ret = SetSysStr1H1(data, len); break; case SFIELD_SET_STR1X2: ret = SetSysStr1X2(data, len); break; case SFIELD_SET_STR1Y2: ret = SetSysStr1Y2(data, len); break; case SFIELD_SET_STR1W2: ret = SetSysStr1W2(data, len); break; case SFIELD_SET_STR1H2: ret = SetSysStr1H2(data, len); break; case SFIELD_SET_STR1X3: ret = SetSysStr1X3(data, len); break; case SFIELD_SET_STR1Y3: ret = SetSysStr1Y3(data, len); break; case SFIELD_SET_STR1W3: ret = SetSysStr1W3(data, len); break; case SFIELD_SET_STR1H3: ret = SetSysStr1H3(data, len); break; case SFIELD_SET_STR2X1: ret = SetSysStr2X1(data, len); break; case SFIELD_SET_STR2Y1: ret = SetSysStr2Y1(data, len); break; case SFIELD_SET_STR2W1: ret = SetSysStr2W1(data, len); break; case SFIELD_SET_STR2H1: ret = SetSysStr2H1(data, len); break; case SFIELD_SET_STR2X2: ret = SetSysStr2X2(data, len); break; case SFIELD_SET_STR2Y2: ret = SetSysStr2Y2(data, len); break; case SFIELD_SET_STR2W2: ret = SetSysStr2W2(data, len); break; case SFIELD_SET_STR2H2: ret = SetSysStr2H2(data, len); break; case SFIELD_SET_STR2X3: ret = SetSysStr2X3(data, len); break; case SFIELD_SET_STR2Y3: ret = SetSysStr2Y3(data, len); break; case SFIELD_SET_STR2W3: ret = SetSysStr2W3(data, len); break; case SFIELD_SET_STR2H3: ret = SetSysStr2H3(data, len); break; case SFIELD_SET_STR3X1: ret = SetSysStr3X1(data, len); break; case SFIELD_SET_STR3Y1: ret = SetSysStr3Y1(data, len); break; case SFIELD_SET_STR3W1: ret = SetSysStr3W1(data, len); break; case SFIELD_SET_STR3H1: ret = SetSysStr3H1(data, len); break; case SFIELD_SET_STR3X2: ret = SetSysStr3X2(data, len); break; case SFIELD_SET_STR3Y2: ret = SetSysStr3Y2(data, len); break; case SFIELD_SET_STR3W2: ret = SetSysStr3W2(data, len); break; case SFIELD_SET_STR3H2: ret = SetSysStr3H2(data, len); break; case SFIELD_SET_STR3X3: ret = SetSysStr3X3(data, len); break; case SFIELD_SET_STR3Y3: ret = SetSysStr3Y3(data, len); break; case SFIELD_SET_STR3W3: ret = SetSysStr3W3(data, len); break; case SFIELD_SET_STR3H3: ret = SetSysStr3H3(data, len); break; case SFIELD_SET_IMAGEDEFAULT: ret = SetImageDefault(data, len); break; case SFIELD_DO_LOGIN: ret = DoSysLogin(data, len); break; case SFIELD_GET_USER_AUTHORITY: ret = GetSysUserAuthority(data, len); break; case SFIELD_ADD_USER: ret = SysAddUser(data, len); break; case SFIELD_DEL_USER: ret = SysDelUser(data, len); break; case SFIELD_IPNCPTZ: ret = SetIpncPtz(data, len); break; case SFIELD_INIT_IPNCPTZ: ret = InitIpncPtz(data, len); break; case SFIELD_SD_FORMAT: ret = SysSdFormat(data, len); break; case SFIELD_SD_UNMOUNT: ret = SysSdUnmount(data, len); break; case SFIELD_SET_GIOINENABLE: ret = SetGIOInEnable(data, len); break; case SFIELD_SET_GIOINTYPE: ret = SetGIOInType(data, len); break; case SFIELD_SET_GIOOUTENABLE: ret = SetGIOOutEnable(data, len); break; case SFIELD_SET_GIOOUTTYPE: ret = SetGIOOutType(data, len); break; case SFIELD_SET_TSTAMPENABLE: ret = SetTStampEnable(data, len); break; case SFIELD_SET_DATEFORMAT: ret = SetSysCommon(data, len, SYS_MSG_SET_DATEFORMAT); break; case SFIELD_SET_TSTAMPFORMAT: ret = SetSysCommon(data, len, SYS_MSG_SET_TSTAMPFORMAT); break; case SFIELD_SET_DATEPPOS: ret = SetSysCommon(data, len, SYS_MSG_SET_DATEPPOS); break; case SFIELD_SET_TIMEPOS: ret = SetSysCommon(data, len, SYS_MSG_SET_TIMEPOS); break; case SFIELD_SET_AUDIOINVOLUME: ret = SetAudioinVolume(data, len); break; case SFIELD_SET_RATE_CONTROL: ret = SetSysRateControl(data, len); break; case SFIELD_SET_FRAMERATE1: ret = SetSysFramerate1(data, len); break; case SFIELD_SET_FRAMERATE2: ret = SetSysFramerate2(data, len); break; case SFIELD_SET_FRAMERATE3: ret = SetSysFramerate3(data, len); break; case SFIELD_SCHEDULE_STOP: ret = SysScheduleStop(data, len); break; case SFIELD_SCHEDULE_RESUME: ret = SysScheduleResume(data, len); break; case SFIELD_SET_MULTICAST: ret = SetSysMulticast(data, len); break; case SFIELD_SET_HTTPSPORT: ret = SetSysCommon(data, len, SYS_MSG_SET_HTTPSPORT); break; case SFIELD_SET_RS485: ret = SetSysCommon(data, len, SYS_MSG_SET_RS485); break; case SFIELD_SET_ALARM_ENABLE: ret = SetSysCommon(data, len, SYS_MSG_SET_ALARM_ENABLE); break; case SFIELD_SET_EXT_ALARM: ret = SetSysCommon(data, len, SYS_MSG_SET_EXT_ALARM); break; case SFIELD_SET_AUDIOALARM: ret = SetSysCommon(data, len, SYS_MSG_SET_AUDIOALARM); break; case SFIELD_SET_ALARM_AUDIOPLAY: ret = SetSysCommon(data, len, SYS_MSG_SET_ALARM_AUDIOPLAY); break; case SFIELD_SET_ALARM_AUDIOFILE: ret = SetSysCommon(data, len, SYS_MSG_SET_ALARM_AUDIOFILE); break; case SFIELD_SET_SCHEDULE_REPEAT_ENABLE: ret = SetSysCommon(data, len, SYS_MSG_SET_SCHEDULE_REPEAT_ENABLE); break; case SFIELD_SET_SCHEDULE_NUMWEEKS: ret = SetSysCommon(data, len, SYS_MSG_SET_SCHEDULE_NUM_WEEKS); break; case SFIELD_SET_SCHEDULE_INFINITE_ENABLE: ret = SetSysCommon(data, len, SYS_MSG_SET_SCHEDULE_INFINITE_ENABLE); break; case SFIELD_SET_LINEARWDR: ret = SetSysLinearWdr(data, len); break; case SFIELD_SET_FLICKER_DETECT: ret = SetSysFlickerDetect(data, len); break; default: ret = -1; break; } return ret; }