﻿

{"id":15634,"date":"2023-10-07T11:28:57","date_gmt":"2023-10-07T02:28:57","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15634"},"modified":"2023-12-13T10:17:10","modified_gmt":"2023-12-13T01:17:10","slug":"people-counting-searching-history-data","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/people-counting-searching-history-data\/","title":{"rendered":"\u3010People Counting\u3011Searching History Data"},"content":{"rendered":"<p><strong><span style=\"font-size: 18pt;\">\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/span><\/strong><\/p>\n<p>\/\/<br \/>\n\/\/ Device Network SDK (People Counting)<br \/>\n\/\/ Search Data and Report<br \/>\n\/\/ Sample Code for Searching History Data<br \/>\n\/\/<br \/>\n#include &lt;stdio.h&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &#8220;Windows.h&#8221;<br \/>\n#include &#8220;HCNetSDK.h&#8221;<br \/>\nusing namespace std;<\/p>\n<p>void main() {<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\/\/ Initialize<br \/>\nNET_DVR_Init();<br \/>\n\/\/Set connection time and reconnection time<br \/>\nNET_DVR_SetConnectTime(2000, 1);<br \/>\nNET_DVR_SetReconnect(10000, true);<\/p>\n<p>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\/\/ Log in to device.<br \/>\nLONG lUserID;<\/p>\n<p>\/\/Login parameters, including device IP address, user name, password, and so on.<br \/>\nNET_DVR_USER_LOGIN_INFO struLoginInfo = {0};<br \/>\nstruLoginInfo.bUseAsynLogin = 0; \/\/Synchronous login mode<br \/>\nstrcpy(struLoginInfo.sDeviceAddress, &#8220;192.0.0.64&#8221;); \/\/IP address<br \/>\nstruLoginInfo.wPort = 8000; \/\/Service port<br \/>\nstrcpy(struLoginInfo.sUserName, &#8220;admin&#8221;); \/\/User name<br \/>\nstrcpy(struLoginInfo.sPassword, &#8220;abcd1234&#8221;); \/\/Password<\/p>\n<p>\/\/Device information, output parameter<br \/>\nNET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0};<br \/>\nlUserID = NET_DVR_Login_V40(&amp;struLoginInfo, &amp;struDeviceInfoV40);<br \/>\nif (lUserID &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;Login failed, error code: %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>NET_DVR_PDC_QUERY_COND m_struPdcResultCond={0};<br \/>\nm_struPdcResultCond.dwSize = sizeof(m_struPdcResultCond);\/\/Condition for searching people counting data<br \/>\nm_struPdcResultCond.dwChannel = 1; \/\/Device channel No.<\/p>\n<p>\/\/Start time<br \/>\nm_struPdcResultCond.struStartTime.wYear = 2016;<br \/>\nm_struPdcResultCond.struStartTime.byMonth = 9;<br \/>\nm_struPdcResultCond.struStartTime.byDay = 5;<br \/>\nm_struPdcResultCond.struStartTime.byHour = 00;<br \/>\nm_struPdcResultCond.struStartTime.byMinute = 00;<br \/>\nm_struPdcResultCond.struStartTime.bySecond = 00;<\/p>\n<p>\/\/End time<br \/>\nm_struPdcResultCond.struEndTime.wYear = 2016;<br \/>\nm_struPdcResultCond.struEndTime.byMonth = 9;<br \/>\nm_struPdcResultCond.struEndTime.byDay = 11;<br \/>\nm_struPdcResultCond.struEndTime.byHour = 23;<br \/>\nm_struPdcResultCond.struEndTime.byMinute = 59;<br \/>\nm_struPdcResultCond.struEndTime.bySecond = 59;<br \/>\nm_struPdcResultCond.byReportType = 2; \/\/Search type: 0-Invalid, 1-Daily Report, 2-Weekly Report, 3- Monthly Report, 4-Annual Report<\/p>\n<p>LONG m_lHandle = NET_DVR_StartRemoteConfig(lUserID, NET_DVR_GET_PDC_RESULT, &amp;m_struPdcResultCond, sizeof(m_struPdcResultCond), NULL, NULL);<br \/>\nif (m_lHandle &gt;= 0)<br \/>\n{<br \/>\nLONG iNextRet = 0;<br \/>\nNET_DVR_PDC_RESULT m_struPdcResult = {0};<br \/>\nwhile(true)<br \/>\n{<br \/>\niNextRet = NET_DVR_GetNextRemoteConfig(m_lHandle, &amp;m_struPdcResult, sizeof(NET_DVR_PDC_RESULT));<br \/>\nif (iNextRet == NET_SDK_GET_NEXT_STATUS_SUCCESS) \/\/Data is found.<br \/>\n{<br \/>\nprintf(&#8220;StartTime[%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d]EndTime[%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d]dwEnterNum[%d]dwLeaveNum[%d]\\n&#8221;,\\<br \/>\nm_struPdcResult.struStartTime.wYear, m_struPdcResult.struStartTime.byMonth, m_struPdcResult.struStartTime.byDay,\\<br \/>\nm_struPdcResult.struStartTime.byHour, m_struPdcResult.struStartTime.byMinute, m_struPdcResult.struStartTime.bySecond,\\<br \/>\nm_struPdcResult.struEndTime.wYear, m_struPdcResult.struEndTime.byMonth, m_struPdcResult.struEndTime.byDay, \\<br \/>\nm_struPdcResult.struEndTime.byHour, m_struPdcResult.struEndTime.byMinute, m_struPdcResult.struEndTime.bySecond);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nif (iNextRet == NET_SDK_GET_NETX_STATUS_NEED_WAIT) \/\/Wait for the device to send data<br \/>\n{<br \/>\nSleep(5);<br \/>\ncontinue;<br \/>\n}<br \/>\nif (iNextRet == NET_SDK_GET_NEXT_STATUS_FINISH) \/\/All data found.<br \/>\n{<br \/>\nprintf(&#8220;People counting data search ended.\\n&#8221;);<br \/>\nbreak;<br \/>\n}<br \/>\nelse if(iNextRet == NET_SDK_GET_NEXT_STATUS_FAILED) \/\/Search exception.<br \/>\n{<br \/>\nprintf(&#8220;Search exception.\\n&#8221;);<br \/>\nbreak;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nprintf(&#8220;Unknown status.\\n&#8221;);<br \/>\nbreak;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nprintf(&#8220;Search failed. Error code: %d\\n&#8221;,NET_DVR_GetLastError());<br \/>\n}<\/p>\n<p>if (m_lHandle &gt;= 0)<br \/>\n{<br \/>\nif (!NET_DVR_StopRemoteConfig(m_lHandle))<br \/>\n{<br \/>\nprintf(&#8220;Stopping searching people counting data failed.Error code: %d\\n&#8221;,NET_DVR_GetLastError());<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/Log out<br \/>\nNET_DVR_Logout(lUserID);<br \/>\n\/\/Release SDK resource<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0 \/\/ \/\/ Device Network SDK (People Counting) \/\/ Search Data and Report \/\/ Sample Code for Searching History Data \/\/ #include &lt;stdio.h&gt; #incl...","protected":false},"author":2,"featured_media":15936,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[107],"tags":[],"class_list":["post-15634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-camera-connection"],"_links":{"self":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/comments?post=15634"}],"version-history":[{"count":3,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15634\/revisions"}],"predecessor-version":[{"id":15768,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15634\/revisions\/15768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/media\/15936"}],"wp:attachment":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/media?parent=15634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}