Is there a way to edit camera properties through the SDK (GPS coordinates, etc.)

I’m trying to find a way to update camera properties (namely GPS coordinates) through the Milestone SDK, but I can’t seem to find any.

I already have the camera objects and I can edit them, but I can’t make the changes to commit. But I have them as Item objects and not Camera objects.

I’ve explored Messaging, ConfigurationAPI, Item/ConfigurationItems but I can’t find anything helpful.

Can you please see these links? Introduction to metadata in Milestone products -

https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/intro_metadata.html&tree=tree_search.html?search=gps

Also GPS Metadata Provider sample might be helpful for you -

https://doc.developer.milestonesys.com/html/index.html?base=samples/gpsmetadataprovider.html&tree=tree_search.html?search=gps

Hello,

Thank you for your answer. After reading the links you sent I struggle to see how can I use this for my issue.

To be more clear on what I need to do.

On the Management Client → Devices → Cameras you can find this:

What I want is to be able to set through the SDK, but I wasn’t able to, for now.

This is what I’ve tried but it doesn’t work.

//This gets the Cameras
List<Item> oItems = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined);
List<Item> cameraItems = GetCameras(oItems[0]);
 
//I tried converting from Item to Camera, so I could use the Save().
Camera test = new Camera(cameraItems[0].FQID);
test.SetProperty("GisPoint", "POINT(88 33)");
test.Save();

But, after I get the Cameras again, the location remains the old one and not the updated version.

Hello again,

Can you please explore Config API Client sample?

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

Please change Device Position and save it in the sample and see the change in the Management Client (please refresh it with F5).

When I update the GisPoint property in the same way as your example, it works fine on my end and I can see the updated coordinates after refreshing the Management Client.

Does the Config API Client sample allow you to successfully change the value?

Not sure if you need to do this in C# or not, but if a PowerShell-based approach would work for you, you might be interested in this sample/demo:

https://github.com/MilestoneSystemsInc/PowerShellSamples/tree/master/Samples/Import-GPS-Coordinates

But since you appear to be changing the property the right way and it is not being updated for you in Management Client, it might be that neither the Config API Client sample or PowerShell work for you either. Let us know.

Oh wow, I can’t believe this happened.

You are right, the code I posted actually works.

I made a silly mistake verifying .

 List<Item> oItems2 = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined);
List<Item> cameraItems2 = GetCameras(oItems[0]); <--- OLD LIST :(

I was getting the items from the old item list instead the new one (oItems instead should be oItems2)… I’m can’t believe I had this for so long and didn’t notice…

Well, happens I guess. Thank you very much for all your answers

I noticed the changes don’t go through immediately , how do I refresh the Management Client so the changes are made in the same session? Right now I have to close and open the Client for the changes to update.

What’s the command to use so this refresh is made on the instant?

Try to see if RefreshConfiguration can help you..

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=refresh

Hi Bo,

I had try that already to no avail.

...
camera.Save();
 
//Tried both separately.
Configuration.Instance.RefreshConfiguration(Kind.Camera);
Configuration.Instance.RefreshConfiguration(cameraItems[0].FQID.ServerId, Kind.Camera);
 
List<Item> oItems2 = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined);
List<Item> cameraItems2 = GetCameras(oItems2[0]);

This is what I tried but it still retrieves the old camera Positioning.

It turns out that my advise was not good. The RefreshConfiguration is only working for MIP items, not for the camera items or other regular built-in items.

Currently the only way to refresh this is for the user to do a refresh (Action → Refresh or press F5). The refresh is total and the Management Client takes time doing this while re-displaying the full UI. You cannot initiate this full refresh from code.

To be able to do this refresh from code is on the wish-list for future development but it has not been prioritized yet.