﻿

{"id":15630,"date":"2023-10-07T11:27:30","date_gmt":"2023-10-07T02:27:30","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15630"},"modified":"2023-12-13T10:19:21","modified_gmt":"2023-12-13T01:19:21","slug":"people-counting-receiving-alarm-or-event-in-arming-mode","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/people-counting-receiving-alarm-or-event-in-arming-mode\/","title":{"rendered":"\u3010People Counting\u3011Receiving Alarm Or Event In Arming Mode"},"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\/\/ Alarm and Event Receiving<br \/>\n\/\/ Receive Alarm\/Event in Arming Mode<br \/>\n\/\/ Sample Code of Receiving Alarm or Event in Arming Mode<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);<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\/\/ Log in to device<br \/>\nLONG lUserID;<br \/>\n\/\/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;); \/\/Device IP address<br \/>\nstruLoginInfo.wPort = 8000; \/\/Service port No.<br \/>\nstrcpy(struLoginInfo.sUserName, &#8220;admin&#8221;); \/\/User name<br \/>\nstrcpy(struLoginInfo.sPassword, &#8220;abcd1234&#8221;); \/\/Password<br \/>\n\/\/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>\/\/Set alarm callback function<br \/>\nNET_DVR_SetDVRMessageCallBack_V50(0, MessageCallbackNo1, NULL);<br \/>\nNET_DVR_SetDVRMessageCallBack_V50(1, MessageCallbackNo2, NULL);<\/p>\n<p>\/\/Enable arming<br \/>\nNET_DVR_SETUPALARM_PARAM_V50 struSetupParamV50={0};<br \/>\nstruSetupParamV50.dwSize=sizeof(NET_DVR_SETUPALARM_PARAM_V50);<br \/>\n\/\/Alarm category to be uploaded<br \/>\nstruSetupParamV50.byAlarmInfoType=1;<br \/>\n\/\/Arming level<br \/>\nstruSetupParamV50.byLevel=1;<br \/>\nchar szSubscribe[1024] = {0};<br \/>\n\/\/The following code is for alarm subscription (subscribe all)<br \/>\nmemcpy(szSubscribe, &#8220;&lt;SubscribeEvent version=\\&#8221;2.0\\&#8221; xmlns=\\&#8221;http:\/\/www.isapi.org\/ver20\/XMLSchema\\&#8221;&gt;\\r\\n&lt;eventMode&gt;all&lt;\/eventMode&gt;\\r\\n&#8221;, 1024);<br \/>\nLONG lHandle = -1;<br \/>\nif (0 == strlen(szSubscribe))<br \/>\n{<br \/>\n\/\/Arm<br \/>\nlHandle = NET_DVR_SetupAlarmChan_V50(lUserID, &amp;struSetupParamV50, NULL, strlen(szSubscribe));<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/Subscribe<br \/>\nLlHandle = NET_DVR_SetupAlarmChan_V50(lUserID, &amp;struSetupParamV50, szSubscribe, strlen(szSubscribe));<br \/>\n}<\/p>\n<p>if (lHandle &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_SetupAlarmChan_V50 error, %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Logout(lUserID);<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>Sleep(20000);<br \/>\n\/\/Disarm the uploading channel<br \/>\nif (!NET_DVR_CloseAlarmChan_V30(lHandle))<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_CloseAlarmChan_V30 error, %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Logout(lUserID);<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>\/\/Log out<br \/>\nNET_DVR_Logout(lUserID);<br \/>\n\/\/Release resources<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) \/\/ Alarm and Event Receiving \/\/ Receive Alarm\/Event in Arming Mode \/\/ Sample Code of Receiving Alarm ...","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-15630","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\/15630","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=15630"}],"version-history":[{"count":3,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15630\/revisions"}],"predecessor-version":[{"id":15771,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15630\/revisions\/15771"}],"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=15630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}