MEng.System.CQC.Runtime.SimpleFieldClient provides field I/O services for control macros that don't need very elaborate field access, which is normally the bulk of them. Most invoked control macros read a few fields to find out the state of the state of whatever they are interested in, and then write to a few fields to achieve the desired result, and never look at any field more than once.
This class is appropriate for those types of macros, and provides that kind of access with the minimum of complexity and fuss. This means that it will be inefficient for more elaborate or repeated field access patterns, and other classes should be used for that kind of work.
This class provides typed field access, so there is a method to read and write each field data type. This is more efficient, but you must be sure to write a field as it's correct type of your operation will fail.
QueryData
(
[In] MEng.String Moniker
, [In] MEng.Card4 QueryId
, [In] MEng.String DataName
, [Out] MEng.Card4 ByteCnt
, [Out] MEng.System.Runtime.MemBuf ToFill
) Returns MEng.Boolean;This method allows you to call a 'backdoor' method on a driver, to get data directly from it, as apposed to the usual field interface. This is generally not used, but it is sometimes required. You must provide the moniker of the driver, and a query id and data name. The latter two are arbitrary and defined by the driver, allowing it to advertise what information it can make available. This method is for querying a binary buffer of data, whereas QueryTextVal is available for querying a string of data.
If the driver recognizes the passed id and data name, it will return True and fill in the buffer and byte count, else it will return False. If an error occurs, the QueryFailed exception will be thrown.
QueryDrivers([Out] StrList ToFill) Returns MEng.Card4;
This method will query a list of all of the currently loaded drivers in a vector of strings. It will return the number of drivers found. You can use any vector of strings, StrList is just defined in order to have one to use in this class' interface. If an error occurs, the QueryFailed exception will be thrown.
QueryFields
(
[In] MEng.String Moniker
, [Out] FldDefList ToFill
, [Out] MEng.Card4 FldListId
, [Out] MEng.Card4 DriverId
, [Out] MEng.Card4 DriverListId
) Returns MEng.Card4;This method will provide a list of all of the fields for a given driver. The driver must be loaded and functional or an error will occur. The last three parameters are not of much use to CML clients at this time, but will be in the future, so they are provided in the interface. You can use any vector of CQCFldDef objects, FldDefList is just defined to make this interface standalone.
QueryTextVal
(
[In] MEng.String Moniker
, [In] MEng.Card4 QueryId
, [In] MEng.String DataName
, [Out] MEng.String ToFill
) Returns MEng.Boolean;This method allows you to call a 'backdoor' method on a driver, to get data directly from it, as apposed to the usual field interface. This method allows you to query a string of text. Use QueryData to get a binary buffer of information. The query id and data name are arbitrary and defined by the driver, allowing it to advertise what information it can make available. If an error occurs, the QueryFailed exception will be thrown.
ReadBoolField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.Boolean;
ReadCardField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.Card4;
ReadFloatField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.Float8;
ReadIntField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.Int4;
ReadStringField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.String;
ReadTimeField
(
[In] MEng.String Moniker, [In] MEng.String FieldName
) Returns MEng.Card8;
WriteBoolField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.Boolean ToWrite
);
WriteCardField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.Card4 ToWrite
);
WriteFloatField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.Float8 ToWrite
);
WriteIntField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.Int4 ToWrite
);
WriteTimeField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.Card8 ToWrite
);
WriteStringField
(
[In] MEng.String Moniker, [In] MEng.String FieldName, [In] MEng.String ToWrite
);These methods read or write fields based on their moniker and field name, and based on the data type of the field. You must write to a field in it's data type, and reads return data in the field's data type.
Though the Write methods do change something, that something is not part of this object's visible state, so they are Const methods as well. The change occurs in the back end CQCServer and the target device.
ReadField([In] MEng.String Moniker, [In] MEng.String Field) Returns MEng.String;
ReadField2([In] MEng.String MonikerFld) Returns MEng.String;
This method reads any field type generically as a string. This is often convenient when formatting out field values or dealing with fields generically. ReadField2 takes the field name in the 'moniker.field' format, and a BadFldName error will be thrown if it is not in the correct format.
WriteField([In] MEng.String Moniker, [In] MEng.String Field, [In] MEng.String ToWrite);
WriteField2([In] MEng.String MonikerFld, [In] MEng.String ToWrite);
This method writes to any field type generically as a string. This is often convenient when dealing dynamically with target fields. WriteField2 takes the field name in the 'moniker.field' format, and a BadFldName error will be thrown if it is not in the correct format.