Example #1
0
BOOL CDlgCfgAlarm::SetConfigToDevice()
{	
	char szJsonBuf[1024 * 40] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_ALARMINPUT, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet Alarm error..."), DLG_CFG_ALARM), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{		
		int nSelChn = m_cmbChn.GetCurSel() == -1 ? 0 : m_cmbChn.GetCurSel();
		int nerror = 0;
		int nrestart = 0;
		
		bRet = CLIENT_SetNewDevConfig((LLONG)m_hLoginID, CFG_CMD_ALARMINPUT, nSelChn, szJsonBuf, 1024*40, &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig Alarm failed:", DLG_CFG_ALARM), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig Alarm ok!"), DLG_CFG_ALARM), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
Example #2
0
BOOL CDlgCfgAlarmSubSystem::SetConfig()
{
	int nChn = m_cmbSeq.GetCurSel();
	if (-1 == nChn)
	{
		return FALSE;
	}
	char szBuf[1024*10] = {0};
	int nErr = 0;
	int nRestart = 0;
	BOOL bRet = CLIENT_PacketData(CFG_CMD_ALARM_SUBSYSTEM, &m_stuInfo, sizeof(m_stuInfo), szBuf, sizeof(szBuf));
	if (!bRet)
	{
		MessageBox(ConvertString("Packet config of AlarmSubSystem error", DLG_CFG_ALARM_SUBSYSTEM), ConvertString("Prompt"));
		return FALSE;
	}
	bRet = CLIENT_SetNewDevConfig(m_lLoginID, CFG_CMD_ALARM_SUBSYSTEM, nChn, szBuf, strlen(szBuf), &nErr, &nRestart, SDK_API_WAIT);
	if (!bRet)
	{
		CString csInfo;
		csInfo.Format("%s:%08x", ConvertString("Set config of AlarmSubSystem error", DLG_CFG_ALARM_SUBSYSTEM), CLIENT_GetLastError());
		MessageBox(csInfo, ConvertString("Prompt"));
		return FALSE;
	}
	else
	{
		MessageBox(ConvertString("Set config of AlarmSubSystem ok", DLG_CFG_ALARM_SUBSYSTEM), ConvertString("Prompt"));
	}
	return TRUE;
}
BOOL CDlgCfgAlarmChassisIntrusion::SetConfigToDevice()
{
	char szJsonBuf[1024 * 40] = {0};
	if (szJsonBuf == NULL)
	{
		return FALSE;
	}

	BOOL bRet = CLIENT_PacketData(CFG_CMD_CHASSISINTRUSION, &m_stuChassisIntrusion, sizeof(m_stuChassisIntrusion), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet ChassisIntrusion error..."), DLG_ALARM_CHASSISINTRUSION), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{
		int nerror = 0;
		int nrestart = 0;
		bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_CHASSISINTRUSION, -1, szJsonBuf, sizeof(szJsonBuf), &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig ChassisIntrusion failed:", DLG_ALARM_CHASSISINTRUSION), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig ChassisIntrusion ok!"), DLG_ALARM_CHASSISINTRUSION), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
Example #4
0
void CDlgCfgAutoMaintain::OnAutomaintainBtnSet() 
{
	// TODO: Add your control notification handler code here
	if (m_lLoginId == 0)
	{
		MessageBox("Please login first!", ConvertString("Prompt"));
		return;
	}

	DlgToStu();
	char szJsonBuf[1024] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_AUTOMAINTAIN, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet AutoMaintain error..."), DLG_AUTOMAINTAIN), ConvertString("Prompt"));
		return ;
	} 
	else
	{
		int nErr = 0, nRestart = 0;
		bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_AUTOMAINTAIN,
			-1, szJsonBuf, strlen(szJsonBuf), &nErr, &nRestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig AutoMainTain failed:", DLG_AUTOMAINTAIN), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return ;
		}
		else
		{
			MessageBox(ConvertString("set AutoMainTain config param OK!", DLG_AUTOMAINTAIN), ConvertString("Prompt"));
		}
	}
}
BOOL CDlgCfgAlarmPowerFault::SetConfigToDevice()
{
	char szJsonBuf[1024 * 40] = {0};

	BOOL bRet = CLIENT_PacketData(CFG_CMD_POWERFAULT, m_pstuPowerFault, 
		sizeof(CFG_POWERFAULT_INFO), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet PowerFault error..."), DLG_ALARM_POWERFAULT), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{
		int nerror = 0;
		int nrestart = 0;
		bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_POWERFAULT, -1, szJsonBuf, 
			strlen(szJsonBuf), &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig PowerFault failed:", DLG_ALARM_POWERFAULT), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig PowerFault ok!"), DLG_ALARM_POWERFAULT), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
Example #6
0
BOOL CDlgCfgExAlarmInput::SetConfigToDevice()
{	
	char szJsonBuf[1024 * 40] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_EXALARMINPUT, &m_stuInfo.stuAlarmIn, sizeof(m_stuInfo.stuAlarmIn), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet ExAlarmInput error..."), DLG_CFG_EXALARMINPUT), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{
#if 0
		WriteLog(szJsonBuf);
#endif	// 0

		int nerror = 0;
		int nrestart = 0;
		bRet = CLIENT_SetNewDevConfig((LLONG)m_lLoginID, CFG_CMD_EXALARMINPUT, m_stuInfo.stuAlarmIn.nChannelID, szJsonBuf, 1024*40, &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig ExAlarmInput failed:", DLG_CFG_EXALARMINPUT), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig ExAlarmInput ok!"), DLG_CFG_EXALARMINPUT), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
