Messaging Protocol and Smart Client - Not recieving EndPoint

Attempting to send messages to an active Smart Client, however, not receiving an EndPoint in the WhoAreOnlineResponse for the client, or any EndPoint notifications when the smart client starts/connects/logs in or disconnects.

Any thoughts on how to get the EndPoints of active Smart Clients?

One thought:

I see a note in the SDK documentation that SecurityLevel defaults to Normal in Smart Client, and thus will ignore anything ended with “Command”, but I can’t find a setting on how to change the Smart Client setting to “Low” (the default of all external apps).

If that setting is changed, it may respond to the WhoAreOnline.

Thanks.

If you use the Chat sample does it work for you?

If the Chat Sample works, you might find help there.

I have tried looking at the Chat sample, though the principle difficulty is I am trying to have an external application, not a plug-in. I will look though if having the chat sample active changes anything to the external app.

As an update, the Chat sample, when put in, would cause the Smart Client to be seen in the WhoAreOnlineResponse. Why it is not “online” until that point seems strange.

The end-idea of this is to send the SetCameraInViewCommand message, however, unless the Smart Client actually reports online, we don’t have a destination known to send to?

Are there any thoughts on how to accomplish this asides from having to install “chat” in each machine just to get it to respond as online? Or other methods to accomplish this?

Thanks.

It is by design that you (your plugin) must report as “online”, this can be done also from standalone applications. I suggest you develop your plug-in for your customers/installations rather than use the Chat sample.

Ok, presuming we put in a plug-in to “enable” the online reporting, this doesn’t seem to allow the SetCameraInViewCommand to be accepted.

I have tried looking at the various samples, however, the only ones to use that command seem to be plug-in samples using EnvironmentManager.PostMessage, sending to the local Smart Client internally. No samples using MessageCommunication.TransmitMessage seem to actually send messages TO Smart Client.

I have tried using TransmitMessage with the discovered FQID of the Smart Client, however, it does not respond. I also tried PostMessage with a destination FQID, with a similar lack of response.

So I am puzzled as to how one would send the SetCameraInViewCommand from an EXTERNAL app (not a plug-in), to the Smart Client and have it process it.

I have enabled all the logging I can find in the Smart Client, but it does not record any messages being received. I don’t know if that means my messages are not being received, or are being ignored, or are incorrectly formatted and thus failing to process the command. Is there any logging I can enable to see if the Smart Client is even receiving the message?

Similarly, are their any examples of using TransmitMessage to send messages to a specific Smart Client that do NOT simply pass NULL for the destination and endpoint parameters? (ie actually direct the message?)

It should be noted that the end environment will have about 10 Smart Clients running, and they have to be individually commanded (ie we can’t have each command affecting all of them at the same time).

Thanks.

It could be just a security setting that is hindering this from working.

--

Introduction to MIP Message Communication

Security Setting

The MessageCommunicationManager has a Security field containing the level of security the MIP Environment is in. The default setting is SecurityLevel.Normal.

The following security levels are defined:High – Ignore all incoming messagesNormal – ignore incoming messages that ends with “Command”Low – accept all incoming messages

Regardless of the SecurityLevel it is always possible to transmit messages.

Notice that for Smart Client MIP Environment, setting this to SecurityLevel.Low will allow remote applications to control the Smart Client.

I had noticed and thought of that, so I modified the Chat sample to set Security to SecurityLevel.Low (I tried both before and after MessageCommunicationManager.Start. No effect.

My suspicion is either my target FQID is wrong in some way, or the Smart Client simply isn’t listening (filter-enabled) for the messages. Presently I am having difficulty determining which it would be.

Perhaps to help, I will post the relevant code snippets:

MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);

_messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

filter_who=_messageCommunication.RegisterCommunicationFilter(WhoHandler,new CommunicationIdFilter(MessageCommunication.WhoAreOnlineResponse));

Console.WriteLine(“Sending: WhoAreOnlineRequest [ConnectionStateChanged]”);

_messageCommunication.TransmitMessage(

new VideoOS.Platform.Messaging.Message(MessageCommunication.WhoAreOnlineRequest), null, null,

null);

//WhoHandler---------

Collection result = message.Data as Collection;

if (result==null)

return(null);

foreach(EndPointIdentityData ep in result) {

if (ep.EndPointFQID.ServerId.ServerHostname==“viewer-name”)

viewer=ep.EndPointFQID;

}

//Get Cameras

cam_servs=VideoOS.Platform.Configuration.Instance.GetItemsByKind(Kind.Camera,ItemHierarchy.SystemDefined);

(note: the following is recursive searching down the tree for cameras)

foreach(Item itm in c_list) {

if (itm.FQID.Kind==Kind.Camera)

cam_list.Add(itm.FQID);

//Switching routine

p_data=new SetCameraInViewCommandData();

p_data.CameraFQID=cam_list[1]; //0 is the group in this demo test

p_data.Index=0;

p_data.StreamId=Guid.Empty;

//EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data),viewer);

_messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), viewer, viewer,null);

In the above switching routine, I also tried PostMessage (presently commented out), and also varied either of the “viewer” parameters with null.

Hopefully this will help someone point out where I have made a wrong turn.

_messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), viewer, viewer,null);

will within the Smart Client become a SendMessage and the destination would then be the Windows ID, this you do not have, try with null instead and then it should be the main window that updates

_messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), viewer, null,null);

Please note I have not made the experiment to see if i am right, I hope I am. Let me know.

To date, I have tried:

messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), viewer, viewer,null);

messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), viewer, null,null);

messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), null, viewer,null);

and

messageCommunication.TransmitMessage(

new Message(MessageId.SmartClient.SetCameraInViewCommand,p_data), null, null,null);

I didn’t really expect the last one to work, I was just being thorough. None of the variants made a difference.

There seems to be some ambiguity if the SDK is sending the message directly to the Smart Client, or sending it to the Event Server to send to the Smart Client (this being the supposed difference between the 2nd and 3rd parameters). The reading suggests the later, but the distinction between those two parameters isn’t clear.

Perhaps the Windows ID can not be null. Is there a way to obtain the Windows ID that the Smart Client main window is using from an external app?

I have been experimenting and I think I see the same. I will consult with Milestone Development.

For now allow me to outline a workaround. You can send your own messages to your plugin and then internally in the Smart Client use SendMessage-

EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.SetCameraInViewCommand, p_data), null, null);

These messages will not get through and execute. You will have to use the workaround method and implement a plugin that uses the internal SendMessage.

Bo,

While that is an inconvenient answer, I do understand it and will work towards that method.

Thank you for researching and finding that out.