Created
March 5, 2018 21:25
-
-
Save ybenitezf/6c10882e46e05ffccaeeb1cb3ea1f51f to your computer and use it in GitHub Desktop.
hvikrecorder control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <iostream> | |
#include "Windows.h" | |
#include "HCNetSDK.h" | |
using namespace std; | |
int saveRecordFile(int userId,char * srcfile,char * destfile) | |
{ | |
int bRes = 1; | |
int hPlayback = 0; | |
if( (hPlayback = NET_DVR_GetFileByName(userId, srcfile, destfile)) =0; nPos = NET_DVR_GetDownloadPos(hPlayback)) | |
{ | |
Sleep(5000); //millisecond | |
} | |
printf("have got %d\n", nPos); | |
if(!NET_DVR_StopGetFile(hPlayback)) | |
{ | |
printf("failed to stop get file [%d]\n",NET_DVR_GetLastError()); | |
bRes = -1; | |
return bRes; | |
} | |
printf("%s\n",srcfile); | |
if(nPos100) | |
{ | |
printf("download err [%d]\n",NET_DVR_GetLastError()); | |
bRes=-1; | |
return bRes; | |
} | |
else | |
{ | |
return 0; | |
} | |
} | |
void main() { | |
//--------------------------------------- | |
//Init device | |
NET_DVR_Init(); | |
//Set connect time and reconnect time | |
NET_DVR_SetConnectTime(2000, 1); | |
NET_DVR_SetReconnect(10000, true); | |
//--------------------------------------- | |
// Register device | |
LONG lUserID; | |
NET_DVR_DEVICEINFO_V30 struDeviceInfo; | |
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo); | |
if (lUserID = 0) | |
{ | |
NET_DVR_FindClose_V30(lFindHandle); | |
} | |
//Logout device | |
NET_DVR_Logout(lUserID); | |
//Release sdk resource | |
NET_DVR_Cleanup(); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment