Components & Customization
Adaptor Architecture
 
Adaptor architecture has 2 interfaces. Both the interfaces can be loaded using Adaptor loader.
1) Device Discovery Interface
This adaptor interface is used to discover devices, for example, ONVIF Protocol or UPnP Protocol:
A new Device Discovery Adaptor should implement
IDeviceDiscoveryInterfaceClass (refer to theinclude/device_discovery_adaptor.hheader file from VST container)
Implement the following methods to create and destroy adaptor object:
typedef IDeviceDiscoveryInterface* createDiscoveryObject(); typedef void destroyDiscoveryObject ( IDeviceDiscoveryInterface* object );
2) Device Control Interface
This adaptor interface controls the devices, for example, ONVIF Control Protocol:
A new Device Control Adaptor should implement
IDeviceControlInterfaceClass (refer to theinclude/device_control_adaptor.hheader file from VST container)
Implement the following methods to create and destroy adaptor object:
typedef IDeviceControlInterface* createObject(); typedef void destroyObject( IDeviceControlInterface* object );
Application Development
- This section helps developers to get insights of VST APIs. 
- VST offers a set of REST APIs for client applications, providing the developers access to all the features of VST. 
- VST APIs are compliant to OpenAPI standards, so developers are able interact with VST via HTTP GET/POST request. 
- Get all device’s details: - GET *api/v1/sensor/list*- Request type : GET 
- Sample request URL: - https://IP_ADDRESS:PORT_NUMBER/api/v1/sensor/list 
 - Sample response on success, otherwise empty response: - [ { "firmwareVersion": "string", "hardware": "string", "hardwareId": "string", "sensorId": "string", "sensorIp": "string", "location": "string", "manufacturer": "string", "name": "string", "position": { "depth": "string", "direction": "string", "fieldOfView": "string", "coordinates": { "x": "string", "y": "string" }, "geoLocation": { "latitude": "string", "longitude": "string" }, "origin": { "latitude": "string", "longitude": "string" } }, "serialNumber": "string", "state": "online", "tags": "string" } ] 
 
- Get list of sensor streams information (RTSP URLs): - GET *api/v1/sensor/streams*- Request type : GET 
- Sample request URL: - https://IP_ADDRESS:PORT_NUMBER/api/v1/sensor/streams 
- Sample response on success, otherwise NULL: - [ { "7927cbbc-cba6-4f22-b65d-46f7382f5f65": [ { "streamId": "7927cbbc-cba6-4f22-b65d-46f7382f5f65", "isMain": true, "url": "rtsp://10.41.18.147:8554/live/7927cbbc-cba6-4f22-b65d-46f7382f5f65", "name": "HIKVISION%20DS-2CD2T43G0-I5", "metadata": { "bitrate": "8000", "codec": "H264", "framerate": "30", "govlength": "60", "resolution": "1920x1080" } } ] } ] 
 
- Get device status: - GET *api/v1/sensor/status*- Request type : GET 
- Sample request URL: - https://IP_ADDRESS:PORT_NUMBER/api/v1/sensor/status 
- Sample response on success, otherwise NULL: - { "Amcrest" : { "error_code" : "NoError", "error_message" : "No Error", "name" : "Amcrest", "state" : "online" } } 
 
- Add new device (applicable for 1) Device Discovery Interface): - POST *api/v1/sensor/add*- This API is used to add device using IP Address or using RTSP URL. Add device using IP Address : url field can be omitted. Add device using RTSP URL : sensorIp, username and password fields can be omitted. - Request type: POST 
- Request Body: - { "sensorIp": "string", "name": "string", "location": "string", "hardware": "string", "username": "string", "password": "string", "manufacturer": "string", "serialNumber": "string", "firmwareVersion": "string", "hardwareId": "string", "tags": "string" } 
- Sample response on success, otherwise Error: - { "sensorId": "string" } 
 
- Authenticate devices (applicable for 1) Device Discovery Interface) : - POST *api/v1/sensor/{sensor-id}/credentials*- Request type : POST 
- sensor-id : Sensor ID retrieved using, - api/v1/sensor/list
- Request Body: - { "password": "string", "username": "string" } 
 - Sample Response on success, otherwise Error: - true
 
- Start Recording of device streams: - POST api/v1/record/{stream-id}/start - Request type : POST 
- sensor-id : Sensor ID retrieved using, api/v1/sensor/list 
- Request Body: - { "streamId": "{stream-id}" } 
 - Sample response on success, otherwise Error: - true
 
- Stop Recording of device streams: - POST api/v1/record/{stream-id}/stop - Request type : POST 
- sensor-id : Sensor ID retrieved using, api/v1/sensor/list 
- Request Body: - { "streamId": "{stream-id}" } 
 - Sample response on success, otherwise Error: - true
 
- Initiate scan for new devices in subnet applicable for 1) Device Discovery Interface: - POST api/v1/sensor/scan - Request type : GET 
- Sample Request: - https://IP_ADDRESS:PORT_NUMBER/api/v1/sensor/scan 
- Sample response on success, otherwise NULL: - true
 
Refer API section which provides details on all the supported RESTful APIs.
Error
| Name | Type | Description | Required | 
|---|---|---|---|
| error_code | string | _Example:_ “VSTInternalError” | Yes | 
| error_message | string | _Example:_ “VST internal processing error” | Yes | 
VST Errors
| HTTP Code | Error Code | Error Message | 
|---|---|---|
| 0 | NoError | No Error | 
| 403 | DeviceUnauthorizedError | Device is not authorized | 
| 401 | ClientUnauthorizedError | Client is not authorized | 
| 400 | InvalidParameterError | Invalid or out of range parameters | 
| 404 | DeviceNotFoundError | Device not found OR device id is not valid | 
| 405 | MethodNotAllowedError | Method Not Allowed | 
| 408 | DeviceRequestTimeoutError | Request Timeout | 
| 500 | CommunicationError | Device communication error | 
| 500 | VSTInternalError | VST internal processing error | 
| 501 | VSTNotSupportedError | Operation/Action not supported | 
| 507 | VSTInsufficientStorage | Insufficient Storage |