VideoOS.Platform.Item Class Reference

This class is used as a base class of all objects and items, be it cameras, audio sources or plug-in developed objects. For simple Items that does not have any Children this base class itself can be used, often though you will need to implement a class that inherit from this Item and make overrides to GetChildren, HasChildren, GetParent and perhaps more methods. More...

Inheritance diagram for VideoOS.Platform.Item:
VideoOS.Platform.ConfigItem VideoOS.Platform.Client.ViewAndLayoutItem VideoOS.Platform.GenericEventConfigItem

Public Member Functions

virtual bool Contains (String searchString)
 Looks through all fields for a match.
 
virtual List< ItemGetChildren ()
 Return a list of Children of this Item. Implementation not required.
 
virtual void GetChildrenAsync (AsyncItemsHandler asyncItemsHandler, Control control, object callerReference)
 Initiates a call to retrieve all Children for the item. The AsyncItemHandler will be called with the result.
 
virtual List< ItemGetChildrenSorted ()
 Same as GetChildren, just sorted by name.
 
virtual DataSource GetDataSource ()
 Get the DataSource relevant for this Item type.
If no DataSource is available for this Item, a null value is returned.

This can for instance be used for retrieving Sequence information for a Camera Item.
 
virtual Item GetParent ()
 Get the parent Item to this Item This implementation will build the FQID from the current ServerId and set objectId = ParentId, and assume other fields are the same (FolderType, Kind). If not found it will try with Kind = Kind.Server.
 
virtual List< ItemGetRelated ()
 Return a list of Related Items for this Item.
Could e.g. be Audio devices to a Camera.
 
virtual void GetRelatedAsync (AsyncItemsHandler asyncItemsHandler, Control control, object callerReference)
 Initiates a call to retrieve all Related items for the item.
The AsyncItemHandler will be called with the result.
 
virtual Image IconWithOverlay ()
 Take item's icon (if available) and place a 'disable' red cross over - if item is disabled.
 
virtual Image IconWithOverlay (bool attention, bool active)
 Construct an icon with overlay.
 
 Item ()
 Create a new Item. The FQID needs to be set afterwards.
 
 Item (FQID fqid, String name)
 Create a new Item including FQID and the items Name. Other properties can be set afterwards.
 
 Item (MIPItem mipItem)
 Construct an Item from the MIPItem retrieved via the Configuration API.
 
 Item (ServerId serverId, Guid parentId, Guid objectId, String name, FolderType folderType, Guid kind)
 Create a new Item. A FQID is created from the provided fields. No further fields needs to be filled to have a valid Item and FQID.
 
 Item (ServerId serverId, Guid parentId, String objectIdString, String name, FolderType folderType, Guid kind)
 Create a new Item. A FQID is created from the provided fields. No further fields needs to be filled to have a valid Item and FQID.
 
 Item (ServerId serverId, String name)
 Create a new Item, a FQID containing the ServerId is created.
Important: You will need to fill the FQIDs parentId, ObjectId or ObjectString and Kind afterwards.
 
 Item (ServerId serverId, String name, FolderType folderType, Guid kind)
 Create a new Item. A FQID is created from the provided fields. Important: You will need to fill the FQIDs ObjectId or ObjectIdString afterwards to have a valid FQID.
 
String Serialize ()
 Serialize the content of the Item, that is independent of Environment and User.
Note: Overloaded properties, UserContext and Authentication will not be saved.
 
void Serialize (XmlWriter xmlWriter)
 Serialize the content of the Item, that is independent of Environment and User.
Note: Overloaded properties, UserContext and Authentication will not be saved.
 
virtual void SetChildren (List< Item > children)
 This method can be used when the base Item class is used, and it contains children. This method will NOT add the children to any servers or configuration, but is merely to simplify instantiation. The children set in this method could be retrieved by the GetChildren method. You should only use this way of implementing an Item, if the number of children is limited.
 
override String ToString ()
 Returns the name of the item. Can be used for adding the Item directly on ListBox's and other user controls.
 

Static Public Member Functions

