Received SMS with python

Colin Helliwell colin.helliwell at ln-systems.com
Fri Sep 22 13:26:58 UTC 2017


> On 21 September 2017 at 11:54 Colin Helliwell <colin.helliwell at ln-systems.com> wrote:
> 
> > On 19 September 2017 at 17:39 Aleksander Morgado <aleksander at aleksander.es> wrote:
> > 
> > ...
> > 
> > Another (better?) option would be to listen to updates in the
> > "Messages" property itself. E.g. just
> > msging.connect('notify::messages',...) and setup a callback that will
> > get called any time the Messages property is updated (and you can call
> > list_sync() inside the callback). If you get a clean example with that
> > logic we could add it to the examples/ directory in git ;)
> 
> A first attempt attached - any critique welcome! (especially w.r.t. cleanup or race hazards etc)
> 
> I notice that I get the callback if the modem is disabled, but not when it is re-enabled? Perhaps I'm missing something there, or perhaps it doesn't matter?
> Also, I'm seeing a message come and go - somewhere around deleting a message and/or disabling/reenabling the modem. At first I thought it was being deleted, but it does seem to reappear at a later point. I've not yet pinned down a repeatable sequence (or even 100% convinced myself I'm not imagining it).
> 
> Next step would be to copy the messages and then delete from the modem (to avoid filling the me storage) - since the actual processing of them may take some time. I'd prefer to copy the whole Sms object rather than just, say, the text - what's a safe way to do that, across all eventualites?

So, I've been looking for a way to copy/clone a whole ModemManager.Sms, but haven't been able to find anything in the API (?), so I've fallen back on copying out the essential 'properties' instead.

I'm now deleting the messages [in the modem] after copying, and find that - in the start-up case - I also get a 'notify::messages' callback when *deleting* messages. Is there a way to examine deeper the detail of the notification?


More information about the ModemManager-devel mailing list