Categories
Knowledge Support Support exacqVision Server Categories Products

How to: Using EVAPI_Discover to Detect the Connectiodn to an exacqVision Server

Overview

The EVAPI_Discover function is used to test the connection between evAPI and an exacqVision server. When EVAPI_Discover is called, it initiates a Discover request to be sent to an exacqVision server. If the Discover request is received by the server, it sends a Discover response indicating the server was found.

<br>

Usage

It is possible to use the EVAPI_Discover function to detect the connection to an exacqVision server after a logged-in connection has been established with a server. Before a logged in-connection is established, the response from EVAPI_Connect and EVAPI_Login should be used to determine the server connection.

Before calling EVAPI_Discover, it is necessary to set an EVAPI_Callback function that handles the Discover response from the server. If no callback is defined or if ParamType Discover is not handled in the callback, the Discover response from the server is not seen.

The behavior of the EVAPI_Discover function is to queue a Discover request packet in an evAPI instance’s write buffer to be sent to the exacqVision server. If the write buffer has space for the Discover request packet, it return a 0 to indicate success. If the write buffer has filled up because evAPI has not been able to send any data or the write buffer is not being flushed, the function returns a 1 to indicate failure.

To send the Discover request, the EVAPI_Select function or the advanced network I/O should be used. If either of these methods returns an error, there is an issue with the network socket and the evAPI instance must be cleaned up and reinitailized before trying again. (Windows only:) If the EVAPI_CreateWindow function is used, it is not necessary to call EVAPI_Select or use the advanced network I/O function to perform network I/O; the network I/O is tied to the Windows message loop and is performed automatically.

<br>

Possible reasons for a socket error:

  • The connection between evAPI and the exacqVision server is closed.
  • The network cable between the client computer hosting the evAPI instance and the router is disconnected.

<br>

If there is no error on the socket and the Discover request packet is sent, it is then necessary to detect ParamType Discover in the EVAPI_Callback function. If the discover response packet is received by evAPI, ParamType Discover is passed to the callback function indicating that the server was found. If no discover response is received,  ParamType Discover is never passed to the callback.

The console sample shipped with the SDK contains an example of using the EVAPI_Discover function using the command line argument “discover-server”.

<br>

Example

Function evCallback(Parameters: ParamType param, int value, Payload* payload, size_t length )

Switch to handle ParamTypes

Case Discover

Disable or reset watchdog timer

End Case

End Switch

End Function evCallback

Function Main

Intialize evAPI (EVAPI_Init)

Connect to server (EVAPI_Connect)

Login to server (EVAPI_Login)

Set evAPI callback to evCallback (EVAPI_SetCallback)

Queue discover request (EVAPI_Discover)

Perform network I/O (EVAPI_Select)

If queue discover request succeeds and network I/O succeeds

Enable watchdog timer for discover paramtype in callback

Else if queue discover request fails or network I/O fails

Handle failed connection to server

End if

If the discover watchdog timer expires

Handle failed connection to server

End if End Function Main

<br>

How-to-Using-EVAPI_Discover-to-Detect-the-Connectiodn-to-an-exacqVision-Server.pdf
Categories
User Guides Documentation exacqVision Client Categories Products

How to: Using EVAPI_Callback and EVAPI_CallbackEx

Overview

The evAPI callback functions are used to receive event notifications from the exacqVision server, such as motion detected by a camera or a configuration change made to a server.

Usage

To use the evAPI callback functionality, it is necessary to define and declare a callback function and then assign the function in the API. The format of the definition for the EVAPI_Callback and EVAPI_CallbackEx functions can be found in the API documentation under the Core API module.

To assign the callback function to be used by evAPI, it is necessary to call EVAPI_SetCallback or EVAPI_SetCallbackEx. If both callbacks are assigned, the API will default to using the EVAPI_Callback function and will not execute the EVAPI_CallbackEx function.

Parameters

                        int param – the event identifier

                          int value – the event state

PayloadType *payload – data associated with event

                   size_t length – the size of the payload parameter

