In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to debug VS2022 through Haikang camera fireworks identification SDK, the article is very detailed, has a certain reference value, interested friends must read it!
The following is the code I put into the VS 2022 version after debugging according to the Haikang official documentation code:
# include # include # include "Windows.h" # include "HCNetSDK.h" using namespace std / / time resolution macro definition # define GET_YEAR (_ time_) (_ time_) > 26) + 2000) # define GET_MONTH (_ time_) (_ time_) > 22) & 15) # define GET_DAY (_ time_) (_ time_) > > 17) & 31) # define GET_HOUR (time_) (_ time_) > 12) & 31) # define GET_MINUTE (_ time_) ((_ time_) > 6) & 63) # define GET_SECOND (_ time_) ((_ time_) > > 0) & 63) BOOL CALLBACK MessageCallback (LONG lCommand NET_DVR_ALARMER* pAlarmer, char* pAlarmInfo, DWORD dwBufLen, void* pUser) {switch (lCommand) {case COMM_FIREDETECTION_ALARM: / / Fire Point Detection alarm {printf ("fire192.168.1.31\ n") NET_DVR_FIREDETECTION_ALARM struFireDetection = {0}; memcpy (& struFireDetection, pAlarmInfo, sizeof (NET_DVR_FIREDETECTION_ALARM)) Printf ("Fire Point Detection alarm: RelativeTime:%d, AbsTime:%d, PTZ {PanPos:%d, TiltPos:%d, ZoomPos:%d},\ PicDataLen:%d, DevInfo {DevIP:%s, Port:%d, Channel:%d, IvmsChannel:%d},\ FireMaxTemperature:%d, TargetDistance:%d, fireRectInfo {fX:%f,fY:%f,fWidth%f,fHeight%f},\ fireMaxTemperaturePoint {fX:%f] FY:%f}\ n ", struFireDetection.dwRelativeTime,\ struFireDetection.dwAbsTime, struFireDetection.wPanPos, struFireDetection.wTiltPos,\ struFireDetection.wZoomPos, struFireDetection.dwPicDataLen,\ struFireDetection.struDevInfo.struDevIP.sIpV4, struFireDetection.struDevInfo.wPort,\ struFireDetection.struDevInfo.byChannel, struFireDetection.struDevInfo.byIvmsChannel,\ struFireDetection.wFireMaxTemperature, struFireDetection.wTargetDistance,\ struFireDetection.struRect.fX, struFireDetection.struRect.fY StruFireDetection.struRect.fWidth,\ struFireDetection.struRect.fHeight, struFireDetection.struPoint.fX, struFireDetection.struPoint.fY) NET_DVR_TIME struAbsTime = {0}; struAbsTime.dwYear = GET_YEAR (struFireDetection.dwAbsTime); struAbsTime.dwMonth = GET_MONTH (struFireDetection.dwAbsTime); struAbsTime.dwDay = GET_DAY (struFireDetection.dwAbsTime); struAbsTime.dwHour = GET_HOUR (struFireDetection.dwAbsTime); struAbsTime.dwMinute = GET_MINUTE (struFireDetection.dwAbsTime); struAbsTime.dwSecond = GET_SECOND (struFireDetection.dwAbsTime) / / Save alarm snapshot if (struFireDetection.dwPicDataLen > 0 & & struFireDetection.pBuffer! = NULL) {char cFilename [256] = {0}; HANDLE hFile; DWORD dwReturn; char chTime [128] Sprintf_s (chTime, "% 4.4d%2.2d%2.2d%2.2d%2.2d%2.2d", struAbsTime.dwYear, struAbsTime.dwMonth, struAbsTime.dwDay, struAbsTime.dwHour, struAbsTime.dwMinute, struAbsTime.dwSecond); sprintf_s (cFilename, "FireDetectionPic [% s] [% s] .jpg", struFireDetection.struDevInfo.struDevIP.sIpV4, chTime); LPCWSTR tmp / / begin added by zhangchao tmp = L "FireDetectionPic31.jpg"; / / end added by zhangchao / / printf ("% s", tmp); hFile = CreateFile (tmp, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile = = INVALID_HANDLE_VALUE) {break } WriteFile (hFile, struFireDetection.pBuffer, struFireDetection.dwPicDataLen, & dwReturn, NULL); CloseHandle (hFile); hFile = INVALID_HANDLE_VALUE;}} break; default: printf ("other192.168.1.31\ n"); printf ("other alarms, alarm message type:% d\ n", lCommand); break } return TRUE;} void RunCam (const char* ip) {/ /-- / / initialize NET_DVR_Init (); / / set connection time and reconnection time NET_DVR_SetConnectTime (2000, 1); NET_DVR_SetReconnect (10000, true) / /-/ / register device LONG lUserID; / / login parameters, including device address, login user, password, etc. NET_DVR_USER_LOGIN_INFO struLoginInfo = {0}; struLoginInfo.bUseAsynLogin = 0; / / synchronous login method strcpy_s (struLoginInfo.sDeviceAddress, ip) StruLoginInfo.wPort = 8000; / device service port strcpy_s (struLoginInfo.sUserName, "your_username"); / / device login user name strcpy_s (struLoginInfo.sPassword, "your_password"); / / device login password / / device information, output parameter NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0}; lUserID = NET_DVR_Login_V40 (& struLoginInfo, & struDeviceInfoV40); if (lUserID)
< 0) { printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); NET_DVR_Cleanup(); return; } //设置报警回调函数 NET_DVR_SetDVRMessageCallBack_V31(MessageCallback, NULL); //启用布防 LONG lHandle; NET_DVR_SETUPALARM_PARAM struAlarmParam = { 0 }; struAlarmParam.dwSize = sizeof(struAlarmParam); //火点检测不需要设置其他报警布防参数,不支持 lHandle = NET_DVR_SetupAlarmChan_V41(lUserID, &struAlarmParam); if (lHandle < 0) { printf("NET_DVR_SetupAlarmChan_V41 error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } Sleep(50000); //等待过程中,如果设备上传报警信息,在报警回调函数里面接收和处理报警信息 //撤销布防上传通道 if (!NET_DVR_CloseAlarmChan_V30(lHandle)) { printf("NET_DVR_CloseAlarmChan_V30 error, %d\n", NET_DVR_GetLastError()); NET_DVR_Logout(lUserID); NET_DVR_Cleanup(); return; } //注销用户 NET_DVR_Logout(lUserID); //释放SDK资源 NET_DVR_Cleanup();}void main() { RunCam("192.168.1.31"); return;}如何配置VS 2022 ? 第一步:打开窗口顶部 【项目】菜单,选中 【属性】。 第二步:在打开的对话框中,左侧菜单选择 【C/C++】=>[general], select the additional inclusion directory on the right, click the down arrow that appears on the right, click Edit, and fill in the dialog box that opens as follows:
The header files of Haikang are placed in the D:\ ws\ vc\ emptycam\ hkheader folder, which are: DataType.h, DecodeCardSdk.h, HCNetSDK.h, plaympeg4.h.
Step 3: select [Linker] > [General] from the left menu. Select the additional library directory on the right, click the small triangle on the right, click Edit, and open the dialog box.
The folder D:\ ws\ vc\ emptycam\ hkdll is where the Haikang dll file is placed. The file is shown in the following figure:
Step 4: select [Linker] > [input] from the left menu. Select [additional dependencies] on the right, click the small triangle on the right, click Edit, and open the dialog box. Fill in the content according to the text in the picture.
The above is all the contents of the article "how to debug VS2022 to identify SDK through Haikang camera fireworks". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.