Example #7
0
BOOL CDlgCfgSensorSampling::setCfgToDevice()
{
	if (m_lLoginId == 0)
	{
		MessageBox(ConvertString("Please login first!", DLG_CFG_SENSORSANMPLING), ConvertString("Prompt"));
		return FALSE;
	}
	
	char szJsonBuf[1024] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_SENSORSAMPLING, (void*)&m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet SensorSampling error..."), DLG_CFG_SENSORSANMPLING), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{
		int nerror = 0;
		int nrestart = 0;
		bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_SENSORSAMPLING, -1, szJsonBuf, sizeof(szJsonBuf), &nerror, &nrestart, SDK_API_WAIT);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s %08x...", ConvertString("SetupConfig SensorSampling failed:", DLG_CFG_SENSORSANMPLING), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
        else
        {    
			MessageBox(ConvertString(CString("SetConfig SensorSampling ok!"), DLG_CFG_SENSORSANMPLING), ConvertString("Prompt"));
        }
	}
	return TRUE;
}
Example #8
0
BOOL CDlgCfgAccessControl::SetConfigToDevice()
{
	int nChn = m_cmbChannel.GetCurSel();
	if (-1 == nChn)
	{
		return FALSE;
	}

	char szJsonBuf[1024 * 40] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_ACCESS_EVENT, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString(CString("packet AccessControl error..."), DLG_CFG_ACCESS_CONTROL), ConvertString("Prompt"));
		return FALSE;
	} 
	else
	{		
		int nerror = 0;
		int nrestart = 0;
		
		bRet = CLIENT_SetNewDevConfig((LLONG)m_lLoginID, CFG_CMD_ACCESS_EVENT, nChn, szJsonBuf, 1024*40, &nerror, &nrestart, 5000);
		if (!bRet)
		{
			CString csErr;
			csErr.Format("%s 0x%08x...", ConvertString("SetupConfig AccessControl failed:", DLG_CFG_ACCESS_CONTROL), CLIENT_GetLastError());
			MessageBox(csErr, ConvertString("Prompt"));
			return FALSE;
		}
		else
		{
			MessageBox(ConvertString(CString("SetConfig AccessControl ok!"), DLG_CFG_ACCESS_CONTROL), ConvertString("Prompt"));
		}
	}
	return TRUE;
}
Example #9
0
BOOL CDlgCfgNetCollection::SetConfigToDevice()
{
    char szJsonBuf[1024 * 40] = {0};
    if (szJsonBuf == NULL)
    {
        return FALSE;
    }
    
    BOOL bRet = CLIENT_PacketData(CFG_CMD_NET_COLLECTION, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
    if (!bRet)
    {
        MessageBox(ConvertString(CString("packet NetCollection error..."), DLG_CFG_NETCOLLECTION), ConvertString("Prompt"));
        return FALSE;
    } 
    else
    {
		int nSelChn = m_cmbChannel.GetCurSel() == -1 ? 0 : m_cmbChannel.GetCurSel();
        int nerror = 0;
        int nrestart = 0;
        bRet = CLIENT_SetNewDevConfig(m_lLoginID, CFG_CMD_NET_COLLECTION, nSelChn, szJsonBuf, sizeof(szJsonBuf), &nerror, &nrestart, SDK_API_WAIT);
        if (!bRet)
        {
            CString csErr;
            csErr.Format("%s 0x%08x...", ConvertString("SetupConfig NetCollection failed:", DLG_CFG_NETCOLLECTION), CLIENT_GetLastError());
            MessageBox(csErr, ConvertString("Prompt"));
            return FALSE;
        }
        else
        {
            MessageBox(ConvertString(CString("SetConfig NetCollection ok!"), DLG_CFG_NETCOLLECTION), ConvertString("Prompt"));
        }
    }
    return TRUE;
}
Example #10
0
BOOL CDlgCfgAlarmExAlarmBox::SetConfigToDevice()
{
	assert(m_pstuInfo != NULL);
	int nSel = m_cbSerialPort.GetCurSel();
	if (nSel == -1 || nSel >= m_nMaxExAlarmBox)
	{
		return FALSE;
	}

	char szJsonBuf[1024 * 2] = {0};
	BOOL bRet = CLIENT_PacketData(CFG_CMD_EXALARMBOX, m_pstuInfo, 
		sizeof(CFG_EXALARMBOX_INFO) * m_nCurExAlarmBoxCount, szJsonBuf, sizeof(szJsonBuf));
	if (!bRet)
	{
		MessageBox(ConvertString("Packet data for ExAlarmBox Configuration failed.", DLG_CFG_EXALARMBOX), ConvertString("Prompt"));
		return FALSE;
	}
	
	int nErr = 0, nRestart = 0;
	bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_EXALARMBOX,
		-1, szJsonBuf, strlen(szJsonBuf), &nErr, &nRestart, SDK_API_WAIT);
	if (!bRet)
	{
		CString csOut;
		csOut.Format("%s %08x!", ConvertString("Set ExAlarmBox Configuration failed:", DLG_CFG_EXALARMBOX), CLIENT_GetLastError());
		MessageBox(csOut, ConvertString("Prompt"));
		return FALSE;
	}
	
	MessageBox(ConvertString("Set ExAlarmBox Configuration Successfully.", DLG_CFG_EXALARMBOX), ConvertString("Prompt"));
	return TRUE;
}
Example #11
0
BOOL CDlgCfgPSTNBreakLine::SetConfigToDevice()
{
    char szJsonBuf[1024 * 40] = {0};
    if (szJsonBuf == NULL)
    {
        return FALSE;
    }
    
    BOOL bRet = CLIENT_PacketData(CFG_CMD_PSTN_BREAK_LINE, &m_stuInfo, sizeof(m_stuInfo), szJsonBuf, sizeof(szJsonBuf));
    if (!bRet)
    {
        MessageBox(ConvertString(CString("packet PSTNBreakLine error..."), DLG_CFG_PSTNBREAKLINE), ConvertString("Prompt"));
        return FALSE;
    } 
    else
    {
        int nerror = 0;
        int nrestart = 0;
        bRet = CLIENT_SetNewDevConfig(m_lLoginId, CFG_CMD_PSTN_BREAK_LINE, -1, szJsonBuf, sizeof(szJsonBuf), &nerror, &nrestart, SDK_API_WAIT);
        if (!bRet)
        {
            CString csErr;
            csErr.Format("%s 0x%08x...", ConvertString("SetupConfig PSTNBreakLine failed:", DLG_CFG_PSTNBREAKLINE), CLIENT_GetLastError());
            MessageBox(csErr, ConvertString("Prompt"));
            return FALSE;
        }
        else
        {
            MessageBox(ConvertString(CString("SetConfig PSTNBreakLine ok!"), DLG_CFG_PSTNBREAKLINE), ConvertString("Prompt"));
        }
    }
    return TRUE;
}
Example #12
0
void CDlgCfgNetwork::OnBtnSet() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	if (0 == m_lLoginID)
	{
		MessageBox(ConvertString("we haven't login a device yet!", DLG_CFG_NETWORK), ConvertString("Prompt"));
		return;
	}

	CString csIp, csMask, csGateway;
	m_ctlIp.GetWindowText(csIp);
	m_ctlMask.GetWindowText(csMask);
	m_ctlGateway.GetWindowText(csGateway);

