1
0
Fork 0

GSM48: Move the helper class up in the file

This commit is contained in:
Holger Hans Peter Freyther 2010-11-26 22:41:54 +01:00
parent 6c5ef4439d
commit 67e54da19c
1 changed files with 63 additions and 62 deletions

125
GSM48.st
View File

@ -18,6 +18,69 @@ Object subclass: GSM48IE [
]
]
GSM48IE subclass: GSM48SimpleData [
| data |
<category: 'osmo-meesage'>
<comment: 'I am the base for some simple data encapsulated'>
GSM48SimpleData class >> initWithData: aData [
^ self new
data: aData;
yourself.
]
GSM48SimpleData class >> length: aByteArray [
^ self length
]
GSM48SimpleData class >> createDefault [
^ self new
data: (ByteArray new: self length);
yourself
]
GSM48SimpleData class >> parseFrom: aByteArray [
| dat |
self length = 0
ifTrue: [
dat := ByteArray new.
]
ifFalse: [
dat := aByteArray copyFrom: 1 to: self length.
].
^ self new
data: dat;
yourself
]
data [
^ data
]
data: aData [
aData size = self class length
ifFalse: [
Error signal: 'DATA needs to be ', self class length asString, ' long.',
'But it was ', aData size asString, ' long.'.
].
data := aData.
]
writeOnDirect: aMsg [
aMsg putByteArray: data.
]
writeOn: aMsg [
"Write a TV"
aMsg putByte: self class elementId.
self writeOnDirect: aMsg
]
]
GSM48IE subclass: GSM48KeySeqLuType [
<category: 'osmo-message'>
| val |
@ -232,68 +295,6 @@ GSM48IE subclass: GSM48MIdentity [
]
]
GSM48IE subclass: GSM48SimpleData [
| data |
<category: 'osmo-meesage'>
<comment: 'I am the base for some simple data encapsulated'>
GSM48SimpleData class >> initWithData: aData [
^ self new
data: aData;
yourself.
]
GSM48SimpleData class >> length: aByteArray [
^ self length
]
GSM48SimpleData class >> createDefault [
^ self new
data: (ByteArray new: self length);
yourself
]
GSM48SimpleData class >> parseFrom: aByteArray [
| dat |
self length = 0
ifTrue: [
dat := ByteArray new.
]
ifFalse: [
dat := aByteArray copyFrom: 1 to: self length.
].
^ self new
data: dat;
yourself
]
data [
^ data
]
data: aData [
aData size = self class length
ifFalse: [
Error signal: 'DATA needs to be ', self class length asString, ' long.',
'But it was ', aData size asString, ' long.'.
].
data := aData.
]
writeOnDirect: aMsg [
aMsg putByteArray: data.
]
writeOn: aMsg [
"Write a TV"
aMsg putByte: self class elementId.
self writeOnDirect: aMsg
]
]
GSM48SimpleData subclass: GSM48RejectCause [
GSM48RejectCause class >> createDefault [