﻿

{"id":15565,"date":"2023-10-07T11:42:46","date_gmt":"2023-10-07T02:42:46","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15565"},"modified":"2023-12-13T10:06:55","modified_gmt":"2023-12-13T01:06:55","slug":"face-recognition-terminal-configuring-access-permission-control-schedule","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/face-recognition-terminal-configuring-access-permission-control-schedule\/","title":{"rendered":"\u3010Face Recognition Terminal\u3011Configuring Access Permission Control Schedule"},"content":{"rendered":"<p><strong><span style=\"font-size: 18pt;\">\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/span><\/strong><\/p>\n<div>\/\/<\/div>\n<div>\/\/ Device Network SDK (Face Recognition Terminal)<\/div>\n<div>\/\/ Configure Access Permission Control Schedule<\/div>\n<div>\/\/ Sample Code for Configuring Access Permission Control Schedule<\/div>\n<div>\/\/<\/div>\n<div>\/\/<\/div>\n<div>#include &lt;stdio.h&gt;<\/div>\n<div>#include &lt;iostream&gt;<\/div>\n<div>#include &lt;afx.h&gt;<\/div>\n<div>#include &#8220;Windows.h&#8221;<\/div>\n<div>#include &#8220;HCNetSDK.h&#8221;<\/div>\n<p>using namespace std;<\/p>\n<div>void main()<\/div>\n<div>{<\/div>\n<div>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>\/\/Initialize<\/div>\n<p>NET_DVR_Init();<\/p>\n<div>\/\/Set connection timeout and reconnection function<\/div>\n<div>NET_DVR_SetConnectTime(2000, 1);<\/div>\n<p>NET_DVR_SetReconnect(10000, true);<\/p>\n<div>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>\/\/Log in to device<\/div>\n<div>LONG lUserID;<\/div>\n<div>\/\/Login parameters, including device IP address, user name, password, and so on<\/div>\n<div>NET_DVR_USER_LOGIN_INFO struLoginInfo = {0};<\/div>\n<div>struLoginInfo.bUseAsynLogin = 0; \/\/Synchronous login mode<\/div>\n<div>strcpy(struLoginInfo.sDeviceAddress, &#8220;192.168.1.64&#8221;); \/\/Device IP address<\/div>\n<div>struLoginInfo.wPort = 8000; \/\/Device service port number<\/div>\n<div>strcpy(struLoginInfo.sUserName, &#8220;admin&#8221;); \/\/User name<\/div>\n<p>strcpy(struLoginInfo.sPassword, &#8220;abcd1234&#8221;); \/\/Password<\/p>\n<div>\/\/Device information, output parameter<\/div>\n<div>NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0};<\/div>\n<p>lUserID = NET_DVR_Login_V40(&amp;struLoginInfo, &amp;struDeviceInfoV40);<\/p>\n<div>if (lUserID &lt; 0)<\/div>\n<div>{<\/div>\n<div>printf(&#8220;Login failed, error code: %d\\n&#8221;, NET_DVR_GetLastError());<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<p>}<\/p>\n<div>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>\/\/Set access permission schedule template, when issuing card, link to this template<\/div>\n<div>CStringm_csTemplateName = &#8220;Access permission schedule template 1&#8221;;<\/div>\n<div>NET_DVR_PLAN_TEMPLATE struPlanTem = {0};<\/div>\n<div>struPlanTem.dwSize = sizeof(struPlanTem);<\/div>\n<div>struPlanTem.byEnable = 1;\/\/Enable or not: 0-No, 1-Yes<\/div>\n<div>strncpy((char *)struPlanTem.byTemplateName, (LPCTSTR)m_csTemplateName, TEMPLATE_NAME_LEN);<\/div>\n<div>struPlanTem.dwWeekPlanNo = 1;\/\/Week schedule No.1<\/div>\n<div>struPlanTem.dwHolidayGroupNo[0] = 1;\/\/Holiday group No.1, up to 16 holiday groups can be linked to each schedule<\/div>\n<p>\/\/struPlanTem.dwHolidayGroupNo[1] = 2;\/\/Holiday group No.2<\/p>\n<div>BOOL bRet1 = NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE, 1, \\<\/div>\n<div>&amp;struPlanTem, sizeof(struPlanTem));<\/div>\n<div>if (!bRet1)<\/div>\n<div>{<\/div>\n<div>printf(&#8220;Setting access permission schedule template failed, error:%d.\\n&#8221;, NET_DVR_GetLastError());<\/div>\n<div>NET_DVR_Logout(lUserID);<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<p>}<\/p>\n<div>\/\/Set week schedule 1 for access permission<\/div>\n<div>NET_DVR_WEEK_PLAN_CFG struWeekPlan = {0};<\/div>\n<div>struWeekPlan.dwSize = sizeof(struWeekPlan);<\/div>\n<div>struWeekPlan.byEnable = 1;\/\/Enable week schedule<\/div>\n<div>NET_DVR_SINGLE_PLAN_SEGMENT struSinglePlanSegment = {0};<\/div>\n<div>LPNET_DVR_SINGLE_PLAN_SEGMENT lpPlanSegment = &amp;struSinglePlanSegment;<\/div>\n<div>struSinglePlanSegment.byEnable = 1;<\/div>\n<div>struSinglePlanSegment.struTimeSegment.struBeginTime.byHour = 0;\/\/Start time<\/div>\n<div>struSinglePlanSegment.struTimeSegment.struBeginTime.byMinute = 0;<\/div>\n<div>struSinglePlanSegment.struTimeSegment.struBeginTime.bySecond = 0;<\/div>\n<div>struSinglePlanSegment.struTimeSegment.struEndTime.byHour = 23;\/\/End time<\/div>\n<div>struSinglePlanSegment.struTimeSegment.struEndTime.byMinute = 59;<\/div>\n<p>struSinglePlanSegment.struTimeSegment.struEndTime.bySecond = 59;<\/p>\n<p>\/*Up to 8 time periods can be set for each day. Here only takes setting one period for each day*\/<\/p>\n<div>for (int iDate = 0; iDate&lt;MAX_DAYS; iDate++)<\/div>\n<div>{<\/div>\n<div>memcpy(&amp;struWeekPlan.struPlanCfg[iDate][0], lpPlanSegment, sizeof(struSinglePlanSegment));<\/div>\n<p>}<\/p>\n<div>BOOL bRet2 = NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_CARD_RIGHT_WEEK_PLAN, 1, \\<\/div>\n<div>&amp;struWeekPlan, sizeof(struWeekPlan));<\/div>\n<div>if (!bRet2)<\/div>\n<div>{<\/div>\n<div>printf(&#8220;Setting week schedule for access permission failed, error:%d.\\n&#8221;, NET_DVR_GetLastError());<\/div>\n<div>NET_DVR_Logout(lUserID);<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<p>}<\/p>\n<div>\/\/Set holiday group for access permission<\/div>\n<div>CStringm_csGroupName = &#8220;access permission holiday group 1&#8221;;<\/div>\n<div>NET_DVR_HOLIDAY_GROUP_CFG struHolidayGroup1 = {0};<\/div>\n<div>struHolidayGroup1.dwSize = sizeof(struHolidayGroup1);<\/div>\n<div>struHolidayGroup1.byEnable = 1;<\/div>\n<div>strncpy((char *)struHolidayGroup1.byGroupName, (LPCTSTR)m_csGroupName, HOLIDAY_GROUP_NAME_LEN);<\/div>\n<div>struHolidayGroup1.dwHolidayPlanNo[0] = 1;\/\/Holiday group 1 links to holiday schedule 1,<\/div>\n<p>\/\/up to 16 holiday schedules can be linked to one holiday group<\/p>\n<div>BOOL bRet3 = NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_CARD_RIGHT_HOLIDAY_GROUP, 1, \\<\/div>\n<div>&amp;struHolidayGroup1, sizeof(struHolidayGroup1));<\/div>\n<div>if (!bRet3)<\/div>\n<div>{<\/div>\n<div>printf(&#8220;Setting holiday group for access permission failed, error:%d.\\n&#8221;, NET_DVR_GetLastError());<\/div>\n<div>NET_DVR_Logout(lUserID);<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<p>}<\/p>\n<div>\/\/Set holiday schedule for access permission<\/div>\n<div>NET_DVR_HOLIDAY_PLAN_CFG struHolidayPlan = {0};<\/div>\n<div>struHolidayPlan.dwSize = sizeof(struHolidayPlan);<\/div>\n<div>struHolidayPlan.byEnable = 1;<\/div>\n<div>struHolidayPlan.struBeginDate.wYear = 2017;\/\/Holiday start date<\/div>\n<div>struHolidayPlan.struBeginDate.byMonth = 10;<\/div>\n<div>struHolidayPlan.struBeginDate.byDay = 1;<\/div>\n<div>struHolidayPlan.struEndDate.wYear = 2017;\/\/Holiday end date<\/div>\n<div>struHolidayPlan.struEndDate.byMonth = 10;<\/div>\n<div>struHolidayPlan.struEndDate.byDay = 7;<\/div>\n<div>\/\/Copy the week schedule parameters to holiday schedule of access permission<\/div>\n<p>memcpy(struHolidayPlan.struPlanCfg, struWeekPlan.struPlanCfg, sizeof(NET_DVR_SINGLE_PLAN_SEGMENT)*MAX_DAYS*MAX_TIMESEGMENT_V30);<\/p>\n<div>BOOL bRet4 = NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_CARD_RIGHT_HOLIDAY_PLAN, 1, \\<\/div>\n<div>&amp;struHolidayPlan, sizeof(struHolidayPlan));<\/div>\n<div>if (!bRet4)<\/div>\n<div>{<\/div>\n<div>printf(&#8220;Setting holiday schedule for access permission failed, error:%d.\\n&#8221;, NET_DVR_GetLastError());<\/div>\n<div>NET_DVR_Logout(lUserID);<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<p>}<\/p>\n<div>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/div>\n<div>\/\/Exit<\/div>\n<p>Sleep(5000);<\/p>\n<div>\/\/Log out<\/div>\n<div>NET_DVR_Logout(lUserID);<\/div>\n<div>\/\/Release SDK resource<\/div>\n<div>NET_DVR_Cleanup();<\/div>\n<div>return;<\/div>\n<div>}<\/div>\n","protected":false},"excerpt":{"rendered":"\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0 \/\/ \/\/ Device Network SDK (Face Recognition Terminal) \/\/ Configure Access Permission Control Schedule \/\/ Sample Code for Configuring Access Permi...","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-15565","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\/15565","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=15565"}],"version-history":[{"count":8,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15565\/revisions"}],"predecessor-version":[{"id":15745,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15565\/revisions\/15745"}],"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=15565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}