static Item Deserialize (String serializedItem)
 De-serializes a string as generated by the Serialize method.
Note: UserContext and Authorization properties are not filled.

 

Protected Attributes

HasChildren _anyChildren = HasChildren.Maybe
 
List< Item_children = new List<Item>()
 
HasRelated _hasRelated = HasRelated.Maybe
 
List< Item_related = new List<Item>()
 

Properties

virtual Dictionary< String, String > Authorization [get]
 Returns a set of strings identifying what the current user is authorized to do.

 
virtual Collection< MapAlarmContextMenuContextMenu [get, set]
 Defines a list of ContextMenu items relevant for this item. It is displayed when a user right click on a Map containing this item.
 
virtual bool Enabled [get, set]
 Interpret the properties dictionary for "Enabled" and "Disabled" keys. If no entry is found, default is enabled. Otherwise values of "Yes"/"No" and "True" / "False" are checked for each.
 
virtual bool Encrypt [get, set]
 Identify if the properties of the item should be stored encrypted on the server.
 
virtual FQID FQID [get, set]
 The Fully Qualified ID of this Item.
 
virtual HasChildren HasChildren [get, set]
 Inform if this Item contains children. If the property is no, then no children should be available. If the property is yes, there will normally be children, but it is not a requirement. This property is used to improve the UI when displaying TreeView controls to avoid the (+) plus sing for expanding items, that does not have any children.
 
virtual HasRelated HasRelated [get, set]
 Inform if this Item contains children. If the property is no, then no children should be available. If the property is yes, there will normally be children, but it is not a requirement.
This property is used to improve the UI when displaying TreeView controls to avoid the (+) plus sing for expanding items, that does not have any children.
 
virtual Image Icon [get, set]
 Icon used for ViewAndLayout items in the Smart Client.
The Icon represent a given layout.
 
virtual Guid MapIconKey [get, set]
 Identified what Icon to display on the Map.
A value of Guid.Empty or this Items Kind will use the default MapIcon on the ItemNode.
Otherwise the value is the key into the MapIconDictionary on the ItemNode class.
Please note that MIP items on Map supports dynamic change but MIP Items on Smart Map do not.
 
virtual String Name [get, set]
 The Display Name of this Item.
 
virtual PositioningInformation PositioningInformation [get, set]
 Will retrieve the gis location and other positioning information for this Item.
 
virtual Dictionary< String, String > Properties [get]
 Returns a set of selected properties for the Item. Can also return null, if implementation has no relevant properties for this type of Item.
For built-in items, the available properties depends on the Kind of item, where it is accessed (e.g. Management Client/Application or Smart Client/Standalone).

A item containing a Camera, Recorder or a Server contains the most properties.

 

Detailed Description

This class is used as a base class of all objects and items, be it cameras, audio sources or plug-in developed objects. For simple Items that does not have any Children this base class itself can be used, often though you will need to implement a class that inherit from this Item and make overrides to GetChildren, HasChildren, GetParent and perhaps more methods.

An item is identified by a FQID.
Only very few fields and methods are defined on an Item.
The Name is the user defined name of the Item, usually entered by an administrator, in a few items the internal Id and Name are the same, e.g. Presets.

The Properties Dictionary contains a set of properties, and it is up to the implementer of a given Item to choose what fields to expose. If your plug-in does not have any relevant field, the Properties property can be empty. All keys and values are Strings. Keys are suggested to be letters only, first character in word to be capital, rest lowercase.
Multi-word keys should uppercase each start of a new word with no space or special character in between. Already abbreviated words may be kept in capital, e.g. "IPAddress".

If the Item knows that no children are present, the HasChildren property is set to HasChildren.No. If Item does not know yet how many children are present, the HasChildren should be set to HasChildren.Maybe, and during the GetChildren or GetChildrenAsync call it is allowed to return an empty list. The GetChildren and GetChildrenAsync returns a list of children Items.

Related property is used to provide a list of relevant related Items, e.g. a Camera can have a microphone and a speaker as related Items. An access control device can have a camera as a related Item.

