smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

gsm48: Decode the Request Reference IE

This commit is contained in:
Holger Hans Peter Freyther 2012-08-24 15:31:27 +02:00
parent 7658a3ca59
commit d130ebaa5e
2 changed files with 27 additions and 0 deletions

View File

@ -318,6 +318,29 @@ GSM48SimpleData subclass: GSM48RequestReference [
<gsmName: 'requestReference'>
<gsmValueLength: 3>
ra [
<category: 'decoding'>
^ data at: 1
]
t1 [
<category: 'decoding'>
^ (data at: 2) bitShift: - 3
]
t2 [
<category: 'decoding'>
^ (data at: 3) bitAnd: 2r00011111
]
t3 [
| high low |
<category: 'decoding'>
high := (data at: 2) bitAnd: 2r111.
low := (data at: 3) bitShift: -5.
^ low bitOr: (high bitShift: 3)
]
]
GSM48DataHolder subclass: GSM48IARestOctets [

View File

@ -298,6 +298,10 @@ TestCase subclass: GSM48Test [
16r2B 16r2B 16r2B 16r2B) asByteArray.
dec := GSM48MSG decode: inp readStream.
self assert: dec type = GSM48RRImmediateAssignCommand messageType.
self assert: dec requestReference ra = 16r1A.
self assert: dec requestReference t1 = 1.
self assert: dec requestReference t2 = 15.
self assert: dec requestReference t3 = 17.
self assert: dec toMessage asByteArray = inp.
]