From 0defce43c97145172f10a5c114281e704820f95c Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期六, 13 六月 2020 13:53:38 +0800 Subject: [PATCH] update --- device/hcnetdisk.c | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/device/hcnetdisk.c b/device/hcnetdisk.c index 7938a60..4c5353b 100644 --- a/device/hcnetdisk.c +++ b/device/hcnetdisk.c @@ -1,5 +1,4 @@ #include "netdisk.h" -#include "hcnetdisk.h" bool HCNetdisk::envInited = false; @@ -36,8 +35,8 @@ -HCNetdisk::HCNetdisk(const std::string &_devicename):Netdisk(_devicename){ - +HCNetdisk::HCNetdisk(): Netdisk(){ + deviceType="HC"; } int HCNetdisk::_login(Netdisk_LoginInfo &loginInfo) { @@ -55,6 +54,7 @@ NET_DVR_DEVICEINFO_V40 struDeviceInfo = {0}; //lUserID = 0; lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfo); + printf("lUserID = %d\n", lUserID); if (lUserID < 0) { printf("Login error, %d\n", NET_DVR_GetLastError()); @@ -62,7 +62,8 @@ return -1; } - printf("lUserID = %ld\n", lUserID); + + loginInfo.userid = std::to_string(lUserID); userid = lUserID; username = loginInfo.username; password = loginInfo.password; @@ -70,10 +71,8 @@ port = loginInfo.port; - startChannel = struDeviceInfo.struDeviceV30.byStartDChan; - maxChannels = struDeviceInfo.struDeviceV30.byIPChanNum + struDeviceInfo.struDeviceV30.byHighDChanNum * 256; - - + deviceInfo.startChannel = struDeviceInfo.struDeviceV30.byStartDChan; + deviceInfo.maxChannels = struDeviceInfo.struDeviceV30.byIPChanNum + struDeviceInfo.struDeviceV30.byHighDChanNum * 256; return 0; } @@ -81,16 +80,14 @@ int HCNetdisk::login(Netdisk_LoginInfo &loginInfo) { - //_login(loginInfo); - Netdisk::addLoginInfo(loginInfo); + return _login(loginInfo); + //Netdisk::addLoginInfo(loginInfo); - return 0; } int HCNetdisk::logout() { //娉ㄩ攢鐢ㄦ埛 NET_DVR_Logout(userid); - userid = -1; return 0; } @@ -99,8 +96,8 @@ char destfile[1024]; int i = 0; - Netdisk_LoginInfo loginInfo = Netdisk::getLoginInfo(request.loginUUID); - _login(loginInfo); + // Netdisk_LoginInfo loginInfo = Netdisk::getLoginInfo(request.loginUUID); + // _login(loginInfo); start = request.start; @@ -117,15 +114,17 @@ // printf("end = %s", asctime(&end)); sprintf(destfile, "%s/%s-%d-%ld-%d", request.destpath.c_str(), - devicename.c_str(), + deviceType.c_str(), request.channel, mktime(&start), i); - // printf("%s\n", destfile); - downloadByTime_wrapper(userid, request.channel, &start, &end, destfile); - if(files != NULL) { - files->push_back(destfile); - } + + if(downloadByTime_wrapper(userid, request.channel, &start, &end, destfile) != -1) { + if(files != NULL) { + files->push_back(destfile); + } + } + start = end; i++; } -- Gitblit v1.8.0