diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-11-30 09:12:49 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-12-05 10:02:08 +0100 |
commit | 4ebe933b5bf6e08b38f8fc525817e719ee6adff3 (patch) | |
tree | 32826665c00fa046a65b4f567d00c7024f26c79b /BSSMAP.st | |
parent | 9ad23782d3d8347371d9142224ce37be4c264942 (diff) |
BSSMAP: Be able to parse the CIC and ChosenChannel
These are not properly decoded yet and would need more
work to be really useful. This will happen once we will
use the IE.
Diffstat (limited to 'BSSMAP.st')
-rw-r--r-- | BSSMAP.st | 78 |
1 files changed, 78 insertions, 0 deletions
@@ -433,3 +433,81 @@ GSM0808IE subclass: GSM0808ChosenEncrIE [ aMsg putByte: algo. ] ] + +GSM0808IE subclass: GSM0808ChannelTypeIE [ + | type preferred codecs | + + GSM0808ChannelTypeIE class >> speechSpeech [ ^ 1 ] + GSM0808ChannelTypeIE class >> speechData [ ^ 2 ] + GSM0808ChannelTypeIE class >> speechSignalling [ ^ 3 ] + + "TODO: provide defs for the 3.2.2.11 ChannelType rate" + + GSM0808ChannelTypeIE class >> elementId [ ^ 11 ] + GSM0808ChannelTypeIE class >> initWith: aType audio: anAudioType codecs: codecs [ + ^ self new + type: aType; + preferred: anAudioType; + audioCodecs: codecs; + yourself + ] + + GSM0808ChannelTypeIE class >> parseFrom: aByteArray [ + ^ self initWith: (aByteArray at: 3) + audio: (aByteArray at: 4) + codecs: (aByteArray copyFrom: 5) + ] + + type [ ^ type ] + type: aType [ + type := aType + ] + + preferred [ ^ preferred ] + preferred: aPreferred [ preferred := aPreferred ] + + + "TODO: This should decode/encode the codecs" + audioCodecs [ ^ codecs ] + audioCodecs: aCodecs [ codecs := aCodecs. ] + + writeOnDirect: aMsg [ + aMsg putByte: 2 + codecs size. + aMsg putByte: type. + aMsg putByte: preferred. + aMsg putByteArray: codecs. + ] +] + +GSM0808IE subclass: GSM0808CICIE [ + | cic | + GSM0808CICIE class >> elementId [ ^ 1 ] + GSM0808CICIE class >> length: aByteArray [ ^ 2 ] + + GSM0808CICIE class >> initWith: aByteArray [ + ^ self new + cic: aByteArray; + yourself. + ] + + GSM0808CICIE class >> parseFrom: aByteArray [ + ^ self initWith: (aByteArray copyFrom: 2 to: 3) + ] + + cic [ + ^ cic + ] + + cic: aCic [ + aCic size = 2 + ifFalse: [ + ^ self error: 'CIC must be two bytes'. + ]. + + cic := aCic. + ] + + writeOnDirect: aMsg [ + aMsg putByteArray: cic. + ] +] |