uecho.protocol package

Submodules

uecho.protocol.esv module

class uecho.protocol.esv.ESV(code=0)

Bases: object

ESV represents a ESV code in a protocol message of Echonet Lite.

NOTIFICATION = 115
NOTIFICATION_REQUEST = 99
NOTIFICATION_REQUEST_ERROR = 83
NOTIFICATION_RESPONSE = 122
NOTIFICATION_RESPONSE_REQUIRED = 116
READ_REQUEST = 98
READ_REQUEST_ERROR = 82
READ_RESPONSE = 114
UNKNOWN = 0
WRITE_READ_REQUEST = 110
WRITE_READ_REQUEST_ERROR = 94
WRITE_READ_RESPONSE = 126
WRITE_REQUEST = 96
WRITE_REQUEST_ERROR = 80
WRITE_REQUEST_RESPONSE_REQUIRED = 97
WRITE_REQUEST_RESPONSE_REQUIRED_ERROR = 81
WRITE_RESPONSE = 113
is_notification() bool

Checks the ESV whether it is classified as a notification type.

Returns:

True whether the specified code is a notification type, otherwise False.

Return type:

bool

is_notification_request() bool

Checks the ESV whether it is classified as a notification notification request type.

Returns:

True whether the specified code is a notification request type, otherwise False.

Return type:

bool

is_notification_response() bool

Checks the ESV whether it is classified as a notification response type. :returns: True whether the specified code is a notification response type, otherwise False. :rtype: bool

is_read_request() bool

Checks the ESV whether it is classified as a read request type.

Returns:

True whether the specified code is a read request type, otherwise False.

Return type:

bool

is_read_response() bool

Checks the ESV whether it is classified as a read response type.

Returns:

True whether the specified code is a read response type, otherwise False.

Return type:

bool

is_request() bool

Checks the ESV whether it is classified as a request type.

Returns:

True whether the specified code is a request type, otherwise False.

Return type:

bool

is_response() bool
is_response_required() bool

Checks the ESV whether it is classified as a response required type.

Returns:

True whether the ESV requires the response, otherwise False.

Return type:

bool

is_write_read_request() bool

Checks the ESV whether it is classified as a write and read request type.

Returns:

True whether the specified code is a write and read request type, otherwise False.

Return type:

bool

is_write_read_response() bool

Checks the ESV whether it is classified as a write and read response type.

Returns:

True whether the specified code is a write and read response type, otherwise False.

Return type:

bool

is_write_request() bool

Checks the ESV whether it is classified as a write request type.

Returns:

True whether the specified code is a write request type, otherwise False.

Return type:

bool

is_write_response() bool

Checks the ESV whether it is classified as a write response type.

Returns:

True whether the specified code is a write response type, otherwise False.

Return type:

bool

uecho.protocol.message module

class uecho.protocol.message.Message

Bases: ESV

Message represents a protocol message of Echonet Lite.

DEOJ: int
EHD1_ECHONET = 16
EHD2_FORMAT1 = 129
EOJ_SIZE = 3
FORMAT1_HEADER_SIZE = 8
FORMAT1_MIN_SIZE = 12
FORMAT1_PROPERTY_HEADER_SIZE = 2
FRAME_HEADER_SIZE = 4
property OPC: int
property OPCGet: int
property OPCSet: int
exception ParserError

Bases: Exception

SEOJ: int
TID: int
TID_MAX = 65535
TID_SIZE = 2
add_get_property(prop: Property) bool
add_property(prop: Property) bool
add_set_property(prop: Property) bool
property all_properties: List[Property]
from_addr: Tuple[str, int] | None
get_properties: List[Property]
is_response_message(msg)
parse_bytes(msg_bytes) bool
parse_hexstring(hes_string: str) bool
properties: List[Property]
set_properties: List[Property]
to_addr: Tuple[str, int] | None
to_bytes() bytes
to_string() str

uecho.protocol.observer module

class uecho.protocol.observer.Observer

Bases: object

Observer is an abstract observer class to listen to request messages to a device.

abstract message_received(msg: Message)

Listens a request message from other nodes

Parameters:

msg (Message) – A request message from other nodes

uecho.protocol.property module

class uecho.protocol.property.Property(code: int = 0, data: bytes = b'')

Bases: object

Property represents a property in a protocol message of Echonet Lite.

code: int
data: bytes

uecho.protocol.subject module

class uecho.protocol.subject.Subject

Bases: object

add_observer(observer) bool

Adds a message observer to the subject.

Parameters:

Observer (observer) – A message observer.

Returns:

Returns True when the specified observer is added, Otherwise False.

Return type:

bool

notify(msg: Message)

Notifies the specified message to the added observers.

