[MERGED] osmo-gsm-tester[master]: compose SMS with more descriptive text

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sat May 6 23:07:27 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: compose SMS with more descriptive text
......................................................................


compose SMS with more descriptive text

Allow tokens to be passed for SMS composition, and use that to pass MO and MT
modem names into the SMS text for easier debugging.

Change-Id: I5e0d066ffa7a4631e8568c6cd4f210627f209122
---
M src/osmo_gsm_tester/ofono_client.py
1 file changed, 7 insertions(+), 8 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/ofono_client.py b/src/osmo_gsm_tester/ofono_client.py
index 9a018e1..18ebec5 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -160,10 +160,10 @@
         else:
             self.log('Use of %r interface not implemented yet, hoping that the modem connects by itself' % I_NETREG)
 
-    def sms_send(self, to_msisdn):
+    def sms_send(self, to_msisdn, *tokens):
         if hasattr(to_msisdn, 'msisdn'):
             to_msisdn = to_msisdn.msisdn
-        sms = Sms(self.msisdn, to_msisdn)
+        sms = Sms(self.msisdn, to_msisdn, 'from ' + self.name(), *tokens)
         self.log('sending sms to MSISDN', to_msisdn, sms=sms)
         if not self.has_interface(I_SMS):
             raise RuntimeError('Modem cannot send SMS, interface not active: %r' % I_SMS)
@@ -186,16 +186,15 @@
     _last_sms_idx = 0
     msg = None
 
-    def __init__(self, from_msisdn=None, to_msisdn=None):
+    def __init__(self, from_msisdn=None, to_msisdn=None, *tokens):
         Sms._last_sms_idx += 1
         msgs = ['message nr. %d' % Sms._last_sms_idx]
-        if from_msisdn or to_msisdn:
-            msgs.append(' sent')
+        msgs.extend(tokens)
         if from_msisdn:
-            msgs.append(' from %s' % from_msisdn)
+            msgs.append('from %s' % from_msisdn)
         if to_msisdn:
-            msgs.append(' to %s' % to_msisdn)
-        self.msg = ''.join(msgs)
+            msgs.append('to %s' % to_msisdn)
+        self.msg = ', '.join(msgs)
 
     def __str__(self):
         return self.msg

-- 
To view, visit https://gerrit.osmocom.org/2497
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5e0d066ffa7a4631e8568c6cd4f210627f209122
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list