* [Fail when initializing settings with invalid arguments](fail-when-initializing-settings-with-invalid-arguments)
* [Add simple customization of equipment specific functions](add-simple-customization-of-equipment-specific-functions)
* [Add function definition language](add-function-definition-language)
* [Change data item and data item access](change-data-item-and-data-item-access)
Fail when initializing settings with invalid arguments
Due to the multi-layered settings structure the keyword arguments of the 'Settings' initializers were not checked for invalid arguments.
A ValueError is now raised if an unknown parameter is passed to the settings constructor.
This is implemented for HsmsSettings, SecsISettings and SecsITcpSettings.
Also tests for the settings were added.
Add simple customization of equipment specific functions
The old, documented way for replacing / adding a customized function to a handler doesn't work with 0.2.0 any more.
So a new way to simply modify the function list for an equipment was added.
To allow equipment specific modifications of the function list, it was moved to the settings in 0.2.0.
With this move a container for the function list was added, to allow simple lookups.
Now a function was added to this container, to update its function list.
This will either add or update the function in the list.
The container is accessible from the settings.
python
class UNITS_New(DataItemBase):
name = "UNITS"
__type__ = SecsVarDynamic changed
__allowedtypes__ = [SecsVarU1, SecsVarU2, SecsVarU4, SecsVarI1, SecsVarI2, SecsVarI4, SecsVarString] changed
class SecsS01F12_New(secsgem.secs.SecsStreamFunction):
_stream = 1
_function = 12
_data_format = [
[
SVID,
SVNAME,
UNITS_New
]
]
_to_host = True
_to_equipment = True Changed
_has_reply = False
_is_reply_required = False
_is_multi_block = True
settings = secsgem.hsms.HsmsSettings()
settings.streams_functions.update(SecsS01F12_New)
handler = secsgem.gem.GemHostHandler(settings)
Add function definition language
Defining the data item for a function is a quite complex and confusing task.
Wrapping the function definition in python data types is not very intuitive.
So a new description language was added, based on SML, which is known in combination with secs.
For more information check the documentation ([Secs Function Definition Language](firststeps/sfdl.md)).
{attention}
Custom data types are currently not supported with SFDL.
Old:
python
class SecsS06F08(SecsStreamFunction):
_stream = 6
_function = 8
_data_format = [
DATAID,
CEID,
[
[
"DS",
DSID,
[
[
"DV",
DVNAME,
DVVAL
]
]
]
]
]
_to_host = True
_to_equipment = False
_has_reply = False
_is_reply_required = False
_is_multi_block = True
New:
python
class SecsS06F08(SecsStreamFunction):
_stream = 6
_function = 8
_data_format = """
< L
< DATAID >
< CEID >
< L DS
< L
< DSID >
< L DV
< L
< DVNAME >
< DVVAL >
>
>
>
>
>
"""
_to_host = True
_to_equipment = False
_has_reply = False
_is_reply_required = False
_is_multi_block = True
Change data item and data item access
A new container for the data items was introduced.
This container is usually accessible via the settings object and the handler, as it represents the equipment specific data items.
This allows the customization of the data items on a per-equipment level.
Custom data item classes need new attributes to work.
python
class UNITS_New(DataItemBase):
name = "UNITS"
__type__ = SecsVarDynamic
__allowedtypes__ = [SecsVarArray, SecsVarBoolean, SecsVarU1, SecsVarU2, SecsVarU4, SecsVarU8, SecsVarI1, SecsVarI2, SecsVarI4, SecsVarI8, \
SecsVarF4, SecsVarF8, SecsVarString, SecsVarBinary]
The `name` attribute marks the name of the data item.
This is required for lookup of the data item class using the settings / handler.
It is also used when updating the data item using the container in the settings.
The `_value` attribute is the mapping used for the constants as a dictionary.
It is used for lookup of the constants.
The downside of this implementation is that code suggestions in the IDE won't work any more.
Recommendation: Start accessing the data items using the handler / settings.
The plan is to remove the function and data item classes and read the configuration directly from the yaml files.
This means code written using the classes will need to be rechanged.