A Background Plugin created with MIP SDK 2014 is not working with SmartClient version 2017 R3. The plugin creates a layout for one or more cameras on the fly and then uses the ViewAndLayoutItem.InsertBuiltinViewItem to insert the camera(s). The layout is created, but the camera is not added. Am I required to upgrade the SDK used to match the SmartClient version?
A plugin working on Smart Client 2014 should work on Smart Client 2017R3.
A first troubleshooting should be on whether it because of a camera, view or other item is having another name, and this leads to the plugin not working.
You can try to debug.
https://developer.milestonesys.com/s/article/debugging-techniques-for-Smart-Client-plugins
You can re-build your plugin using a newer MIP SDK, it might work better even if it should not be needed.
Thank you, Bo.
I won’t be able to debug the code since this is running on a production environment, but I added enough log entries to give me an idea of what may be happening.
I’m waiting on the client to grant me access to their machine so that I can run the test plugin.
In the meantime, I’m wondering if the camera names I have in my database do not match the names configured in Milestone.
Does the user logged in to the SmartClient needs special permission for the plugin be able to obtain the complete list of configured cameras?
My plugin calls the Configuration.Instance.GetItems to get a complete list of camera names.
Thank you,
[cid:image001.jpg@01D475E0.E05EA490]
Mauricio Wanderley
Development Manager
mauricio.wanderley@centralsquare.commailto:[first.last@company.com](mailto:first.last@company.com)\
o: 407-304-3492
A user will belong to a role and a role will have assigned privileges, the user will be able to see the cameras where the privileges have been given to the role.
So the list of cameras the user will get is not always the complete list of all cameras in the system, but the list of cameras for the role.
It is important to note that if the camera can be viewed by the user (role) the camera will also be on the list when you using the SDK asks for the list of cameras.
It might be a good idea to use the Smart Client as reference. If a camera works and can be seen by the user in Smart Client, then the same camera should work for the user in a MIP SDK based application.
Since I could not attache and debug the plugin (it’s running on a production environmnent), I added log entries to my plugin to understand what was going on. I identified that my internal camera-name/fqid dictionary I was populating ran into issues when I got 2 different cameras with the same name. I got that taken care and my plugin got a bit further, but I’m still having issues that so far my logs have not been able to help. My plugin creates layouts on the fly and loads them with cameras on demand.
I create a new Temporary View Group on top level in the Tree structure and add two folders:
var myRootItem = (ConfigItem)ClientControl.Instance.CreateTemporaryGroupItem(MIPPluginConst.RootName);
var myItem = (ConfigItem)rootItem.AddChild(MIPPluginConst.MyItemName, Kind.View, FolderType.UserDefined);
myRootItem.PropertiesModified();
Later on demand from my app, we send a request to create a layout to view one or more cameras. My code snippet:
// Create New LayoutItem.
myLayout = (ViewAndLayoutItem)myItem.AddChild(layoutName, Kind.View, FolderType.No);
myLayout.Layout = BuildRectangle(CameraList.Count);
myLayout.Icon = Properties.Resources.CAD;
LoadCameras(myLayout, CamerasList);
ClientControl.Instance.CallOnUiThread(() =>
{
myLayout.Save();
rootItem.PropertiesModified();
});
And then I select the newly created viewlayout:
var windows = Configuration.Instance.GetItemsByKind(Kind.Window);
var mainWindowFQID = new FQID(new ServerId(“SC”, “”, 0, Guid.Empty));
if (windows.Count > 0)
{
mainWindowFQID = windows[0].FQID;
}
EnvironmentManager.Instance.PostMessage(new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.MultiWindowCommand,
new MultiWindowCommandData()
{
MultiWindowCommand = MultiWindowCommand.SetViewInWindow,
View = myLayout.FQID,
Window = mainWindowFQID
}));
The layout is being created and selected, but the tree structure is not alsways creating an item for my layout. I also noticed an error reported saying “Failed to save data for the view MyRootItem. View group is read only.”. But it appears if I create another layout, some times the first one appears in the tree. I’m trying to see how I can make sure my root item is not read only, but I can’t see it.
FYI, I have not updated my SDK. The plugin is currently using SDK 2014. And I;m running SmartClient 2014 with a XProtect Server v 2018.
The SDK and the Smart Client is the same version, only the Xprotect server behind was changed?
Does it make a difference if you test ths using a user that is member of the administrators role (to rule out permissions)?
I failed in undertanding how to make a plugin of my own with your functionality for testing. Might you be able to share the source code project? (Maybe on a Support case if you do not want to share it on this public forum.)