mobile_insight.monitor.dm_collector.dm_endec.dm_log_packet module¶
dm_log_packet.py Defines DMLogPacket class.
Author: Jiayao Li
- class mobile_insight.monitor.dm_collector.dm_endec.dm_log_packet.DMLogPacket(decoded_list)¶
Bases:
object
DM log packet decoder.
A log packet contains a header that specifies the packet type and timestamp, and a payload field that store useful information of a phone. This class will decode both the header and payload fields.
This class depends on Wireshark to decode some 3GPP standardized messages.
- classmethod _decode_msg(msg_type, b)¶
Decode standard message using WSDissector.
- _init_called = False¶
- classmethod _parse_internal_list(out_type, decoded_list)¶
Parse the internal list to create different types of output.
- Parameters
out_type (string) – can be “dict”, “list”, “xml/dict” or “xml/list”
decoded_list (list) – output of dm_collector_c library
- classmethod _parse_internal_list_dict(decoded_list)¶
- classmethod _parse_internal_list_list(decoded_list)¶
- classmethod _parse_internal_list_old(out_type, decoded_list)¶
- classmethod _parse_internal_list_xml(tag_name, decoded_list)¶
- classmethod _preparse_internal_list(decoded_list)¶
- classmethod _search_result(result, target)¶
- classmethod _wrap_decoded_xml(xmls)¶
- Returns
an XML string that looks like:
<msg>
<packet>…</packet> <packet>…</packet> <packet>…</packet>
</msg>
- decode()¶
Decode a DM log packet.
- Returns
a Python dict object that looks like:
{
”type_id”: “LTE_RRC_OTA_Packet”, “timestamp”: datetime.datetime(……), “Pkt Version”: 2, “RRC Release Number”: 9, # other fields … “Msg”: “””
- <msg>
<packet>…</packet> <packet>…</packet> <packet>…</packet>
</msg> “””,
}
- Raises
FormatError – this message has an unknown type
- decode_json()¶
Decode the message and convert to a standard JSON dictionary.
- Returns
a string that contains the converted JSON document.
- decode_xml()¶
Decode the message and convert to a standard XML document.
- Returns
a string that contains the converted XML document.
- get_type_id()¶
- classmethod init(prefs)¶
Configure the DMLogPacket class with user preferences.
This method should be called before any actual decoding.
- Parameters
prefs (dict) – a dict storing the preferences
- exception mobile_insight.monitor.dm_collector.dm_endec.dm_log_packet.FormatError¶
Bases:
RuntimeError
Error in decoding messages.