PayloadType

 u32 camera – camera ID or device ID associated with an event

        i32 time – UTC time of the event

          u16 ms – millisecond part of the event time

          u8 type – 0 for audio, >=1 for video

          u8 flags – 0x80 for motion, 0x40 for alarm

   u32 trigger – trigger ID associated with an event

i32 time_end – UTC time of the end of the event

  u16 ms_end – millisecond part of the event end time

ParamTypes

ParamType Discover – indicates a server was found.

   param – Discover

     value – N/A

payload – NULL

   length – size of payload

ParamType Login – indicates there was a login attempt on the server.

   param – Login

     value – 0 for success, otherwise error

payload – NULL

   length – size of payload

ParamType Config – indicates configuration information has been sent from the server. 

   param – Config

     value – N/A

payload – NULL

   length – size of payload

Notes: A ParamType Config is sent any time the configuration of the server changes, such as when a camera is added or removed from the server or a soft trigger is created.

ParamType Status – indicates status information has been sent from the server.

   param – Status

     value – N/A

payload – NULL

   length – size of payload

ParamType Loss – indicates that there is no video signal detected on an analog camera input for the camera id in the payload.

   param – Loss

     value – 1 for video loss, 0 for no video loss

payload – camera

                 time

                 ms

   length – size of payload

ParamType Motion – indicates that motion was detected on the camera that corresponds to the camera id in the payload.

   param – Motion

     value – 1 for motion, 0 for no motion

payload – camera

                 time

                 ms

   length – size of payload

ParamType Connected – indicates the server no longer detects a previously detected IP camera with the camera id in the payload.

   param – Connection

     value – 1 for connected, 0 for not connected

payload – camera

                 time

                 ms

   length – size of payload

ParamType Live – indicates that a live video frame corresponding to the camera id in the payload has been received and decompressed. 

   param – Live

     value – N/A

payload – camera

                 time

                 ms

                   type

                   flags

   length – size of payload

Notes: The type payload field indicates whether audio or video data is being streamed. The flags payload field indicates whether motion or an alarm associated with the camera has been triggered.

ParamType Stored – indicates that a stored video frame corresponding to the camera id in the payload has been received but NOT decompressed.

   param – Stored

     value – N/A

payload – camera

                 time

                 ms

                   type

                   flags

   length – size of payload

Notes: The type payload field indicates whether audio or video data is being streamed. The flags payload field indicates whether motion or an alarm associated with the camera has been triggered.

ParamType SoftTrigger – indicates that a soft trigger has been set to either on or off on the server.

   param – SoftTrigger

     value – 1 for trigger on, 0 for trigger off

payload – time

                 ms

                   trigger

   length – size of payload

ParamType InputTrigger – indicates that an input trigger has been set to either on or off on the server.

   param – InputTrigger

     value – 1 for trigger on, 0 for trigger off

payload – camera

                   time

                 ms

                   trigger

   length – size of payload

Notes: The camera payload field represents the device ID associated with the input trigger.

ParamType EVAPI_DISPLAY – indicates that a frame is ready for display after a call to EVAPI_SetFrame. This means that the frame has been decompressed.

   param – EVAPI_DISPLAY

     value – N/A

payload – camera

                 time

                 ms

                   type

                   flags

   length – size of payload

ParamType EVAPI_SEARCH_COMPLETE – indicates the server has completed and sent all the found video or meta data from a search.

   param – EVAPI_SEARCH_COMPLETE

     value – N/A

payload – camera

                 time

                 ms

                 type

                 flags

   length – size of payload

ParamType EVAPI_TEMPERATURE – indicates the temperature status of a device on the server.

   param – EVAPI_TEMPERATURE

     value – 1 for alarm, 0 for no alarm

payload – camera

                 time

                 ms (optional)

   length – size of payload

Notes: The camera payload field may also represent a device_id.

ParamType EVAPI_LICENSE – indicates exacq license information has been received from the server. 

   param – EVAPI_LICENSE

     value – N/A

payload – NULL

   length – size of payload

ParamType EVAPI_DEVICE_FAIL – indicates that a capture card on the server has failed to initialize.

   param – EVAPI_DEVICE_FAIL

     value – 1 for alarm, 0 for no alarm

