Applications often need a way to send a message to end users. The typical approach is to store information somewhere where each station monitors this location. While this “pull” method is useful for offline systems, a “push” method is far better when online systems need an immediate notification. The SRP DirectConnect Control makes this a reality for OpenInsight applications.

As of version 4.0 of the SRP ActiveX Controls, you can also use the SRP DirectConnect Control to asynchronously make calls to the SRP Engine Server. You send requests and receive the responses via events, ensuring that OI is not locked down waiting for the results.

Prog IDSRP.DirectConnect.1

 

Properties

OLE control properties are the primary means of interacting with OLE controls. Properties, much like OI control properties, describe the persistent attributes of the control, that is, attributes having some meaningful value for the entire life of the control. The following properties apply to the SRP DirectConnect Control:

PropertyDescriptionVersion Introduced
EngineServerThe format is IP:@FM:Port:@FM:KeepAliveTime. Use this to set the IP and Port number the SRP Engine Server is listening on (default port is 7777). The KeepAliveTime is how often DirectConnect checks in with the SRP Engine Server. The default is 400. Set this to 0 to turn it off. If you are concerned about network traffic, set this to 0. It shouldn't cause disconnects, and you can always change it back if you feel the need.4.0
EngineServerValid(Read Only) Use this to test that you are currently connected to the SRP Engine Server.4.0
ServerThe format is IP:@FM:Port:@FM:KeepAliveTime. Use this to set the IP and Port number the SRP Sync Server is listening on (default port is 25000). The KeepAliveTime is how often DirectConnect checks in with the SRP Sync Server. The default is 400. Set this to 0 to turn it off. If you are concerned about network traffic, set this to 0. It shouldn't cause disconnects, and you can always change it back if you feel the need. 
ServerValid(Read Only) Use this to test that you have a valid connection to the SRP Engine Server. 

Methods

OLE control methods provide convenient one-time operations to developers. Unlike properties, whose values are persistant over the life of a control, methods represent actions that a control can perform. The following methods apply to the SRP DirectConnect Control:

MethodDescriptionVersion Introduced
Broadcast(Message)Call this to send a message to the direct connect server, which copies the message to all other connected direct connect controls. The other controls will receive OnMessage events with the given message as a parameter. The message can be anything you want. If you want to pass delimited data, avoid using @RM and @FM because OpenInsight doesn’t support those delimiters when passed as event parameters. 
SendEngineRequest(Reqeust)Call this method to send an asynchronous request to the SRP Engine Server. This call will not wait for a response, so it will return immediately. The response will return via any of the OnEngine events mentioned below. The contents of Request must be any valid OEngine request string, i.e., anything you van validly enter into the System Monitor in OpenInsight.4.0

Events

OLE control events provide a way for the OLE control to communicate back to OpenInsight. Once an event has been qualified using OI's QUALIFY_EVENT message, then the OLE control will fire the event to OpenInsight allowing you to respond to any one of the control's predefined actions. The following events apply to the SRP DirectConnect Control:

EventDescriptionVersion Introduced
OnEngineError(ID, Error)Fired when the SRP Engine Server encounters an error while processing a request. The ID parameter contains the engine's request ID. The Error parameter contains any error text supplied by the OpenEngine when the error occurred.4.0
OnEngineResponse(ID, Response)Fired when the SRP Engine Server finishes a request. The ID parameter contains the engine's request ID. The Response parameter contains the final response of the request. Note that OpenInsight does not like it when event parameters contain @RM and @FM delimiters, so try to limit your requests to routines that avoid returning these delimiters.4.0
OnEngineStatus(ID, Status)Fired when the SRP Engine Server has some status information while processing a request. The ID parameter contain the engine's request ID. The Status parameter contains information custom to the request. For example, some stored procedures call Send_Info to update the system of it's progress. When that occurs in the SRP Engine Server, this event is fired. Since a routine can send anything it wants, you'll have to refer to it's documentation on how to interpret the status. Sometimes it's just text, but sometimes it contains progress percentages.4.0
OnMessage(Message)Fired when the control receives a message broadcast from another control. The message parameter contains the message.

Note: The OnMessage event should be qualified as asynchronous. This is how OpenInsight qualifies OLE events by default. But SRP FrameWorks normally qualifies events as synchronous instead. Therefore there should be a change in the PROMOTED_CREATE_EVENT routine to override this.

 

Search this documentation

  • No labels