Note: Presets for a camera are accessed as children to the camera Item (And not as related Items).

A plug-in defined Item is managed by the plug-ins own ItemManager.

When implementing your own plug-in defined Items based on this Item, please note that the MIP Environment functions for serializing and deserializing Items only handles the fields defined in this base class. If you select to save your configuration on a Milestone server, then ONLY store extra fields in the properties Dictionary, to ensure serialize and deserialize will contain all fields. New methods can then be implemented to ease access to the fields stored in the Dictionary.

Constructor & Destructor Documentation

◆ Item() [1/7]

VideoOS.Platform.Item.Item ( )
inline

Create a new Item. The FQID needs to be set afterwards.

◆ Item() [2/7]

VideoOS.Platform.Item.Item ( FQID fqid,
String name )
inline

Create a new Item including FQID and the items Name. Other properties can be set afterwards.

Parameters
fqid
name

◆ Item() [3/7]

VideoOS.Platform.Item.Item ( ServerId serverId,
String name )
inline

Create a new Item, a FQID containing the ServerId is created.
Important: You will need to fill the FQIDs parentId, ObjectId or ObjectString and Kind afterwards.

Parameters
serverId
name

◆ Item() [4/7]

VideoOS.Platform.Item.Item ( ServerId serverId,
String name,
FolderType folderType,
Guid kind )
inline

Create a new Item. A FQID is created from the provided fields. Important: You will need to fill the FQIDs ObjectId or ObjectIdString afterwards to have a valid FQID.

Parameters
serverId
name
folderType
kind

◆ Item() [5/7]

VideoOS.Platform.Item.Item ( ServerId serverId,
Guid parentId,
Guid objectId,
String name,
FolderType folderType,
Guid kind )
inline

Create a new Item. A FQID is created from the provided fields. No further fields needs to be filled to have a valid Item and FQID.

Parameters
serverId
parentId
objectId
name
folderType
kind

◆ Item() [6/7]

VideoOS.Platform.Item.Item ( ServerId serverId,
Guid parentId,
String objectIdString,
String name,
FolderType folderType,
Guid kind )
inline

Create a new Item. A FQID is created from the provided fields. No further fields needs to be filled to have a valid Item and FQID.

Parameters
serverId
parentId
objectIdString
name
folderType
kind

◆ Item() [7/7]

VideoOS.Platform.Item.Item ( MIPItem mipItem)
inline

Construct an Item from the MIPItem retrieved via the Configuration API.

Parameters
mipItem

Member Function Documentation

◆ Contains()

virtual bool VideoOS.Platform.Item.Contains ( String searchString)
inlinevirtual

Looks through all fields for a match.

But name and properties are searched.

Parameters
searchString
Returns
True if any string contains the searchString

◆ Deserialize()

static Item VideoOS.Platform.Item.Deserialize ( String serializedItem)
inlinestatic

De-serializes a string as generated by the Serialize method.
Note: UserContext and Authorization properties are not filled.

Parameters
serializedItem
Returns

◆ GetChildren()

virtual List< Item > VideoOS.Platform.Item.GetChildren ( )
inlinevirtual

Return a list of Children of this Item. Implementation not required.

Reimplemented in VideoOS.Platform.ConfigItem.

◆ GetChildrenAsync()

virtual void VideoOS.Platform.Item.GetChildrenAsync ( AsyncItemsHandler asyncItemsHandler,
Control control,
object callerReference )
inlinevirtual

Initiates a call to retrieve all Children for the item. The AsyncItemHandler will be called with the result.

Implementation not required. If not implemented, the default implementation will simply call the GetChildren() method and user the parameters to call be on directly. E.g. executed in the callers thread.

Parameters
asyncItemsHandlerThe Async Handler to retrieve the list of Children
controlThe Forms.Control to execute on.
callerReferenceAny object the called need to synchronize the call and the result.

◆ GetChildrenSorted()

virtual List< Item > VideoOS.Platform.Item.GetChildrenSorted ( )
inlinevirtual

Same as GetChildren, just sorted by name.

