Hi,
i want to change the stream bitrate programmatically, i used this piece of code :
Camera camera = hardware.CameraFolder.Cameras.First();
camera.DeviceDriverSettingsFolder.DeviceDriverSettings.First().StreamChildItems.First().SetProperty("Bitrate", "3072");
camera.DeviceDriverSettingsFolder.DeviceDriverSettings.First().Save();
camera.DeviceDriverSettingsFolder.Save();
camera.Save();
But when i go to the Management to view the setting, nothing is changed.
I installed the follow Device Package on Milestone XCO 2018 R3:
Standard 9.9.2.146
Legacy 1.1.2.170
Thanks in advange
First a quick check.. The Management Client will newer reflect anything new unless you use the refresh button (or F5). Did you do this?
Yes we do the refresh. As further information I can tell you that the camera is a sony snc-ch210. Also when we do this action from “ConfigApiClient”, it is successful.
You use the wrong key. This code works for me (did a minimal modification of your code)..
ManagementServer ms = new ManagementServer(EnvironmentManager.Instance.MasterSite.ServerId);
var hardware = ms.RecordingServerFolder.RecordingServers.FirstOrDefault().HardwareFolder.Hardwares.FirstOrDefault(x => x.Name.Contains("TestHardwareName"));
Camera camera = hardware.CameraFolder.Cameras.First();
var deviceDriverSet = camera.DeviceDriverSettingsFolder.DeviceDriverSettings.FirstOrDefault();
var prop = deviceDriverSet.StreamChildItems.First();
var key = prop.GetPropertyKeys().FirstOrDefault(x => x.Contains("Bitrate"));
prop.SetProperty(key, "3072");
deviceDriverSet.Save();
Thanks for your reply, it works.
Now I have another problem, I have to build a windows form to set all properties, if I iterate prop.GetPropertyKeys(), the kyes are something like “stream:0.0.0/Resolution/2b25c3c5-35ba-4ec1-a748-f225732161ed” and
Collections deviceDriverSet.StreamChildItems.Properties.Keys and deviceDriverSet.StreamChildItems.Properties.KeysFullName have the same elements.
There is a method that do lookup from the key “stream:0.0.0/Resolution/2b25c3c5-35ba-4ec1-a748-f225732161ed” to “Resolution” String?
For example in DeviceDriverSettingsChildItem.Properties the Keys attribute contains string elements like “Contrast” and KeysFullName contains string elements like “device:0.0/Contrast/597dd4e9-7ad8-4b24-960d-d64b0b08a3a5”