Beispiel #1
0
void CDevByFileDlg::OnButtonQuery() 
{
	// TODO: Add your control notification handler code here
	BOOL bValid = UpdateData(TRUE);
	if(bValid && (0 != m_lLoginHandle))
	{
		int nIndex = m_ctlChannel.GetCurSel();
		int nChannelId = (int)m_ctlChannel.GetItemData(nIndex);

		NET_TIME netTimeFrom = ConvertToDateTime(m_dateFrom,m_timeFrom);
		NET_TIME netTimeTo = ConvertToDateTime(m_dateTo,m_timeTo);

		nIndex = m_ctlType.GetCurSel();	
		int nRecordFileType = m_ctlType.GetItemData(nIndex);

		int nMaxLen = 2000 * sizeof(NET_RECORDFILE_INFO);
		int nFileCount = 0;
		BOOL bSuccess = CLIENT_QueryRecordFile(m_lLoginHandle, nChannelId, nRecordFileType,
			&netTimeFrom, &netTimeTo, NULL, m_netFileInfo, nMaxLen, &nFileCount, 5000, FALSE);
		if(bSuccess)
		{
			if(0 == nFileCount)
			{
				MessageBox(ConvertString("No record!"), ConvertString("Prompt"));
			}
			else
			{
				AddRecordInfoToListView(m_netFileInfo,nFileCount);
			}
		}
		else
		{
			MessageBox(ConvertString("Failed to query!"), ConvertString("Prompt"));
		}
	}
}
Beispiel #2
0
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;
    }
}