diff --git a/GSM48.st b/GSM48.st index 23b5a03..706020c 100644 --- a/GSM48.st +++ b/GSM48.st @@ -215,6 +215,39 @@ Object subclass: GSM48MIdentity [ ] ] +Object subclass: GSM48RejectCause [ + | cause | + + GSM48RejectCause class >> createDefault [ + + ^ self new + cause: 11; + yourself. + ] + + GSM48RejectCause class >> length: aByteArray [ + ^ 1 + ] + + GSM48RejectCause class >> parseFrom: aByteArray [ + ^ self new + cause: (aByteArray at: 1); + yourself + ] + + cause [ + ^ cause + ] + + cause: aCause [ + cause := aCause. + ] + + writeOnDirect: aMsg [ + aMsg putByte: cause. + ] +] + IEMessage subclass: GSM48MSG [ diff --git a/Tests.st b/Tests.st index fd773ca..8aca17b 100644 --- a/Tests.st +++ b/Tests.st @@ -163,6 +163,20 @@ TestCase subclass: GSM48Test [ self assert: gsm imsi = imsi. ] + testRejectCause [ + | rej msg target | + target := #(11) asByteArray. + + msg := Osmo.MessageBuffer new. + rej := GSM48RejectCause createDefault. + rej writeOnDirect: msg. + self assert: msg asByteArray = target. + + self assert: (GSM48RejectCause length: target) = 1. + rej := GSM48RejectCause parseFrom: target. + self assert: rej cause = 11. + ] + testLU [ | gsm msg res |