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

Add long sms concat info for received sms #73

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yurenchen000
Copy link

COPY from faucamp#93


Add concat property for ReceivedSms:

  • Get Concantion from pdu smsDict['udh']
  • Update examples/sms_handler_demo.py

test output of sms_handler_demo.py

== SMS message received ==
From: +8613400000000
Time: 2018-04-13 20:00:02+08:00
concat: {}
Message:
hello, no concat

== SMS message received ==
From: +8613400000000
Time: 2018-04-13 20:00:08+08:00
concat: {'reference': 21, 'number': 2, 'parts': 2, 'dataLength': 3, 'data': [21, 2, 2], 'id': 0}
Message:
test mesage, part 2 of 2

add `concat` property for received sms
//get Concantion from pdu `smsDict['udh']`
Add `concat` property for `ReceivedSms`:
  - Get Concantion from pdu `smsDict['udh']`
  - Update examples/sms_handler_demo.py
@@ -18,7 +18,9 @@
from gsmmodem.modem import GsmModem

def handleSms(sms):
print(u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text))
# long sms Concatenation support: reference, parts, number
concat = sms.concat.__dict__ if sms.concat else {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to have this line here?
Could you move this logic to the module?
Just thinking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this process just for print purpose,
in GsmModem, the sms.concat property will be:

  • dict (for long sms)
  • None (for normal sms)

I think None is more clear than {} for normal sms 's concat info,

what do you think about it?

@babca
Copy link
Owner

babca commented Mar 12, 2019

There is a small conflict to resolve. Do you feel you can resolve it? (I'm sure you can, the conflicts seem pretty self-explanatory.)

Copy link
Collaborator

@lcnittl lcnittl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your additions!

I have now resolved the merge conflict - if you please could confirm, @yurenchen000, that those changes reflect your proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants