Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the need for the general A XDR parser. #26

Open
Krolken opened this issue Feb 18, 2021 · 0 comments
Open

Remove the need for the general A XDR parser. #26

Krolken opened this issue Feb 18, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Krolken
Copy link
Contributor

Krolken commented Feb 18, 2021

The current A XDR parser was made so that it was possible to just write a parsing config to APDUs and it would output the correct dict to create the object.

But it has proven that it is just was smoother to handparse each APDU. Some of the larger and more complex ones might be a little bit annoying but on the whole it is much clearer in the code when the parsing is done explicitly.

The use we want to keep it for is to parse dynamic DLMS data returned from meters. If we remove the general parsing and make it into a dlms response data parse we can get a smoother solution than:

def parse_as_dlms_data(data: bytes):
    data_decoder = a_xdr.AXdrDecoder(
        encoding_conf=a_xdr.EncodingConf(
            attributes=[a_xdr.Sequence(attribute_name="data")]
        )
    )
    return data_decoder.decode(data)["data"]
@Krolken Krolken self-assigned this Feb 18, 2021
@Krolken Krolken added the enhancement New feature or request label Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant