D2000 OBJApi - basic parts of the user client process
Initializing the communication
Handling NewObjectValue message
Handling NewDefinition message
Executive part
Stopping the communication
Initializing the communication
Before calling a function from the interface D2000 ObjApi, it is necessary at first to call the initialization function - ConnectKernel, which provides a connection with the D2000 Server process. After calling the function ConnectKernel, then there is calling the function SendChildren that provides acceptance of the definition of user process' children.
Handling NewObjectValuemessage
When the connection is established with the D2000 Server, we use the parameter ConnectKernel to define a service procedure that will receive asynchronous messages about a change in the object value or status. Such messages are to be sent for each object, which is opened by calling the function OpenObject and for all children of a given process.
Handling NewDefinition message
After connecting to the D2000 Server, it is possible to request for a definition of user process children by calling the function SendChildren. When calling this function, we define a service procedure that will receive NewDefinition configuration messages.
Executive part
In this part, we can call functions of the interface D2000 ObjApi which are used to:
- open and close an object. For the open object, there are sent the messages NewObjectValue about a change of its value or its status.
- get current object value,
- set up the object value,
- get data from the archive database,
- get data from the log database (not yet implemented),
- get the list of objects of a given type, all objects, or objects matching the entered mask.
Stopping the communication
Before terminating the user process, it is necessary to stop correctly the communication with D2000 Server by calling the function LogoffProc. An automatic restart of the user process is executed, if the following conditions are met:
- while the user process was terminating, there was a connected D2000 Server and the connection was not terminated correctly by calling LogoffProc,
- the process D2000 Server is running on the same computer as the user process,
- own executable file of the user process is placed in the subdirectory Bin of the installation directory containing all executable files of the D2000 System,
- the process must not be configured as a "service" using the parameter /X, always must run as a standard process communicating with the user.
0 komentárov