2010-12-14 02:03:20 +00:00
|
|
|
"
|
|
|
|
(C) 2010 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 <http://www.gnu.org/licenses/>.
|
|
|
|
"
|
|
|
|
|
2010-12-11 08:45:25 +00:00
|
|
|
PackageLoader fileInPackage: 'Iliad-Core'.
|
2010-12-12 09:38:57 +00:00
|
|
|
PackageLoader fileInPackage: 'Iliad-More-Comet'.
|
2010-12-11 11:21:07 +00:00
|
|
|
PackageLoader fileInPackage: 'Iliad-More-Formula'.
|
2010-12-11 08:45:25 +00:00
|
|
|
PackageLoader fileInPackage: 'Iliad-Swazoo'.
|
|
|
|
|
2010-12-15 11:36:17 +00:00
|
|
|
PackageLoader fileInPackage: 'OsmoGSM'.
|
2010-12-11 08:45:25 +00:00
|
|
|
FileStream fileIn: 'GSMDriver.st'.
|
2010-12-11 11:21:07 +00:00
|
|
|
FileStream fileIn: 'TestPhone.st'.
|
2010-12-11 08:45:25 +00:00
|
|
|
|
|
|
|
Iliad.ILWidget subclass: ServerConfigWidget [
|
2010-12-12 09:38:57 +00:00
|
|
|
initialize [
|
|
|
|
super initialize.
|
|
|
|
]
|
|
|
|
|
2010-12-11 08:45:25 +00:00
|
|
|
contents [
|
|
|
|
^ [:e |
|
2010-12-11 11:21:07 +00:00
|
|
|
self application gsmServer isConnected
|
|
|
|
ifTrue: [
|
|
|
|
e text: 'The A link is connected to the MSC'.
|
|
|
|
]
|
|
|
|
ifFalse: [
|
|
|
|
e text: 'The A link is not connected: '.
|
|
|
|
e a
|
|
|
|
text: 'Connect';
|
|
|
|
action: [self connectServer]
|
|
|
|
].
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
]
|
2010-12-11 11:21:07 +00:00
|
|
|
|
|
|
|
connectServer [
|
|
|
|
(self application gsmServer)
|
|
|
|
connect;
|
|
|
|
serve.
|
|
|
|
]
|
2010-12-12 09:38:57 +00:00
|
|
|
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
Iliad.ILWidget subclass: PhoneConfigWidget [
|
2010-12-11 11:21:07 +00:00
|
|
|
configFormOn: anItem [
|
|
|
|
| form |
|
2010-12-11 08:45:25 +00:00
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
form := ILFormula on: anItem.
|
|
|
|
(form inputOn: #imsi)
|
|
|
|
labelContents: [:e | e span text: 'IMSI' ].
|
|
|
|
(form inputOn: #auKey)
|
|
|
|
labelContents: [:e | e span text: 'AuKey' ].
|
|
|
|
^ form
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
configurePhone [
|
|
|
|
self lightbox: ((self configFormOn: self session gsmConfig)
|
|
|
|
addMessage: [:e | e h2: 'Configure Test Phone'];
|
|
|
|
yourself)
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
contents [
|
|
|
|
^ [:e | e a text: 'Configure phone'; action: [self configurePhone]].
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-12 09:39:57 +00:00
|
|
|
Iliad.ILWidget subclass: ErrorWidget [
|
|
|
|
| reason |
|
|
|
|
|
|
|
|
ErrorWidget class >> initWith: anError [
|
|
|
|
^ self new
|
|
|
|
reason: anError;
|
|
|
|
yourself
|
|
|
|
]
|
|
|
|
|
|
|
|
reason: aReason [
|
|
|
|
reason := aReason.
|
|
|
|
]
|
|
|
|
|
|
|
|
contents [
|
|
|
|
^ [:e | e text: reason ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
Iliad.ILWidget subclass: ProcedureWidget [
|
|
|
|
runProcedure: aBlock name: aName[
|
2011-06-15 23:45:47 +00:00
|
|
|
| conn |
|
2010-12-12 09:39:57 +00:00
|
|
|
[
|
2011-06-15 23:45:47 +00:00
|
|
|
conn := aBlock value.
|
|
|
|
conn openConnection.
|
|
|
|
self session procedures add: conn.
|
2010-12-12 15:03:37 +00:00
|
|
|
self application procedures markDirty.
|
2010-12-12 09:39:57 +00:00
|
|
|
] on: Exception do: [:e |
|
|
|
|
self lightbox: (ErrorWidget initWith: aName, ' could not be started.')
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
ProcedureWidget subclass: LUWidget [
|
2010-12-11 08:45:25 +00:00
|
|
|
contents [
|
|
|
|
^ [:e |
|
2010-12-11 11:21:07 +00:00
|
|
|
e a
|
|
|
|
text: 'Start LU';
|
|
|
|
action: [self doLU]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
doLU [
|
2010-12-12 09:39:57 +00:00
|
|
|
self runProcedure: [self application gsmServer doLU: self session gsmConfig] name: 'LU'
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-12 09:39:57 +00:00
|
|
|
ProcedureWidget subclass: CallWidget [
|
2010-12-11 08:45:25 +00:00
|
|
|
contents [
|
2010-12-11 11:33:44 +00:00
|
|
|
^[:e |
|
|
|
|
e form build: [:form |
|
|
|
|
form input action: [:val | self placeCall: val].
|
|
|
|
form button text: 'Call']
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
placeCall: aNumber [
|
2010-12-13 04:26:28 +00:00
|
|
|
self runProcedure: [self application gsmServer doCallNumber: self session gsmConfig nr: aNumber] name: 'Call'
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
2010-12-11 11:21:07 +00:00
|
|
|
]
|
2010-12-11 08:45:25 +00:00
|
|
|
|
2011-04-01 11:16:02 +00:00
|
|
|
ProcedureWidget subclass: USSDWidget [
|
|
|
|
contents [
|
|
|
|
^[:e |
|
|
|
|
e form build: [:form |
|
|
|
|
form input action: [:val | self doUSSD: val].
|
|
|
|
form button text: 'USSD']
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
doUSSD: aNumber [
|
|
|
|
self runProcedure: [self application gsmServer doUSSD: self session gsmConfig nr: aNumber] name: 'USSD'.
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-12 15:03:37 +00:00
|
|
|
Iliad.ILWidget subclass: ProcedureWidget [
|
|
|
|
showStatus: item on: form [
|
|
|
|
| status |
|
2011-06-15 23:45:47 +00:00
|
|
|
status := item isComplete
|
2010-12-12 15:03:37 +00:00
|
|
|
ifTrue: [
|
2011-06-15 23:45:47 +00:00
|
|
|
item mainProc success
|
|
|
|
ifTrue: [item mainProc name, ' completed with success']
|
|
|
|
ifFalse: [item mainProc name, ' completed with failure'].
|
2010-12-12 15:03:37 +00:00
|
|
|
]
|
|
|
|
ifFalse: [
|
2011-06-15 23:45:47 +00:00
|
|
|
item mainProc name, ' in-progress'
|
2010-12-12 15:03:37 +00:00
|
|
|
].
|
|
|
|
|
|
|
|
form text: status.
|
|
|
|
form button
|
|
|
|
text: 'Remove';
|
2010-12-13 04:32:41 +00:00
|
|
|
action: [self markDirty.
|
2011-06-15 23:45:47 +00:00
|
|
|
item isComplete
|
2010-12-13 04:32:41 +00:00
|
|
|
ifFalse: [
|
2011-06-15 23:45:47 +00:00
|
|
|
item sendClearRequest.
|
2010-12-13 04:32:41 +00:00
|
|
|
].
|
|
|
|
self session procedures remove: item.].
|
2010-12-12 15:03:37 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
contents [
|
|
|
|
^ [:e | | procs |
|
|
|
|
e a
|
|
|
|
action: [self markDirty];
|
|
|
|
text: 'Refresh Procedures'.
|
|
|
|
|
|
|
|
procs := self session procedures.
|
|
|
|
procs do: [:each |
|
|
|
|
e form build: [:form |
|
|
|
|
self showStatus: each on: form.]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
Iliad.ILSession subclass: GSMTestphoneSession [
|
|
|
|
| user gsmConfig procedures |
|
2010-12-11 08:45:25 +00:00
|
|
|
|
2010-12-11 11:30:46 +00:00
|
|
|
isAuthenticated [
|
|
|
|
^ user = 'toto-user'
|
|
|
|
]
|
|
|
|
|
|
|
|
username: aUser [
|
|
|
|
user := aUser.
|
|
|
|
]
|
2010-12-11 11:21:07 +00:00
|
|
|
|
|
|
|
gsmConfig [ ^ gsmConfig ifNil: [gsmConfig := PhoneConfig new. ]]
|
|
|
|
procedures [ ^ procedures ifNil: [procedures := OrderedCollection new]]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
Iliad.ILApplication subclass: GSMTestphoneApp [
|
2011-04-01 11:16:02 +00:00
|
|
|
| config call lu serverConfig gsmServer procedureWidget ussd |
|
2010-12-11 08:45:25 +00:00
|
|
|
GSMTestphoneApp class >> path [ ^ 'testphone' ]
|
|
|
|
|
2010-12-11 11:21:07 +00:00
|
|
|
GSMTestphoneApp class >> initialize [
|
|
|
|
Iliad.ILSessionManager current sessionClass: GSMTestphoneSession.
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
gsmServer [
|
|
|
|
^ gsmServer ifNil: [gsmServer := IPAConfig new]
|
|
|
|
]
|
|
|
|
|
|
|
|
phoneConfig [
|
2010-12-11 11:21:07 +00:00
|
|
|
^ config ifNil: [config := PhoneConfigWidget new]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
serverConfig [
|
2010-12-11 11:21:07 +00:00
|
|
|
^ serverConfig ifNil: [serverConfig := ServerConfigWidget new]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
2010-12-12 15:03:37 +00:00
|
|
|
procedures [
|
|
|
|
^ procedureWidget ifNil: [procedureWidget := ProcedureWidget new]
|
|
|
|
]
|
|
|
|
|
2010-12-11 08:45:25 +00:00
|
|
|
call [
|
2010-12-11 11:21:07 +00:00
|
|
|
^ call ifNil: [call := CallWidget new]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
lu [
|
2010-12-11 11:21:07 +00:00
|
|
|
^ lu ifNil: [lu := LUWidget new]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
2011-04-01 11:16:02 +00:00
|
|
|
ussd [
|
|
|
|
^ ussd ifNil: [ussd := USSDWidget new]
|
|
|
|
]
|
|
|
|
|
2010-12-11 08:45:25 +00:00
|
|
|
index [
|
|
|
|
<category: 'controllers'>
|
|
|
|
^ [:e |
|
2010-12-12 09:38:57 +00:00
|
|
|
e
|
|
|
|
build: self cometConnection;
|
|
|
|
build: self serverConfig;
|
|
|
|
build: self phoneConfig;
|
|
|
|
build: self lu;
|
2010-12-12 15:03:37 +00:00
|
|
|
build: self call;
|
2011-04-01 11:16:02 +00:00
|
|
|
build: self ussd;
|
2010-12-12 15:03:37 +00:00
|
|
|
build: self procedures.
|
2010-12-11 08:45:25 +00:00
|
|
|
].
|
|
|
|
]
|
2010-12-11 11:30:46 +00:00
|
|
|
|
|
|
|
loginContents [
|
|
|
|
<category: 'building'>
|
|
|
|
^[:e |
|
|
|
|
e form build: [:form |
|
|
|
|
form input action: [:val | self login: val].
|
|
|
|
form button text: 'Login']]
|
|
|
|
]
|
|
|
|
|
|
|
|
login: aString [
|
|
|
|
<category: 'actions'>
|
|
|
|
self session username: aString.
|
|
|
|
self redirectToCurrentController
|
|
|
|
]
|
|
|
|
|
|
|
|
dispatchOverride [
|
|
|
|
<category: 'dispatching'>
|
|
|
|
^self session isAuthenticated
|
|
|
|
ifFalse: [self loginContents]
|
|
|
|
ifTrue: [super dispatchOverride]
|
|
|
|
]
|
2010-12-11 08:45:25 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
Eval [
|
2010-12-11 11:21:07 +00:00
|
|
|
GSMTestphoneApp initialize.
|
2010-12-11 08:45:25 +00:00
|
|
|
Iliad.SwazooIliad startOn: 8080.
|
|
|
|
|
|
|
|
stdin next.
|
|
|
|
]
|