summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--codec/attributes/SMPPAddressNumberingPlanIndicator.st12
-rw-r--r--codec/attributes/SMPPAddressTypeOfNumber.st12
-rw-r--r--codec/attributes/SMPPInteger.st36
-rw-r--r--codec/attributes/SMPPInterfaceVersion.st12
-rw-r--r--package.xml1
5 files changed, 48 insertions, 25 deletions
diff --git a/codec/attributes/SMPPAddressNumberingPlanIndicator.st b/codec/attributes/SMPPAddressNumberingPlanIndicator.st
index a623d72..ef05bc6 100644
--- a/codec/attributes/SMPPAddressNumberingPlanIndicator.st
+++ b/codec/attributes/SMPPAddressNumberingPlanIndicator.st
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
-Object subclass: SMPPAddressNumberingPlanIndicator [
+SMPPInteger subclass: SMPPAddressNumberingPlanIndicator [
<comment: 'I re-present 5.2.6 of SMPPv3.4'>
SMPPAddressNumberingPlanIndicator class [
@@ -72,13 +72,9 @@ Object subclass: SMPPAddressNumberingPlanIndicator [
]
SMPPAddressNumberingPlanIndicator class >> tlvDescription [
- ^Osmo.TLVDescription new
- typeKind: Osmo.TLVDescription valueOnly;
- instVarName: #addr_npi; parseClass: self;
+ ^super tlvDescription
+ instVarName: #addr_npi;
+ valueSize: 1;
yourself
]
-
- SMPPAddressNumberingPlanIndicator class >> readFrom: aStream with: anAttr [
- ^aStream next
- ]
]
diff --git a/codec/attributes/SMPPAddressTypeOfNumber.st b/codec/attributes/SMPPAddressTypeOfNumber.st
index 854fae2..bf95dd7 100644
--- a/codec/attributes/SMPPAddressTypeOfNumber.st
+++ b/codec/attributes/SMPPAddressTypeOfNumber.st
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
-Object subclass: SMPPAddressTypeOfNumber [
+SMPPInteger subclass: SMPPAddressTypeOfNumber [
<comment: 'I re-present 5.2.5 of SMPPv3.4'>
SMPPAddressTypeOfNumber class [
@@ -58,13 +58,9 @@ Object subclass: SMPPAddressTypeOfNumber [
]
SMPPAddressTypeOfNumber class >> tlvDescription [
- ^Osmo.TLVDescription new
- instVarName: #addr_ton; parseClass: self;
- typeKind: Osmo.TLVDescription valueOnly;
+ ^super tlvDescription
+ instVarName: #addr_ton;
+ valueSize: 1;
yourself
]
-
- SMPPAddressTypeOfNumber class >> readFrom: aStream with: anAttribute [
- ^aStream next
- ]
]
diff --git a/codec/attributes/SMPPInteger.st b/codec/attributes/SMPPInteger.st
new file mode 100644
index 0000000..315326c
--- /dev/null
+++ b/codec/attributes/SMPPInteger.st
@@ -0,0 +1,36 @@
+"
+ (C) 2014 by Holger Hans Peter Freyther
+ All Rights Reserved
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"
+
+Object subclass: SMPPInteger [
+ <comment: 'I help with the various kind of numbers'>
+
+ SMPPInteger class >> tlvDescription [
+ ^Osmo.TLVDescription new
+ parseClass: self;
+ typeKind: Osmo.TLVDescription valueOnly;
+ yourself
+ ]
+
+ SMPPInteger class >> readFrom: aStream with: anAttribute [
+ anAttribute valueSize = 1
+ ifTrue: [^aStream next].
+
+ "This is not implemented yet"
+ ^self error: 'The base class does not support other value sizes'.
+ ]
+]
diff --git a/codec/attributes/SMPPInterfaceVersion.st b/codec/attributes/SMPPInterfaceVersion.st
index 8725add..b2dbee3 100644
--- a/codec/attributes/SMPPInterfaceVersion.st
+++ b/codec/attributes/SMPPInterfaceVersion.st
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
-Object subclass: SMPPInterfaceVersion [
+SMPPInteger subclass: SMPPInterfaceVersion [
<comment: 'I re-present 5.2.4 of SMPPv3.4'>
SMPPInterfaceVersion class >> attrVersion34 [
@@ -24,16 +24,10 @@ Object subclass: SMPPInterfaceVersion [
^16r34
]
-
SMPPInterfaceVersion class >> tlvDescription [
- ^Osmo.TLVDescription new
- instVarName: #version; parseClass: self;
- typeKind: Osmo.TLVDescription valueOnly;
+ ^super tlvDescription
+ instVarName: #version;
valueSize: 1;
yourself
]
-
- SMPPInterfaceVersion class >> readFrom: aStream with: anAttribute [
- ^aStream next
- ]
]
diff --git a/package.xml b/package.xml
index 335b0c6..74dc6fd 100644
--- a/package.xml
+++ b/package.xml
@@ -9,6 +9,7 @@
<filein>codec/SMPPBindTransmitterBody.st</filein>
<filein>codec/attributes/SMPPOctetString.st</filein>
+ <filein>codec/attributes/SMPPInteger.st</filein>
<filein>codec/attributes/SMPPSystemId.st</filein>
<filein>codec/attributes/SMPPPassword.st</filein>
<filein>codec/attributes/SMPPSystemType.st</filein>