|
|
Back in the annals of time, in the cosmic soup of PICS design concepts, before the PC world had even advanced to 32-bit operating systems, one idea grew faster than the others. It became strong. It defeated the competition. It looked like it might even work.
It was the PICS Real Time DDE Kernel.
However, as time moved forward, evolution continued its relentless course toward perfection and passed NetDDE by, on the way to nearly universal TCP/IP networking and a world-wide internet. PICS, too, evolved beyond its humble DDE roots into a citizen of the internet. Luckily, the great and powerful Microsoft, mired in its own bog of legacy software, decided to keep DDE alive in its products for fear that they might be abandoned should the feature be lost to those that used it. Microsoft's hatred of legacy software was great, however, and the scribes refused to commit any of their vast DDE knowledge to paper (or even into help files) for fear that a new generation of DDE users might be born.
By this time, PICS had ventured out into the world. It had even won a few converts to its cause, yet, those converts still wanted more than PICS could provide and Lo! unto them was given the PICS Real Time DDE Server, born of the original PICS Real Time DDE Kernel, and extended to provide some data formats designed especially for Microsoft Excel. Because of its ancient history, the DDE Server is not particularly efficient, yet it is fully functional and provides a quick and relatively painless method for PICS brethren to access, utilize, and otherwise manipulate PICS real time data.
The remainder of this document attempts to fill in some of the gaps in our knowledge that have occurred since the Lords of Microsoft forbade discussion of the dreaded DDE within their sight. Please be very careful with this knowledge... for should the Lords of Microsoft discover that you find it useful, they may well eliminate DDE support from future versions of the very products you find useful today.
DDE Initiate Service=RTDB Topic=Request DDE Execute [ Subscribe ( SubscriptionName, PointIDList ) ] DDE Advise Item=SubscriptionName DDE Unadvise Item=SubscriptionName DDE Execute [ Cancel ( SubscriptionName ) ] DDE Terminate
SubscriptionName Name of a DDE item to be created to contain the results of the subscription. PointIDList Point ID numbers to be included in the subscription.
The DDE Execute protocol allows for multiple command strings to be included in a single execute request. RTDB also supports this feature, however, due to the limitations of the DDE execute protocol, very limited result information may be returned. The DDE Execute protocol may return one of the following values:
DDE_FACK All commands in the execute command completed. DDE_FBUSY The server was too busy to process one of the commands DDE_FNOTPROCESSED The server was unable to process one of the commands. Errors may also occur at different levels during the transmission of the execute request. If an error occurs within RTDB's processing of the request, the SubscriptionName item will contain an error message in the following format:
RTDBERR:nnnn:Descriptive error text...
The first string is an error message identifier. nnnn represents the actual error code and will correspond to one of the error values defined in PDXDBDEF.H. The remaining text may be used as [part of] a message to the user (and for debugging).
When an error occurs before RTDB begins processing, the SubscriptionName item will not exist, so a DDE request to it will fail. This will normally indicate an invalid command string, for example using illegal characters or misspelling the function name.
All clients must always either request the value in the SubscriptionName item created, or use the following execute command to force the result to be cleared. Otherwise, RTDB will eventually run out of space to store pending results and will therefore fail. To cancel a subscription:
[ Cancel ( SubscriptionName ) ]
struct RTDB_Point
{
WORD wPID;
DWORD dwTime;
WORD wDate;
WORD wStatus;
float rfValue
};
For digital points, the rfValue field is undefined. For all points, dwTime contains the number of milliseconds since midnight on the given date and wDate contains the number of days since Jan 1, 1980 (i.e. 1/1/80 == 0, 1/2/80 = 1, etc.).
To use PICS real time data from Microsoft Excel, use formulas in the format:
=program|topic!'item'For example, to get the value of X186, the formula would be:
=rtdbdde|value!'X186'This will cause Excel to issue the necessary commands to RTDBDDE to subscribe to the value of X186 as long as the sheet is open. When the sheet is re-opened, Excel will offer to re-establish the links automatically.
XLDateTime The point's current date/time in a format which Microsoft Excel understands. (Days since Jan 0, 1900) Date Point's current date in PICS format (Days since Jan 0, 1980) Time Point's current time in PICS format (milliseconds since midnight) OnState On state string (also the Units string for non-digital points) OffState Off state string Units Units string (also the OnState string for digital points) Type Point type Desc Point description Stat10 Point status as an unsigned decimal value Stat16 Point status as an eight digit hexidecimal value Value Numeric point value (digitals are 0 or 1) Xvalue Translated point value (digitals are OnState or OffState)
|
|