//	CFG_NETWORK_INFO stuNetworkPara = {0};
	CFG_NETWORK_INFO& stuNetworkPara = m_stuNetwork;
	stuNetworkPara.nInterfaceNum = 1;
	strncpy(stuNetworkPara.stuInterfaces[0].szIP, csIp, MAX_ADDRESS_LEN-1);
	strncpy(stuNetworkPara.stuInterfaces[0].szSubnetMask, csMask, MAX_ADDRESS_LEN-1);
	strncpy(stuNetworkPara.stuInterfaces[0].szDefGateway, csGateway, MAX_ADDRESS_LEN-1);

	char szJsonBuf[1024] = {0};
	BOOL nRet = CLIENT_PacketData(CFG_CMD_NETWORK, &stuNetworkPara, sizeof(CFG_NETWORK_INFO), szJsonBuf, sizeof(szJsonBuf));
	if (!nRet)
	{
		MessageBox(ConvertString("Packet network json buffer failed.", DLG_CFG_NETWORK), ConvertString("Prompt"));
		return;
	}

	int nErr = 0, nRestart = 0;
	nRet = CLIENT_SetNewDevConfig(m_lLoginID, CFG_CMD_NETWORK,
		-1, szJsonBuf, strlen(szJsonBuf), &nErr, &nRestart, SDK_API_WAIT);
	if (!nRet)
	{
		CString csErr;
		csErr.Format("%s %08x...", ConvertString("SetupConfig network failed:", DLG_CFG_NETWORK), CLIENT_GetLastError());
		MessageBox(csErr, ConvertString("Prompt"));
		return ;
	}

 	MessageBox(ConvertString("send network parameters successfully.", DLG_CFG_NETWORK), ConvertString("Prompt"));

	return;
}
Example #13
0
void CSpliceScreenConfigDlg::OnOK() 
{
	if (m_wndWall.IsBlockIDConflict())
	{
		MsgBox("Block ID conflict.");
		return;
	}

	BOOL bResult = FALSE;
	const int nMaxJsonLen = 64 * 1024;
	char* pszJsonBuf = new char[nMaxJsonLen];
	memset(pszJsonBuf, 0, sizeof(nMaxJsonLen));

	AV_CFG_MonitorWall* pstuWall = new AV_CFG_MonitorWall;
	memset(pstuWall, 0, sizeof(AV_CFG_MonitorWall));
	pstuWall->nStructSize = sizeof(AV_CFG_MonitorWall);
	strcpy(pstuWall->szName, m_wndWall.GetName());
	pstuWall->nColumn = m_wndWall.GetGridLayout().cx;
	pstuWall->nLine = m_wndWall.GetGridLayout().cy;
	pstuWall->nBlockCount = __min(_countof(pstuWall->stuBlocks), m_wndWall.GetBlockCount());
	for (int i = 0; i < pstuWall->nBlockCount; ++i)
	{
		const WMBlock* pBlock = m_wndWall.GetBlock(i);
		AV_CFG_MonitorWallBlock& block = pstuWall->stuBlocks[i];
		block.nStructSize = sizeof(AV_CFG_MonitorWallBlock);
		strcpy(block.szName, pBlock->szName);
		block.nColumn = pBlock->stuTVSize.cx;
		block.nLine = pBlock->stuTVSize.cy;
		if (strlen(pBlock->szCompositeID))
		{
			strcpy(block.szCompositeID, pBlock->szCompositeID);
		}
		else
		{
			MsgBox1("Composite (%s) ID can't be empty.", block.szName);
		}
//		block.bComposite = TRUE;
		block.stuRect.nStructSize = sizeof(AV_CFG_Rect);
		RECT rcGrid = m_wndWall.GridRect(pBlock);
		block.stuRect.nLeft = rcGrid.left;
		block.stuRect.nTop = rcGrid.top;
		block.stuRect.nRight = rcGrid.right;
		block.stuRect.nBottom = rcGrid.bottom;
		block.nTVCount = __min(_countof(block.stuTVs), pBlock->vecOutputs.size());
		for (int j = 0; j < block.nTVCount; ++j)
		{
			AV_CFG_MonitorWallTVOut& output = block.stuTVs[j];
			output.nStructSize = sizeof(AV_CFG_MonitorWallTVOut);
			int nOutputID = pBlock->vecOutputs[j];
			output.nChannelID = nOutputID;
			sprintf(output.szName, "output %d", nOutputID);
		}
		// 开关机时间测试
// 		for (int k = 0; k < WEEK_DAY_NUM; ++k)
// 		{
// 			block.stuTimeSection[k][0].nBeginHour = 2;
// 			block.stuTimeSection[k][0].nEndHour = 3;			
// 			block.stuTimeSection[k][1].nBeginHour = 12;
// 			block.stuTimeSection[k][1].nEndHour = 13;
// 		}
	}

	if (CLIENT_PacketData(CFG_CMD_MONITORWALL, pstuWall, sizeof(*pstuWall), pszJsonBuf, nMaxJsonLen))
	{
		bResult = CLIENT_SetNewDevConfig(m_lLoginID, CFG_CMD_MONITORWALL, -1, pszJsonBuf, strlen(pszJsonBuf), NULL, NULL, WAIT_TIME);
	}

	/*
	// NVD需要再设置融合屏(老协议)
	CDemoMonitorWallDlg* pParent = (CDemoMonitorWallDlg*)GetParent();
	if (pParent && 
		pParent->GetDecoderInfo() && 
		strcmp(pParent->GetDecoderInfo()->GetDeviceClass(), CDecoderNVD::DCID()) == 0)
	{
		AV_CFG_SpliceScreen* pstuScreen = new AV_CFG_SpliceScreen[pstuWall->nBlockCount];
		ZeroMemory(pstuScreen, sizeof(AV_CFG_SpliceScreen) * pstuWall->nBlockCount);
		for (int i = 0; i < pstuWall->nBlockCount; ++i)
		{
			pstuScreen[i].nStructSize = sizeof(AV_CFG_SpliceScreen);
			strcpy(pstuScreen[i].szWallName, pstuWall->szName);
			pstuScreen[i].nBlockID = i;
			strcpy(pstuScreen[i].szName, pstuWall->stuBlocks[i].szName);
		}

		if (CLIENT_PacketData(CFG_CMD_SPLICESCREEN, pstuScreen, sizeof(AV_CFG_SpliceScreen) * pstuWall->nBlockCount, pszJsonBuf, nMaxJsonLen))
		{
			bResult = CLIENT_SetNewDevConfig(m_lLoginID, CFG_CMD_SPLICESCREEN, -1, pszJsonBuf, strlen(pszJsonBuf), NULL, NULL, WAIT_TIME);
		}
		delete[] pstuScreen;
	}
	*/

	delete pstuWall;
	delete[] pszJsonBuf;

	if (bResult)
	{
		CDialog::OnOK();
	}
	else
	{
		MsgBox("Set config error.");
	}
}
Example #14
0
static int 
dah_set_device_config(struct service *srv, int parm_id, void *parm)
{
    int ret = FALSE, err = 0;
    int user_id, cmd;

    proxy_ctrl_t *ctrl;
    proxy_task_t *task;

    dah_service_t *dah_srv;
    dah_config_t  *dah_cfg;
    dah_new_config_t *dah_new_cfg;

    DISKCTRL_PARAM *disk_ctrl;

    NMP_ASSERT(srv && parm_id && 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 SET_SERIAL_CONFIG:
            goto SET_CFG;
        case SET_DEVICE_TIME:
            goto SET_CFG;
        case SET_NTP_CONFIG:
            goto SET_CFG;
        case SET_NETWORK_CONFIG:
            goto SET_CFG;
        case SET_PPPOE_CONFIG:
            goto SET_CFG;
        case SET_FTP_CONFIG:
            goto SET_CFG;
        case SET_SMTP_CONFIG:
            goto SET_CFG;
        case SET_DDNS_CONFIG:
            goto SET_CFG;
        case SET_UPNP_CONFIG:
            goto SET_CFG;

        case SET_DISK_FORMAT:
            disk_ctrl = (DISKCTRL_PARAM*)nmp_new(DISKCTRL_PARAM, 1);
            memcpy(disk_ctrl, ((dah_config_t*)parm)->buffer, sizeof(DISKCTRL_PARAM));
            ctrl = proxy_new_ctrl_2(srv, CTRL_CMD_FRMTDISK, disk_ctrl, 
                    sizeof(DISKCTRL_PARAM), dah_free_ctrl_user);
            if (!ctrl)
                ret = FALSE;
            else
            {
                task = proxy_new_task(CONTROL_DEVICE, ctrl, sizeof(ctrl), 
                        proxy_free_ctrl, dah_srv->owner);
                if (task)
                {
                    proxy_thread_pool_push(task);
                    ret = TRUE;
                }
                else
                {
                    proxy_free_ctrl((void*)ctrl, sizeof(ctrl));
                    ret = FALSE;
                }
            }
            break;

        case CONTROL_DEVICE_CMD:
            switch (((JControlDevice*)parm)->command)
            {
                case SHUTDOWN_DEVICE:
                    ret = TRUE;
                    cmd = CTRL_CMD_SHUTDOWN;
                    break;
                case RESTART_DEVICE:
                    ret = TRUE;
                    cmd = CTRL_CMD_REBOOT;
                    break;
                case RESTORE_DEFAULT:
                    ret = TRUE;
                    cmd = CTRL_CMD_RESET;
                    break;

                case DETECT_DEAL_PIX:
                    ret = FALSE;
                    break;
                case DETECT_IRIS:
                    ret = FALSE;
                    break;

                default:
                    ret = FALSE;
                    break;
            }

            if (ret)
            {
                ctrl = proxy_new_ctrl(srv, cmd, NULL);
                if (!ctrl)
                    ret = FALSE;
                else
                {
                    task = proxy_new_task(CONTROL_DEVICE, ctrl, sizeof(ctrl), 
                            proxy_free_ctrl, dah_srv->owner);
                    if (task)
                    {
                        proxy_thread_pool_push(task);
                        ret = TRUE;
                    }
                    else
                    {
                        proxy_free_ctrl((void*)ctrl, sizeof(ctrl));
                        ret = FALSE;
                    }
                }
            }
            break;

        case SET_ENCODE_CONFIG:
            goto SET_CFG;
        case SET_DISPLAY_CONFIG:
            goto SET_CFG;
        case SET_OSD_CONFIG:
            goto SET_CFG;
        case SET_PTZ_CONFIG:
            goto SET_NEW_CFG;
        case SET_RECORD_CONFIG:
            goto SET_CFG;
        case SET_HIDE_CONFIG:
            goto SET_CFG;
        case SET_MOTION_CONFIG:
            goto SET_CFG;
        case SET_VIDEO_LOST_CONFIG:
            goto SET_CFG;
        case SET_HIDE_ALARM_CONFIG:
            goto SET_CFG;
        case SET_IO_ALARM_CONFIG:
            goto SET_CFG;

        case CONTROL_PTZ_CMD:
            ret = CLIENT_PTZControl(user_id, 
                    (int  )((dah_ptz_ctrl_t*)parm)->channel, 
                    (DWORD)((dah_ptz_ctrl_t*)parm)->ptz_cmd, 
                    (DWORD)((dah_ptz_ctrl_t*)parm)->step, 
                    (BOOL )((dah_ptz_ctrl_t*)parm)->stop);
            break;

        case SET_PRESET_CONFIG:
            /*strm_info = find_stream_by_channel(&dah_srv->rtsp.real_strm_list, 
                            ((struct dah_preset*)parm)->channel);
            if (strm_info && DAH_INVALID_HANDLE != strm_info->handle)
            {
                handle = strm_info->handle;
            }

            if (DAH_INVALID_HANDLE != handle)
            {
                ret = NET_DVR_PTZPreset((LONG)handle, 
                    (DWORD)((struct dah_preset*)parm)->preset_cmd, 
                    (DWORD)((struct dah_preset*)parm)->preset_no);
show_debug("NET_DVR_PTZPreset: %s<-------------------------------\n", (ret == TRUE) ? "Success" : "Failure");
            }*/
            break;

        case SET_CRUISE_CONFIG:
        case ADD_CRUISE_CONFIG:
        case MDF_CRUISE_CONFIG:
            break;

        default:
            ret = FALSE;
            break;
    }
    
    if (TRUE == ret)
        return 0;
    else
        return -1;

SET_CFG:
    dah_cfg = (dah_config_t*)parm;
    ret = CLIENT_SetDevConfig(user_id, 
            (DWORD  )dah_cfg->command, 
            (LONG   )dah_cfg->channel, 
            (LPVOID )dah_cfg->buffer, 
            (DWORD  )dah_cfg->b_size, 
            (int    )dah_cfg->waittime);
    show_debug("CLIENT_SetDevConfig: %s<-------------------------------\n", 
        (ret == TRUE) ? "Success" : "Failure");

    if (TRUE == ret)
        return 0;
    else
    {
        show_debug("ERROR: 0x%x<-------------------------------\n", 
            CLIENT_GetLastError());
        return -1;
    }

SET_NEW_CFG:
    dah_new_cfg = (dah_new_config_t*)parm;
    ret = CLIENT_PacketData(
            dah_new_cfg->command, 
            dah_new_cfg->buffer, 
            dah_new_cfg->b_size, 
            dah_new_cfg->out_json, 
            DEF_OUT_JSON_SIZE);
    if (ret)
    {
        ret = CLIENT_SetNewDevConfig(user_id, 
                dah_new_cfg->command, 
                dah_new_cfg->channel, 
                dah_new_cfg->out_json, 
                DEF_OUT_JSON_SIZE, 
                &err, FALSE, dah_new_cfg->waittime);

        show_debug("CLIENT_SetNewDevConfig: %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;
    }
}