[PATCH] osmo-ttcn3-hacks[master]: MNCC: Represent 'keypad' as one-character charstring, not int

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Feb 3 20:46:11 UTC 2018


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

MNCC: Represent 'keypad' as one-character charstring, not int

The MNCC Unix Domain Socket encoding uses an int here, which is
a bit odd, given that it's an ASCII / IA5 char value on the actual
GSM L3.  Let's convert from/to something useful.

Change-Id: Id17ac502ca33f4962214a3d5938d0dc29ca6ec1b
---
M library/MNCC_EncDec.cc
M library/MNCC_Types.ttcn
2 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/68/6268/1

diff --git a/library/MNCC_EncDec.cc b/library/MNCC_EncDec.cc
index 2c68cb1..fef2a40 100644
--- a/library/MNCC_EncDec.cc
+++ b/library/MNCC_EncDec.cc
@@ -155,8 +155,8 @@
 			mncc.fields |= MNCC_F_SIGNAL;
 		}
 		if (in_sig.keypad().is_value()) {
-			const INTEGER &kpd = in_sig.keypad();
-			mncc.signal = kpd;
+			const CHARSTRING &kpd = in_sig.keypad();
+			mncc.signal = (int) kpd[0].get_char();
 			mncc.fields |= MNCC_F_KEYPAD;
 		}
 		mncc.more = in_sig.more();
@@ -292,8 +292,10 @@
 			sign.ssversion() = CHARSTRING(in_mncc->ssversion.info);
 		if (in_mncc->fields & MNCC_F_CCCAP)
 			sign.cccap() = MNCC__cccap(in_mncc->cccap.dtmf, in_mncc->cccap.pcp);
-		if (in_mncc->fields & MNCC_F_KEYPAD)
-			sign.keypad() = in_mncc->keypad;
+		if (in_mncc->fields & MNCC_F_KEYPAD) {
+			char kpd[2] = { (char) in_mncc->keypad, 0 };
+			sign.keypad() = CHARSTRING(kpd);
+		}
 		if (in_mncc->fields & MNCC_F_SIGNAL)
 			sign.signal() = in_mncc->signal;
 
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index 258db3f..bc7c4e6 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -303,7 +303,7 @@
 };
 
 type int MNCC_notify (0..127);
-type int MNCC_keypad (0..127);
+type charstring MNCC_keypad length (1);
 
 type enumerated MNCC_bcap {
 	GSM_MNCC_BCAP_SPEECH	(0),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id17ac502ca33f4962214a3d5938d0dc29ca6ec1b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list