Hi,
I have a camera with a custom PTZ mode i’d like to add support for, how do i send custom messages to the camera via MIPs Plugin?
I’ve currently got the following code:
PTZRectangleCommandData data = new PTZRectangleCommandData();
data.Left = absolutePosXStart;
data.Right = absolutePosXCur;
data.Top = absolutePosYStart;
data.Bottom = absolutePosYCur;
data.RefHeight = (absolutePosYCur - absolutePosYStart);
data.RefWidth = (absolutePosXCur - absolutePosXStart);
EnvironmentManager.Instance.SendMessage(
new VideoOS.Platform.Messaging.Message(MessageId.Control.PTZRectangleCommand, data), _selectedCameraItem.FQID);
How do i send this same information to a camera that milestone does not recognize as PTZ capable or in otherwords how would I send a custom message to the camera?
Regards,
Amir E
Software Engineer
SecureCitySolutions Ltd.
The camera driver in Milestone XProtect does unfortunately not support sending custom commands to the camera.
Your plug-in will have to communicate directly with the camera to send commands to it.
In XProtct Corporate and Expert you can use the Configuration API to get the hostname and the like of the camera. In other XProtect VMS your plug-in itself will need to know hostname/address etc. in order to communicate with the camera directly.
Hi,
How do i get the camera information programmatically from Smart Client Plugin side?
Also can you clarify why this post claims it can’t be done? I noticed myself that when i try to get camera hostname i get the server’s IP and port instead.
https://developer.milestonesys.com/s/question/0D50O00003EIsBXSA1/get-url-with-video-feed-from-milestone-camera
Try to explore the Config Dump tool plugin sample. This will work for every XProtect but will not give you sufficient information to be able to communicate with the camera directly.
If using XProtect Corporate or Expert try to explore the Config API Client sample, here you will see how you can get the rest of the data needed.
I think the post you refer to is answering another question: If you can get a camera stream from the VMS by using a simple URL.
I’ve taken a look at the Config API Client sample, however, the sample as is does not work for me.. It says it cannot find the correct endpoint,
http://localhost:81/ is where i usually connect via Xprotect client, and this works for ConfigAccessViaSDK sample, but not ConfigAPIClient sample. I tried looking at the ConfigAccessViaSDK sample but it again only shows the server’s ip address and port, not the cameras.
Here is what i see on ConfigAccessViaSDK sample
Here is what i see when i attempt to use ConfigApiClient
My Version of Milestone is 2016 R2 Enterprise.
Configuration API is unfortunately only supported on XProtect Corporate and Expert - not on XProtect Enterprise.
For security reasons each environment only has access to the information needed to perform the functionality supported in that environment. The XProtect Smart Client never connects directly to the cameras - it only connects to the Milestone servers which then provides the necessary data - so therefore the IP, port, password, etc is not available in the Smart Client. Same goes for external applications such as the ConfigAccessViaSDK sample.
IP, port, user name and password are available in the management applications, but you will have to do something yourself if the information should be made available to plugins running in other environments.
That’s unfortunate, is there anyway i can programmatically set the camera as ptz rectangle capable?
Under onvif, is there something i can send that would tell milestone that the camera supports ptz rectangle?
No sorry - the current ONVIF driver does not support rectangle PTZ (or area zoom as we call it), so there is no way you can get the VMS to expose the functionality for ONVIF cameras.
Is there a way i can send a relative move command then other than PTZCenter?
I could feasibly translate the bounding box to a series of relative move if your onvif supports it.
For PTZ Center, also, how do you determine the range of x y pan tilt values? In my testing it seems to vary between -1 and over 1600, what is the scale used for this?
For relative move you can use the PtzMoveCommand message. Its data part is a PTZMoveCommandData and allows you to to stepwise movement in any direction. I am, however, not sure how you can utilize this to achieve what you want since you cannot control how far each step goes.
Alternatively you can use the PTZMoveAbsoluteCommand message if the camera supports it. This will allow you to go to specific coordinates, so it will require that you are able yourself to do the calculations from relative to absolute coordinates.
Finally the PTZCenterCommandData message will allow you to go a specific position with the current picture. As the documentation also states the parameters in the data part are all except zoom in pixels, so the range will vary depending on the size of the view item. Zoom is always from 0-1 (1=fully zoomed in).
I understand the parameters are in pixels, I’m asking about the x y values that milestone itself calculates after you set the parameters, are those in pixels as well?
Also is it possible to write a server-sided plugin that will provide my client sided plugin with the camera information? Do you have any documentation on writing server-side plugins?
I am not sure I understand your first question. How the various SDK functionality is implemented internally in the software is hardly a topic for this forum. Please let me know for what purpose you need this information.
You cannot write a server-side plug-in for providing the information, since the only supported server-side plugin is in the Event Server and it does not have access to the information you need (for same reasons as described above).
You will need to write a Management Application plug-in. Have a look at the configuration dump plug-in to see how it accesses the information and then have a look at one of the other management plug-ins (e.g. the server-side carousel) for examples on how to store it in the MIP configuration, and afterwards accessed from the Smart Client plug-in.