smalltalk
/
osmo-st-gsm
Archived
1
0
Fork 0

Move the BCD implementation to Messages.st

This commit is contained in:
Holger Hans Peter Freyther 2010-11-19 19:12:44 +01:00
parent f02d98935d
commit fdd716a58b
2 changed files with 17 additions and 18 deletions

View File

@ -11,24 +11,6 @@ Object subclass: GSM0808Helper [
GSM0808Helper class >> msgClearComp [ <category: 'spec'> ^ 16r21 ]
]
Object subclass: BCD [
<category: 'osmo-message'>
<comment: 'Class to deal with Binary Coded Decimals'>
BCD class >> encode: aNumber [
<category: 'access'>
| col num |
col := OrderedCollection new.
num := aNumber.
1 to: 3 do: [:each |
col add: num \\ 10.
num := num // 10.
].
^ col reverse asByteArray
]
]
Object subclass: LAI [
<category: 'osmo-message'>
<comment: 'Generate a Location Area Identifier'>

View File

@ -37,4 +37,21 @@ Object subclass: IEMessage [
]
]
Object subclass: BCD [
<category: 'osmo-message'>
<comment: 'Class to deal with Binary Coded Decimals'>
BCD class >> encode: aNumber [
<category: 'access'>
| col num |
col := OrderedCollection new.
num := aNumber.
1 to: 3 do: [:each |
col add: num \\ 10.
num := num // 10.
].
^ col reverse asByteArray
]
]