aea.protocols.base
This module contains the base message and serialization definition.
Message Objects
This class implements a message.
Performative Objects
Performatives for the base message.
__
str__
Get the string representation.
__
init__
Initialize a Message object.
Arguments:
_body
: the dictionary of values to hold.kwargs
: any additional value to add to the body. It will overwrite the body values.
json
Get json friendly str representation of the message.
from_
json
Construct message instance from json data.
valid_
performatives
Get valid performatives.
has_
sender
Check if it has a sender.
sender
Get the sender of the message in Address form.
sender
Set the sender of the message.
has_
to
Check if it has a sender.
to
Get address of receiver.
to
Set address of receiver.
dialogue_
reference
Get the dialogue_reference of the message.
message_
id
Get the message_id of the message.
performative
Get the performative of the message.
target
Get the target of the message.
set
Set key and value pair.
Arguments:
key
: the key.value
: the value.
get
Get value for key.
is_
set
Check value is set for key.
__
eq__
Compare with another object.
__
repr__
Get the representation of the message.
__
str__
Get the string representation of the message. Abbreviated to prevent spamming of logs.
encode
Encode the message.
decode
Decode the message.
has_
dialogue_
info
Check whether a message has the dialogue fields populated.
More precisely, it checks whether the fields 'message_id', 'target' and 'dialogue_reference' are set.
Returns:
True if the message has the dialogue fields set, False otherwise.
Encoder Objects
Encoder interface.
encode
Encode a message.
Arguments:
msg
: the message to be encoded.
Returns:
the encoded message.
Decoder Objects
Decoder interface.
decode
Decode a message.
Arguments:
obj
: the sequence of bytes to be decoded.
Returns:
the decoded message.
Serializer Objects
The implementations of this class defines a serialization layer for a protocol.
Protocol Objects
This class implements a specifications for a protocol.
It includes a serializer to encode/decode a message.
__
init__
Initialize the protocol manager.
Arguments:
configuration
: the protocol configurations.message_class
: the message class.kwargs
: the keyword arguments.
serializer
Get the serializer.
from_
dir
Load the protocol from a directory.
Arguments:
directory
: the directory to the skill package.kwargs
: the keyword arguments.
Returns:
the protocol object.
from_
config
Load the protocol from configuration.
Arguments:
configuration
: the protocol configuration.kwargs
: the keyword arguments.
Returns:
the protocol object.
protocol_
id
Get protocol id.
protocol_
specification_
id
Get protocol specification id.
__
repr__
Get str representation of the protocol.