From e70adb15dbfe2f4de1fd86f46369ead948e47619 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 30 Nov 2010 21:25:47 +0100 Subject: [PATCH] GSM: Implement handling the GSM Alerting messages.. --- GSM48.st | 28 ++++++++++++++++++++++++++++ Tests.st | 5 +++++ 2 files changed, 33 insertions(+) diff --git a/GSM48.st b/GSM48.st index 04dc460..73d483c 100644 --- a/GSM48.st +++ b/GSM48.st @@ -643,6 +643,8 @@ IEMessage subclass: GSM48MSG [ "TODO: Complain if we have not consumed everything" dat size = 0 ifFalse: [ + res inspect. + dat printNl. self error: 'Every byte should be consumed'. ]. @@ -724,6 +726,7 @@ GSM48MSG subclass: GSM48CCMessage [ GSM48CCMessage class >> classType [ ^ 16r3 ] + GSM48CCMessage class >> msgAlerting [ ^ 16r1 ] GSM48CCMessage class >> msgProceeding [ ^ 16r2 ] GSM48CCMessage class >> msgSetup [ ^ 16r5 ] @@ -1000,6 +1003,30 @@ GSM48CCMessage subclass: GSM48CCProceeding [ ] ] +GSM48CCMessage subclass: GSM48CCAlerting [ + + Mandantory := nil. + Optional := nil. + + GSM48CCAlerting class >> messageType [ ^ self msgAlerting ] + GSM48CCAlerting class >> Mandantory [ + ^ Mandantory ifNil: [ Mandantory := OrderedCollection new ] + ] + + GSM48CCAlerting class >> Optional [ + ^ Optional ifNil: [ Optional := OrderedCollection new ] + ] + + GSM48CCAlerting class >> initialize [ + self addOptional: 'facility' with: GSMFacility. + self addOptional: 'progress' with: GSMProgress. + self addOptional: 'useruser' with: GSMUserUser. + + "mobile station to network" + self addOptional: 'ssVersion' with: GSMSSVersionInd. + ] +] + Eval [ GSM48LURequest initialize. GSM48LUReject initialize. @@ -1013,4 +1040,5 @@ Eval [ GSM48CCSetup initialize. GSM48CCProceeding initialize. + GSM48CCAlerting initialize. ] diff --git a/Tests.st b/Tests.st index aed92af..34a53ce 100644 --- a/Tests.st +++ b/Tests.st @@ -354,5 +354,10 @@ TestCase subclass: TestMessages [ inp := #(6 0 0 72 0 1 5 1 0 2 131 2) asByteArray. msg := MSGParser parse: inp. self assert: msg toMessage asByteArray = inp. + + "Alerting" + inp := #(6 0 0 72 0 1 9 1 0 6 131 1 30 2 234 129) asByteArray. + msg := MSGParser parse: inp. + self assert: msg toMessage asByteArray = inp. ] ]