smia.logic.inter_smia_interactions_utils module¶
This class groups the methods related to the Inter AAS interactions between I4.0 SMIA entities.
- smia.logic.inter_smia_interactions_utils.create_svc_json_data_from_acl_msg(acl_msg)[source]¶
This method creates the dictionary with all the required data of a service related to an ACL message.
- Parameters:
acl_msg (spade.message.Message) – ACL message where to get the information
- Returns:
dictionary with all the information about the service
- Return type:
dict
- smia.logic.inter_smia_interactions_utils.create_inter_smia_response_msg(receiver, thread, performative, ontology, service_id=None, service_type=None, service_params=None)[source]¶
This method creates the Inter AAS interaction response object.
- Parameters:
receiver (str) – the JID of the receiver of the ACL message from which the service is requested.
thread (str) – the thread of the ACL message.
performative (str) – the performative of the ACL message.
ontology (str) – the ontology of the ACL message.
service_id (str) – the serviceID of the ACL message.
service_type (str) – the serviceType of the ACL message.
service_params (str) – the serviceParams of the “serviceData” section of the ACL message.
- Returns:
SPADE message object FIPA-ACL-compliant.
- Return type:
spade.message.Message
- async smia.logic.inter_smia_interactions_utils.create_acl_response_from_received_msg(received_msg, performative, response_body=None)[source]¶
This method creates an Inter SMIA interaction response object from a received ACL message. Thus, some of the required data will be obtained from the received message (receiver, thread, ontology, protocol, encoding and language).
- Parameters:
received_msg (spade.message.Message) – the received ACL message.
performative (str) – the performative of the ACL message.
response_body – the body of the ACL response message.
- Returns:
SPADE message object FIPA-ACL-compliant.
- Return type:
spade.message.Message
- async smia.logic.inter_smia_interactions_utils.create_acl_smia_message(receiver, thread, performative, ontology, msg_body=None, protocol=None, encoding=None, language=None)[source]¶
- This method creates a FIPA-ACL-SMIA message for an Inter SMIA interaction. If optional attributes are set, they will
be added to the message.
- Parameters:
receiver (str) – the JID of the receiver of the ACL message from which the service is requested.
thread (str) – the thread of the ACL message.
performative (str) – the performative of the ACL message.
ontology (str) – the ontology of the ACL message.
msg_body – the vody of the ACL message.
protocol (str) – the protocol of the ACL message.
encoding (str) – the encoding of the ACL message.
language (str) – the language of the ACL message.
- Returns:
SPADE message object FIPA-ACL-SMIA-compliant.
- Return type:
spade.message.Message
- async smia.logic.inter_smia_interactions_utils.acl_message_to_json(acl_message)[source]¶
This method converts a FIPA-ACL-SMIA message to JSON object. :param acl_message: SPADE message object FIPA-ACL-SMIA-compliant. :type acl_message: spade.message.Message
- Returns:
JSON object with all the information of the ACL message.
- Return type:
dict
- async smia.logic.inter_smia_interactions_utils.check_received_request_data_structure_old(received_data, json_schema)[source]¶
This method checks if the received data for a request is valid. The JSON object with the specific data is also validated against the given associated JSON Schema. In any case, if it is invalid, it raises a RequestDataError exception.
- Parameters:
received_data (dict) – received data in form of a JSON object.
json_schema (dict) – JSON Schema in form of a JSON object.
- async smia.logic.inter_smia_interactions_utils.check_received_request_data_structure(received_data, json_schema)[source]¶
This method checks if the received data for a request is valid. So, the JSON object with the specific data is validated against the given associated JSON Schema for FIPA-ACL-SMIA messages. In any case, if it is invalid, it raises a RequestDataError exception.
- Parameters:
received_data (dict) – received data in form of a JSON object.
json_schema (dict) – JSON Schema in form of a JSON object.
- async smia.logic.inter_smia_interactions_utils.send_response_msg_from_received(agent_behav, received_msg, performative, response_body=None)[source]¶
This method sends a response message from a received one, adding the desired data: performative and body.
- Parameters:
agent_behav (AgentBehavior) – Agent behaviour object.
received_msg (spade.message.Message) – the received ACL message.
performative (str) – the performative of the ACL message.
response_body – the body of the ACL response message.