GSM48: Move the helper class up in the file
This commit is contained in:
parent
6c5ef4439d
commit
67e54da19c
125
GSM48.st
125
GSM48.st
|
@ -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 [
|
||||
|
|
Reference in New Issue