Configure Region Entrance Alarm for Smart Device

For smart device, you can call HCNetSDK APIs to set region entrance detection and alarm parameters without passing through the request URLs.

  • Make sure you have called NET_DVR_Init to initialize the development environment.

  • Make sure you have called NET_DVR_Login_V40 to log in to the device.

Figure 1 API Calling Flow of Configuring Region Entrance Alarm for Smart Device

  1. Call NET_DVR_GetSTDAbility, and set dwAbilityType to "NET_DVR_GET_SMART_CAPABILITIES" (value: 3500) for getting the smart device capability to check whether the region entrance detection is supported.

    The smart device capability is returned in the message XML_SmartCap by lpOutBuffer.

    If the node <isSupportRegionEntrance> is returned in the message and its value is "true", it indicates that region entrance detection is supported, you can continue to perform this step.

    Otherwise, the region entrance detection is not supported by device, please end this task.

  2. Configure region entrance detection rules (including all detection regions).
    1. Optional: Call NET_DVR_GetSTDAbility, set dwAbilityType to "NET_DVR_GET_REGION_ENTRANCE_CAPABILITIES" (value: 3502), and set lpCondBuffer to a 4-byte channel No. for getting configuration capability of region entrance detection rules.

      The configuration capability is returned in the message XML_Cap_RegionEntrance by lpOutBuffer.

    2. Optional: Call NET_DVR_GetSTDConfig with "NET_DVR_GET_REGION_ENTR_DETECTION" (command No.: 3503) and set lpCondBuffer to a 4-byte channel No. for getting default or configured region entrance detection rules for reference.

      The region entrance detection parameters are returned in the structure NET_DVR_REGION_ENTRANCE_DETECTION by lpOutBuffer.

    3. Call NET_DVR_SetSTDConfig with "NET_DVR_SET_REGION_ENTR_DETECTION" (command No.: 3504), set lpCondBuffer to a 4-byte channel No., and set lpInBuffer to NET_DVR_REGION_ENTRANCE_DETECTION for setting region entrance detection rules.
  3. Optional: Configure parameters of a detection region.
    1. Optional: Call NET_DVR_GetSTDConfig with "NET_DVR_GET_REGION_ENTR_REGION" (command No.: 3505), and set lpCondBuffer to NET_DVR_SMART_REGION_COND for getting default or configured parameters of a detection region for reference.

      The parameters of a detection are returned in the structure NET_DVR_REGION_ENTRANCE_DETECTION by lpOutBuffer.

    2. Call NET_DVR_SetSTDConfig with "NET_DVR_SET_REGION_ENTR_REGION" (command No.: 3506), set lpCondBuffer to NET_DVR_SMART_REGION_COND, and set lpInBuffer to NET_DVR_REGION_ENTRANCE_DETECTION for setting parameters of a detection region.
  4. Configure arming schedule of region entrance detection.
    1. Optional: Call NET_DVR_GetSTDAbility, set dwAbilityType to "NET_DVR_GET_REGION_ENTRANCE_SCHEDULE_CAPABILITIES" (value: 3584), and set lpCondBuffer to a 4-byte channel No. for getting arming schedule capability of region entrance detection.

      The arming schedule capability of region entrance detection is returned in the message XML_Cap_Schedule by lpOutBuffer.

    2. Optional: Call NET_DVR_GetSTDConfig with "NET_DVR_GET_REGION_ENTR_SCHEDULE" (command No.: 3509), and set condition buffer (lpCondBuffer) of structure NET_DVR_STD_ABILITY to 4-byte channel No. for getting default or configured arming schedule parameters of region entrance detection for reference.

      The arming schedule parameters of region entrance detection are returned in the structure NET_DVR_EVENT_SCHEDULE by lpOutBuffer.

    3. Call NET_DVR_SetSTDConfig with "NET_DVR_SET_REGION_ENTR_SCHEDULE" (command No.: 3510), set lpCondBuffer to a 4-byte channel No., and set lpInBuffer to NET_DVR_EVENT_SCHEDULE for setting arming schedule of region entrance detection.
  5. Configure alarm linkage for region entrance detection.
    1. Optional: Call NET_DVR_GetSTDAbility, and set dwAbilityType to "NET_DVR_GET_EVENT_TRIGGERS_CAPABILITIES" (value: 3501) for getting alarm linkage capability.

      The alarm linkage capability is returned in the message XML_EventTriggersCap by lpOutBuffer.

    2. Optional: Call NET_DVR_GetSTDConfig with "NET_DVR_GET_REGION_ENTR_TRIGGER" (command No.: 3507) and set lpCondBuffer to 4-byte channel No. for getting default or configured alarm linkage parameters for reference.

      The alarm linkage parameters are returned in the structure NET_DVR_EVENT_TRIGGER by lpOutBuffer.

    3. Call NET_DVR_SetSTDConfig with "NET_DVR_SET_REGION_ENTR_TRIGGER" (command No.: 3508), set lpCondBuffer to a 4-byte channel No., and set lpInBuffer to NET_DVR_EVENT_TRIGGER for setting alarm linkage.
      Note:
      • To receive the alarm in the platform, the linkage action must be set to "center" (upload to center).

      • The above region entrance detection parameters can also be configured by logging in to device via web browser.

  6. Optional: Set lCommand to "COMM_ALARM_RULE" (command No.: 0x1102) and set wEventTypeEx to "ENUM_VCA_EVENT_ENTER_AREA" in the alarm callback function to receive region entrance alarm in arming mode (see Receive Alarm/Event in Arming Mode) or listening mode (see Receive Alarm/Event in Listening Mode) when alarm is triggered.

    The received alarm details in the structure NET_VCA_RULE_ALARM.

Call NET_DVR_Logout and NET_DVR_Cleanup to log out and release resources.