From dfa26b01fc93d5fb7b9a115f1ac8b23b884fccea Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 10 Aug 2012 17:03:23 +0200 Subject: [PATCH] oml: New approach to the init. We will have separate processes We start with a SM process, that will spawn the BTS process which will spawn... communication will occur through queues, dispatching will happen through the OML queue. --- fakebts/OML.st | 33 +++++++++++++++-- fakebts/OMLInit.st | 79 ++++++++++++++++++++++++++++++++++------- fakebts/OMLMsg.st | 88 ++++++++++++++++++++++++++++++++++++++++++++-- fakebts/Test.st | 10 ++++++ 4 files changed, 192 insertions(+), 18 deletions(-) diff --git a/fakebts/OML.st b/fakebts/OML.st index 9523258..6ec97f0 100644 --- a/fakebts/OML.st +++ b/fakebts/OML.st @@ -88,6 +88,11 @@ Object subclass: OMLManagerBase [ ^ attributes at: 'Availability Status' ifAbsent: [nil]. ] + administrativeState [ + + ^ attributes at: 'Administrative State' ifAbsent: [nil]. + ] + createStateChange [ @@ -98,8 +103,7 @@ Object subclass: OMLManagerBase [ objectInstance: self fomInstance; operationalState: self operationalState; availabilityStatus: self availabilityStatus; - administrativeState: - (attributes at: 'Administrative State' ifAbsent: [nil]); + administrativeState: self administrativeState; yourself); yourself. ] @@ -150,6 +154,16 @@ Object subclass: OMLManagerBase [ initializeAttributes; sendStateChanged. ] + + basicOpstart [ + + self operationalState state: OMLOperationalState enabled. + self availabilityStatus state: nil. + ] + + opstart [ + ^ self basicOpstart + ] ] OMLManagerBase subclass: SiteManagerOML [ @@ -254,6 +268,15 @@ OMLManagerBase subclass: SiteManagerOML [ swActivated := true. ] + opstart [ + + (swActivated not or: [swLoaded not]) + ifTrue: [^false]. + + self basicOpstart. + ^ true + ] + siteManager [ ^ self @@ -270,6 +293,12 @@ OMLManagerBase subclass: SiteManagerOML [ bts: 16rFF trx: 16rFF ts: 16rFF; yourself ] + + findObject: anInstance [ + ^ anInstance = self fomInstance + ifTrue: [self] + ifFalse: [bts findObject: anInstance]. + ] ] OMLManagerBase subclass: BTSOML [ diff --git a/fakebts/OMLInit.st b/fakebts/OMLInit.st index 7856b7d..0b1722f 100644 --- a/fakebts/OMLInit.st +++ b/fakebts/OMLInit.st @@ -19,7 +19,7 @@ "Attempt to have the OMLinit as a imperative routine" Object subclass: OMLBTSInit [ - | sm bts | + | sm bts queues smStarted | aMsg putByte: bts; putByte: trx; putByte: ts. ] + + = anInstance [ + + bts = anInstance bts + ifFalse: [^false]. + trx = anInstance trx + ifFalse: [^false]. + ts = anInstance ts + ifFalse: [^false]. + + ^ true + ] + + hash [ + + ^ ((bts bitShift: 16) + (trx bitShift: 8) + ts) hash + ] ] Object subclass: OMLAttribute [ @@ -305,9 +323,13 @@ OMLAttribute subclass: OMLAvailabilityStatus [ writeOn: aMsg [ - aMsg - putLen16: 1; - putByte: state + state isNil + ifTrue: [ + aMsg putLen16: 0] + ifFalse: [ + aMsg + putLen16: 1; + putByte: state]. ] ] @@ -576,6 +598,21 @@ Object subclass: OMLMessageBase [ ^ 16r0F ] + + msgOpstart [ + + ^ 16r74 + ] + + msgOpstartAck [ + + ^ 16r75 + ] + + msgOpstartNack [ + + ^ 16r76 + ] ] OMLMessageBase class >> parse: aStream [ @@ -658,6 +695,18 @@ OMLMessageBase subclass: FOMMessage [ omDataField: om_field createAck; yourself ] + + createNack [ + + ^ self notImplementedYet + ] + + createResponse: aResponse [ + + ^ aResponse + ifTrue: [self createAck] + ifFalse: [self createNack]. + ] ] Object subclass: OMLDataField [ @@ -920,3 +969,36 @@ OMLDataField subclass: OMLSWActivatedReport [ ^ #() ] ] + +OMLDataField subclass: OMLOpstart [ + + + + OMLOpstart class >> attributeType [ + + ^ FOMMessage msgOpstart + ] + + OMLOpstart class >> tlvDescription [ + + ^ #() + ] + + createAck [ + + ^ OMLOpstartAck new + objectClass: self objectClass; + objectInstance: self objectInstance; + yourself + ] +] + +OMLOpstart subclass: OMLOpstartAck [ + + + + OMLOpstartAck class >> attributeType [ + + ^ FOMMessage msgOpstartAck + ] +] diff --git a/fakebts/Test.st b/fakebts/Test.st index d86d5e5..a2ffcb3 100644 --- a/fakebts/Test.st +++ b/fakebts/Test.st @@ -144,6 +144,10 @@ TestCase subclass: OMLMsgTest [ ^ #(128 128 0 18 14 0 255 255 255 66 18 0 3 1 2 3 19 0 3 3 4 5) ] + opStartData [ + ^ #(128 128 0 5 116 0 255 255 255) + ] + testFomMessage [ | oml | @@ -203,6 +207,12 @@ TestCase subclass: OMLMsgTest [ nack := oml createAck. self assert: nack toMessage asByteArray = self activationRequestDataAck asByteArray. ] + + testOpStart [ + | oml | + oml := OMLMessageBase parse: self opStartData readStream. + self assert: self opStartData asByteArray = oml toMessage asByteArray + ] ] TestCase subclass: TLVDescriptionTest [