Eocortex API SDK Guide en
Eocortex API SDK Guide en
Table of Contents
Issued 11.07.2019
Eocortex API and SDK 3
Issued 11.07.2019
Eocortex API and SDK 4
ExternalAction Action Base class that allows adding new actions for
scripts and task scheduler
VideoAnalyst Video Base class used for video analytics on the server
analytics
plugin
MotionDetector Motion Base class used for motion detector
detector implementation
plugin
Tracker Tracker plugin Base class used for tracker creation
RTVisualiser Visualizer Visualizer base class used for graphic display of
plugin specific information on the Eocortex Client
application channel
ClientMenuItem Menu item Base class that allows to create proper sub-item
plugin in Setup menu of Eocortex Client
EventProcessor Event Event processor base class that allows to register
processor and generate its own events, get events from
plugin Eocortex, and execute commands in the
channel. Plugins of this type are used to perform
integration with other systems.
IRealTimeFrameReceiver Frame IP devices’ frame receiving interface that allows
receiver plugin to get video, audio and motion detection data
and control PTZ cameras.
• All the above specified base classes (interfaces) types, as well as some other
supporting entities, are the subjects of related chapters of the document. All the
plugins exist and operate within the Eocortex channel. Thus, all plugin instances are
isolated from each other by default, but, if necessary, relevant data can be shared
within plugin static fields. As a rule, plugins that solve the same complex task are in
one .NET assembly. Such assembly is a dynamic link library (DLL) which operates
within Eocortex. Assemblies connection and plugin registration is carried out at the
stage of startup of software system separate components (see Plugin registration in
Eocortex, page 6).
Issued 11.07.2019
Eocortex API and SDK 5
Issued 11.07.2019
Eocortex API and SDK 6
3. Plugins
The present chapter deals with the process of plugin registration. It also discusses in detail
each type of plugin. The most important code fragments are shown in the text.
/// <summary>
/// Returns module name
/// </summary>
string Name { get; }
/// <summary>
/// Returns module manufacturer name
/// </summary>
string Manufacturer { get; }
/// <summary>
/// Module initialization.
/// It is called by the host during module registration in the system.
/// </summary>
/// <param name="host">Host interface</param>
void Initialize(IPluginHost host);
}
Example of the given interface implementation:
public class ModuleDef : IPlugin
{
public Guid Id
{
get { return new Guid("17EE3457-8FC2-4C0F-B133-EF11D0C4F38C"); }
}
Issued 11.07.2019
Eocortex API and SDK 7
Once the specified interface has been detected by the host, the initialization member
(Initialize) is called. As an argument IPluginHost interface, providing host service methods,
is transferred to the initialization member:
public interface IPluginHost
{
/// <summary>
/// Gets log management interface
/// </summary>
/// <returns></returns>
IMcLogMgr GetLogManager();
/// <summary>
/// Device registration.
/// </summary>
void RegisterDevType(DevType_RegInfo regInfo);
/// <summary>
/// Frame receiver registration.
/// </summary>
void RegisterRTFR(RTFR_RegInfo regInfo);
/// <summary>
/// Registers external event
/// </summary>
void RegisterExternalEvent(Type eventType);
/// <summary>
/// Registers external action
/// </summary>
void RegisterExternalAction(Type actionType);
/// <summary>
/// Registers a menu item in the Eocortex client
/// </summary>
void RegisterMenuItem(Type menuItemType, List<Guid> requiredPluginIDs);
Issued 11.07.2019
Eocortex API and SDK 8
To specify the conditions of the plugin registration it is required to create the text file with
*.dep extension and the name coincident with the name of the dll-library containing plugin
implementation. The file which describes interactions can have, for example, the following
contents:
<?xml version="1.0"?>
<PluginDependence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Files>
<DependenceFilename>core.dll</DependenceFilename>
<DependenceFilename>..\..\..\EocortexSDK.dll</DependenceFilename>
<DependenceFilename>..\..\abc*.dll</DependenceFilename>
</Files>
<DependenceRegistryKey>
HKEY_LOCAL_MACHINE\SOFTWARE\Eocortex
</DependenceRegistryKey>
<DependenceRegistryValue>Path</DependenceRegistryValue>
</PluginDependence>
In revisions earlier than Eocortex 1.9 the given file is compulsory for plugin registration, in
later revisions it is not compulsory. It must be in the same folder as a plugin to be in use.
<Files> tag can contain multiple files. Symbol * is supported as a notation of any quantity
of any symbols. <DependenceRegistryKey> and <DependenceRegistryValue> tags are
meaningful only when used together.
/// <summary>
/// Initialization. It is called by host before starting work.
/// </summary>
/// <param name="host"></param>
public virtual void Initialize(IActionHost host)
{
actionHost = host;
}
/// <summary>
/// User action setting element. It is called by configurator.
/// Must return UserControl type (WPF).
/// </summary>
public abstract object GetGUISettingsControl();
Issued 11.07.2019
Eocortex API and SDK 9
/// <summary>
/// Displays if the current action
/// is configured properly
/// </summary>
public abstract bool IsConfigurated
{
get;
}
/// <summary>
/// The feature shows if the action is related to
/// the specific channel. In other words, whether the action affects
/// the channel in any way.
/// </summary>
public virtual bool IsChannelIndependent
{
get
{
//the action is not related to channel in any way by default
return true;
}
}
/// <summary>
/// Starting action to be executed
/// </summary>
public abstract void Run(RawChannelEvent channelEvent);
/// <summary>
/// Command execution in the channel. It is completed by server, can be used in
/// the Run method (see above)
/// </summary>
[NonSerialized]
public ExecuteCommandDelegate ExecuteCommand;
}
In the descendant class the following attributes must be created:
• ActionGUIName – name of action, used in graphic interface in the configurator.
• GuidAttribute – action identification.
ActionNeedsEventArgument attribute can be determined as an option to define that the
event object must be transmitted from the server to call Run plugin method. It also means
that the action is executed only at an event, and cannot be executed in the scheduled tasks
when events do not occur in these tasks.
Also, the base class methods must be defined (redefined). Let’s consider in detail the
initialization member in which IActionHost interface is passed from the host. The interface
is as follows:
/// <summary>
/// Interface providing the host capabilities
/// when initializing the action plugin.
/// </summary>
public interface IActionHost
{
/// <summary>
/// Getting information about the channel,
/// in which the current action plugin
/// runs.
/// </summary>
RawChannelInfo GetChannelInfo();
Issued 11.07.2019
Eocortex API and SDK 10
/// <summary>
/// Saves any serialized object in the
/// Eocortex configuration. It is used in the configurator.
/// </summary>
/// <param name="id">Object identifier</param>
/// <param name="obj">Object</param>
void SaveObject(Guid id, object obj);
/// <summary>
/// Gets a previously serialized object from the configuration.
/// It is used in the configurator.
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
object GetObject(Guid id);
}
The interface allows to get the information on the channel to which the plugin instance is
attached. The information includes the channel name and identification. The identification
must be used at command execution in the channel (ref. ExecuteCommand delegate).
For more detailed information on available commands refer to Section Event Processor Plugin
(page 21). In addition, with the help of SaveObject and GetObject methods the given
interface allows to save and download any serializable object using its identifier when
Eocortex configuration is set. This technique allows to save and retrieve settings that are the
same for all plugin instance configurations.
GetGUISettingsControl method must return the UserControl type element, which contains
a graphic interface for the plugin instance configuration in the configurator. The whole graphic
interface must be executed with WPF (Windows Presentation Foundation). IsConfigurated
property shows if the action is configured correctly in the graphic interface. If anything is
wrong, the configuration cannot be applied unless the mistakes are corrected.
For Action registration in the system, it is required to call RegisterExternalAction host
interface method (see Рlugin registration in Eocortex, page. 6) when downloading the assembly
and plugin in the IPlugin initialization class method.
/// <summary>
/// Video analytics class. It is used for frame and motion map processing.
/// </summary>
public abstract class VideoAnalyst : IDisposable
{
/// <summary>
/// Analyst initialization. It is called by host before starting processing.
/// </summary>
/// <param name="Id">A channel identifier</param>
/// <param name="archiveEventsReader">Archive access interface</param>
/// <param name="mdZones">Motion detection zones.</param>
/// <param name="settings">Analyst settings.</param>
public abstract void Initialize(Guid Id, IArchiveEventsReader archiveEventsReader,
List<MDZone> mdZones, PluginSettings settings);
Issued 11.07.2019
Eocortex API and SDK 11
/// <summary>
/// Frames and motion maps processing method. It is called by host.
/// </summary>
/// <param name="image">Frame</param>
/// <param name="motionMap">A motion map, can be null</param>
/// <param name="background">A motion detector background. Is equal to null, if
/// NeedBackground == false</param>
public abstract void Process(ImageData image, MotionMap motionMap,
BackgroundImage background);
/// <summary>
/// Generates a previously registered external event in the channel.
/// It is completed by host. It is called by analyst.
/// </summary>
public GenerateEventDelegate GenerateEvent;
/// <summary>
/// If the analyst supports work with partially decoded frames.
/// True means that zoomed out video frames can be transmitted to the input,
/// False means that video frames in original resolution are always transmitted
/// to the input.
/// </summary>
public virtual bool SupportsPartlyDecodedFrames
{
get
{
return false;
}
}
/// <summary>
/// Pixel format supported
/// </summary>
public virtual VAPixelFormat PixelFormat
{
get
{
return VAPixelFormat.BGR24;
}
}
/// <summary>
/// Executes a command.
/// </summary>
/// <param name="cmdObj"></param>
public abstract object ProcessCommand(object cmdObj);
/// <summary>
/// Replaces a motion detector for a preset one in the channel.
/// Ii is completed by host. Can be null.
/// </summary>
public ReplaceMotionDetectorDelegate ReplaceMotionDetector;
Issued 11.07.2019
Eocortex API and SDK 12
/// <summary>
/// Resource deallocation
/// </summary>
public abstract void Dispose();
/// <summary>
/// Changes general or specific analyst settings, if necessary.
/// A calling of method shall result in opening of user setting window.
/// It is called by host (configurator).
public abstract PluginSettings SetSettings(ISettingsHost settingsHost,
PluginSettings settings);
}
Descendant class must redefine all base class abstract methods and, if necessary, virtual
properties. Also, a subclass must contain PluginGUINameAttribute, which contains the
name of the analyst displayed in Eocortex Configurator graphical shell. In case the analyst
can be set up in the configurator, implementing SetSettings adjustment method and
specifying PluginHasSettingsAttribute is required.
Video data is transmitted to the analyst input as a class described below:
/// <summary>
/// General plugin settings. Are not related to the current channel. Can be null.
/// A setting object must be serializable.
/// </summary>
public object generalSettings;
}
If analyst settings are unified for all channels, it is sufficient to complete only a general setting
object. Otherwise, if all the analyst settings are related to a specific channel, it is sufficient to
complete only a specific channel setting object. The objects of general and specific settings are
user-defined. The only requirement for them is the possibility of their serialization, as all the
analyst settings are kept in Eocortex general configuration.
Issued 11.07.2019
Eocortex API and SDK 13
Let us consider ProcessCommand method which allows the analyst to execute commands
from the Menu Item plugin (see Menu Item plugin, page 19). This method receives a
command as a serialized object formed on the Menu Item plugin side. As a result, this
method shall also return the serialized object, which will be received subsequently and
processed by the Menu Item plugin. This mechanism allows to implement client-server
interaction, as the Videoanalyst plugin operates on the server, and the Menu Item plugin
always operates in the client.
While processing video frames, the videoanalyst shall transmit the results of its analysis to
the server by means of event generating. To do so, it is required to register in advance on
the host side (see Plugin registration in Eocortex, page 6) the outside user event containing a
description of all fields required for interpreting the operating results of the analyst. The event is
registered by IPluginHost interface using RegisterExternalEvent method during the
module initialization stage. The user event must inherit RawChannelEvent base class:
/// <summary>
/// Parent class in event hierarchy on channel.
/// </summary>
[Serializable]
public abstract class RawChannelEvent
{
/// <summary>
/// Event time stamp.
/// </summary>
public DateTime EventTime;
/// <summary>
/// An event comment.
/// </summary>
public string Comment;
/// <summary>
/// If event is local.
/// Local events are not sent outside the current host.
/// </summary>
public bool IsLocal = false;
/// <summary>
/// If the event is to be saved in the database
/// </summary>
public bool Save = true;
/// <summary>
/// The event saving mode in the database.
/// </summary>
public abstract EventArchiveSaveMode SaveMode
{
get;
}
public RawChannelEvent()
{
EventTime = DateTime.UtcNow;
}
}
Each user event should have a number of mandatory attributes:
• GuidAttribute – explicitly defines a unique event
• Serializable - allows to complete event serialization
Issued 11.07.2019
Eocortex API and SDK 14
Issued 11.07.2019
Eocortex API and SDK 15
[GuidAttribute("389EDCE2-54BB-4C2C-9984-51B7516A5DDF")]
[EventNameGUI("The object is left")]
[EventDatabaseName("objectleft")]
[EventGeneratesAlarmByDefault]
[EventGenerationFrequency(EventGenerationFrequencyMode.Low)]
[Serializable]
public class ObjectLeftEvent : RawChannelEvent
{
[EventFieldSaveable(0, true)]
[EventFieldNameGUI("Object")]
private string objectName;
/// <summary>
/// A motion detector.
/// Base abstract class for all motion detectors.
/// </summary>
public abstract class MotionDetector
{
/// <summary>
/// Detection zones.
/// </summary>
protected List<MDZone> zones = new List<MDZone>();
/// <summary>
/// Adds zone 1 with a full frame mask.
/// </summary>
public void AddFullFrameZone()
{
MDZone zone = new MDZone();
zones.Add(zone);
}
Issued 11.07.2019
Eocortex API and SDK 16
/// <summary>
/// Adds zone 1 with a full frame mask, with the zone features.
/// </summary>
public void AddFullFrameZone(float minObjWidth, float minObjHeight)
{
MDZone zone = new MDZone(0, minObjWidth, minObjHeight);
zones.Add(zone);
}
/// <summary>
/// Zone adding.
/// </summary>
/// <param name="zone">A zone added.</param>
public void AddZone(MDZone zone)
{
zones.Add(zone);
}
/// <summary>
/// Amount of zones. Read only.
/// </summary>
public int ZonesCount
{
get
{
return zones.Count;
}
}
/// <summary>
/// Motion detection in the preset frame.
/// </summary>
/// <param name="width">Frame width.</param>
/// <param name="height">Frame hight.</param>
/// <param name="bgr24bytes"> Array of bytes in video frame in bgr24
///format.
/// </param>
/// <param name="timestamp">Time stamp.</param>
/// <returns>Returns the motion map. Index > 0 means that motion occurs
/// in controlled pixel. Index value in the motion map
/// corresponds to index of a moving object.
///</returns>
public abstract MotionMap Detect(int width, int height, int offset,
int stride, byte[] bgr24bytes, DateTime timestamp);
}
Zones field is server completed before the plugin type operation starts by means of
AddFullFrameZone and AddZone methods. All fields in “Essentials for standard motion
detector” are used by a built-in motion detector only and must not be altered.
Main plugin logic is in Detect method, which receives bgr24 video frame (Blue, Green, Red
channels, 8 bytes each channel). The method results in MotionMap. To create a motion map
two arrays are required:
1) Occurrence of the motions map is two-dimensional array of integral numbers. Each
nonzero number of the array (index) identifies a moving object. Zero 0 means absence
of motion.
2) Objects in the motion array. Access to elements of the array is fulfilled through the
motion map indexes.
Issued 11.07.2019
Eocortex API and SDK 17
For the Motion Detector plugin registration the host interface RegisterMotionDetector
method must be called at the stage of assembly and plugin loading in IPlugin interface using
class initialization method (see Plugin registration in Eocortex, стр. 6).
/// <summary>
/// Graphical elements container. Allows to deposit separate
/// UserControl elements in the channel.
/// </summary>
protected Panel controlsContrainer;
Issued 11.07.2019
Eocortex API and SDK 18
/// <summary>
/// Visualiser initialization. It is called by host.
/// </summary>
/// <param name="Id">A channel identifier</param>
/// <param name="pluginToolset"> Archive access interface used for sending
commands
/// for event subscription in the system.</param>
/// <param name="drawingPanel"> A drawing panel.</param>
/// <param name="controlsContrainer"></param>
public virtual void Initialize(Guid Id, IPluginToolSet pluginToolset,
IDrawingPanel drawingPanel, Panel controlsContrainer)
{
this.pluginToolset = pluginToolset;
this.drawingPanel = drawingPanel;
this.controlsContrainer = controlsContrainer;
}
/// <summary>
/// Visualiser event processing. Specific drawing of event results.
/// </summary>
/// <param name="channelId">A channel identifier</param>
/// <param name="chEv">Event.</param>
/// <param name="isAlarm">If event is alarm</param>
public abstract void ProcessEvent(Guid channelId, RawChannelEvent chEv,
bool isAlarm);
/// <summary>
/// Delegate for sub-item registration in channel pop-up menu
/// in Eocortex client.
/// It is completed by host. It is called by visualiser.
/// </summary>
/// <param name="item"></param>
public RegisterChannelMenuItemHandler RegisterChannelMenuItem;
/// <summary>
/// Clearing all the visualizer drawings.
/// </summary>
public abstract void Clear();
/// <summary>
/// All resources deallocation. It is obligatory to call Release base class
/// in reloaded descendant methods.
/// </summary>
public virtual void Release()
{
drawingPanel = null;
controlsContrainer = null;
pluginToolset = null;
RegisterChannelMenuItem = null;
}
}
Each Visualiser plugin must define ProcessEvent method, which receives events from the
channel. All events are generated by Eocortex and other plugins. The plugin can visualize
events of any type, and they can be filtered using if operator and is key word, for example:
if (chEv is CounterEvent)
{
...
}
Issued 11.07.2019
Eocortex API and SDK 19
Visualiser can register its subitem in the pop-up menu (right click on the channel in the
Eocortex Client). This allows to alter visualiser logic according to the user preference. It is
provided by RegisterChannelMenuItem delegate.
For Visualiser plugin registration, the host interface RegisterRTVisualiser method must be
called at the stage of assembly and plugin loading in IPlugin interface using class initialization
method (see Registration of plugins in Eocortex, page 6).
/// <summary>
/// Menu item class. It is used in client for adding
/// sub-items on the Configuration button menu.
/// </summary>
public abstract class ClientMenuItem : IDisposable
{
private bool isEnabled = true;
/// <summary>
/// Plugin initialization.
/// </summary>
/// <param name="toolSet"></param>
public abstract void Initialize(IPluginToolSet toolSet);
/// <summary>
/// Menu item name.
/// </summary>
public abstract string Name
{
get;
}
/// <summary>
/// If the menu item is enabled.
/// </summary>
public bool IsEnabled
{
get
{
return isEnabled;
}
set
{
isEnabled = value;
}
}
/// <summary>
/// Processing method of click (keystroke) of the user
/// </summary>
public abstract void OnClicked();
Issued 11.07.2019
Eocortex API and SDK 20
/// <summary>
/// Resourses release method.
/// </summary>
public abstract void Dispose();
}
The initialization method should be defined in the descendant class, which receives interface with
service functions from the host (Eocortex Client). The functions allow to receive channel
identifiers and their names in current configuration. In addition, they provide access to Eocortex
archive and possibility to send commands to analytical plugins and receive results of their
execution. It is possible to subscribe for all events occurring in the system. The interface is as
follows:
/// <summary>
/// A host provided interface for
/// archive access, sending commands,
/// system events subscription.
/// </summary>
public interface IPluginToolSet
{
/// <summary>
/// Receives archive access interface
/// </summary>
/// <returns></returns>
IArchiveEventsReader GetArchiveReader();
/// <summary>
/// Sends a command to plugin
/// running in the server.
/// </summary>
/// <param name="pluginId">Plugin identifier</param>
/// <param name="channelsId">Channel identifiers</param>
/// <param name="cmdObj">Command</param>
/// <returns> Returns each channel result.
/// The key is channel identifier.
/// Value is a result of the command execution.</returns>
Dictionary<Guid, object> SendChannelsCommand(Guid pluginId,
List<Guid> channelsId, object cmdObj);
/// <summary>
/// Installs/deletes the channel event handler.
/// </summary>
/// <param name="subscrId"> A subscriber identifier </param>
/// <param name="channelId"> A channel identifier </param>
/// <param name="eventsHandler"> Handler. If it is null, then
/// previously installed handler is deleted.</param>
void SetEventsHandler(Guid subscrId,
Guid channelId, EventsHandler eventsHandler);
/// <summary>
/// Receives plugin settings with a specified identifier for the channel.
/// </summary>
/// <param name="channelId">A channel identifier</param>
/// <param name="pluginId">Plugin identifier</param>
/// <returns></returns>
PluginSettings GetPluginSettings(Guid channelId, Guid pluginId);
}
GetArchiveReader method provides access interface to archive and current channels
information in the configuration. Detailed data about this interface are kept in Eocortex SDK
source codes.
Issued 11.07.2019
Eocortex API and SDK 21
/// <summary>
/// Plugin class for system event processing, command and proper event generating.
/// </summary>
public abstract class EventProcessor
{
/// <summary>
/// Initialization. Called by host.
/// </summary>
/// <param name="archiveReader">Archive access interface</param>
/// <param name="channelSpecificSettings">Plugin settings</param>
public abstract void Initialize(IArchiveEventsReader archiveReader,
PluginSettings settings);
/// <summary>
/// Generates a registered external event in the channel. Is completed
/// by host. Called by plugin.
/// </summary>
public GenerateEventDelegate GenerateEvent;
/// <summary>
/// Sends a set command to be executed in the channel. Is completed by host.
/// Called by plugin.
/// </summary>
public ExecuteCommandExDelegate ExecuteCommand;
/// <summary>
/// Allows to subscribe for events on the channel. Completed by
/// plugin if necessary at the initialization stage.
/// </summary>
public ReceiveEventDelegate OnChannelEventReceived;
/// <summary>
/// Changes general or specific settings, if necessary.
/// Method calling must result in user setting window opening.
/// It is called by host (configurator).
/// </summary>
/// <param name="settings"> Current plugin settings.</param>
/// <returns>New plugin settings.</returns>
public abstract PluginSettings SetSettings(PluginSettings settings);
}
Issued 11.07.2019
Eocortex API and SDK 22
/// <summary>
/// General plugin settings. Not related to the current channel. Can be null.
/// A setting object must be serializable.
/// </summary>
public object generalSettings;
}
If the analyst settings are unified for all channels, it will be enough to complete only general
settings object. Otherwise, if all the plugin settings are related to a single channel, it will be
enough to complete only a specific channel settings object. General and specific objects are
user-defined. The only requirement is the object serialization, as all the plugin settings are
kept in Eocortex general configuration.
If the plugin must execute a specific command as a result of its operation (such as, turn
recording on/off, set up a preset on a camera, turn a camera, etc.), a command object should
be created. Currently there are following commands:
• RawEnableRecordingCommand - turns on a record in the channel, record interval is
defined optionally;
• RawDisableRecordingCommand - turns off a record in the channel;
• RawGoToPresetPtzCommand - sets up a preset on a camera;
• RawGoHomePtzCommand - sets up home camera position;
• RawStopPtzCommand - stops ptz (panorama/tilt/zoom) command execution on a
camera;
• RawMovePtzCommand - one step movement;
• RawZoomPtzCommand – relative approximation (zoom);
• RawStartMovePtzCommand - continuous (preferred flowing) motion;
• RawMoveToPtzCommand - turns a camera so that a reference point is in the center
of the frame area;
• RawSetOutputIOCommand - adjusts a signal level on the camera output;
• RawSetOutputPulsesIOCommand - generates the impulse sequence on the camera
output
The Event Processor plugin can subscribe for events occurring at the channel. To do so the
event processor has to complete OnChannelEventReceived delegate when initializing. In
addition, the plugin can generate its own events at the channel.
For the Event Processor plugin registration, the host interface RegisterEventProcessor
should be called at the stage of assembly and plugin loading in IPlugin interface of class
initialization method (see Plugin registration in Eocortex, page 6).
Issued 11.07.2019
Eocortex API and SDK 23
/// <summary>
/// Interface of receiving real time frames.
/// Used for creation of plugins that receive frames
/// from IP cameras.
/// </summary>
public interface IRealTimeFrameReceiver
{
/// <summary>
/// Event handler on receiving a new frame.
/// It is called by the side that operates interface.
/// The host is subscribed for events.
/// </summary>
event NewRawFrameEventHandler NewRawFrame;
/// <summary>
/// Event handler. It is called by the side that operates interface.
/// The host is subscribed for the handler.
/// </summary>
event NewRawEventHandler NewEvent;
/// <summary>
/// Handler of a new record entering in the log. Informs the host that
/// Connection Log field has changed (ref. below).
/// The log is viewed in the Configurator after clicking the "Log History"
/// It is called by the side that operates interface.
/// The host is subscribed for the handler.
/// </summary>
event EventHandler NewLogRecord;
/// <summary>
/// A flag that denotes if it is necessary to enter a record in log.
/// It is changed by host.
/// </summary>
bool IsWritingConnectionLog
{
get;
set;
}
/// <summary>
/// Current content of the connection log.
/// </summary>
string ConnectionLog
{
get;
}
/// <summary>
/// If the stream is active
/// </summary>
/// <param name="streamType">Stream type</param>
/// <returns></returns>
bool IsStreamActive(ChannelStreamTypes streamType);
Issued 11.07.2019
Eocortex API and SDK 24
/// <summary>
/// Starts the specified stream to receive frames
/// </summary>
/// <param name="streamType"></param>
void StartStream(ChannelStreamTypes streamType);
/// <summary>
/// Stops the specified stream
/// </summary>
/// <param name="streamType"></param>
void StopStream(ChannelStreamTypes streamType);
/// <summary>
/// Sends sound to the device (duplex sound realization).
/// </summary>
/// <param name="soundData"></param>
void SendSound(byte[] soundData);
/// <summary>
/// Releases all resources. Closes all streams.
/// </summary>
void Release();
}
While implementing this interface, it is necessary to create a mechanism for working with
data streams, which can be a sequence of particular frame type, or a sequence of events.
Current Eocortex SDK version contains the following data stream types:
/// <summary>
/// Channel stream types.
/// </summary>
public enum ChannelStreamTypes : ulong
{
/// <summary>
/// Main video stream
/// </summary>
MainVideo = 1,
/// <summary>
/// Alternative video stream
/// </summary>
AlternativeVideo = 2,
/// <summary>
/// Camera sound stream.
/// </summary>
MainSound = 4,
/// <summary>
/// Alternative sound stream
/// </summary>
AlternativeSound = 8,
/// <summary>
/// Reverse sound stream.
/// </summary>
OutputSound = 16,
/// <summary>
/// Motion detection data stream.
/// </summary>
MotionDetection = 32,
Issued 11.07.2019
Eocortex API and SDK 25
/// <summary>
/// Camera I/O system data stream
/// </summary>
IO = 64,
}
The data streams of different types are to be generated depending on the device capabilities
and the channel settings in the configurator.
MainVideo and AlterntaiveVideo data streams consist of RawVideoFrame video frames,
received from the camera.
MainSound and AlternativeSound, and OutputSound data streams consist of
RawSoundFrame sound frame sequence. MotionDetection data stream consists of
RawChEv_MDresults and Raw ChEv_NoDetection events sequence.
I/O stream consists of RawChEv_InputSignalLevelChanged events.
StartStream method starts the data streams from the host, in which the next stream is
initialized. The method has to immediately return control to the host and implement long-
term operations (input/output operations) in separate streams. Stopping the streams and
control of their activities using StopStream and IsStreamActive methods is called by the
host, and these actions must be completed immediately without any long-term operations.
Streams return the results of their operation to the host by calling frame (NewRawFrame)
and event (NewEvent) handlers.
For example, if the IP-device sends MJPEG frames, MainVideo (or AlternativeVideo), the
data stream must call NewRawFrame and transmit RawMJPEGFrame video frame as one
of the arguments:
/// <summary>
/// MJPEG frame
/// </summary>
[Serializable]
public class RawMJPEGFrame : RawVideoFrame
{
public RawMJPEGFrame() { }
/// <summary>
/// The frame data
/// </summary>
/// <param name="data"></param>
public RawMJPEGFrame(byte[] data)
{
Data = data;
}
}
Issued 11.07.2019
Eocortex API and SDK 26
Likewise, for MainSound (or AlternativeSound) data stream and sound in the G.711U
format, the frame RawG711UFrame is to be transmitted:
/// <summary>
/// G.711U frame
/// </summary>
[Serializable]
public class RawG711UFrame : RawSoundFrame
{
/// <summary>
/// The frame data
/// </summary>
/// <param name="data"></param>
public RawG711UFrame(byte[] data)
{
this.Data = data;
this.samplesRate = 8000;
this.bitsPerSample = 16;
this.channels = 1;
this.bitrate = 64000;
}
}
After the creation of the appropriate type video frame, completing the following fields of
RawFrame base class is required:
• Id – the frame identifier consisting of 2 parts: a sequence identifier (is generated at
random before receiving the data stream) and a frame ordinal number.
• Timestamp – the frame timestamp, defined in UTC format.
In MPEG-4 and H.264 codecs:
• It is obligatory for P-frames to complete Dependencies field containing all frame identifiers
on which the given frame depends.
• The decoder initializing information is to be defined in SpecInitData field in each I-frame.
Example of MJPEG frame creating:
Issued 11.07.2019
Eocortex API and SDK 27
/// <summary>
/// The device registration information.
/// is used during frame receiving plugin
/// registration.
/// </summary>
public class DevType_RegInfo
{
/// <summary>
/// Device identifier.
/// </summary>
public Guid DeviceTypeGuid;
/// <summary>
/// Name of manufacturer.
/// </summary>
public string DevTypeBrandName;
/// <summary>
/// Device name.
/// </summary>
public string DevTypeModelName;
/// <summary>
/// List of device capabilities.
/// </summary>
public DevType_Capabilities Capabilities;
/// <summary>
/// List of available resolutions for the device.
/// </summary>
public List<VideoResolutions> AvailableResolutions = new
List<VideoResolutions>();
Issued 11.07.2019
Eocortex API and SDK 28
/// <summary>
/// Delegate that allows host to change camera/ video server settings.
/// </summary>
public SetDeviceParametersDelegate SetDeviceParameters;
/// <summary>
/// Receiving IRealTimeFrameReceiver interface.
/// </summary>
public GetRTFRDelegate GetRTFR;
/// <summary>
/// Receiving PTZ interface.
/// </summary>
public GetPtzControllerDelegate GetPtzController;
/// <summary>
/// Receiving I/O interface.
/// </summary>
public GetIOControllerDelegate GetIOController;
}
GetRTFR delegate, called by host, must return a specific implementation of
IRealTimeFrameReceiver interface. The delegate receives connection parameters
(ConnectionParameters) and substream parameters (SubStreamParameters), which
have been defined by the user in the channel configuration as arguments.
Capabilities of IP device with which the Frame Receiver plugin operates are described in the
Capabilities field:
/// <summary>
/// List of device capabilities
/// </summary>
public enum DevType_Capabilities : ulong
{
/// <summary>
/// Device supports only cameras.
/// </summary>
SupportsCameras = 1,
/// <summary>
/// Device supports cameras and video servers.
/// </summary>
SupportsCamerasAndServers = 2,
/// <summary>
/// Device supports alternative stream.
/// </summary>
SupportsAlternativeVideoStream = 4,
/// <summary>
/// Parameters (resolution, fps, compression), described by
/// SupportedDeviceParameters/SupportedExtraParameters arrays, are
independent of the format
/// of the stream (are the same for mjpeg, mpeg4, h264).
/// </summary>
DeviceParametersFormatIndependent = 8,
}
Issued 11.07.2019
Eocortex API and SDK 29
If it is required to solve a task of controlling a tilting camera or its inputs/outputs (IO), the
IPtzController and/or IIOController interfaces need to be implemented:
/// <summary>
/// Unified interface of tilting camera control implementation.
/// </summary>
public interface IPtzController
{
#region ----------------- BASE PART ------------------
/// <summary>
/// A camera initialization.
/// </summary>
/// <returns></returns>
void Initialization();
/// <summary>
/// Returns the camera capabilities.
/// </summary>
/// <returns></returns>
PtzCapabilities GetCapabilities();
/// <summary>
/// Returns names of camera presets.
/// The number of elements in resulting array corresponds to the number of
/// presets.
/// Each preset corresponds to a number equal to the array index.
/// </summary>
/// <returns>Names of camera presets.</returns>
string[] GetPresetsNames();
/// <summary>
/// Defines a preset by its index.
/// </summary>
/// <param name="presetIndex"> The preset index.</param>
void SetPresetPosition(int presetIndex);
/// <summary>
/// Moves the camera to the home position.
/// </summary>
void MoveToHome();
/// <summary>
/// Stops any PTZ command executing.
/// </summary>
void Stop();
/// <summary>
/// One step movement.
/// </summary>
/// <param name="panSpeed"> Horisontal speed. Range from -100 to
/// 100.</param>
/// <param name="tiltSpeed">Vertical speed. Range from -100 to
/// 100.</param>
void StepMove(int panSpeed, int tiltSpeed);
Issued 11.07.2019
Eocortex API and SDK 30
/// <summary>
/// Continuous (preferred flowing) motion.
/// </summary>
/// <param name="panSpeed">Horisontal speed. Range from -100 to
/// 100.</param>
/// <param name="tiltSpeed">Vertical speed. Range from -100 to
/// 100.</param>
void ContiniousMove(int panSpeed, int tiltSpeed);
/// <summary>
/// Relative zooming in.
/// </summary>
/// <param name="step">Step from 1 to 100.</param>
void StepZoomIn(int step);
/// <summary>
/// Relative zooming out.
/// </summary>
/// <param name="step">Step from 1 to 100.</param>
void StepZoomOut(int step);
/// <summary>
/// Continuous (preferred flowing) zooming in.
/// </summary>
/// <param name="speed">Speed. Range from 1 to 100.</param>
void ContiniousZoomIn(int speed);
/// <summary>
/// Returns the camera max. zooming in.
/// </summary>
/// <returns>The camera max. zooming in. If the function is not
/// supported, a negative number is returned.</returns>
double GetMaxZoomFactor();
/// <summary>
/// Returns the current camera zooming in.
/// </summary>
/// <returns> Current camera zooming in. If the function is not supported,
/// a negative number is returned.</returns>
double GetCurrentZoomFactor();
/// <summary>
/// Sets up absolute zooming in. No operation if camera does not support
/// the function. Ref. PtzCapabilities.
/// </summary>
void SetZoomFactor(double factor);
/// <summary>
/// Sets max. zooming in.
/// </summary>
void ZoomTele();
Issued 11.07.2019
Eocortex API and SDK 31
/// <summary>
/// Sets min. zooming in.
/// </summary>
void ZoomWide();
#endregion
/// <summary>
/// Turns the camera so that reference point is
/// in the center of the frame area.
/// </summary>
/// <param name="point">Display point (in pixels) that is necessary to be put
/// in the center by turning the camera.
/// Starting point (0,0) is the upper-left corner of frame о</param>
/// <param name="frameSize">The frame size in pixels</param>
void MoveTo(System.Drawing.Point point, System.Drawing.Size frameSize);
/// <summary>
/// turns and zooms the camera so that
/// controlled rectangle takes a full frame area.
/// If rectangle aspect ratio does not correspond to that of the frame,
/// then zooming is executed so that the whole rectangle
///fits within the frame.
/// The rectangle center fits the frame center.
/// </summary>
/// <param name="rect">Rectangle is set in pixels</param>
/// <param name="frameSize">Frame size in pixels</param>
void ShowRect(System.Drawing.Rectangle rect, System.Drawing.Size frameSize);
#endregion
}
/// <summary>
/// Unified interface of camera input/output control implementation
/// </summary>
public interface IIOController
{
/// <summary>
/// Initialization
/// </summary>
/// <returns></returns>
void Initialization();
/// <summary>
/// Returns the camera capabilities.
/// </summary>
/// <returns></returns>
IOCapabilities GetCapabilities();
/// <summary>
/// Sets the defined value in the output
/// </summary>
/// <param name="portID">Output No.</param>
/// <param name="value">1 or 0</param>
void SetOutput(int portID, int value);
Issued 11.07.2019
Eocortex API and SDK 32
/// <summary>
/// Supplies pulse sequence (PWM) in indicated output.
/// It is not supported by all cameras.
/// </summary>
/// <param name="portID">Output No.</param>
/// <param name="pulses"> Pulse array </param>
void SetOutput(int portID, IOPulse[] pulses)
}
Pan-and-tilt (IO controller) capabilities must be returned using GetCapabilities() method to
inform the host about methods of optional capabilities implemented in the interface (if the
device supports them).
DevType_RegInfo registration information of the device must be defined at the stage of
loading the assembly and plugin in the class initialization metod which realizes IPlugin
interface by calling RegisterDevType host interface method (see Plugin registration in
Eocortex, page 6).
Besides DevType_RegInfo, it is also necessary to complete the RTFR_RegInfo frame
feceiver information:
/// <summary>
/// The frame receiver registration information
/// </summary>
public class RTFR_RegInfo
{
/// <summary>
/// Device identifier
/// </summary>
public Guid DeviceTypeGuid;
/// <summary>
/// Data stream format
/// </summary>
public VideoStreamFormats StreamFormat;
/// <summary>
/// Connection protocol used
/// </summary>
public NetworkConnectionTypes ConnectionType;
/// <summary>
/// The device capabilities using the set format StreamFormat
/// </summary>
public RTFR_Capabilities Capabilities;
}
This information must be specified as many times as many different stream formats the IP
device supports.
Simiar to DevType_RegInfo, RTFR_RegInfo information must be defined at the stage of
assembly and plugin loading in IPlugin interface of class initialization method. Call the host
interface RegisterDevType method to complete it. Example of completing the classes is
given below:
Issued 11.07.2019
Eocortex API and SDK 33
KingNet_KS3002MJ_Device.GetPtzController = null;
KingNet_KS3002MJ_Device.GetRTFR = (conParam, subParams) =>
{
RealTimeFrameReceiver rtfr = new RealTimeFrameReceiver(conParam, subParams);
return rtfr;
};
KingNet_KS3002MJ_Device.SetDeviceParameters = (conParams, subParams) =>
{
return true;
};
host.RegisterDevType(KingNet_KS3002MJ_Device);
host.RegisterRTFR(rtfrKingNet_KS3002MJ_Mjpeg);
}
Issued 11.07.2019
Eocortex API and SDK 34
HTTP/1.1 200 OK
…
Content-Type: multipart/x-mixed-replace; boundary=myboundary
-- myboundary
Content-Type: image/jpeg
Content-Length: 63125
or
-- myboundary
Content-Type: audio, PCMU
Content-Length: 1000
If the stream format is MJPEG, Content-Type parameter contains «image/jpeg» line. In case
of MPEG4 format, Content-Type parameter has “video, mpeg4, I-frame” for I-frames and
“video, mpeg4, P-frame” for P-frames. Each key I-frame contains initializing information
for MPEG4 decoder. Likewise, if it is H.264 decoder, for I-frames Content-Type field contains
“video, h264, I-frame” and “video, h264, P-frame”. Similarly to MPEG4 format, before
each I-frame there is initializing information for H264 decoder.
Issued 11.07.2019
Eocortex API and SDK 35
Example of query:
http://127.0.0.1:8080/video?mode=archive&startTime=20.09.2011+11:49:12
&speed=1&channel=Channel 1&login=root&password=
Issued 11.07.2019
Eocortex API and SDK 36
Each resolution corresponds to maximum frame rate (defined in settings). Client can send a
query for a lower frame rate by defining fps parameter (positive integer – necessary frame
rate per second). If fps exceeds maximum value or is not defined, video is returned with
maximum rate. For example:
http://127.0.0.1:8080/mobile?channelid=e9d42141-8f7f-4577-bb5e-4dd9f79331ab
&login=root&resolutionx=640&resolutiony=480&fps=10
Issued 11.07.2019
Eocortex API and SDK 37
<Streams>
<StreamInfo RotationMode="None"
StreamFormat="H264"
StreamType="Main"/>
<StreamInfo RotationMode="None"
StreamFormat="MJPEG"
StreamType="Alternative"/>
</Streams>
</ChannelInfo>
</Channels>
<RootSecurityObject Id="9c7d175a-9c84-455e-b104-57cc12cb9d47">
<ChildSecurityObjects>
<SecObjectInfo Id="583f67a8-d173-4b59-8c49-5e774c99bcf9"
Name="Object 1">
<ChildSecurityObjects/>
<ChildChannels>
<ChannelId>9bacefb4-4605-4813-940d-41c056248f8d</ChannelId>
</ChildChannels>
</SecObjectInfo>
</ChildSecurityObjects>
<ChildChannels/>
</RootSecurityObject>
<UserGroup>
<Id>464daa9e-755d-4491-a616-5fbda4423ac8</Id>
<Name>Administrators</Name>
<CanConfigure>true</CanConfigure>
<CanConfigureWorkplace>false</CanConfigureWorkplace>
<CanShutdown>true</CanShutdown>
<CanChangeChannelMode>true</CanChangeChannelMode>
<CanManageRec>true</CanManageRec>
<CanAccessExpertMode>true</CanAccessExpertMode>
<CanPTZ>true</CanPTZ>
<CanReceiveSound>true</CanReceiveSound>
<CanTransmitSound>true</CanTransmitSound>
<CanAccessNewCamera>true</CanAccessNewCamera>
<CanGetTranscodedVideoFromMobileServer>
true
</CanGetTranscodedVideoFromMobileServer>
<CanAccessEditingAnalystPluginsInClient>
true
</CanAccessEditingAnalystPluginsInClient>
<CanAccessVideoViaWeb>true</CanAccessVideoViaWeb>
<CanAccessVideoViaSmartTV>true</CanAccessVideoViaSmartTV>
<CanExportVideoToAvi>true</CanExportVideoToAvi>
<CanReceiveMainStream>true</CanReceiveMainStream>
<AllowedArchiveDepth/>
<IsAllForbidden>false</IsAllForbidden>
<CanAccessUnifiedLog>true</CanAccessUnifiedLog>
<CanAccessToAllUsersInUnifiedLog>true</CanAccessToAllUsersInUnifiedLog>
<CanReceiveMobilePush>true</CanReceiveMobilePush>
</UserGroup>
Issued 11.07.2019
Eocortex API and SDK 38
Issued 11.07.2019
Eocortex API and SDK 39
"IsSoundArchivingEnabled": false,
"AllowedRealtime": true,
"AllowedArchive": true,
"IsPtzOn": false,
"IsTransmitSoundOn": false,
"ArchiveMode": "MDandManual",
"Streams": [
{
"StreamType": 0,
"StreamFormat": 3,
"RotationMode": 0
},
{
"StreamType": 1,
"StreamFormat": 1,
"RotationMode": 0
}
],
"ArchiveStreamType": "Main"
}
],
"RootSecObject": {
"ChildSecObjects": [
{
"ChildSecObjects": [],
"ChildChannels": [
"9bacefb4-4605-4813-940d-41c056248f8d"
],
"Id": "583f67a8-d173-4b59-8c49-5e774c99bcf9",
"Name": "Object 1"
}
],
"ChildChannels": [],
"Id": "9c7d175a-9c84-455e-b104-57cc12cb9d47",
"Name": null
},
"UserGroup": {
"Id": "464daa9e-755d-4491-a616-5fbda4423ac8",
"Name": "Administrators",
"CanConfigure": true,
"CanConfigureWorkplace": false,
"CanShutdown": true,
"CanChangeChannelMode": true,
"CanManageRec": true,
"CanAccessExpertMode": true,
"CanPTZ": true,
"CanReceiveSound": true,
"CanTransmitSound": true,
"CanAccessNewCamera": true,
"CanGetTranscodedVideoFromMobileServer": true,
"CanAccessEditingAnalystPluginsInClient": true,
"CanAccessVideoViaWeb": true,
"CanAccessVideoViaSmartTV": true,
"CanExportVideoToAvi": true,
"CanReceiveMainStream": true,
"AllowedArchiveDepth": "416.16:00:00",
"IsAllForbidden": false,
"CanAccessUnifiedLog": true,
Issued 11.07.2019
Eocortex API and SDK 40
"CanAccessToAllUsersInUnifiedLog": true,
"CanReceiveMobilePush": true
},
"MobileServerInfo": {
"IsEnabled": true,
"IsProxyEnabled": true,
"IsMobilePushEnabled": false,
"Port": 8089,
"UsePFrames": false,
"FpsLimit": 0,
"LowResolution": "120 x 90",
"MiddleResolution": "240 x 180",
"HighResolution": "800 x 480",
"Resolutions": [
{
"Width": 800,
"Height": 480,
"IsEnabled": true,
"FpsLimit": 15,
"UsePFrames": true,
"Type": 2
},
{
"Width": 240,
"Height": 180,
"IsEnabled": true,
"FpsLimit": 4,
"UsePFrames": false,
"Type": 1
},
{
"Width": 120,
"Height": 90,
"IsEnabled": false,
"FpsLimit": 4,
"UsePFrames": false,
"Type": 0
}
]
},
"RtspServerInfo": {
"IsEnabled": true,
"TcpPort": 554,
"IsMjpegEnabled": false
}
}
Configuration element in the response contains the following:
• A version of XMLProtocolVersion protocol. The current protocol number is 2, it is
supposed to be changed when new elements and attributes in xml-response appear.
• Time stamp of the last Timestamp configuration application.
• Unique identifier Id of current configuration and its revision number Revision. After
each configuration change revision number increases by one.
• Identifier of SenderId server that sent the xml-response.
Issued 11.07.2019
Eocortex API and SDK 41
Issued 11.07.2019
Eocortex API and SDK 42
Issued 11.07.2019
Eocortex API and SDK 43
{
"Index": 3,
"IsEmpty": false,
"ChannelId": "1b6204af-f3ae-49ab-935f-878cbb3a9139",
"Viewer": "Realtime"
}
]
}
Where:
index — cell’s ordinal number (starting from zero);
isempty — is the cell empty;
channeled – channel identifier;
viewer — type of cell contents, adopts the following values:
• none — cell is empty;
• realtime — real time;
• archive — archive;
• other — other; at the present moment, it may only be a plan of the premises.
The type of grid coincides with the one described in Aquiring a list of available grids in Eocortex
client (page 42).
Issued 11.07.2019
Eocortex API and SDK 44
Issued 11.07.2019
Eocortex API and SDK 45
Issued 11.07.2019
Eocortex API and SDK 46
Issued 11.07.2019
Eocortex API and SDK 47
Issued 11.07.2019
Eocortex API and SDK 48
Issued 11.07.2019
Eocortex API and SDK 49
Issued 11.07.2019
Eocortex API and SDK 50
Issued 11.07.2019
Eocortex API and SDK 51
Issued 11.07.2019
Eocortex API and SDK 52
Whithin one request, one portion of audiodata is sent, meaning the request is not a permanent
connection, and the server sends a portion of sound to the camera only after completing the
reception of the corresponding query from the client.
To generate a portion of audiodata (sound coding) one should use third-party data libraries
(for example, NAudio: https://github.com/naudio/NAudio, coding parameters: Samplesrate
= 8000; Bitspersample = 16; Number of channels = 1).
Transmission session is a series of queries sent from a certain client computer to a certain
camera. A unique clientID must be used for each transmission session. In order to decrease
server issues, it is recommended to use the same clientID for a series of queries within the
same session. The clientid is created by the client independently.
Issued 11.07.2019
Eocortex API and SDK 53
Also, for these events it is possible to assign actions in scenarios, using Eocortex Configurator
application:
Issued 11.07.2019
Eocortex API and SDK 54
To make a RTSP connection it is possible to use TCP (RTSP over TCP) or HTTP (RTSP over
HTTP) connections. UDP connections (RTSP over UDP)
are not supported.
By default, MJPEG broadcasting via RTSP protocol is off, because this protocol
supports only MJPEG frames coded in Baseline mode. Thus, recoding is required for
broadcasting video streams coded in other MJPEG modes, which in its turn will
increase server load. Additionally, MJPEG recoding may cause lower fps as
compared with the fps broadcast directly by the camera.
Connection to the server is made by an RTSP client, for example, VLC, with the following
connection string:
rtsp://<ip address of Eocortex server and rtsp port>/rtsp?channelid=<channel id>
&login=<user name>&password=<MD5 hash of password>[&sound=on]
[&streamtype=alternative]
channelid mandatory parameter assigns channel identifier for obtaining video. Also, for
channel assignment a channel ordinal number in the configuration (starting from zero) can
be used – to do so, channelnum parameter must be used instead of channelid (see
Obtaining real time and archive video, page Ошибка! Закладка не определена.).
login mandatory parameter assigns user name. The user must have rights for the requested
channel.
password parameter is obligatory if there is a password assigned for the user. If the user
has no password (blank password), then password parameter is optional and may be
ommited or left blank.
sound optional parameter with on value allows to get audio together with video. Audio frames
always come in G.711U format.
streamtype optional parameter with alternative value allows to request alternative (2nd)
video stream which normally has lower resolution.
Example of query:
rtsp://127.0.0.1:554/rtsp?channelid=D3039B22-3350-47C6-85FE-40F29B1C7FBD&login=root
To get access to the archive, it is required to set the parameters similar to those used for
HTTP connection (see Obtaining real time and archive video, page Ошибка! Закладка не
определена.).
rtsp://<ip address of Eocortex server and rtsp port>/rtsp?channelid=<channel id>
&login=<user name>&password=<hash-line MD5 password>&mode=archive
&starttime= <dd.mm.yyyy+ hh:mm:ss[.fff]>[&sound=on][&speed=<n>][&isforward=false]
channelid, login, password and sound parameters are similar to the parameters of a
request to obtain real time video via RTSP protocol.
mode mandatory parameter with archive value indicates the access to the archive.
starttime mandatory parameter indicates the time of recording when the archive playback
starts. This value is set as a combination of the date and UTC time.
speed optional parameter sets the speed of archive playback. The range of values accepted
is continuous and varies from 0.1 to 20. Default value is 1.0.
isforward optional parameter with false value indicates that the archive should be played
backwards.
Example of query:
rtsp://127.0.0.1:554/rtsp?channelid=D3039B22-3350-47C6-85FE-40F29B1C7FBD
&login=root&mode=archive&starttime=21.04.2015+ 12:05:01.125&sound=on&speed=1
Issued 11.07.2019
Eocortex API and SDK 55
Issued 11.07.2019
Eocortex API and SDK 56
Issued 11.07.2019
Eocortex API and SDK 57
Broadcasting video to site can be organized with the help of Eocortex server and JavaScript
component on the client’s side. A script for the client’s side and the example of its usage on
the HTML page can be found in the Examples\Site\frameReceiver.js folder. In the script
it is necessary to indicate the parameters for connection to Eocortex server, as well as the
identifier (name/number) of a channel from which the video will be broadcast and the required
size of the area to which video frames will be output.
Example of script configuration:
var serverUrl = "http://95.23.84.1:8080" /*server URL*/
var login = "root" /*user with rights to watch channel being broadcast*/
var password = ""; /*MD5 hash of user password in upper case or empty string in case
of blank password*/
var channelnum = 0; /*ordinal number of channel in general configuration, counting
from 0*/
var drawWidth = 577; /*display area width in pixels*/
var drawHeight = 432; /*display area height in pixels*/
An example of script using the channel identifier instead of its ordinal number can be found
in Examples\Site\frameReceiver_id.js folder. There must be a tag
<imgname='frontImage'/> on the HTML page where MJPEG-coded video stream will be
displayed.
Issued 11.07.2019
Eocortex API and SDK 58
It is not recommended to change display area size dynamically, because it will cause a
substantial increase of resources used by mobile connections service since it
transcodes initial video stream into MJPEG and then divides the received stream
among many clients (sessions). The use of different resolutions will also cause
additional load to the mobile connections service.
Issued 11.07.2019