Callback_agg_convert_setting()
Description: |
Callback procedure, invoked every time a setting A-variable is being read or written. Provides an opportunity to convert the value before writing to a setting or after reading from a setting. Procedure body has to be created elsewhere in the project (externally with respect to the library). |
Syntax: |
sub callback_agg_convert_setting(byref setting_name as string, index as byte, byref setting_value as string, op as en_agg_rdwr) |
Returns: |
--- |
See Also: |
Parameter |
Description |
setting_name |
Name of the setting being read or written. |
index |
Setting index (zero for single-value settings). |
setting_value |
Value to be converted. This argument is also used for returning the converted value: take setting_value, modify as needed, and store back. |
op |
EN_AGG_GET- reading from the setting EN_AGG_SET- writing to the setting |
Details
This procedure allows to store the value in a format or type that is different from the way the same is perceived in AggreGate.
Here is a simple example: Supposing, there is a setting that stores device temperature. The setting data originates from a temperature measuring IC, which outputs a byte value. Seven most significant bits are degrees. The least significant bit represent a 0.5-degree step. The output of 0 corresponds to -40 degrees C. Therefore, the output of 255 corresponds to +87.5 degrees C.
Now, the operator in AggreGare would surely prefer to see "natural" temperature values like -40 and +87.5, rather than 0 and 255. This procedure can provide a place to do the conversion.
The same possibility exists for stored event's fields (see Callback_agg_convert_event_field()) but not for table A-variables. Tables must be stored in exactly the same way that the AggreGate server "believes" them to be stored. This is because table synchronization is based on hash strings.