payload – camera (device ID)

–          time

–          ms (optional)            

   length – size of payload

ParamType EVAPI_STORAGE_ALARM – indicates the status of a storage drive on the server.

   param – EVAPI_STORAGE_ALARM

     value – 1 for over threshold, 0 for below or equal to threshold

payload – camera

                 time

                 ms

   length – size of payload

Notes: The drive number associated with the alarm is indicated by the camera field of the Payload.

ParamType EVAPI_DEVICE_BUTTON – indicates the status of the front panel push button on the exacq server.

   param – EVAPI_DEVICE_BUTTON

     value – 1 for alarm, 0 for no alarm

payload – camera (device ID)

–          time

–          ms (optional)            

   length – size of payload

ParamType EVAPI_LICENSE_PACKET – indicates that a license packet has been received after a call to EVAPI_LicenseRequest.

   param – EVAPI_LICENSE_PACKET

     value – N/A

payload – NULL

   length – size of payload

ParamType EVAPI_CORE_THROTTLING – indicates the status of the server throttling video.

   param – EVAPI_CORE_THROTTLING

     value – 1 for alarm, 0 for no alarm

payload – time

   length – size of payload

ParamType EVAPI_DEVICE_FAN_FAIL – indicates the status a video capture card fan.

   param – EVAPI_DEVICE_FAN_FAIL

     value – 1 for alarm, 0 for no alarm

payload – camera (device ID)

–          time

–          ms (optional)            

   length – size of payload

ParamType EVAPI_SYS_MGMT – indicates the status of storage device.

   param – EVAPI_SYS_MGMT

     value – 1 for alarm, 0 for no alarm

payload – camera (storage ID)

–          time

   length – size of payload

ParamType UpdateStatus – indicates the status of a remote server update.

   param – UpdateStatus

     value –

INSTALL_TIMEOUT               = -21,        

INSTALL_ERROR                    = -20,        

WGET_PARSE_ERROR        = -17,        

WGET_FILE_IO_ERROR      = -16,        

WGET_NETWORK_ERROR    = -15,        

WGET_SSL_ERROR               = -14,        

WGET_AUTH_ERROR           = -13,        

WGET_PROTOCOL_ERROR   = -12,        

WGET_HOST_ERROR           = -11,        

WGET_ERROR                       = -10,        

INVALID_PATH_URI             = -6,        

INVALID_HOST_NAME       = -5,        

CHECKSUM_FAILED             = -4,        

INVALID_URI_LOCATION    = -3,       

NO_BUNDLE_NAME            = -2,        

UPDATE_FAILED                   = -1,        

NO_UPDATE                                          = 0,       

BUNDLE_DOWNLOAD                         = 1,        

BUNDLE_INSTALL                 = 2,        

PENDING_UPDATE               = 3,        

BUNDLE_FILE                                        = 4,        

UPDATE_SUCCESS                = 13    

payload – time

   length – size of payload

ParamType EVAPI_META_DATA_SEARCH – returns video meta data from a EVAPI_MetaDataSearch.

   param – EVAPI_META_DATA_SEARCH

     value – 0

payload – camera

–          time (beginning of meta data block)

–          flags  (0x80 for motion, 0x40 for alarm, 0x0 for free run)

–          time_end  (end of meta data block)

   length – size of payload

ParamType EVAPI_SOFT_TRIGGER_SEARCH – returns results from a soft trigger search.

   param – EVAPI_SOFT_TRIGGER_SEARCH

     value – 0

payload –

–          time

–          time_ms

–          trigger

–          time_end 

–          ms_end

   length – size of payload

ParamType EVAPI_INPUT_TRIGGER_SEARCH – returns results from an input trigger search.

   param – EVAPI_INPUT_TRIGGER_SEARCH

     value – 0

payload –

–          time

–          time_ms

–          trigger

–          time_end 

–          ms_end

   length – size of payload

ParamType EVAPI_ARCHIVE_ALARM – indicates if the server has lost connection to an archive target .

   param – Connection

     value – 1 for connected, 0 for not connected

