Move the BCD implementation to Messages.st
This commit is contained in:
parent
f02d98935d
commit
fdd716a58b
18
BSSMAP.st
18
BSSMAP.st
|
@ -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'>
|
||||
|
|
17
Messages.st
17
Messages.st
|
@ -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
|
||||
]
|
||||
]
|
||||
|
||||
|
|
Reference in New Issue