Configure Ship Flow Detection Alarm

Ship flow detection can calculate the amount of ships passing through a predefined area, and triggers an alarm when the ship crosses the predefined line. It is widely applied to river monitoring under severe weather conditions, such as heavy rain, heavy fog, and so on.

  • 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 Programming Flow of Configuring Ship Flow Detection Alarm

  1. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/capabilities for getting the thermal capability to check if the device supports ship detection by scene.

    The thermal capability is returned in the message XML_ThermalCap by lpOutBuffer.

    If supports, the node <isSupportShipsDetectionWithScene> is returned in the message and its value is "true", and then you can perform the following steps.

    Otherwise, ship detection by scene is not supported by device, please end this task.

  2. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/capabilities?format=json for getting the ship detection capability to check the supported parameters.

    The ship detection capability is returned in the message JSON_shipsDetectionCap by lpOutBuffer.

  3. Set basic parameters of ship detection.
    1. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/basicParam/capabilities?format=json for getting basic configuration capability of ship detection to check the supported parameters.

      The basic configuration capability of ship detection is returned in the message JSON_basicParamCap by lpOutBuffer.

    2. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/basicParam?format=json for getting default or configured basic parameters of ship detection for reference.

      The basic parameters of ship detection are returned in the message JSON_basicParam by lpOutBuffer.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/basicParam?format=json and set lpInBuffer to JSON_basicParam for setting basic parameters for ship detection.
  4. Set scene parameters for ship detection.
    1. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/capabilities?format=json for getting scene configuration capability.

      The scene configuration capability is returned in the message JSON_ShipsDetectionSceneCap by lpOutBuffer.

    2. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection?format=json for getting default or configured parameters of a or all scene(s) for reference.

      The parameters of a or all scene(s) are returned in the message JSON_ShipsDetectionScene or JSON_ShipsDetectionSceneList by lpOutBuffer.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection?format=json for creating a or all scenes(s).
    4. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection?format=json and set lpInBuffer to JSON_ShipsDetectionScene or JSON_ShipsDetectionSceneList for setting parameters of a or all scenes.
    5. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: DELETE /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection?format=json for deleting a or all scenes(s).
  5. Optional: Perform the following operation(s) to switch scene, start scene auto-switch, set capture ratio for scene, and set advanced parameters for ship detection.
    Option Description

    Switch Scene

    Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/goto?format=json

    Scene Auto-Switch

    1. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/sceneTrace/capabilities?format=json for getting scene auto-switch capability.

    2. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/sceneTrace?format=json for getting default or configured scene auto-switch parameters for reference.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/sceneTrace?format=json and set lpInBuffer to JSON_ShipsDetectionSceneTraceList for starting scene auto-switch.

    Capture Ratio

    1. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/captureRatio/capabilities?format=json for getting configuration capability of capture ratio.

    2. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/captureRatio?format=json for getting default or configured capture ratio for reference.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/captureRatio?format=json and set lpInBuffer to JSON_ShipsDetectionCaptureRatio for setting capture ratio.

    Advanced Configuration

    1. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/advanceParam/capabilities?format=json for getting advanced configuration capability of ship detection to check the supported parameters.

    2. Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/advanceParam?format=json for getting default or configured advanced parameters of ship detection for reference.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/advanceParam?format=json and set lpInBuffer to JSON_advanceParam for setting advanced parameters of ship detection.

  6. Set function mode to "shipFlowDetection" to detect the ship flow.
    1. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipsFunctionMode/capabilities?format=json for getting function mode capability to check the supported modes.

      The function mode capability is returned in the message JSON_Cap_functionMode by lpOutBuffer.

    2. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipsFunctionMode?format=json for getting default or configured function mode for reference.

      The function mode is returned in the message JSON_functionMode by lpOutBuffer.

    3. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipsFunctionMode?format=json and set lpInBuffer to JSON_functionMode for setting the function mode to "shipFlowDetection".
  7. Set ship flow detection rules.
    1. Optional: Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipFlowDetection/regions/capabilities?format=json for getting rule configuration capability of ship flow detection to check the supported rule parameters.

      The rule configuration capability of ship flow detection is returned in the message JSON_ShipFlowDetectionRuleListCap by lpOutBuffer.

    2. Optional: Call NET_DVR_STDXMLConfig to transmit the request URIs: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipFlowDetection/regions/<ID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipFlowDetection/regions?format=json for getting default or configured rules of a or all ship flow detection(s) for reference.

      The rules of a or all ship flow detection(s) are returned in the message JSON_ShipFlowDetectionRule or JSON_ShipFlowDetectionRuleList by lpOutBuffer.

    3. Call NET_DVR_STDXMLConfig to transmit the request URIs: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipFlowDetection/regions/<ID>?format=json or /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipFlowDetection/regions?format=json and set lpInBuffer to JSON_ShipFlowDetectionRule or JSON_ShipFlowDetectionRuleList for setting rules of a or all ship flow detection(s).
  8. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Event/schedules/shipsFlowDetection/<ID>/scene/<SID> for setting the arming schedule of ship flow detection.
    Note:

    Before setting arming schedule, you can transmit this URI by GET method to get default or configured arming schedule for reference.

  9. Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Event/triggers/shipsFlowDetection/<ID>/scene/<SID> for setting linkage action of ship flow detection alarm.
    Note:
    • Before setting linkage action, you can transmit this URI by GET method to get default or configured linkage actions for reference.

    • To receive the alarm via platform, the linkage action must be set to "center".

  10. Optional: Perform the following operation(s) after configuring ship flow detection alarm.
    Option Description

    Get Ship Statistics by Scene

    Call NET_DVR_STDXMLConfig to transmit the request URI: GET /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/shipsDetectionCount?format=json

    Clear Ship Statistics by Scene

    Call NET_DVR_STDXMLConfig to transmit the request URI: PUT /ISAPI/Thermal/channels/<ID>/shipsDetection/<SID>/resetCount?format=json

    Receive Alarm in Arming or Listening Mode

    Perform the flow of Receive Alarm/Event in Arming Mode or Receive Alarm/Event in Listening Mode and set lCommand in the registered alarm callback function (MSGCallBack) to "COMM_ALARM_SHIPSDETECTION" (command No.: 0x4521).

    Note:

    The ship flow detection alarm information is returned in the structure NET_DVR_SHIPSDETECTION_ALARM by pAlarmInfo of alarm callback function.

Call NET_DVR_Logout and NET_DVR_Cleanup to log out and release the resources.