payload – camera ( target ID)

–          time                           

   length – size of payload

Example

Function evCallback(parameters: int param, int value, PayloadType *payload, size_t length)

Switch on param

     Case Discover

        Do something

        End Case

        Case Login

           Do something

        End Case

        ….

        Continue for other params

        ….

     End Switch

End Function evCallback

Function Main

     Initialize evAPI (EVAPI_INIT)

Set evAPI callback to evCallback (EVAPI_SetCallback)

     ….

     Continue with other functions

     ….

End Function Main

Note: Samples of how to use the callback with C/C++ or C# are shipped with the SDK in the window and c-sharp samples.

<br>

How-to-Using-EVAPI-Callback-and-EVAPI-CallbackEx.pdf
Categories
Knowledge Support Support exacqVision Client Categories Products

exacqVision SDVR boards with PAL cameras

Sometimes exacqVision SDVR boards do not immediately recognize the PAL format of analog cameras. Images could be displayed in black and white or even with tearing. If your PAL cameras show those issues when using SDVR boards, complete the following steps in Linux:

  1. Log out of the restricted user account and log in as an administrator.
  2. Close the exacqVision Client.
  3. Click Start and select Accessories and then Terminal.
  4. Type sudo /etc/init.d/edvrserver stop.
  5. Type admin256 at the prompt (or the correct admin password if it has been changed from the default).
  6. Type sudo nano /etc/stretch.conf.
  7. Find the DefaultVideoStandard=”NTSC” line in the file.
  8. Change the line to DefaultVideoStandard=”PAL”.
  9. Press Ctrl+O to output the file.
  10. Press Enter to confirm.
  11. Press Ctrl+X to exit.
  12. Type sudo /etc/init.d/edvrserver start.
  13. Restart exacqVision Client.

<br>

exacqVision-SDVR-boards-with-PAL-cameras.pdf
Categories
Knowledge Support Support exacqVision Server Categories Products

Adding/Configuring Locales on Ubuntu Linux

For Ubuntu, adding a new locale (language) is a two-step process. First, determine the UTF8-encoded locale name, then generate the UTF8-encoded locale.

<br>

Determine Locale Name

Open a command line window and type:

less /user/share/i18n/SUPPORTED

This will list all of the locales Ubuntu supports. Scroll down to find the one that matches the ISO 639-1/ISO 3369-1 language codes of the language you are wanting to add.

Please be aware that some of the locales will not have a suffix (look closely – there is no period (‘.’) between the xx_YY language code and the following characters). Others will have a suffix of ‘.UTF-8.’ Still others will have suffixes like ‘@euro’ and ‘.EUC-KR.’ For ExacqVision, you must use the locale with the ‘UTF-8’ suffix.

For example, Irish in Ireland has these three locales:

...
ga_IE.UTF-8 UTF-8
ga_IE ISO-8859-1
ga_IE@euro ISO-8859-15
...

The first one has a ‘UTF-8’ suffix and should be used. The second and third ones do not have the ‘UTF-8’ suffix and should NOT be used.

<br>

Generate Locale

Since we’ve now determined the proper locale to generate, head back to the command prompt and type (once for each locale you wish to generate):

sudo locale-gen ga_IE.UTF-8

To actually trigger Ubuntu to generate the locale(s), type:

sudo dpkg-reconfigure locales

To verify that the locale(s) were generated, type:

locale -a

<br>

Change the Locale

For any given run of any program

Also, you may run the exacqVision Client from the command line preceded by an env setting. For example:

env LANG=es_CL.utf8 /usr/local/exacq/client/edvrclient

will cause the exacqVision Client to run with the Chilean Spanish translation.

<br>

Permanently

To change the locale, you may change the entire operating system by going to System->Administration->Language Support and changing the default language dropdown. This will require a reboot.

<br>

Categories
Knowledge Support Support exacqVision Server Categories Products

Common Linux CLI Commands (Terminal)

Download the latest release

Use the ‘wget‘ command followed by the URL for each exacqVision application:

Server
https://www.exacq.com/release/exacqVisionServerRC.deb

