mobile CCTV,mobile surveillance,police body worn cameras
标题:
使用MFC 通过FTP访问设备文件
[打印本页]
author:
zhu52170341
time:
2020-8-17 16:55
标题:
使用MFC 通过FTP访问设备文件
void ms_On_Ftp_Event(BVCU_FTP_HSession hSession, int iEventCode, void* pParam)
{
BVCU_Result result = ((BVCU_Event_Common*)pParam)->iResult;
printf_s("\n\n=========ms_On_Ftp_Event: hSession:%d, iEventCode:%d, result:%d.\n\n", hSession, iEventCode, result);
}
void ms_On_Ftp_Cmd(BVCU_FTP_HSession hSession, BVCU_FTP_Command* pCommand, int iEventCode, void* pParam)
{
BVCU_Event_SessionCmd* sessionCmd = (BVCU_Event_SessionCmd*)pParam;
int dataCount = sessionCmd->stContent.iDataCount;
string * fileNames = new string[dataCount];
BVCU_FTP_RecordFileInfo* infos = (BVCU_FTP_RecordFileInfo*)(sessionCmd->stContent.pData);
for (int i = 0;i < dataCount;i++)
{
fileNames[i] = string(infos[i].szFileName);
}
printf_s("\n\n---------ms_On_Ftp_Cmd: hSession:%d, iResult:%d, dataCount:%d, iEventCode:%d.\n",
hSession, sessionCmd->iResult, dataCount, iEventCode);
for (int i = 0;i < dataCount; i++)
{
printf_s("fileName: %s\n", fileNames[i]);
}
}
void Login_Ftp()
{
BVCU_FTP_ServerParam pParam;//= new BVCU_FTP_ServerParam();
memset(&pParam, 0, sizeof(pParam));
pParam.iSize = sizeof(pParam);
pParam.hSession = CMLibBVCU::m_session;
strcpy_s(pParam.szID, sizeof(pParam.szID), "PU_273A");
memset(pParam.szUserName, 0, sizeof(pParam.szUserName));
memset(pParam.szPassword, 0, sizeof(pParam.szPassword));
memset(pParam.szServerAddr, 0, sizeof(pParam.szServerAddr));
//strcpy_s(pParam.szUserName, sizeof(pParam.szUserName), "");
//strcpy_s(pParam.szPassword, sizeof(pParam.szPassword), "");
//strcpy_s(pParam.szServerAddr, sizeof(pParam.szServerAddr), "");
pParam.iServerPort = 0;
pParam.iTimeOut = 10000;// loginTimeOut <= 0 ? 300000 : loginTimeOut;
pParam.iKeepAliveInterval = 0;
pParam.OnEvent = ms_On_Ftp_Event;
BVCU_FTP_HSession* m_FtpSessionHandle;
BVCU_Result ret = BVCU_FTP_Login(&m_FtpSessionHandle, &pParam);
printf_s("\n\n+++++++++++++BVCU_FTP_Login:%d\n\n", ret);
}
void Query_Ftp_Record()
{
BVCU_FTP_Command cmd;
memset(&cmd, 0, sizeof(BVCU_FTP_Command));
cmd.iSize = sizeof(BVCU_FTP_Command);
cmd.iMethod = BVCU_FTP_METHOD_SEARCH_RECORDFILE;// BVCU_FTP_METHOD_SEARCH_RECORDFILE;
cmd.OnEvent = ms_On_Ftp_Cmd;
cmd.iTimeOut = 10000;
cmd.stMsgContent.iDataCount = 1;
BVCU_FTP_RecordFileFilter recordFilter;// = new BVCU_FTP_RecordFileFilter();
memset(&recordFilter, 0, sizeof(recordFilter));
strcpy_s(recordFilter.szPUID, sizeof(recordFilter.szPUID), "PU_273A");
//strcpy_s(recordFilter->szPUName, sizeof(recordFilter->szPUName), "CYYHDMDVR2737");
recordFilter.iChannelIndex = -1;// channelIndex < 0 ? -1 : channelIndex;//如果小于0,则设置为-1,查询所有
recordFilter.iFileType = 0;
recordFilter.iTimeBegin = 1407132000000000;// mktime(t_startTime) * 1000000;
recordFilter.iTimeEnd = 1407218400000000;// mktime(t_endTime) * 1000000;
cmd.stMsgContent.iDataCount = 1;
cmd.stMsgContent.pData = &recordFilter;
BVCU_Result ret = BVCU_FTP_SendCommand(m_FtpSessionHandle, &cmd);
printf_s("\n\n+++++++++++++BVCU_FTP_SendCommand:%d\n\n", ret);
}
---------------------------------------------------------
以上是MFCDEMO 里面的代码 都是被注释起来了, 我想通过FTP访问设备文件,
请问一下 BVCU_Event_SessionCmd,BVCU_FTP_HSession等 这个数据结构定义的头文件是哪个?在MFCDEMO里我没找到 ,开发手册里没有
author:
besovideo
time:
2020-8-17 16:57
请加微信13355692871
author:
fanghj90
time:
2020-8-17 17:02
您好,请问用的是什么设备呢? ftp接口已经不推荐使用,且android设备已经不再支持。android设备 查询/下载文件,分别使用BVCU_SUBMETHOD_SEARCH_LIST命令和BVCU_FileTransfer_Open接口。
author:
besovideo
time:
2020-8-17 17:03
FTP接口是针对老一代的基于海思芯片的嵌入式LINUX设备的,
目前主流的安卓终端已经废弃了这种旧的接口,改用全新的优化的文件上传、下载的接口了。
author:
zhu52170341
time:
2020-8-17 17:05
全新的优化的文件上传、下载的接口是哪个 有技术文档吗?
author:
fanghj90
time:
2020-8-17 17:11
zhu52170341 post on2020-8-17 17:05
全新的优化的文件上传、下载的接口是哪个 有技术文档吗?
https://github.com/besovideo/bvcusdk
https://gitee.com/besovideo/bvcusdk
c#demo中有示例代码。
查询文件:BVCU_SUBMETHOD_SEARCH_LIST命令
下载文件:BVCU_FileTransfer_Open接口。
author:
zhu52170341
time:
2020-8-17 17:13
没有C++的demo吗?
author:
besovideo
time:
2020-8-17 17:14
底层都是C++,只是界面是C#的,没本质区别。您仔细研究下即可。
author:
zhu52170341
time:
2020-8-18 09:51
请问一下 方便QQ或者微信联系吗?QQ:419273936 VX :z7899999
欢迎光临 mobile CCTV,mobile surveillance,police body worn cameras (http://bbs.besovideo.com:8067/)
Powered by Discuz! X3.2