How to get both master and federation server?

How to login into management server without using DialogLoginForm to retrieve both two Master server and federated server.

using “VideoOS.Platform.SDK.Environment.Login” to login into XPCO2017R3 management server with federated XPCO2014 server, only XPCO2017R3 can be retrieved.

Please see the Multi-site Viewer sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/multisiteviewer.html&tree=tree_2.html

Thank you Bo Andersen

With the sample of Multi-Site Viewer, both Master Site and Sub Site can be retrieved, but still don’t know how to get the camera list of these two sites because the sample is using ItemPickerForm without source. Would you please advise the methods to get camera list. Thank you very much.

Hi Bo Anderson,

Now we can able to get both master and federated servers. But Multi-site Viewer sample uses ItemPickerForm to get the cameras from both the servers.

ItemPickerForm form = new ItemPickerForm();

form.KindFilter = Kind.Camera;

form.AutoAccept = true;

form.Init(Configuration.Instance.GetItems(ItemHierarchy.SystemDefined));

Could you please provide some sample source code to get cameras from both master and federated servers without using ItemPickerForm.

You have given the answer even if you might not realize.

var myConfiguration = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined);

Here it is important that the “configuration” you get is not a simple list but rather a tree structure containing the elements of the configuration. On some items you then use GetChildren() to reach the next level in the tree. To see the configuration illustrated as a tree try the ConfigAccessViaSDK sample. The CameraStreamResolution sample has a method to find a camera by using the configuration in a recursive way.

See also - https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_configuration.html&tree=tree_search.html?search=getitems

To illustrate this further I have made a snippet of code that creates a plain list of the camera items.

List<Item> cameraList = PlainList(Configuration.Instance.GetItems(ItemHierarchy.SystemDefined), Kind.Camera);
 
static public List<Item> PlainList(List<Item> xpList, Guid kind)
{
    List<Item> tempList = new List<Item>();
    //foreach (Item item in xpList)
    {
        FindItems(xpList, kind, tempList);
    }
    return tempList;
}
 
static private void FindItems(List<Item> items, Guid kind, List<Item> list)
{
    if (items != null && items.Count > 0)
    {
        foreach (Item item in items)
        {
            if (item.FQID.Kind == kind)
            {
                if (item.FQID.FolderType == FolderType.No)
                {
                    list.Add(item);
                }
            }
            if (item.HasChildren != HasChildren.No)
                FindItems(item.GetChildren(), kind, list);
        }
    }
}

Hi Bo Andersen,

All cameras from both Master site and it’s subsite can be retrieved now after added AddUriToCache method. Thanks you very much.