﻿

{"id":15795,"date":"2023-10-07T16:00:10","date_gmt":"2023-10-07T07:00:10","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15795"},"modified":"2024-01-12T10:03:39","modified_gmt":"2024-01-12T01:03:39","slug":"general-setting-multiple-callback-functions-to-receive-different-alarms-events-in-arming-mode","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/general-setting-multiple-callback-functions-to-receive-different-alarms-events-in-arming-mode\/","title":{"rendered":"\u3010General\u3011Setting Multiple Callback Functions To Receive Different Alarms Events 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 (General)<br \/>\n\/\/<br \/>\n\/\/ Sample Code of Setting Multiple Callback Functions to Receive Different Alarms\/Events in Arming<br \/>\n\/\/<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>int iNum=0;<br \/>\nvoid CALLBACK MessageCallbackNo1(LONG lCommand, NET_DVR_ALARMER *pAlarmer, char *pAlarmInfo, DWORD dwBufLen, void* pUser)<br \/>\n{<br \/>\nint i=0;<br \/>\nchar filename[100];<br \/>\nFILE *fSnapPic=NULL;<br \/>\nFILE *fSnapPicPlate=NULL;<br \/>\n\/\/This sample code is for reference only. Actually, it is not recommended<br \/>\nto process the data and save file in the callback function directly.<br \/>\n\/\/You&#8217;d better process the data in the message response funcion via message<br \/>\nmode (PostMessage).<br \/>\nswitch(lCommand)<br \/>\n{<br \/>\ncase COMM_ALARM:<br \/>\n{<br \/>\nNET_DVR_ALARMINFO struAlarmInfo;<br \/>\nmemcpy(&amp;struAlarmInfo, pAlarmInfo, sizeof(NET_DVR_ALARMINFO));<br \/>\nswitch (struAlarmInfo.dwAlarmType)<br \/>\n{<br \/>\ncase 3: \/\/Motion detection alarm<br \/>\nfor (i=0; i&lt;16; i++) \/\/#define MAX_CHANNUM 16 \/\/The maximum number of channels<br \/>\n{<br \/>\nif (struAlarmInfo.dwChannel[i] == 1)<br \/>\n{<br \/>\nprintf(&#8220;Channel Number with Motion Detection Alarm%d\\n&#8221;, i+1);<br \/>\n}<br \/>\n}<br \/>\nbreak;<br \/>\ndefault:<br \/>\nbreak;<br \/>\n}<br \/>\nbreak;<br \/>\n}<\/p>\n<p>case COMM_UPLOAD_PLATE_RESULT:<br \/>\n{<br \/>\nNET_DVR_PLATE_RESULT struPlateResult={0};<br \/>\nmemcpy(&amp;struPlateResult, pAlarmInfo, sizeof(struPlateResult));<br \/>\nprintf(&#8220;License Plate Number: %s\\n&#8221;,<br \/>\nstruPlateResult.struPlateInfo.sLicense);\/\/License plate number<br \/>\nswitch(struPlateResult.struPlateInfo.byColor)\/\/License plate color<br \/>\n{<br \/>\ncase VCA_BLUE_PLATE:<br \/>\nprintf(&#8220;Vehicle Color: Blue\\n&#8221;);<br \/>\nbreak;<br \/>\ncase VCA_YELLOW_PLATE:<br \/>\nprintf(&#8220;Vehicle Color: Yellow\\n&#8221;);<br \/>\nbreak;<br \/>\ncase VCA_WHITE_PLATE:<br \/>\nprintf(&#8220;Vehicle Color: White\\n&#8221;);<br \/>\nbreak;<br \/>\ncase VCA_BLACK_PLATE:<br \/>\nprintf(&#8220;Vehicle Color: Black\\n&#8221;);<br \/>\nbreak;<br \/>\ndefault:<br \/>\nbreak;<br \/>\n}<\/p>\n<p>\/\/Scene picture<br \/>\nif (struPlateResult.dwPicLen != 0 &amp;&amp; struPlateResult.byResultType == 1 )<br \/>\n{<br \/>\nsprintf(filename,&#8221;testpic_%d.jpg&#8221;,iNum);<\/p>\n","protected":false},"excerpt":{"rendered":"\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0 \/\/ \/\/ Device Network SDK (General) \/\/ \/\/ Sample Code of Setting Multiple Callback Functions to Receive Different Alarms\/Events in Arming \/\/ \/\/ #...","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-15795","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\/15795","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=15795"}],"version-history":[{"count":3,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15795\/revisions"}],"predecessor-version":[{"id":16302,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15795\/revisions\/16302"}],"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=15795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}