diff --git a/BSSMAP.st b/BSSMAP.st index a4ab7b4..3b69b18 100644 --- a/BSSMAP.st +++ b/BSSMAP.st @@ -511,3 +511,53 @@ GSM0808IE subclass: GSM0808CICIE [ aMsg putByteArray: cic. ] ] + +GSM0808IE subclass: GSM0808CauseIE [ + | cause | + + GSM0808CauseIE class >> elementId [ ^ 21 ] + GSM0808CauseIE class >> length: aByteArray [ ^ 1 ] + GSM0808CauseIE class >> initWith: aCause [ + ^ self new + cause: aCause; + yourself + ] + + GSM0808CauseIE class >> parseFrom: aByteArray [ + ^ self initWith: (aByteArray at: 2) + ] + + cause [ ^ cause ] + cause: aCause [ cause := aCause ] + + writeOnDirect: aMsg [ + aMsg putByte: cause. + ] +] + +GSM0808IE subclass: GSM0808SpeechVerIE [ + | speech | + + GSM0808SpeechVerIE class >> elementId [ ^ 64 ] + GSM0808SpeechVerIE class >> length: aByteArray [ ^ 1 ] + GSM0808SpeechVerIE class >> initWith: aVersion [ + ^ self new + speechVersion: aVersion; + yourself + ] + + GSM0808SpeechVerIE class >> parseFrom: aByteArray [ + ^ self initWith: (aByteArray at: 2) + ] + + speechVersion: aVersion [ + speech := aVersion + ] + + speechVersion [ ^ speech ] + + + writeOnDirect: aMsg [ + aMsg putByte: speech. + ] +] diff --git a/Tests.st b/Tests.st index 701ce9e..975c28a 100644 --- a/Tests.st +++ b/Tests.st @@ -334,5 +334,10 @@ TestCase subclass: TestMessages [ inp := #(6 0 0 72 0 1 11 0 9 1 11 3 1 10 17 1 0 20 ) asByteArray. msg := MSGParser parse: inp. self assert: msg toMessage asByteArray = inp. + + "Assignment Complete" + inp := #(6 1 3 35 0 1 11 0 9 2 21 0 33 152 44 2 64 17) asByteArray. + msg := MSGParser parse: inp. + self assert: msg toMessage asByteArray = inp. ] ]