资源简介
QT开发的视频采集并定时上传到服务器例程
使用到了OpenCV库函数
代码片段和文件信息
#include
#include
#include
#include
#include “ftpput.h“
FtpPut::FtpPut(Qobject *parent)
: Qobject(parent)
{
iTimeOutSeconds = 10;
connect(&ftp SIGNAL(commandStarted(int)) this SLOT(ftpCommandStarted(int)));
connect(&ftp SIGNAL(commandFinished(int bool)) this SLOT(ftpCommandFinished(int bool)));
connect(&ftp SIGNAL(stateChanged(int)) this SLOT(ftpStateChanged(int)));
connect(&ftp SIGNAL(done(bool)) this SLOT(ftpDone(bool)));
}
bool FtpPut::connectServer(const QUrl &url QString userName QString passWord)
{
int iCount;
if (!url.isValid())
{
std::cerr << “Error: Invalid URL“ << std::endl;
return false;
}
if (url.scheme() != “ftp“)
{
std::cerr << “Error: URL must start with ‘ftp:‘“ << std::endl;
return false;
}
iCount = 0;
idFtpConnect = ftp.connectToHost(url.host() url.port(21));
while(iFtpState != 1)
{
if (iFtpState < 0)
return false;
QTest::qWait(100);
iCount++;
if(iCount > iTimeOutSeconds*10)
{
iFtpState = -10;
std::cerr << “Error: timeout!“ << std::endl;
}
}
// ftp.login();
iCount = 0;
idFtpLogin = ftp.login(userName passWord);
while(iFtpState != 2)
{
if (iFtpState < 0)
return false;
QTest::qWait(100);
iCount++;
if(iCount > iTimeOutSeconds*10)
{
iFtpState = -10;
std::cerr << “Error: timeout!“ << std::endl;
}
}
iCount = 0;
idFtpSetTransferMode = ftp.setTransferMode(QFtp::Active);
while(iFtpState != 3)
{
if (iFtpState < 0)
return false;
QTest::qWait(100);
iCount++;
std::cerr << “Time takes: “ << float(iCount)/10.0 << std::endl;
if(iCount > iTimeOutSeconds*10)
{
iFtpState = -10;
std::cerr << “Error: timeout!“ << std::endl;
}
}
return true;
}
bool FtpPut::disconnectServer()
{
int iCount;
iCount = 0;
idFtpClose = ftp.close();
while(iFtpState != 6)
{
if (iFtpState < 0)
return false;
QTest::qWait(100);
iCount++;
if(iCount > iTimeOutSeconds*10)
{
iFtpState = -10;
std::cerr << “Error: timeout!“ << std::endl;
}
}
return true;
}
bool FtpPut::changeDir(QString dstPath)
{
int iCount;
iCount = 0;
idFtpCD = ftp.cd(dstPath);
while(iFtpState != 4)
{
if (iFtpState < 0)
return false;
QTest::qWait(100);
iCount++;
if(iCount > iTimeOutSeconds*10)
{
iFtpState = -10;
std::cerr << “Error: timeout!“ << std::endl;
return false;
}
}
return true;
}
bool FtpPut::putFile(QString localFileName QString dstFileName)
{
int iCount;
file.setFileName(localFile
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 784 2013-05-13 17:13 GigeVideoSave\GigeVideoSave.pro
文件 18941 2013-05-14 14:46 GigeVideoSave\GigeVideoSave.pro.user
文件 3516 2013-08-02 11:26 GigeVideoSave\main.cpp
文件 6944 2013-05-13 18:05 GigeVideoSave\ftpput.cpp
文件 1157 2013-05-13 17:16 GigeVideoSave\ftpput.h
目录 0 2013-05-12 20:38 GigeVideoSave
----------- --------- ---------- ----- ----
31342 6
- 上一篇:TCP/UDP/ICMP/IGMP发包工具
- 下一篇:专门卸载软件的工具
相关资源
- labview_vision连续图像采集
- LabVIEWvision破解和一个更新的dll
- linux下的通用lcd驱动lcdproc
- Keil uVision4 STC库文件
- 简单的IRC server
- HaneWin NFS Server 1.2.18汉化版文件包-搭建
- Vita48- Revision D0.15
- SkSockServer
- arcgis server 10.3 开发服务器 授权文件
- KEPserver__OPC远程访问配置步骤说明
- roboticsvisionandcontrolpdf.txt
- ubuntu server 10.4下Apache2的三种虚拟主机
- VisualSVN Server 用网页修改用户密码
- OPC Server 用户使用手册
- arcgis server 10.3 许可文件
- Vision Development Module 8.5.注册机
- ibm serveRAID M1015 M5015驱动
- ibm serveRAID M1015驱动
- Windows Server 2008上安装Exchange Server 20
- Geoserver WPS服务开发教程
- 在数据库中遍历查找某个字符串
- Windows server 2008 R2 M5210e、m5210阵列卡驱
- 使用geoserver发布arcgis切片
- Intel 82583V网卡 Windows Server 2016 驱动
- keil uVision4 for ARM Cortex-M3 使用汇编
- 微型HTTP服务器-HttpMockServerTool
- ArcGIS 10.2许可文件(LicenceManager+Deskt
- ArcGIs Server 缓冲区查询源码
- ArcGIS Server 和Portal 10.5 授权证书 ecp
- Active X (OCX)日期控件超级好用,包
评论
共有 条评论