What are the benefits of creating a Generic Event?
Nx Witness doesn't have a direct API method to start or stop recording on certain cameras, but there is an option in the Rules Engine called Generic Event that can trigger the pre-configured action Recording on camera. Expand the functionality by pairing it with a Soft Trigger event and Do HTTP Request action.
Recording for a fixed duration
I. Create Generic Event and Camera recording action
- Open Nx Witness Desktop and connect to Nx Witness Server as an Administrator.
- Right-click on one or more cameras in the Resource Tree and select Camera Settings.
- Switch to the Recording tab and click the switch to enable recording. The schedule can be left blank.
- Open the Main Menu and select System Administration (Ctrl+Alt+A) then click the icon Event Rules.
- Click on Event Rules and click on the Add button. The Event and Action sections will show up at the bottom half of the dialog.
- In the Event section, click the drop-down list next to When and select Generic Event.
- Fill in the following fields for Generic Event:
- Source (required)
- Caption (optional)
- Description (optional)
- In the Action section, click the drop-down list next to Do and select Camera Recording.
- Next to at, click the drop-down list and select the camera to record (the camera(s) from step 2) and click Apply.
- Change the following fields for Camera recording:
- Uncheck the interval of action (the interval will be instant).
- Select desired Quality and FPS.
- Click Apply to save the changes, then click OK.
NOTE: Nx Witness 3.0 and below users don’t have this option and will need to follow the instructions “Recording for an undefined amount of time”.
II. Create Soft Trigger event and Do HTTP Request action
- Open Nx Witness Desktop and connect to Nx Witness Server as an Administrator.
- Open the Main Menu and select System Administration (Ctrl+Alt+A). then click the icon Event Rules.
- Click on Event Rules and click on the Add button. The Event and Action sections will show up at the bottom half of the dialog.
- In the Event section, click the drop-down list next to When and select Soft Trigger.
- Fill in the following fields for Soft Trigger:
- At: Pick the camera(s) that you want to have the recording button.
- Available to: Pick the user(s) who can have this button on the screen.
- Name: You can give an identifier. (Ex: Start Record)
- Icon: Choose an icon
- In the Action section, click the drop-down list next to Do and select Do HTTP Request.
- Fill in the following fields for Do HTTP Request:
- HTTP URL: add the Nx Witness Generic Event API call with the same parameter values identical to those used in Section I, Step 7 (source, caption, and description). The format should be
http://<server_ip>:<server_port>/api/createEvents?source=Interrogation&caption=record
Example: http://127.0.0.1:7001/api/createEvents?source=Interrogation&caption=record - HTTP content: leave blank
- Content-type: Auto
- Authentication type: Auto
- Request type: GET
- Login: Your Nx Witness username
- Password: Your Nx Witness password
Recording for an undefined amount of time
If you want to record continuously until a second soft trigger to stop the recording is clicked, you will need to use the pre/post-recording option for the Camera Recording action and create two Soft Trigger events.
- Create the Generic Event/Camera Recording action. Follow Section I. Create Generic Event and Camera recording action, but at Step 10 you will also need to
a. Uncheck the Fix Duration.
b. Keep the post-recording time as 0 seconds.
c. Change pre-recording time as desired. - Create the Soft Trigger that will start the recording. Follow Section II. Create Soft Trigger event and Do HTTP Request action, but at Step 7 add ?state=Active to your URL. The format is
http://<server_ip>:<server_port>/api/createEvents?state=Active&source=Interrogation&caption=record
Example: http://127.0.0.1:7001/api/createEvents?state=Active&source=Interrogation&caption=record - Create the Soft Trigger that will stop the recording. Follow Section II. Create Soft Trigger event and Do HTTP Request action, but at Step 7 add ?state=Inactive to your URL. The format should be:
http://<server_ip>:<server_port>/api/createEvents?state=Inactive&source=Interrogation&caption=record
Example: http://127.0.0.1:7001/api/createEvents?state=Inactive&source=Interrogation&caption=record
Authentication
Please keep in mind that all these requests will require authentication from Nx Witness Server. Nx Witness Server supports basic and digest authentication. Digest is more secure and the workflow is described in the API documentation.
If authentication from Nx Witness Server is successful and there is no misprint in the API method, Nx Witness Server will reply with 200 HTTP status code and JSON with a certain info message. It will tell you either some parameter is missing or be like below if the server accepted the generic event:
{
"error": "0",
"errorString": "",
"reply": null
}
Comments
0 comments
Article is closed for comments.