summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/mobile/primitives.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-12-26 12:46:30 +0800
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-12-27 10:07:17 +0800
commita8130aba91247e07df83d2612f14d58d9a45eaa7 (patch)
treec72730d9c1edb60e2716b70a4b5a1fbca383a9be /src/host/layer23/src/mobile/primitives.c
parentf02c04f4441ae0d05f46f5fdfd1aa8181ede57a8 (diff)
mobile: Send SMS through the primitive interface
Make this symmetric and send the SMS through the primitive interface. Construct and copy the sms into the prim, store the SCA in the prim as well. In 04.11 we see we can store 2*10 digits in the destination address and a NUL. Change-Id: I91d7537f4f6ce5ba00218c58f3456947ec7bc662
Diffstat (limited to 'src/host/layer23/src/mobile/primitives.c')
-rw-r--r--src/host/layer23/src/mobile/primitives.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c
index fd486ea2..c3f28a5a 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -173,6 +173,19 @@ static int cancel_timer(struct mobile_prim_intf *intf, struct mobile_timer_param
return -1;
}
+static int send_sms(struct mobile_prim_intf *intf, struct mobile_sms_param *param)
+{
+ struct gsm_sms *sms;
+
+ sms = sms_alloc();
+ *sms = param->sms;
+
+ /* Force a NUL at the end of the string */
+ param->sca[sizeof(param->sca) - 1] = '\0';
+
+ return gsm411_tx_sms_submit(intf->ms, param->sca, sms);
+}
+
int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim)
{
int rc = 0;
@@ -184,6 +197,9 @@ int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim
case OSMO_PRIM(PRIM_MOB_TIMER_CANCEL, PRIM_OP_REQUEST):
rc = cancel_timer(intf, &prim->u.timer);
break;
+ case OSMO_PRIM(PRIM_MOB_SMS, PRIM_OP_REQUEST):
+ rc = send_sms(intf, &prim->u.sms);
+ break;
default:
LOGP(DPRIM, LOGL_ERROR, "Unknown primitive: %d\n", OSMO_PRIM_HDR(&prim->hdr));
break;