Reading hexadecimal ascii_pdu output in send_message and read_once#247
Open
JavierEgido wants to merge 3 commits intopython-smpplib:masterfrom
Open
Reading hexadecimal ascii_pdu output in send_message and read_once#247JavierEgido wants to merge 3 commits intopython-smpplib:masterfrom
JavierEgido wants to merge 3 commits intopython-smpplib:masterfrom
Conversation
eigenein
reviewed
Feb 7, 2024
Collaborator
There was a problem hiding this comment.
There is a couple of things that I don't really like about this implementation:
- It breaks the public interface,
read_pdu()will now return a tuple. It isn't a bad thins per se, but I believe it could be implemented in a non-breaking way (1 or 2). PS. The tests also failed because of interface change - It will always perform the conversion even though vast majority of users will most likely ignore the result. The display this way can't be changed either. It would be more generic to return/forward a byte-string and leave the conversion to user
Could you adjust the implementation perhaps?
Author
There was a problem hiding this comment.
Thank you for your comments. I created some new parallel functions for read_once, read_pdu and send_message to avoid affection on already implemented systems.
pdu, submit_sm_resp = client.send_message_rawpdu
deliver_pdu = client.read_once_rawpdu()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had the need to read hexadecimal PDU responses from server.
As discussed in Read raw_pdu #242 I have done some modifications in client.py.
Now send_message and read_once functions return not only decoded PDU but also hexadecimal ASCII PDU.
Examples:
pdu, submit_sm_resp = client.send_message(...)
deliver_sm = client.read_once()
submit_sm_resp 00000019800000040000000000000002354532443736353100