IEMessage: Pass the data with type and length...
This commit is contained in:
parent
df1afe1440
commit
711ccdf1fa
15
Messages.st
15
Messages.st
|
@ -1,21 +1,20 @@
|
|||
"General IE based message handling"
|
||||
Object subclass: DataIE [
|
||||
| type data |
|
||||
| data |
|
||||
|
||||
<category: 'osmo-messages'>
|
||||
DataIE class >> initWith: aType data: aData [
|
||||
DataIE class >> initWith: aData [
|
||||
^ self new
|
||||
type: aType;
|
||||
data: aData;
|
||||
yourself
|
||||
]
|
||||
|
||||
type [
|
||||
^ type
|
||||
^ data at: 1
|
||||
]
|
||||
|
||||
type: aType [
|
||||
type := aType.
|
||||
data at: 1 put: aType.
|
||||
]
|
||||
|
||||
data [
|
||||
|
@ -27,8 +26,6 @@ Object subclass: DataIE [
|
|||
]
|
||||
|
||||
writeOn: aMsg [
|
||||
aMsg putByte: type.
|
||||
aMsg putByte: data size.
|
||||
aMsg putByteArray: data.
|
||||
]
|
||||
]
|
||||
|
@ -48,7 +45,7 @@ Object subclass: IEMessage [
|
|||
"TODO: This needs to move some basic dispatch class"
|
||||
"Find the IE that handles the type specified"
|
||||
|
||||
^ DataIE initWith: type data: data.
|
||||
^ DataIE initWith: data.
|
||||
"
|
||||
IEBase allSubclassesDo: [:each |
|
||||
each elementId = type
|
||||
|
@ -70,7 +67,7 @@ Object subclass: IEMessage [
|
|||
| type size data |
|
||||
type := dat at: 1.
|
||||
size := dat at: 2.
|
||||
data := dat copyFrom: 3 to: 2 + size.
|
||||
data := dat copyFrom: 1 to: 2 + size.
|
||||
dat := dat copyFrom: 3 + size.
|
||||
|
||||
msg addIe: (self findIE: type with: data from: IEBase).
|
||||
|
|
Reference in New Issue