Returns

◆ GetDataSource()

virtual DataSource VideoOS.Platform.Item.GetDataSource ( )
inlinevirtual

Get the DataSource relevant for this Item type.
If no DataSource is available for this Item, a null value is returned.

This can for instance be used for retrieving Sequence information for a Camera Item.

Returns
The default DataSource for the item, or null is none supported

◆ GetParent()

virtual Item VideoOS.Platform.Item.GetParent ( )
inlinevirtual

Get the parent Item to this Item This implementation will build the FQID from the current ServerId and set objectId = ParentId, and assume other fields are the same (FolderType, Kind). If not found it will try with Kind = Kind.Server.

Returns
Item of the parent, if it could be found

◆ GetRelated()

virtual List< Item > VideoOS.Platform.Item.GetRelated ( )
inlinevirtual

Return a list of Related Items for this Item.
Could e.g. be Audio devices to a Camera.

◆ GetRelatedAsync()

virtual void VideoOS.Platform.Item.GetRelatedAsync ( AsyncItemsHandler asyncItemsHandler,
Control control,
object callerReference )
inlinevirtual

Initiates a call to retrieve all Related items for the item.
The AsyncItemHandler will be called with the result.

Parameters
asyncItemsHandlerThe Async Handler to retrieve the list of related items
controlThe Forms.Control to execute on.
callerReferenceAny object the called need to synchronize the call and the result.

◆ IconWithOverlay() [1/2]

virtual Image VideoOS.Platform.Item.IconWithOverlay ( )
inlinevirtual

Take item's icon (if available) and place a 'disable' red cross over - if item is disabled.

If item does not have an icon, the default icon is taken from the ItemNode definition.

Returns

◆ IconWithOverlay() [2/2]

virtual Image VideoOS.Platform.Item.IconWithOverlay ( bool attention,
bool active )
inlinevirtual

Construct an icon with overlay.

The priority is to place an overlay - checked in this order:
1 - Disabled
2 - Attention required
3 - Active

Parameters
attention
active
Returns

◆ Serialize() [1/2]

String VideoOS.Platform.Item.Serialize ( )
inline

Serialize the content of the Item, that is independent of Environment and User.
Note: Overloaded properties, UserContext and Authentication will not be saved.

Returns

◆ Serialize() [2/2]

void VideoOS.Platform.Item.Serialize ( XmlWriter xmlWriter)
inline

Serialize the content of the Item, that is independent of Environment and User.
Note: Overloaded properties, UserContext and Authentication will not be saved.

◆ SetChildren()

virtual void VideoOS.Platform.Item.SetChildren ( List< Item > children)
inlinevirtual

This method can be used when the base Item class is used, and it contains children. This method will NOT add the children to any servers or configuration, but is merely to simplify instantiation. The children set in this method could be retrieved by the GetChildren method. You should only use this way of implementing an Item, if the number of children is limited.

Parameters
children

◆ ToString()

override String VideoOS.Platform.Item.ToString ( )
inline

Returns the name of the item. Can be used for adding the Item directly on ListBox's and other user controls.

Returns

Member Data Documentation

◆ _anyChildren

HasChildren VideoOS.Platform.Item._anyChildren = HasChildren.Maybe
protected

◆ _children

List<Item> VideoOS.Platform.Item._children = new List<Item>()
protected

◆ _hasRelated

HasRelated VideoOS.Platform.Item._hasRelated = HasRelated.Maybe
protected

◆ _related

List<Item> VideoOS.Platform.Item._related = new List<Item>()
protected

Property Documentation

◆ Authorization

virtual Dictionary<String, String> VideoOS.Platform.Item.Authorization
get

Returns a set of strings identifying what the current user is authorized to do.

Implementation is not required.

From MIP v2.0 this Dictionary will be filled by the authorized options allowed for the current user, when the item is one of the built-in items, e.g. a Camera. Value will always be either "Yes" or "No" depending on whether current user is allowed to do the given operation on the item.

