" (C) 2010-2012 by Holger Hans Peter Freyther All Rights Reserved This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . " SCCPGlobalTitle subclass: SCCPGlobalTitleTranslation [ | trans plan nature addr | SCCPGlobalTitleTranslation class >> subType [ ^ 4 ] SCCPGlobalTitleTranslation class >> initWith: data [ | enc | enc := (data at: 2) bitAnd: 16r0F. ^ self new translation: (data at: 1); plan: (((data at: 2) bitAnd: 16rF0) bitShift: -4); nature: ((data at: 3) bitAnd: 16r7F); addr: (self parseAddr: (data copyFrom: 4) encoding: enc); yourself ] translation [ ^ trans ifNil: [ 0 ] ] translation: aTrans [ trans := aTrans ] plan [ ^ plan ] plan: aPlan [ plan := aPlan ] encoding [ ^addr size odd ifTrue: [1] ifFalse: [2] ] nature [ ^ nature ] nature: aNai [ nature := aNai ] address [ ^addr ] addr [ ^self address ] addr: anAddr [ addr := anAddr ] asByteArray [ | data | data := OrderedCollection new. "write the header" data add: self translation. data add: ((plan bitShift: 4) bitOr: self encoding). data add: nature. "encode the number" SCCPGlobalTitle formatAddr: addr on: data. ^ data asByteArray ] ]