Client
https://www.exacq.com/release/exacqVisionClientRC.deb

Web Service
https://www.exacq.com/release/exacqVisionWebServiceRC.deb

<br>

Install the latest release

Use the ‘dpkg’ package manager to install exacqVision packages after downloading using the ‘wget‘ commands above.

Server
dpkg -i exacqVisionServer.deb

Client
dpkg -i exacqVisionClient.deb

Web Service
dpkg -i exacqVisionWebService.deb

<br>

Check available hard drive space

Use the ‘disk free’ command. Disk partitions used by exacqVision are usually labeled with their mount points as /mnt/edvr/1, 2, 3, and so on.

df -h

<br>

Check if exacqVision Server is running

Use the ‘process status’ command to list running processes followed by the ‘grep’ command to filter results to ‘core’ which is the name of the exacqVision Server process.

ps auxw | grep core

<br>

Stop the exacqVision Server service

Use either of the following commands:

  • sudo service edvrserver stop
  • sudo /etc/init.d/edvrserver stop

<br>

Start the exacqVision Server service:

Use either of the following commands:

  • sudo service edvrserver start
  • sudo /etc/init.d/edvrserver start

<br>

Stop the exacqVision Web Service

sudo /usr/local/exacq/webservice/service.sh stop

<br>

Start the exacqVision Web service

sudo /usr/local/exacq/webservice/service.sh start

<br>

List server log files

Log files are titled by date.

ls /usr/local/exacq/server/logs/

<br>

View a log file

Replace *filename* with the name of the log file you wish to open.

sudo less /usr/local/exacq/server/logs/*filename*

<br>

Compress a server log file to send to support

Replace *filename* with the name of the log file you wish to compress.

tar -cvjf log.tar.bz2 /usr/local/exacq/server/logs/*logfilename*

<br>

Compress all server log files to send to support

tar -cvjf logs.tar.bz2 /usr/local/exacq/server/logs

<br>

Open log file to show new entries as they are written

Replace *filename* with the name of the log file for the current date.

tail -n 25 -f /usr/local/exacq/server/logs/*filename*

Stop the update and return to a command prompt by pressing CTRL+C.

Note: The number after “-n” allows the number of lines displayed to be adjusted. (25 lines in this case)

<br>

Check for a mounted data drive

mount

<br>

Edit the Web Service config file

The command used will depend on the version of the web service used on the NVR.

9.6+          sudo nano /etc/webservice/wfe.json

9.0 – 9.4   sudo nano /etc/webservice/webservice.conf

1.x – 8.8   sudo nano /etc/webservice.conf

Note: Press CTRL+X to exit. This will prompt to save changes.

<br>

List PCI Devices in System (Capture Boards, Sound Card, Video Card)

lspci

<br>

List Motherboard BIOS information

sudo dmidecode

<br>

Show routing table

route -n

On newer OS’s if route is not installed by default, you may use ip.

ip route list

<br>

Add a static route

Setting static routes may be necessary when you have two or more networks that your computer needs to send traffic to. Most devices only connect to one network and all network traffic is routed to the default gateway, which is a router that chooses where to forward traffic to next. When you add more static routes, it adds more gateways. This will tell the system to send data you know is destined for a specific network to a chosen router instead of the default.

Replace NETWORK with the target network IP. Replace NETMASK and GATEWAY with the respective network mask and gateway IP address.

sudo route add -net NETWORK netmask NETMASK gw GATEWAY

Example: sudo route add -net 192.168.5.0 netmask 255.255.0.0 gw 192.168.5.1

On newer OS’s if route is not installed by default, you may use ip. Replace CIDR with the CIDR notation for the netmask and INTERFACE with the name of the network interface.

sudo ip route add NETWORK/CIDR dev INTERFACE

Example: sudo ip route add 192.168.5.0/16 dev eth0

<br>

Local Commands

Change Screen Resolution for the User profile

Press CTRL+ALT+F3.

Log in as user and run the following 2 commands:

  1. export DISPLAY=:0.0
  2. gnome-display-properties

Press CTRL+ALT+F7.

<br>