Hello everyone,
I would like to ask if is possible to add PTZ for camera from plugin? I have example “PTZandPresets” via this everything works correctly but unfortunetly when a make same solution in plugin it does not work. Can you help me? Example, advice ect.
I need only button_selectCamera, textBox_NamePTZ, button_AddPTZ.
I use Visual Studio 2017, MIPSDK_Installer_2017R2 and XProtect Smart Client 2017 R2 (64-bit)
Thank you.
In the PTZandPresets sample the functionailty to add PTZ Presets is shown but the method used works only for XProtect Enterprise, Professional and Express (E-code).
If using XProtect Corporate, Expert or one of the Plus products (C-code) this will not work, but in these products you can use the Configuration API.
Try to run the Config API Client sample and see how you can create PTZ Presets using it.
Hello,
thank you for your answer. It means: PTZ preposition is not possible add from plugin only from “Form application”. Because both example are “Form application”. It is correct?
No, fortunately it is not correct. The exact same methods can be used in a plugin.
We have a sample showing this on Configuration API:
If you look at the Smart Client AddUser sample the sample does something different than you are trying to do but it does use the Configuration API.
So if you have developed a routine capable of creating and managing PTZ Presets using Configuration API you can also implement the routine in a plugin.
Note.
The upcoming MIP SDK 2017R3 there is new functionality..
Configuration API
- Strongly typed classes are now available for easier use of the Configuration API. Under the namespace VideoOS.Platform.ConfigurationItems (located in VideoOS.Platform.dll) any standalone application or MIP plugin can now access all the configuration items through these approximately 75 classes.
Hello,
I tried to figure out the problem but without success. Can you show me short code or where exactly is function in the examples to add PTZ? Thank you.
The Config API Client sample does show this. There is no sample showing this using the new strongly typed classes.
Sorry,
can you write or make picture for me where exactly in API Client sample it is - class, row etc.
As the Config API Client sample does not use strongly typed classes I cannot do this. Perhaps you should explore the strongly typed classes. I suggest you do. Try to do the following in your code, make a breakpoint and explore the camera object.
VideoOS.Platform.ConfigurationItems.Camera camera = new VideoOS.Platform.ConfigurationItems.Camera(fqidCamera);
If working with these classes MIP SDK 2017R3 is required, make sure you upgrade if you haven’t already.
Hello,
Version MIP SDK 2017 R3 is already release. Can you give me advice how to do it? You mentioned that will be more easier in “Configuration API”.
using VideoOS.Platform.ConfigurationItems;
Camera camera = new Camera(_camera.FQID);
PtzPresetFolder folder = camera.PtzPresetFolder;
folder.AddPtzPreset(textBoxPresetName.Text, "", pan, tilt, zoom);
The above code was what I was trying to link you to in the other forum thread..
I realize you never did tell what product your XProtect VMS is. If it is XProtect Corporate, Expert or a Plus product my assumption is right and you need to use the Config API.
See - https://developer.milestonesys.com/s/question/0D50O00003gvDpLSAU/ptzandpresets-sample-enhancement
Hello,
Thank you for advice. The code above works fine for me. But I’am little bit confused: when I added PTZ to camera, I saw immediately in database dbo.Device - camera column “Presets”. But when I used function _camera.GetChildren().Capacity still I had minus one PTZ. I had to switch off and switch on XProtect Smart Client 2017 R3 (64-bit) and after that operation I can used new PTZ - sent message to camera “Go to PTZ” and camera start to rotary,zoom ect. Without restart Smart Client new PTZ doesn’t work.
Second question: when I want to remove PTZ. I used code:
Camera camera = new Camera(_camera.FQID);
PtzPresetFolder folder = camera.PtzPresetFolder;
folder.RemovePtzPreset("NameNewPTZ");
but it doesn’t work. I tried as input parametr for function FQID new PTZ but same problem - exeption. What is correct parametr “itemSelection”? 
When you change configuration and add a camera or as in your case a PTZ preset you have the issue that the Smart Client always runs on a cached configuration. A newly add camera or preset does not show unless you either logout and login or do a refresh configuration.
My guess is that your preset gets added correctly.
The correct use of RemovePtzPreset is
Camera camera = new Camera(_camera.FQID);
PtzPresetFolder folder = camera.PtzPresetFolder;
PtzPreset ptzPreset = folder.PtzPresets.Where(x => x.Name == "Name").FirstOrDefault();
if (ptzPreset != null)
{
folder.RemovePtzPreset(ptzPreset.Path);
}
Use the message -
ReloadConfigurationCommand = “SmartClient.ReloadConfigurationCommand” This message will reload the entire configuration from all sites and all views from the server. This message takes time, please use with care.
Hello,
Thank you for example - works well for me. Add PTZ is not everyday routine, we will restart Smart Client. Thank you.