Parameters:

msg (Message) – A notify message

observers: List[Observer]

Module contents

This module includes internal classes to handle any messages of Echonet Lite protocol.

class uecho.protocol.ESV(code=0)

Bases: object

ESV represents a ESV code in a protocol message of Echonet Lite.

NOTIFICATION = 115
NOTIFICATION_REQUEST = 99
NOTIFICATION_REQUEST_ERROR = 83
NOTIFICATION_RESPONSE = 122
NOTIFICATION_RESPONSE_REQUIRED = 116
READ_REQUEST = 98
READ_REQUEST_ERROR = 82
READ_RESPONSE = 114
UNKNOWN = 0
WRITE_READ_REQUEST = 110
WRITE_READ_REQUEST_ERROR = 94
WRITE_READ_RESPONSE = 126
WRITE_REQUEST = 96
WRITE_REQUEST_ERROR = 80
WRITE_REQUEST_RESPONSE_REQUIRED = 97
WRITE_REQUEST_RESPONSE_REQUIRED_ERROR = 81
WRITE_RESPONSE = 113
is_notification() bool

Checks the ESV whether it is classified as a notification type.

Returns:

True whether the specified code is a notification type, otherwise False.

Return type:

bool

is_notification_request() bool

Checks the ESV whether it is classified as a notification notification request type.

Returns:

True whether the specified code is a notification request type, otherwise False.

Return type:

bool

is_notification_response() bool

Checks the ESV whether it is classified as a notification response type. :returns: True whether the specified code is a notification response type, otherwise False. :rtype: bool

is_read_request() bool

Checks the ESV whether it is classified as a read request type.

Returns:

True whether the specified code is a read request type, otherwise False.

Return type:

bool

is_read_response() bool

Checks the ESV whether it is classified as a read response type.

Returns:

True whether the specified code is a read response type, otherwise False.

Return type:

bool

is_request() bool

Checks the ESV whether it is classified as a request type.

Returns:

True whether the specified code is a request type, otherwise False.

Return type:

bool

is_response() bool
is_response_required() bool

Checks the ESV whether it is classified as a response required type.

Returns:

True whether the ESV requires the response, otherwise False.

Return type:

bool

is_write_read_request() bool

Checks the ESV whether it is classified as a write and read request type.

Returns:

True whether the specified code is a write and read request type, otherwise False.

Return type:

bool

is_write_read_response() bool

Checks the ESV whether it is classified as a write and read response type.

Returns:

True whether the specified code is a write and read response type, otherwise False.

Return type:

bool

is_write_request() bool

Checks the ESV whether it is classified as a write request type.

Returns:

True whether the specified code is a write request type, otherwise False.

Return type:

bool

is_write_response() bool

Checks the ESV whether it is classified as a write response type.

Returns:

True whether the specified code is a write response type, otherwise False.

Return type:

bool

class uecho.protocol.Message

Bases: ESV

Message represents a protocol message of Echonet Lite.

DEOJ: int
EHD1_ECHONET = 16
EHD2_FORMAT1 = 129
EOJ_SIZE = 3
FORMAT1_HEADER_SIZE = 8
FORMAT1_MIN_SIZE = 12
FORMAT1_PROPERTY_HEADER_SIZE = 2
FRAME_HEADER_SIZE = 4
property OPC: int
property OPCGet: int
property OPCSet: int
exception ParserError

Bases: Exception

SEOJ: int
TID: int
TID_MAX = 65535
TID_SIZE = 2
add_get_property(prop: Property) bool
add_property(prop: Property) bool
add_set_property(prop: Property) bool
property all_properties: List[Property]
from_addr: Tuple[str, int] | None
get_properties: List[Property]
is_response_message(msg)
parse_bytes(msg_bytes) bool
parse_hexstring(hes_string: str) bool
properties: List[Property]
set_properties: List[Property]
to_addr: Tuple[str, int] | None
to_bytes() bytes
to_string() str
class uecho.protocol.Observer

Bases: object

Observer is an abstract observer class to listen to request messages to a device.

abstract message_received(msg: Message)

Listens a request message from other nodes

Parameters:

msg (Message) – A request message from other nodes

class uecho.protocol.Property(code: int = 0, data: bytes = b'')

Bases: object

Property represents a property in a protocol message of Echonet Lite.

code: int
data: bytes
class uecho.protocol.Subject

Bases: object

add_observer(observer) bool

Adds a message observer to the subject.

Parameters:

Observer (observer) – A message observer.

Returns:

Returns True when the specified observer is added, Otherwise False.

Return type:

bool

notify(msg: Message)

Notifies the specified message to the added observers.

Parameters:

msg (Message) – A notify message

observers: List[Observer]