Skip to content

Instantly share code, notes, and snippets.

@esavchenkov
Forked from FinnWoelm/read-text-message.sh
Created July 6, 2023 06:06
Show Gist options
  • Save esavchenkov/35bd1e3ba027e2bf8f18e314dd1ffef5 to your computer and use it in GitHub Desktop.
Save esavchenkov/35bd1e3ba027e2bf8f18e314dd1ffef5 to your computer and use it in GitHub Desktop.

Revisions

  1. @FinnWoelm FinnWoelm revised this gist Dec 27, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions read-text-message.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    # Full instructions: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html
    # Examples: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html#examples
    # Supported modems: https://www.freedesktop.org/wiki/Software/ModemManager/SupportedDevices/

    # Get list of connected modems.
    mmcli --list-modems
    # Output:
  2. @FinnWoelm FinnWoelm created this gist Dec 27, 2019.
    30 changes: 30 additions & 0 deletions read-text-message.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # Get list of connected modems.
    mmcli --list-modems
    # Output:
    # Found 1 modems:
    # /org/freedesktop/ModemManager1/Modem/1 [huawei] E3531
    # The number at the end of the path is the modem index.
    # In this case, that's the 1. We will use that to target
    # the modem in all future commands:
    # mmcli -m 1 ...

    # Get list of received text messages
    mmcli --modem 1 --messaging-list-sms
    # Output:
    # Found 1 SMS messages:
    # /org/freedesktop/ModemManager1/SMS/0 (received)
    # The number at the end of the path is the SMS index.

    # Display the received text message
    mmcli --modem 1 --sms 0
    # Output:
    # SMS '/org/freedesktop/ModemManager1/SMS/0'
    # -----------------------------------
    # Content | number: '+3376660xxxx'
    # | text: 'Hello Finn'
    # -----------------------------------
    # Properties | PDU type: 'deliver'
    # | state: 'received'
    # | storage: 'me'
    # | smsc: '+3369500xxxx'
    # | timestamp: '191227144612+01'