1
0
Fork 0

TestPhone: Start with a lot of stubs..

This commit is contained in:
Holger Hans Peter Freyther 2010-11-14 22:37:50 +01:00
commit 6ec4e192d3
3 changed files with 134 additions and 0 deletions

40
Messages.st Normal file
View File

@ -0,0 +1,40 @@
"Messages for GSM04.08"
Object subclass: LocationUpdatingRequest [
| imsi tmsi |
LocationUpdatingRequest class >> initWithIMSI: aImsi [
^ (self new)
imsi: aImsi;
yourself
]
LocationUpdatingRequest class >> initWithTMSI: aTmsi [
^ (self new)
tmsi: aTmsi;
yourself
]
toMessage [
]
]
Object subclass: LocationUpdatingAccept [
toMessage [
]
]
Object subclass: LocationUpdatingReject [
toMessage [
]
]
Object subclass: IdentityRequest [
toMessage [
]
]
Object subclass: IdentityResponse [
toMessage [
]
]

1
README Normal file
View File

@ -0,0 +1 @@
A simple test phone to do a LU and place a call

93
TestPhone.st Normal file
View File

@ -0,0 +1,93 @@
PackageLoader fileInPackage: 'OsmoNetwork'.
Object subclass: SCCPHadler [
<comment: 'I handle SCCP messages'>
registerOn: aDispatcher [
aDispatcher addHandler: Osmo.IPAConstants protocolSCCP
on: self with: #handleMsg.
]
handlerMsg: aMsg [
'Got a new SCCP message' printNl.
]
]
Object subclass: IPAConnection [
| socket demuxer queue muxer dispatcher sccp ipa |
IPAConnection class >> initWith: anAddr port: aPort token: aToken [
^ (self new)
socket: (Sockets.Socket remote: anAddr port: aPort);
setup: aToken;
yourself
]
socket: aSocket [
socket := aSocket.
]
setup: aToken [
demuxer := Osmo.IPADemuxer initOn: socket.
queue := SharedQueue new.
muxer := Osmo.IPAMuxer initOn: queue.
dispatcher := Osmo.IPADispatcher new.
dispatcher initialize.
sccp := SCCPHadler new.
sccp registerOn: dispatcher.
ipa := Osmo.IPAProtoHandler new.
ipa registerOn: dispatcher.
ipa muxer: muxer.
ipa token: aToken
]
serve [
[true] whileTrue: [
[
| data |
data := demuxer next.
dispatcher dispatch: data first with: data second.
self drainSendQueue.
] on: SystemExceptions.EndOfStream do: [:e | ^ false ]
]
]
drainSendQueue [
[queue isEmpty] whileFalse: [
| msg |
msg := queue next.
socket nextPutAllFlush: msg.
]
]
]
Object subclass: IPAConfig [
| socket addr port token connection |
addr: anAddr port: aPort [
addr := anAddr.
port := aPort.
]
token: aToken [
token := aToken.
]
connect [
connection := IPAConnection initWith: addr port: port token: token.
]
connection [
^ connection
]
]
Object subclass: LUOperation [
]
Object subclass: PhoneCallOperation [
]