Messages: Introduce a ChosenChannel IE, the first TV
Make GSM0808IE>>#length: return the length of the payload including the length field if it is present. This is done to be able to support a Tag only IE in the future.
This commit is contained in:
parent
a57c26261c
commit
892d4d19ab
28
BSSMAP.st
28
BSSMAP.st
|
@ -3,7 +3,7 @@ IEBase subclass: GSM0808IE [
|
|||
<comment: 'Base class of IEs for GSM0808'>
|
||||
|
||||
GSM0808IE class >> length: aByteArray [
|
||||
^ (aByteArray at: 2).
|
||||
^ (aByteArray at: 2) + 1.
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -241,3 +241,29 @@ GSM0808IE subclass: GSMCauseIE [
|
|||
aMsg putByte: cause.
|
||||
]
|
||||
]
|
||||
|
||||
GSM0808IE subclass: GSM0808ChosenChannel [
|
||||
| channel |
|
||||
|
||||
GSM0808ChosenChannel class >> elementId [ ^ 33 ]
|
||||
GSM0808ChosenChannel class >> initWith: aChannel [
|
||||
^ self new
|
||||
channel: aChannel;
|
||||
yourself
|
||||
]
|
||||
|
||||
GSM0808ChosenChannel class >> length: aByteArray [
|
||||
^ 1
|
||||
]
|
||||
|
||||
GSM0808ChosenChannel class >> parseFrom: aByteArray [
|
||||
^ self initWith: (aByteArray at: 2).
|
||||
]
|
||||
|
||||
channel [ ^ channel ]
|
||||
channel: aChannel [ channel := aChannel ]
|
||||
|
||||
writeOnDirect: aMsg [
|
||||
aMsg putByte: channel
|
||||
]
|
||||
]
|
||||
|
|
|
@ -41,9 +41,9 @@ Object subclass: IEMessage [
|
|||
ifTrue: [
|
||||
| enc size |
|
||||
size := each length: data.
|
||||
enc := data copyFrom: 1 to: 2 + size.
|
||||
enc := data copyFrom: 1 to: 1 + size.
|
||||
aMsg addIe: (each parseFrom: enc).
|
||||
^ 2 + size
|
||||
^ 1 + size
|
||||
].
|
||||
].
|
||||
|
||||
|
|
Reference in New Issue