/      日本語

mwings.parsers.app_uart_ascii_extended Module

Parsers for packets sent from the serial communication app (format mode: extended).

Parsers for packets sent from the serial communication app (format mode: extended) and data structures to store their contents.

src/mwings/parsers/app_uart_ascii_extended.py

PacketParser

Static class parser for interpreting packets representing data sent from the serial communication app (format mode: extended).

Inherits from: common.PacketParserBase

is_valid()

is_valid(bare_packet)

Checks whether the given bare packet is valid.

Parameters

NameTypeDescription
bare_packetcommon.BarePacketRaw packet data

Returns

TypeValueDescription
boolTrueValid, parsable
FalseInvalid, not parsable

parse()

parse(bare_packet)

Parses the given bare packet.

Parameters

NameTypeDescription
bare_packetcommon.BarePacketRaw packet data

Returns

TypeValueDescription
optional ParsedPacketInstance of ParsedPacketParsed data
NoneParsing failed

ParsedPacket

Data structure to store the results of parsing packets representing data sent from the serial communication app (format mode: extended).

Inherits from: common.ParsedPacketBase

ParsedPacket()

ParsedPacket(*, time_parsed=None, packet_type=PacketType.BARE, sequence_number=None, source_serial_id=0, source_logical_id=0, lqi=None, supply_voltage=None, destination_serial_id=120, command_id=0, data=b'')

Parameters

Including inherited properties.

NameTypeDescription
time_parsedoptional AwareDatetimeParsing timestamp
packet_typecommon.PacketTypePacket type
sequence_numberoptional common.UInt16Not available, always None
source_serial_idcommon.UInt32Sender’s serial ID
source_logical_idcommon.UInt8Sender’s logical device ID
lqicommon.UInt8Radio signal quality
supply_voltageoptional common.UInt16Not available, always None
destination_serial_idcommon.UInt32Receiver’s serial ID
command_idcommon.UInt8Command ID
databytesData

You can also pass a dictionary unpacked with **.

to_df()

to_df(include=None, exclude=None, verbose=True)

Converts the parsed data into a pandas DataFrame.

Parameters

NameTypeDescription
includeoptional set[str]Set of columns (members) to include in the DataFrame
excludeoptional set[str]Set of columns (members) to exclude from the DataFrame
verboseboolWhether to include system information (only when other arguments are None)

Returns

TypeDescription
pd.DataFrameConverted DataFrame

Exceptions

  • EnvironmentError if pandas is not installed

to_dict()

to_dict(include=None, exclude=None, verbose=True, spread=False, sort_keys=False)

Converts the parsed data into a dictionary.

Parameters

NameTypeDescription
includeoptional set[str]Set of keys (members) to include in the dictionary
excludeoptional set[str]Set of keys (members) to exclude from the dictionary
verboseboolWhether to include system information (only when other arguments are None)
spreadboolWhether to split list-like data that is not time series
sort_keysboolWhether to sort keys

Returns

TypeDescription
dict[str, Any]Converted dictionary

to_json()

to_json(include=None, exclude=None, verbose=True, spread=False, indent=2, sort_keys=False)

Converts the parsed data into JSON format.

Parameters

NameTypeDescription
includeoptional set[str]Set of keys (members) to include in the JSON
excludeoptional set[str]Set of keys (members) to exclude from the JSON
verboseboolWhether to include system information (only when other arguments are None)
spreadboolWhether to split list-like data that is not time series
indentoptional intNumber of spaces for indentation (None for no line breaks)
sort_keysboolWhether to sort keys

Returns

TypeDescription
strConverted JSON string

model_*()