[PATCH] osmocom-bb[master]: mobile: Inform the primitive layer about status and new sms

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/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sun Nov 19 15:23:51 UTC 2017


Review at  https://gerrit.osmocom.org/4932

mobile: Inform the primitive layer about status and new sms

Inform the layer about new SMS and inform about the cause of
it. In both cases pass the SMS.

Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161
---
M src/host/layer23/include/osmocom/bb/mobile/primitives.h
M src/host/layer23/src/mobile/gsm411_sms.c
M src/host/layer23/src/mobile/primitives.c
3 files changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/32/4932/1

diff --git a/src/host/layer23/include/osmocom/bb/mobile/primitives.h b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
index eda0e83..9a66994 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/primitives.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
@@ -14,6 +14,7 @@
 	PRIM_MOB_TIMER_CANCEL,
 	PRIM_MOB_STARTED,
 	PRIM_MOB_SHUTDOWN,
+	PRIM_MOB_SMS,
 };
 
 struct mobile_prim_intf {
@@ -53,9 +54,22 @@
 	int new_state;
 };
 
+/**
+ * SMS related configs.
+ */
+struct mobile_sms_prim {
+	struct osmo_prim_hdr hdr;
+	struct gsm_sms *sms;
+
+	bool cause_valid;
+	int cause;
+};
+
 struct mobile_prim_intf *mobile_prim_intf_alloc(struct osmocom_ms *ms);
 int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct osmo_prim_hdr *hdr);
 void mobile_prim_intf_free(struct mobile_prim_intf *intf);
 
 void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started);
 void mobile_prim_ntfy_shutdown(struct osmocom_ms *ms, int old_state, int new_state);
+void mobile_prim_ntfy_sms_new(struct osmocom_ms *ms, struct gsm_sms *sms);
+void mobile_prim_ntfy_sms_status(struct osmocom_ms *ms, struct gsm_sms *sms, uint8_t cause);
diff --git a/src/host/layer23/src/mobile/gsm411_sms.c b/src/host/layer23/src/mobile/gsm411_sms.c
index 73fad84..21b416a 100644
--- a/src/host/layer23/src/mobile/gsm411_sms.c
+++ b/src/host/layer23/src/mobile/gsm411_sms.c
@@ -40,6 +40,7 @@
 #include <osmocom/gsm/gsm0411_utils.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/bb/mobile/vty.h>
+#include <osmocom/bb/mobile/primitives.h>
 
 #define UM_SAPI_SMS 3
 
@@ -129,6 +130,7 @@
 		vty_notify(ms, "SMS to %s failed: %s\n", sms->address,
 			get_value_string(gsm411_rp_cause_strs, cause));
 
+	mobile_prim_ntfy_sms_status(ms, sms, cause);
 	return 0;
 }
 /*
@@ -186,6 +188,8 @@
 	char vty_text[sizeof(gsms->text)], *p;
 	FILE *fp;
 
+	mobile_prim_ntfy_sms_new(ms, gsms);
+
 	/* remove linefeeds and show at VTY */
 	strcpy(vty_text, gsms->text);
 	for (p = vty_text; *p; p++) {
diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c
index 3cc3133..f7c3d37 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -120,6 +120,28 @@
 	dispatch(ms, &prim.hdr);
 }
 
+void mobile_prim_ntfy_sms_new(struct osmocom_ms *ms, struct gsm_sms *sms)
+{
+	struct mobile_sms_prim prim = { 0, };
+
+	osmo_prim_init(&prim.hdr, 0, PRIM_MOB_SMS, PRIM_OP_INDICATION, NULL);
+	prim.sms = sms;
+
+	dispatch(ms, &prim.hdr);
+}
+
+void mobile_prim_ntfy_sms_status(struct osmocom_ms *ms, struct gsm_sms *sms, uint8_t cause)
+{
+	struct mobile_sms_prim prim = { 0, };
+
+	osmo_prim_init(&prim.hdr, 0, PRIM_MOB_SMS, PRIM_OP_INDICATION, NULL);
+	prim.sms = sms;
+	prim.cause_valid = true;
+	prim.cause = cause;
+
+	dispatch(ms, &prim.hdr);
+}
+
 static int cancel_timer(struct mobile_prim_intf *intf, struct mobile_timer_prim *prim)
 {
 	struct timer_closure *closure;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7ab34b1b85b62ef0e8fff347adccbc5dc414161
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>



More information about the gerrit-log mailing list