Following keys are available for a camera item:
BookmarkAdd
BookmarkDelete
BookmarkEdit
BookmarkView
Event
ExportAvi
ExportJpeg
ExportDatabase
GetSequences
Live
Output
Playback
Preset
PTZ
RetentionCreate
RetentionRemove
RetentionView
RetrieveEdgeRecordings
SmartSearch
StartRecording

When the Dictionary is not filled out, it is unknown what the configured authorization is.

◆ ContextMenu

virtual Collection<MapAlarmContextMenu> VideoOS.Platform.Item.ContextMenu
getset

Defines a list of ContextMenu items relevant for this item. It is displayed when a user right click on a Map containing this item.

◆ Enabled

virtual bool VideoOS.Platform.Item.Enabled
getset

Interpret the properties dictionary for "Enabled" and "Disabled" keys. If no entry is found, default is enabled. Otherwise values of "Yes"/"No" and "True" / "False" are checked for each.

When setting this property, the "Enabled" entries in the Properties dictionary is updated with "Yes" / "No"

◆ Encrypt

virtual bool VideoOS.Platform.Item.Encrypt
getset

Identify if the properties of the item should be stored encrypted on the server.

Interprets __Encrypt property from properties dictionary. Value is true if property is set to "True". Value is false if property is set to "False" or property is not present in the dictionary.

Note: Supported from VMS version 2020 R3.

◆ FQID

virtual FQID VideoOS.Platform.Item.FQID
getset

The Fully Qualified ID of this Item.

◆ HasChildren

virtual HasChildren VideoOS.Platform.Item.HasChildren
getset

Inform if this Item contains children. If the property is no, then no children should be available. If the property is yes, there will normally be children, but it is not a requirement. This property is used to improve the UI when displaying TreeView controls to avoid the (+) plus sing for expanding items, that does not have any children.

◆ HasRelated

virtual HasRelated VideoOS.Platform.Item.HasRelated
getset

Inform if this Item contains children. If the property is no, then no children should be available. If the property is yes, there will normally be children, but it is not a requirement.
This property is used to improve the UI when displaying TreeView controls to avoid the (+) plus sing for expanding items, that does not have any children.

◆ Icon

virtual Image VideoOS.Platform.Item.Icon
getset

Icon used for ViewAndLayout items in the Smart Client.
The Icon represent a given layout.

◆ MapIconKey

virtual Guid VideoOS.Platform.Item.MapIconKey
getset

Identified what Icon to display on the Map.
A value of Guid.Empty or this Items Kind will use the default MapIcon on the ItemNode.
Otherwise the value is the key into the MapIconDictionary on the ItemNode class.
Please note that MIP items on Map supports dynamic change but MIP Items on Smart Map do not.

◆ Name

virtual String VideoOS.Platform.Item.Name
getset

The Display Name of this Item.

◆ PositioningInformation

virtual PositioningInformation VideoOS.Platform.Item.PositioningInformation
getset

Will retrieve the gis location and other positioning information for this Item.

If Item does not have any defined position, null is returned.

Setting part is for future use.

Note: Supported for Camera items from 2018 R1

◆ Properties

virtual Dictionary<String, String> VideoOS.Platform.Item.Properties
get

Returns a set of selected properties for the Item. Can also return null, if implementation has no relevant properties for this type of Item.
For built-in items, the available properties depends on the Kind of item, where it is accessed (e.g. Management Client/Application or Smart Client/Standalone).

A item containing a Camera, Recorder or a Server contains the most properties.

Sample: A camera item retrieved in a standalone application, could be: PTZ : Yes
PTZCenter = No
PTZRectangle = Yes
PTZHome = Yes
pan = Absolute
tilt = Absolute
zoom = Absolute

In the Management Client / Application the following can be used:
Enabled = Yes (or No)


A camera accessed from within the management client/application will also contain information about storage, path to disk and more.

To get a full set of properties, please run the configuration dump sample, or check the ItemProperties class.

For configuration for integration defined Items, be aware that the term "FQID" is reserved and must not be used as the name of a property nor as the beginning of a name of a property in the dictionary.