diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2018-08-29 08:27:03 +0100 |
---|---|---|
committer | Holger Freyther <holger@freyther.de> | 2018-09-16 13:51:29 +0000 |
commit | b4294471684b6b56c4c93479be7e7771f5d8a676 (patch) | |
tree | e4da5d4ffd292e1047dc8e2c9e38a235c3028e6a /src/host/layer23/src/mobile/primitives.c | |
parent | 6b8fd006d4f3f0e28f8f8b185ac2b28659faf4c0 (diff) |
lua: Expose API to trigger a network reselection
Same as the "network search" VTY command but implemented as primitive
and exposed to LUA.
Change-Id: I096233a2ca9dd7daa358cebed0523cb8c0dbf593
Diffstat (limited to 'src/host/layer23/src/mobile/primitives.c')
-rw-r--r-- | src/host/layer23/src/mobile/primitives.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/primitives.c b/src/host/layer23/src/mobile/primitives.c index aa467128..f562466a 100644 --- a/src/host/layer23/src/mobile/primitives.c +++ b/src/host/layer23/src/mobile/primitives.c @@ -20,6 +20,7 @@ #include <inttypes.h> +#include <osmocom/bb/mobile/gsm322.h> #include <osmocom/bb/mobile/primitives.h> #include <osmocom/bb/common/logging.h> @@ -191,6 +192,17 @@ static int send_sms(struct mobile_prim_intf *intf, struct mobile_sms_param *para return gsm411_tx_sms_submit(intf->ms, param->sca, sms); } +static int network_reselect(struct mobile_prim_intf *intf) +{ + struct msgb *nmsg; + + nmsg = gsm322_msgb_alloc(GSM322_EVENT_USER_RESEL); + if (!nmsg) + return -1; + gsm322_plmn_sendmsg(intf->ms, nmsg); + return 0; +} + int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim) { int rc = 0; @@ -205,6 +217,9 @@ int mobile_prim_intf_req(struct mobile_prim_intf *intf, struct mobile_prim *prim case OSMO_PRIM(PRIM_MOB_SMS, PRIM_OP_REQUEST): rc = send_sms(intf, &prim->u.sms); break; + case OSMO_PRIM(PRIM_MOB_NETWORK_RESELECT, PRIM_OP_REQUEST): + rc = network_reselect(intf); + break; default: LOGP(DPRIM, LOGL_ERROR, "Unknown primitive: %d\n", OSMO_PRIM_HDR(&prim->hdr)); break; |