diff options
-rw-r--r-- | BSSMAP.st | 5 | ||||
-rw-r--r-- | Messages.st | 12 | ||||
-rw-r--r-- | Tests.st | 9 |
3 files changed, 25 insertions, 1 deletions
@@ -1,6 +1,11 @@ Object subclass: GSM0808IE [ <category: 'osmo-message'> <comment: 'Base class of IEs for GSM0808'> + + type [ + "Go through the elementId of the class" + ^ self class elementId + ] ] Object subclass: GSM0808Helper [ diff --git a/Messages.st b/Messages.st index 87ffa8c..d3bb805 100644 --- a/Messages.st +++ b/Messages.st @@ -96,6 +96,18 @@ Object subclass: IEMessage [ ^ ies ] + findIE: type ifAbsent: block [ + "Find the IE with the type" + self ies do: [:each | + each type = type + ifTrue: [ + ^ each + ]. + ]. + + ^ block value. + ] + writeOn: aMsg [ <category: 'creation'> aMsg putByte: type. @@ -162,7 +162,7 @@ TestCase subclass: TestMessages [ ] testMsgParser [ - | msg bssap bssmap | + | msg bssap bssmap ies l3 | msg := MSGParser parse: #(1 154 2 0 2 2 4 2 66 254 15 32 0 30 87 5 8 0 114 244 128 16 3 156 64 23 17 5 8 @@ -175,5 +175,12 @@ TestCase subclass: TestMessages [ bssmap := bssap data. self assert: (bssmap isKindOf: IEMessage). + + ies := bssmap ies. + self assert: ies size = 2. + + l3 := bssmap findIE: (GSMLayer3Info elementId) ifAbsent: [ + self assert: false. + ]. ] ] |