﻿

{"id":16999,"date":"2023-10-07T17:10:18","date_gmt":"2023-10-07T08:10:18","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=16999"},"modified":"2024-01-31T16:21:51","modified_gmt":"2024-01-31T07:21:51","slug":"thermal-measuring-real-time-temperature","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/thermal-measuring-real-time-temperature\/","title":{"rendered":"\u3010Thermal\u3011Measuring Real Time Temperature"},"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 (Thermal)<br \/>\n\/\/ Measure Real-Time Temperature<br \/>\n\/\/ Sample Code of Measuring Real-Time Temperature<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>\/\/Macro Definition of temporal resolution<br \/>\n#define GET_YEAR(_time_) (((_time_)&gt;&gt;26) + 2000)<br \/>\n#define GET_MONTH(_time_) (((_time_)&gt;&gt;22) &amp; 15)<br \/>\n#define GET_DAY(_time_) (((_time_)&gt;&gt;17) &amp; 31)<br \/>\n#define GET_HOUR(_time_) (((_time_)&gt;&gt;12) &amp; 31)<br \/>\n#define GET_MINUTE(_time_) (((_time_)&gt;&gt;6) &amp; 63)<br \/>\n#define GET_SECOND(_time_) (((_time_)&gt;&gt;0) &amp; 63)<\/p>\n<p>int iNum=0;<br \/>\n#define ISAPI_OUT_LEN 3 * 1024 * 1024<br \/>\n#define ISAPI_STATUS_LEN 8*1024<\/p>\n<p>void CALLBACK GetThermInfoCallback(DWORD dwType, void* lpBuffer, DWORD dwBufLen, void* pUserData)<br \/>\n{<br \/>\nif (dwType == NET_SDK_CALLBACK_TYPE_DATA)<br \/>\n{<br \/>\nLPNET_DVR_THERMOMETRY_UPLOAD lpThermometry = new NET_DVR_THERMOMETRY_UPLOAD;<br \/>\nmemcpy(lpThermometry, lpBuffer, sizeof(*lpThermometry));<br \/>\nNET_DVR_TIME struAbsTime = {0};<br \/>\nstruAbsTime.dwYear = GET_YEAR(lpThermometry-&gt;dwAbsTime);<br \/>\nstruAbsTime.dwMonth = GET_MONTH(lpThermometry-&gt;dwAbsTime);<br \/>\nstruAbsTime.dwDay = GET_DAY(lpThermometry-&gt;dwAbsTime);<br \/>\nstruAbsTime.dwHour = GET_HOUR(lpThermometry-&gt;dwAbsTime);<br \/>\nstruAbsTime.dwMinute = GET_MINUTE(lpThermometry-&gt;dwAbsTime);<br \/>\nstruAbsTime.dwSecond = GET_SECOND(lpThermometry-&gt;dwAbsTime);<\/p>\n<p>printf(&#8220;Real-time temperature measurement result: byRuleID[%d]wPresetNo[%d]byRuleCalibType[%d]byThermometryUnit[d%]byDataType[d%]&#8221;<br \/>\n&#8220;dwAbsTime[%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d]\\n&#8221;, lpThermometry-&gt;byRuleID, lpThermometry-&gt;wPresetNo,<br \/>\nlpThermometry-&gt;byRuleCalibType,lpThermometry-&gt;byThermometryUnit, lpThermometry-&gt;byDataType,<br \/>\nstruAbsTime.dwYear, struAbsTime.dwMonth, struAbsTime.dwDay,<br \/>\nstruAbsTime.dwHour, struAbsTime.dwMinute, struAbsTime.dwSecond);<\/p>\n<p>if(lpThermometry-&gt;byRuleCalibType==0) \/\/Measure temperature by point<br \/>\n{<br \/>\nprintf(&#8220;Information of Measuring Temperature by Point: fTemperature[%d]\\n&#8221;, lpThermometry-&gt;struPointThermCfg.fTemperature);<br \/>\n}<\/p>\n<p>if((lpThermometry-&gt;byRuleCalibType==1)||(lpThermometry-&gt;byRuleCalibType==2)) \/\/Measure temperature by frame or line<br \/>\n{<br \/>\nprintf(&#8220;Information of Measuring Temperature by Frame or Line: fMaxTemperature[%d]fMinTemperature[%d]fAverageTemperature[%d]fTemperatureDiff[%d]\\n&#8221;,<br \/>\nlpThermometry-&gt;struLinePolygonThermCfg.fMaxTemperature,lpThermometry-&gt;struLinePolygonThermCfg.fMinTemperature,<br \/>\nlpThermometry-&gt;struLinePolygonThermCfg.fAverageTemperature,lpThermometry-&gt;struLinePolygonThermCfg.fTemperatureDiff);<br \/>\n}<\/p>\n<p>if (lpThermometry != NULL)<br \/>\n{<br \/>\ndelete lpThermometry;<br \/>\nlpThermometry = NULL;<br \/>\n}<br \/>\n}<br \/>\nelse if (dwType == NET_SDK_CALLBACK_TYPE_STATUS)<br \/>\n{<br \/>\nDWORD dwStatus = *(DWORD*)lpBuffer;<br \/>\nif (dwStatus == NET_SDK_CALLBACK_STATUS_SUCCESS)<br \/>\n{<br \/>\nprintf(&#8220;dwStatus:NET_SDK_CALLBACK_STATUS_SUCCESS\\n&#8221;);<br \/>\n}<br \/>\nelse if (dwStatus == NET_SDK_CALLBACK_STATUS_FAILED)<br \/>\n{<br \/>\nDWORD dwErrCode = *(DWORD*)((char *)lpBuffer + 4);<br \/>\nprintf(&#8220;NET_DVR_GET_MANUALTHERM_INFO failed, Error code %d\\n&#8221;, dwErrCode);<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>void main()<br \/>\n{<br \/>\nDWORD dwChannel = 2; \/\/Thermal imaging channel<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 connected time and reconnected 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\/\/Register device (it is not required when listening alarm)<br \/>\nLONG lUserID;<br \/>\nNET_DVR_DEVICEINFO_V30 struDeviceInfo;<br \/>\nlUserID = NET_DVR_Login_V30(&#8220;10.8.10.199 &#8220;, 8000, &#8220;admin&#8221;, &#8220;abcd1234&#8221;, &amp;struDeviceInfo);<br \/>\nif (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 real-time temperature measurement<br \/>\nNET_DVR_REALTIME_THERMOMETRY_COND struThermCond = {0};<br \/>\nstruThermCond.dwSize = sizeof(struThermCond);<br \/>\nstruThermCond.byRuleID = 1; \/\/Rule ID, 0-Get All Rules, the ID starts from 1.<br \/>\nstruThermCond.dwChan = dwChannel; \/\/Start from 1, 0xffffffff- Get All Channels<br \/>\nLONG lHandle = NET_DVR_StartRemoteConfig(lUserID, NET_DVR_GET_REALTIME_THERMOMETRY, &amp;struThermCond, sizeof(struThermCond), GetThermInfoCallback, NULL);<\/p>\n<p>if (lHandle &gt;= 0)<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_GET_REALTIME_THERMOMETRY failed, error code: %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_GET_REALTIME_THERMOMETRY is successful!&#8221;);<br \/>\n}<\/p>\n<p>Sleep(5000); \/\/Wait for receiving real-time temperature measurement result<br \/>\n\/\/Close the handle created by long connection configuration API, and release resource.<br \/>\nif(!NET_DVR_StopRemoteConfig(lHandle))<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_StopRemoteConfig failed, error code: %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\n}<\/p>\n<p>\/\/User logout, if the user is not login, skip this step.<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 (Thermal) \/\/ Measure Real-Time Temperature \/\/ Sample Code of Measuring Real-Time Temperature \/\/ #include &lt;stdio.h&gt...","protected":false},"author":2,"featured_media":15936,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[107],"tags":[],"class_list":["post-16999","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\/16999","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=16999"}],"version-history":[{"count":1,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/16999\/revisions"}],"predecessor-version":[{"id":17000,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/16999\/revisions\/17000"}],"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=16999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=16999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=16999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}