smia.assetconnection.asset_connection module¶
- class smia.assetconnection.asset_connection.AssetConnection[source]¶
Bases:
objectThis class is an abstract class for all AssetConnections.
- class ArchitectureStyle(value)[source]¶
Bases:
EnumAn enumeration.
- PUBSUB = 0¶
- CLIENTSERVER = 1¶
- NOTAPPLICABLE = 2¶
- abstract async configure_connection_by_aas_model(interface_aas_elem)[source]¶
This method configures de Asset Connection using the interface element defined in the AAS model.
- Parameters:
interface_aas_elem (basyx.aas.model.SubmodelElement) – element of the AAS model with the asset interface information.
- abstract async execute_skill_by_asset_service(interaction_metadata, skill_params_exposure_elems, skill_input_params=None, skill_output_params=None)[source]¶
This method sends a message to the asset and returns the response. The connection of the interface of the asset is already configured in ‘configure_connection_by_aas_model’ method, but the interaction metadata is provided in form of a Python object of AAS model (SubmodelElement).
- Parameters:
interaction_metadata (basyx.aas.model.SubmodelElement) – element of the AAS model with all metadata for the interaction with the asset.
skill_params_exposure_elems (list(basyx.aas.model.SubmodelElement)) – submodel elements that exposes all skill parameters.
skill_input_params (dict) – skill input parameters in form of JSON object (None if the skill does not have inputs).
skill_output_params (dict) – skill output parameters in form of JSON object (None if the skill does not have outputs).
- Returns:
response information defined in the interaction metadata.
- Return type:
object
- abstract async execute_asset_service(interaction_metadata, service_input_data=None)[source]¶
This method sends a message to the asset and returns the response. The connection of the interface of the asset is already configured in ‘configure_connection_by_aas_model’ method, but the interaction metadata is provided in form of a Python object of AAS model (SubmodelElement).
- Parameters:
interaction_metadata (basyx.aas.model.SubmodelElement) – element of the AAS model with all metadata for the interaction with the asset.
service_input_data – object with the input data of the service
- Returns:
response information defined in the interaction metadata.
- Return type:
object
- async check_endpoint_metadata()[source]¶
This method checks if the given endpointMetadata object is valid (if it is within the correct submodel and if it has all required attributes).
- async check_interaction_metadata(interaction_metadata)[source]¶
This method checks if the given interactionMetadata object is valid (if it is within the correct submodel and if it has all required attributes).
- Parameters:
interaction_metadata (basyx.aas.model.SubmodelElementCollection) – SubmodelElement of interactionMetadata.
- async get_interaction_metadata_content_type(interaction_metadata)[source]¶
This method gets the content type of the interaction metadata. If it is not defined, the type defined in the EndpointMetadata will be :param interaction_metadata: interactionMetadata Python object. :type interaction_metadata: basyx.aas.model.SubmodelElementCollection
- Returns:
Python object of the content type
- Return type:
basyx.aas.model.SubmodelElementElement
- async classmethod check_submodel_element_exist_by_semantic_id(submodel_elem_col, sm_id_short, semantic_id)[source]¶
This method checks if a submodelElement with the given semanticID exists within the given SubmodelElementCollection.
- Parameters:
submodel_elem_col (basyx.aas.model.SubmodelElementCollection) – SubmodelElementCollection where the SubmodelElement has to be found.
sm_id_short (str) – idShort of the SubmodelElement to find.
semantic_id (str) – semantic ID to find the required SubmodelElement.
- async classmethod check_data_query_type(interaction_elem_name, content_type, data_query_elem)[source]¶
This method checks if the data query of the interaction metadata element is valid. It is valid when the type specified in the data query is the appropriate for the content type of the element.
- Parameters:
interaction_elem_name (str) – name of the interaction element to show in case of invalid data query.
content_type (str) – type of the content of the interaction metadata element.
data_query_elem (basyx.aas.model.SubmodelElementCollection) – SubmodelElement of dataQuery.
Returns:
- async classmethod get_response_content(interaction_metadata, response_content)[source]¶
This method gets the required information from the content of the response message from the asset using the interactionMetadata information.
- Parameters:
interaction_metadata (basyx.aas.model.SubmodelElementCollection) – SubmodelElement of interactionMetadata.
response_content (str) – The content of the response message from the asset in string format.
- async classmethod extract_information_with_data_query(content_type, content_data, query)[source]¶
This method extracts the information of the content using the query defined in the interface element.
- Parameters:
content_type (str) – format of the content.
content_data – data of the content.
query (str) – query to extract information from the content.
- Returns:
extracted information (result of the query in the given data).
- Return type:
object