GSM48: Parse the reject cause properly
This commit is contained in:
parent
5a4cb78826
commit
f396be9541
33
GSM48.st
33
GSM48.st
|
@ -215,6 +215,39 @@ Object subclass: GSM48MIdentity [
|
|||
]
|
||||
]
|
||||
|
||||
Object subclass: GSM48RejectCause [
|
||||
| cause |
|
||||
|
||||
GSM48RejectCause class >> createDefault [
|
||||
<category: 'creation'>
|
||||
^ 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 [
|
||||
<category: 'osmo-message'>
|
||||
|
|
14
Tests.st
14
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 |
|
||||
|
||||
|
|
Reference in New Issue