﻿

{"id":15599,"date":"2023-10-07T11:15:33","date_gmt":"2023-10-07T02:15:33","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15599"},"modified":"2023-12-13T10:33:50","modified_gmt":"2023-12-13T01:33:50","slug":"general-receiving-alarm-event-in-listening-mode","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/general-receiving-alarm-event-in-listening-mode\/","title":{"rendered":"\u3010General\u3011Receiving Alarm Event In Listening 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 (General)<br \/>\n\/\/ Sample Code of Receiving Alarm\/Event in Listening 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 \/>\nNET_DVR_DEVICEINFO_V30 struDeviceInfo;<br \/>\nlUserID = NET_DVR_Login_V30(&#8220;172.0.0.100&#8221;, 8000, &#8220;admin&#8221;, &#8220;12345&#8221;, &amp;struDeviceInfo);<\/p>\n<p>if (lUserID &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;Login error, %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>\/\/Enable listening<br \/>\nLONG lHandle;<br \/>\nlHandle = NET_DVR_StartListen_V30(NULL,7200, MessageCallback, NULL);<br \/>\nif (lHandle &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_StartListen_V30 error, %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Logout(lUserID);<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>Sleep(5000);<br \/>\n\/\/Disable listening<br \/>\nif (!NET_DVR_StopListen_V30(lHandle))<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_StopListen_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 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 (General) \/\/ Sample Code of Receiving Alarm\/Event in Listening Mode \/\/ #include &lt;stdio.h&gt; #include &lt;iostream&g...","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-15599","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\/15599","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=15599"}],"version-history":[{"count":3,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15599\/revisions"}],"predecessor-version":[{"id":15718,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15599\/revisions\/15718"}],"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=15599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}