BOOL CDlgCfgAlarm::GetConfigFromDevice() { char szJsonBuf[1024 * 40] = {0}; int nerror = 0; int nSelChn = m_cmbChn.GetCurSel() == -1 ? 0 : m_cmbChn.GetCurSel(); BOOL bRet = CLIENT_GetNewDevConfig((LLONG)m_hLoginID, CFG_CMD_ALARMINPUT, nSelChn, szJsonBuf, 1024*40, &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_ALARMINPUT, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse Alarm error..."), DLG_CFG_ALARM), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s %08x...\r\n\r\n%s", ConvertString("QueryConfig Alarm error:", DLG_CFG_ALARM), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgAlarmSubSystem::GetConfig() { int nChn = m_cmbSeq.GetCurSel(); if (-1 == nChn) { return FALSE; } char szBuf[1024*10] = {0}; int nErr = 0; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_ALARM_SUBSYSTEM, nChn, szBuf, sizeof(szBuf), &nErr, SDK_API_WAIT); if (!bRet) { CString csInfo; csInfo.Format("%s:%08x", ConvertString("Get config of AlarmSubSystem error", DLG_CFG_ALARM_SUBSYSTEM), CLIENT_GetLastError()); MessageBox(csInfo, ConvertString("Prompt")); return FALSE; } int nRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_ALARM_SUBSYSTEM, szBuf, &m_stuInfo, sizeof(m_stuInfo), &nRetLen); if (!bRet || nRetLen != sizeof(m_stuInfo)) { MessageBox(ConvertString("Parse config of AlarmSubSystem error", DLG_CFG_ALARM_SUBSYSTEM), ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgAlarmChassisIntrusion::GetConfigFromDevice() { char szJsonBuf[1024 * 40] = {0}; int nerror = 0; int nSelChn = -1; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_CHASSISINTRUSION, nSelChn, szJsonBuf, sizeof(szJsonBuf), &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_CHASSISINTRUSION, szJsonBuf, (void*)&m_stuChassisIntrusion, sizeof(m_stuChassisIntrusion), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse ChassisIntrusion error..."), DLG_ALARM_CHASSISINTRUSION), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s %08x...\r\n\r\n%s",ConvertString("QueryConfig ChassisIntrusion error:", DLG_ALARM_CHASSISINTRUSION), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
void CDlgCfgAutoMaintain::OnAutomaintainBtnGet() { // TODO: Add your control notification handler code here if (m_lLoginId == 0) { MessageBox(ConvertString("Please login first!", DLG_AUTOMAINTAIN), ConvertString("Prompt")); return; } char szJsonBuf[1024] = {0}; int nErr = 0, nRestart = 0; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_AUTOMAINTAIN, -1, szJsonBuf, sizeof(szJsonBuf), &nErr, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_AUTOMAINTAIN, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse AutoMaintain error..."), DLG_AUTOMAINTAIN), ConvertString("Prompt")); return ; } } else { CString csErr; csErr.Format("%s %08x...\r\n\r\n%s", ConvertString("get config AutoMaintain error:", DLG_AUTOMAINTAIN), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return; } StuToDlg(); }
BOOL CDlgCfgAlarmPowerFault::GetConfigFromDevice() { char szJsonBuf[1024 * 40] = {0}; int nerror = 0; int nSelChn = -1; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_POWERFAULT, nSelChn, szJsonBuf, sizeof(szJsonBuf), &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_POWERFAULT, szJsonBuf, (void*)m_pstuPowerFault, sizeof(CFG_POWERFAULT_INFO), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse PowerFault error..."), DLG_ALARM_POWERFAULT), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s %08x...\r\n\r\n%s", ConvertString("QueryConfig PowerFault error:", DLG_ALARM_POWERFAULT), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgAccessControl::GetConfigFromDevice() { int nChn = m_cmbChannel.GetCurSel(); if (-1 == nChn) { return FALSE; } char szJsonBuf[1024 * 40] = {0}; int nerror = 0; BOOL bRet = CLIENT_GetNewDevConfig((LLONG)m_lLoginID, CFG_CMD_ACCESS_EVENT, nChn, szJsonBuf, 1024*40, &nerror, 5000); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_ACCESS_EVENT, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse AccessControl error..."), DLG_CFG_ACCESS_CONTROL), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s 0x%08x...\r\n\r\n%s", ConvertString("QueryConfig AccessControl error:", DLG_CFG_ACCESS_CONTROL), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgSensorSampling::getCfgFromDevice() { if (m_lLoginId == 0) { MessageBox(ConvertString("Please login first!", DLG_CFG_SENSORSANMPLING), ConvertString("Prompt")); return FALSE; } char szOutBuffer[1024] = {0}; int nerror = 0; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_SENSORSAMPLING, -1, szOutBuffer, 1024, &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_SENSORSAMPLING, szOutBuffer, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse SensorSampling error..."), DLG_CFG_SENSORSANMPLING), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s %08x...\r\n\r\n%s", ConvertString("get config SensorSampling error:", DLG_CFG_SENSORSANMPLING), CLIENT_GetLastError(), szOutBuffer); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgNetCollection::GetConfigFromDevice() { char szJsonBuf[1024 * 40] = {0}; int nerror = 0; int nSelChn = m_cmbChannel.GetCurSel() == -1 ? 0 : m_cmbChannel.GetCurSel(); BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_NET_COLLECTION, nSelChn, szJsonBuf, sizeof(szJsonBuf), &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_NET_COLLECTION, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse NetCollection error..."), DLG_CFG_NETCOLLECTION), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s 0x%08x...\r\n\r\n%s",ConvertString("QueryConfig NetCollection error:", DLG_CFG_NETCOLLECTION), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
BOOL CDlgCfgPSTNBreakLine::GetConfigFromDevice() { char szJsonBuf[1024 * 40] = {0}; int nerror = 0; int nSelChn = -1; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_PSTN_BREAK_LINE, nSelChn, szJsonBuf, sizeof(szJsonBuf), &nerror, SDK_API_WAIT); if (bRet) { DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_PSTN_BREAK_LINE, szJsonBuf, (void*)&m_stuInfo, sizeof(m_stuInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString(CString("parse PSTNBreakLine error..."), DLG_CFG_PSTNBREAKLINE), ConvertString("Prompt")); return FALSE; } } else { CString csErr; csErr.Format("%s 0x%08x...\r\n\r\n%s",ConvertString("QueryConfig PSTNBreakLine error:", DLG_CFG_PSTNBREAKLINE), CLIENT_GetLastError(), szJsonBuf); MessageBox(csErr, ConvertString("Prompt")); return FALSE; } return TRUE; }
void CDlgCfgNetwork::GetNetworkPara() { if (0 == m_lLoginID) { MessageBox(ConvertString("we haven't login a device yet!", DLG_CFG_NETWORK), ConvertString("Prompt")); return; } char szJsonBuf[1024] = {0}; int nErr = 0; BOOL bRet = CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_NETWORK, -1, szJsonBuf, sizeof(szJsonBuf), &nErr, SDK_API_WAIT); if (!bRet) { CString csErr; csErr.Format("%s %08x...", ConvertString("GetConfig network failed:", DLG_CFG_NETWORK), CLIENT_GetLastError()); MessageBox(csErr, ConvertString("Prompt")); return; } CFG_NETWORK_INFO stNetworkInfo = {0}; DWORD dwRetLen = 0; bRet = CLIENT_ParseData(CFG_CMD_NETWORK, szJsonBuf, &stNetworkInfo, sizeof(stNetworkInfo), &dwRetLen); if (!bRet) { MessageBox(ConvertString("Parse network jason failed.", DLG_CFG_NETWORK), ConvertString("Prompt")); return; } if (0 == stNetworkInfo.stuInterfaces[0].szIP[0] || 0 == stNetworkInfo.stuInterfaces[0].szSubnetMask[0] || 0 == stNetworkInfo.stuInterfaces[0].szDefGateway[0]) { MessageBox(ConvertString("Invalidate ip parameters.", DLG_CFG_NETWORK), ConvertString("Prompt")); return; } memcpy(&m_stuNetwork, &stNetworkInfo, sizeof(CFG_NETWORK_INFO)); m_ctlIp.SetWindowText(stNetworkInfo.stuInterfaces[0].szIP); m_ctlMask.SetWindowText(stNetworkInfo.stuInterfaces[0].szSubnetMask); m_ctlGateway.SetWindowText(stNetworkInfo.stuInterfaces[0].szDefGateway); #if 0 DWORD dwIp = ntohl(inet_addr(stNetworkInfo.stuInterfaces[0].szIP)); m_ctlIp.SetAddress(dwIp); DWORD dwMask = ntohl(inet_addr(stNetworkInfo.stuInterfaces[0].szSubnetMask)); m_ctlMask.SetAddress(dwMask); DWORD dwGateway = ntohl(inet_addr(stNetworkInfo.stuInterfaces[0].szDefGateway)); m_ctlGateway.SetAddress(dwGateway); #endif }
BOOL CDlgCfgAlarmExAlarmBox::GetConfigFromDevice() { assert(m_pstuInfo != NULL); int nSel = m_cbSerialPort.GetCurSel(); if (nSel == -1 || nSel >= m_nMaxExAlarmBox) { return FALSE; } char szJsonBuf[1024 * 2] = {0}; int nErr = 0; AV_int32 nRet = CLIENT_GetNewDevConfig(m_lLoginId, CFG_CMD_EXALARMBOX, -1, szJsonBuf, sizeof(szJsonBuf), &nErr, SDK_API_WAIT); if (!nRet) { CString csOut; csOut.Format("%s %08x\r\n\r\n%s", ConvertString("Query ExAlarmBox Configuration failed: ", DLG_CFG_EXALARMBOX), CLIENT_GetLastError(), szJsonBuf); MessageBox(csOut, ConvertString("Prompt")); return FALSE; } CFG_EXALARMBOX_INFO* pstuInfo = new CFG_EXALARMBOX_INFO[m_nMaxExAlarmBox]; assert(pstuInfo != NULL); memset(pstuInfo, 0, sizeof(CFG_EXALARMBOX_INFO) * m_nMaxExAlarmBox); DWORD dwRetLen = 0; nRet = CLIENT_ParseData(CFG_CMD_EXALARMBOX, szJsonBuf, pstuInfo, sizeof(CFG_EXALARMBOX_INFO) * m_nMaxExAlarmBox, &dwRetLen); if (!nRet) { MessageBox(ConvertString("Parse data for ExAlarmBox Configuration failed!", DLG_CFG_EXALARMBOX), ConvertString("Prompt")); delete []pstuInfo; return FALSE; } int nCount = __min(m_nMaxExAlarmBox, dwRetLen / sizeof(CFG_EXALARMBOX_INFO)); if (nCount > 0) { m_nCurExAlarmBoxCount = nCount; m_cbSerialPort.ResetContent(); int i = 0; for (i = 0; i < m_nCurExAlarmBoxCount; i++) { CString csTemp; csTemp.Format("%s %02d", ConvertString("Channel", DLG_CFG_SERIAL), i + 1); m_cbSerialPort.InsertString(-1, csTemp); } m_cbSerialPort.SetCurSel(0); } memcpy(m_pstuInfo, pstuInfo, sizeof(CFG_EXALARMBOX_INFO) * nCount); delete []pstuInfo; return TRUE; }
void CSpliceScreenConfigDlg::InitUI() { m_wndWall.CreateEx(WS_EX_CLIENTEDGE, NULL, NULL, WS_CHILD | WS_VISIBLE, CRect(0, 0, 465, 385), this, 22333); m_cbTVLayoutRow.SetCurSel(0); m_cbTVLayoutColumn.SetCurSel(0); m_cbTVSizeRow.SetCurSel(0); m_cbTVSizeColumn.SetCurSel(0); CheckDlgButton(IDC_RADIO_LAYOUT_2x2, TRUE); CheckDlgButton(IDC_RADIO_SIZE_1x1, TRUE); OnRadioLayout(); OnRadioSize(); const int nMaxNameLen = 60; CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_SPLICE_NAME); pEdit->LimitText(nMaxNameLen); pEdit = (CEdit*)GetDlgItem(IDC_EDIT_SPLICE_ID); pEdit->LimitText(nMaxNameLen); // fill outputs m_lbOutputs.ResetContent(); const CDecoder* pDecoder = ((CDemoMonitorWallDlg*)GetParent())->GetDecoderInfo(); CDecChnMap::const_iterator it = pDecoder->GetDecChnMap().begin(); for (; it != pDecoder->GetDecChnMap().end(); ++it) { if (!it->second.m_bSpliceScreen) { int nIndex = m_lbOutputs.AddString(it->second.ToString()); m_lbOutputs.SetItemData(nIndex, it->first); } } // get config const int nMaxJsonLen = 64 * 1024; char* pszJsonBuf = new char[nMaxJsonLen]; memset(pszJsonBuf, 0, nMaxJsonLen); // 解码器使用老协议配置拼接屏 if (_stricmp(CDecoderNVD::DCID(), pDecoder->GetDeviceClass()) == 0) { // 解码器的拼接屏ID无法设置 GetDlgItem(IDC_EDIT_SPLICE_ID)->EnableWindow(FALSE); // 获取电视墙配置 if (CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_MONITORWALL, -1, pszJsonBuf, nMaxJsonLen, NULL)) { const int nMaxMonitorWall = 1; AV_CFG_MonitorWall* pstuWall = new AV_CFG_MonitorWall[nMaxMonitorWall]; for (int i = 0; i < nMaxMonitorWall; ++i) { pstuWall[i].nStructSize = sizeof(AV_CFG_MonitorWall); for (int j = 0; j < AV_CFG_Max_Block_In_Wall; ++j) { pstuWall[i].stuBlocks[j].nStructSize = sizeof(AV_CFG_MonitorWallBlock); pstuWall[i].stuBlocks[j].stuRect.nStructSize = sizeof(AV_CFG_Rect); for (int k = 0; k < AV_CFG_Max_TV_In_Block; ++k) { pstuWall[i].stuBlocks[j].stuTVs[k].nStructSize = sizeof(AV_CFG_MonitorWallTVOut); } } } int nRetLen = 0; if (CLIENT_ParseData(CFG_CMD_MONITORWALL, pszJsonBuf, pstuWall, pstuWall->nStructSize * nMaxMonitorWall, &nRetLen)) { m_wndWall.ClearBlock(); m_wndWall.SetName(pstuWall->szName); m_wndWall.SetGridLayout(CSize(pstuWall->nColumn, pstuWall->nLine)); // 获取拼接屏配置 if (CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_SPLICESCREEN, -1, pszJsonBuf, nMaxJsonLen, NULL)) { int nMaxSpliceScreen = 32; AV_CFG_SpliceScreen* pstuScreen = new AV_CFG_SpliceScreen[nMaxSpliceScreen]; for (int i = 0; i < nMaxSpliceScreen; ++i) { pstuScreen[i].nStructSize = sizeof(AV_CFG_SpliceScreen); } if (CLIENT_ParseData(CFG_CMD_SPLICESCREEN, pszJsonBuf, pstuScreen, pstuScreen->nStructSize * nMaxSpliceScreen, &nRetLen)) { int nSpliceCount = nRetLen / pstuScreen->nStructSize; // 拼接屏数量 for (int k = 0; k < nSpliceCount; ++k) { AV_CFG_SpliceScreen* p = pstuScreen + k; // 判断该拼接屏是否包含在电视墙配置中 if (_stricmp(p->szWallName, pstuWall->szName) == 0 && p->nBlockID >= 0 && p->nBlockID < pstuWall->nBlockCount) { int j = 0; const AV_CFG_MonitorWallBlock& block = pstuWall->stuBlocks[p->nBlockID]; WMBlock wmblock(&m_wndWall); wmblock.bNew = TRUE; sprintf(wmblock.szCompositeID, "%d", p->nBlockID); strcpy(wmblock.szName, p->szName); wmblock.stuTVSize.cx = block.nColumn; wmblock.stuTVSize.cy = block.nLine; wmblock.stuBlockSize.cx = (block.stuRect.nRight - block.stuRect.nLeft + 1) / block.nColumn; wmblock.stuBlockSize.cy = (block.stuRect.nBottom - block.stuRect.nTop + 1) / block.nLine; wmblock.stuLeftTop.x = block.stuRect.nLeft * m_wndWall.GetGridSize().cx; wmblock.stuLeftTop.y = block.stuRect.nTop * m_wndWall.GetGridSize().cy; for (j = 0; j < block.nTVCount; ++j) { wmblock.vecOutputs.push_back(block.stuTVs[j].nChannelID); } m_wndWall.AddBlock(wmblock); } } } delete[] pstuScreen; } } delete[] pstuWall; } } // 其他设备使用新协议 else { if (CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_MONITORWALL, -1, pszJsonBuf, nMaxJsonLen, NULL, WAIT_TIME)) { AV_CFG_MonitorWall* pstuWall = new AV_CFG_MonitorWall(); if( NULL == pstuWall ) { return; } memset(pstuWall , 0 , sizeof(AV_CFG_MonitorWall)); pstuWall->nStructSize = sizeof(AV_CFG_MonitorWall); for (int i = 0; i < AV_CFG_Max_Block_In_Wall; ++i) { pstuWall->stuBlocks[i].nStructSize = sizeof(AV_CFG_MonitorWallBlock); pstuWall->stuBlocks[i].stuRect.nStructSize = sizeof(AV_CFG_MonitorWallTVOut); for (int j = 0; j < AV_CFG_Max_TV_In_Block; ++j) { pstuWall->stuBlocks[i].stuTVs[j].nStructSize = sizeof(AV_CFG_MonitorWallTVOut); } } int nRetLen = 0; if (CLIENT_ParseData(CFG_CMD_MONITORWALL, pszJsonBuf, pstuWall, sizeof(AV_CFG_MonitorWall), &nRetLen)) { m_wndWall.ClearBlock(); m_wndWall.SetName(pstuWall->szName); m_wndWall.SetGridLayout(CSize(pstuWall->nColumn, pstuWall->nLine)); for (int i = 0; i < pstuWall->nBlockCount; ++i) { AV_CFG_MonitorWallBlock* pBlockInfo = pstuWall->stuBlocks + i; //if (pBlockInfo->nTVCount > 0) if (*pBlockInfo->szCompositeID) { WMBlock block(&m_wndWall); block.bNew = TRUE; strcpy(block.szCompositeID, pBlockInfo->szCompositeID); strcpy(block.szName, pBlockInfo->szName); block.stuTVSize.cx = pBlockInfo->nColumn; block.stuTVSize.cy = pBlockInfo->nLine; block.stuBlockSize.cx = (pBlockInfo->stuRect.nRight - pBlockInfo->stuRect.nLeft + 1) / pBlockInfo->nColumn; block.stuBlockSize.cy = (pBlockInfo->stuRect.nBottom - pBlockInfo->stuRect.nTop + 1) / pBlockInfo->nLine; block.stuLeftTop.x = pBlockInfo->stuRect.nLeft * m_wndWall.GetGridSize().cx; block.stuLeftTop.y = pBlockInfo->stuRect.nTop * m_wndWall.GetGridSize().cy; for (int j = 0; j < pBlockInfo->nTVCount; ++j) { block.vecOutputs.push_back(pBlockInfo->stuTVs[j].nChannelID); } m_wndWall.AddBlock(block); } } } else { MsgBox0("Parse config data (monitor wall) error."); } delete pstuWall; } else { MsgBoxErr("Get config (monitor wall) error."); } } delete[] pszJsonBuf; }
static int dah_get_device_config(struct service *srv, int parm_id, void *parm) { int user_id, ret = FALSE, err = 0; JDevCap *dev_cap; dah_service_t *dah_srv; dah_config_t *dah_cfg; dah_new_config_t *dah_new_cfg; dah_query_t *query; NMP_ASSERT(srv && parm); dah_srv = (dah_service_t*)srv; user_id = dah_get_user_id(&dah_srv->parm); if (DAH_LOGOUT == user_id) { show_debug("Proxy device logout!!!!!!!!!!!!!!\n"); return -1; } switch (parm_id) { case GET_DEVICE_CONFIG: goto GET_CFG; case GET_SERIAL_CONFIG: goto GET_CFG; case GET_DEVICE_TIME: goto GET_CFG; case GET_NTP_CONFIG: goto GET_CFG; case GET_NETWORK_CONFIG: goto GET_CFG; case GET_PPPOE_CONFIG: goto GET_CFG; case GET_FTP_CONFIG: goto GET_CFG; case GET_SMTP_CONFIG: goto GET_CFG; case GET_DDNS_CONFIG: goto GET_CFG; case GET_UPNP_CONFIG: goto GET_CFG; case GET_DISK_LIST: goto GET_DEV_STATE; case GET_ENCODE_CONFIG: goto GET_CFG; case GET_DISPLAY_CONFIG: goto GET_CFG; case GET_OSD_CONFIG: goto GET_CFG; case GET_PTZ_CONFIG: goto GET_NEW_CFG; case GET_RECORD_CONFIG: goto GET_CFG; case GET_HIDE_CONFIG: goto GET_CFG; case GET_MOTION_CONFIG: goto GET_CFG; case GET_VIDEO_LOST_CONFIG: goto GET_CFG; case GET_HIDE_ALARM_CONFIG: goto GET_CFG; case GET_IO_ALARM_CONFIG: goto GET_CFG; case GET_STORE_LOG: query = (dah_query_t*)parm; printf("user_id : %d\n", user_id); printf("channel : %d\n", query->channel); printf("file_type: %d\n", query->file_type); if (CLIENT_QueryRecordFile((LLONG)user_id, query->channel, query->file_type, &query->start, &query->end, query->card_id, (NET_RECORDFILE_INFO*)query->buffer, query->buf_size, &query->filecount, query->waittime, FALSE)) { show_info("count: %d<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", query->filecount); ret = TRUE; } else { ret = FALSE; show_debug("ERROR: 0x%x<-------------------------------\n", CLIENT_GetLastError()); } show_debug("CLIENT_QueryRecordFile: %s<-----------------\n", (ret == TRUE) ? "Success" : "Failure"); break; case GET_CRUISE_CONFIG: /*cruise = (dah_cruise_t*)parm; show_debug("crz_no: %d<--------------------\n", cruise->crz_no); ret = NET_DVR_GetPTZCruise(user_id, (LONG)cruise->channel, (LONG)cruise->crz_no, (NET_DVR_CRUISE_RET*)cruise->input); show_debug("NET_DVR_GetDVRConfig: %s<-------------------------------\n", (ret == TRUE) ? "Success" : "Failure"); if (FALSE == ret) show_debug("ERROR: 0x%x<-------------------------------\n", CLIENT_GetLastError());*/ break; case GET_CAPABILITY_SET: dev_cap = (JDevCap*)parm; dev_cap->cap0 = DEV_CAP_VIDEO_IN | DEV_CAP_AUDIO | DEV_CAP_IRIS | DEV_CAP_PTZ | DEV_CAP_ALARM_IN | DEV_CAP_ALARM_OUT | DEV_CAP_STORAGE | DEV_CAP_WEB | DEV_CAP_PLATFORM | DEV_CAP_INTELLIGENT_ANALYSIS | DEV_CAP_UPDATE | DEV_CAP_VIDEO_OUT;// | DEV_CAP_IR; dev_cap->ftp_enable = 1; dev_cap->upnp_enable = 0; dev_cap->chn_cap.size = sizeof(JChnCap); dev_cap->chn_cap.encode = VIDEO_ENCODE_H264_E | VIDEO_ENCODE_MJPEG_E | VIDEO_ENCODE_JPEG_E | VIDEO_ENCODE_MPEG4_E; dev_cap->chn_cap.supp_mask = 1; dev_cap->chn_cap.mask_count = 4; dev_cap->chn_cap.supp_hide_alarm = 1; dev_cap->chn_cap.hide_alarm_count = 1; dev_cap->chn_cap.supp_move_alarm = 1; dev_cap->chn_cap.move_alarm_count = 1; dev_cap->chn_cap.supp_video_lost_alarm = 1; dev_cap->chn_cap.osd_count = 1; dev_cap->chn_cap.stream_count = 2; dev_cap->chn_cap.stream_supp_resolution[0] = CAP_VIDEO_QCIF | CAP_VIDEO_CIF | CAP_VIDEO_HD1 | CAP_VIDEO_D1 | CAP_VIDEO_QQVGA | CAP_VIDEO_QVGA | CAP_VIDEO_VGA | CAP_VIDEO_SVGA | CAP_VIDEO_UXGA | CAP_VIDEO_720P | CAP_VIDEO_960 | CAP_VIDEO_1080P; dev_cap->chn_cap.stream_supp_resolution[1] = CAP_VIDEO_QCIF | CAP_VIDEO_CIF | CAP_VIDEO_HD1 | CAP_VIDEO_D1 | CAP_VIDEO_QQVGA | CAP_VIDEO_QVGA | CAP_VIDEO_VGA | CAP_VIDEO_SVGA | CAP_VIDEO_UXGA | CAP_VIDEO_720P | CAP_VIDEO_960 | CAP_VIDEO_1080P; dev_cap->chn_cap.stream_supp_resolution[2] = CAP_VIDEO_QCIF | CAP_VIDEO_CIF | CAP_VIDEO_HD1 | CAP_VIDEO_D1 | CAP_VIDEO_QQVGA | CAP_VIDEO_QVGA | CAP_VIDEO_VGA | CAP_VIDEO_SVGA | CAP_VIDEO_UXGA | CAP_VIDEO_720P | CAP_VIDEO_960 | CAP_VIDEO_1080P; dev_cap->chn_cap.stream_supp_resolution[3] = CAP_VIDEO_QCIF | CAP_VIDEO_CIF | CAP_VIDEO_HD1 | CAP_VIDEO_D1 | CAP_VIDEO_QQVGA | CAP_VIDEO_QVGA | CAP_VIDEO_VGA | CAP_VIDEO_SVGA | CAP_VIDEO_UXGA | CAP_VIDEO_720P | CAP_VIDEO_960 | CAP_VIDEO_1080P; dev_cap->chn_cap.stream_max_frate_rate[0] = 25; dev_cap->chn_cap.img_cap = IMA_BRIGHTNESS | IMA_CONTRAST | IMA_SATURATION | IMA_HUE | IMA_SHARPNESS; ret = TRUE; break; default: ret = FALSE; show_warn("parm_id Invalid!!!!!\n"); break; } if (TRUE == ret) return 0; else return -1; GET_CFG: dah_cfg = (dah_config_t*)parm; ret = CLIENT_GetDevConfig((LLONG)user_id, (DWORD ) dah_cfg->command, (LONG ) dah_cfg->channel, (LPVOID ) dah_cfg->buffer, (DWORD ) dah_cfg->b_size, (LPDWORD)&dah_cfg->returns, (int ) dah_cfg->waittime); show_debug("CLIENT_GetDevConfig: %s<-------------------------------\n", (ret == TRUE) ? "Success" : "Failure"); if (TRUE == ret) return 0; else { show_debug("ERROR: 0x%x<-------------------------------\n", CLIENT_GetLastError()); return -1; } GET_NEW_CFG: dah_new_cfg = (dah_new_config_t*)parm; ret = CLIENT_GetNewDevConfig((LLONG)user_id, dah_new_cfg->command, dah_new_cfg->channel, dah_new_cfg->out_json, DEF_OUT_JSON_SIZE, &err, dah_new_cfg->waittime); show_debug("CLIENT_GetNewDevConfig: %s<-------------------------------\n", (ret == TRUE) ? "Success" : "Failure"); if (TRUE == ret) { CLIENT_ParseData( dah_new_cfg->command, dah_new_cfg->out_json, dah_new_cfg->buffer, dah_new_cfg->b_size, NULL); return 0; } else { show_debug("ERROR: 0x%x, err: 0x%x<-------------------------------\n", CLIENT_GetLastError(), err); return -1; } GET_DEV_STATE: dah_cfg = (dah_config_t*)parm; ret = CLIENT_QueryDevState(user_id, (DWORD) dah_cfg->command, (char*) dah_cfg->buffer, (DWORD) dah_cfg->b_size, (int* )&dah_cfg->returns, (int ) dah_cfg->waittime); show_debug("CLIENT_QueryDevState: %s<-------------------------------\n", (ret == TRUE) ? "Success" : "Failure"); if (TRUE == ret) return 0; else { show_debug("ERROR: 0x%x, err: %d<-------------------------------\n", CLIENT_GetLastError(), err); return -1; } }
void CPowerDlg::InitUI() { m_vecWall.clear(); const int nMaxJsonBuf = 64 * 1024; char* pszJsonBuf = new char[nMaxJsonBuf]; ZeroMemory(pszJsonBuf, nMaxJsonBuf); int nRetLen = 0; // È¡µçÊÓǽÅäÖà if (CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_MONITORWALL, -1, pszJsonBuf, nMaxJsonBuf, NULL)) { const int nMaxMonitorWall = 4; AV_CFG_MonitorWall* pstuWall = new AV_CFG_MonitorWall[nMaxMonitorWall]; for (int i = 0; i < nMaxMonitorWall; ++i) { pstuWall[i].nStructSize = sizeof(AV_CFG_MonitorWall); for (int j = 0; j < AV_CFG_Max_Block_In_Wall; ++j) { pstuWall[i].stuBlocks[j].nStructSize = sizeof(AV_CFG_MonitorWallBlock); for (int k = 0; k < AV_CFG_Max_TV_In_Block; ++k) { pstuWall[i].stuBlocks[j].stuTVs[k].nStructSize = sizeof(AV_CFG_MonitorWallTVOut); } } } if (CLIENT_ParseData(CFG_CMD_MONITORWALL, pszJsonBuf, pstuWall, pstuWall->nStructSize * nMaxMonitorWall, &nRetLen)) { for (int i = 0; i < nRetLen / pstuWall->nStructSize; ++i) { m_vecWall.push_back(pstuWall[i]); } } delete[] pstuWall; } // // È¡ÈÚºÏÆÁÅäÖà // if (CLIENT_GetNewDevConfig(m_lLoginID, CFG_CMD_SPLICESCREEN, -1, pszJsonBuf, nMaxJsonBuf, NULL)) // { // const int nMaxSpliceScreen = 128; // AV_CFG_SpliceScreen* pstuScreen = new AV_CFG_SpliceScreen[nMaxSpliceScreen]; // for (int i = 0; i < nMaxSpliceScreen; ++i) // { // pstuScreen[i].nStructSize = sizeof(AV_CFG_SpliceScreen); // } // // int nRetLen = 0; // if (CLIENT_ParseData(CFG_CMD_SPLICESCREEN, pszJsonBuf, pstuScreen, pstuScreen->nStructSize * nMaxSpliceScreen, &nRetLen)) // { // for (int i = 0; i < nRetLen / pstuScreen->nStructSize; ++i) // { // m_vecSplice.push_back(pstuScreen[i]); // } // } // delete[] pstuScreen; // } delete[] pszJsonBuf; // m_cbWall.ResetContent(); CString strText; for (int i = 0; i < m_vecWall.size(); ++i) { const AV_CFG_MonitorWall& wall = m_vecWall[i]; strText.Format("%s (%d)", wall.szName, i); int nIndex = m_cbWall.AddString(strText); m_cbWall.SetItemData(nIndex, i); } m_cbWall.SetCurSel(0); OnSelchangeComboMonitorwall(); m_cbPower.SetCurSel(0); }