Phone Specification

From WeizmannWiki
Revision as of 07:53, 10 September 2014 by Smadar (Talk | contribs)

Jump to: navigation, search

The phone example demonstrates the creation of LSCs using NL play-in. It uses the default system model GUI created automatically by PlayGo. It was later augmented with a manually created Java swing GUI to make the application more user-friendly.
Systemmodel GUI.png

The automatically created system model GUI.

Requirements

For each requirement, we present the requirement in natural language with no additional explanation, since the text is straightforward. Additionally, we present the LSC diagram created and comments on the creation process, when necessary.

Name Requirement in Natural Language Text Comments LSC
Lock and Unlock when the user clicks the star and the user clicks the end, if the display state is "Time" then the display state changes to "num" otherwise if the display state is "num" and the chip content is "" then the display state changes to "Time" Time state is considered to be the lock state, in which the phone displays the time and accepts calls. Num state is the unlock state, in which the user can also dial.
Testing scenario: Click the star button and then click the end button, the phone starts as "Time" and should become "num". Change it back to "Time".
LSC
Back Color Changes when the display state changes to "num" then the display backcolor changes to "pink" Testing scenario: Change states between time, num and off, and see that the color changes to gray, pink and dark gray respectively.
LSC
when the display state changes, if the display state is "Time" then the display backcolor changes to "gray" otherwise if the display state is "off" then the display backcolor changes to "darkGray"
LSC
Dial when the user clicks any Cnumber, if the display state is "num" and the chip content is "" then the display concatenates the Cnumber value

Concatenate is a function implemented in Java, that concatenates the digits. It overrides the generated code of the display class. See code in playgo.systemmode.classes.

 
Testing scenario:Click the number buttons and check the numbers that appear on the display.

LSC
Clear when the user clicks the clear, if the chip content is "" then the display clears

Clear is a function implemented in Java, that clears the last digit. It overrides the generated code of the display class. See code in playgo.systemmode.classes.


Testing scenario:With the phone in num state (unlocked, display in pink color), dial some numbers and then press the c button, the last digit will be cleared.

LSC
End when the user clicks the end then the chip clears and the memory clears and the display shows "" and the speaker sound turns "off" Testing scenario:Press the end button to clear all numbers from the display. Also, check to see that upon pressing the end, the chip content clears, the memory clears and the speaker change to off.
LSC
Power when the user clicks the power, if the display state is not "off" and the chip content is "" then the display state changes to "off" and the display Text changes to "" otherwise the display state changes to "num"

The off state is when the user switches off the phone, in which case the user can’t dial or accept a call.

 
Testing scenario:Pressing the p button will make the phone turn to off.

LSC
Call when the user clicks the call, if the display length is not "1" then the chip content is set to the display Text When the env gets any call from the chip, the env responses to the chip either by “busy” and the call is not connected, or by “ack“ and the call is connected.

To generate an external call from the Env- right-click the Env object in system model and choose 'call other object'. After that right-click the receive method of the chip object and choose 'call message'. When required, provide the argument “ack” or “Busy”.

Testing scenario:Dial some digits (not a single digit, since that will activate the speed dial feature for the digit dialed), then press the call button. Depending on the response “busy” or “ack”(set the response from the env) the display will show “busy” or “connected“ and the speaker sound will stop.
LSC
when the chip content is set, if the chip content is not "Busy" and the chip content is not "" and the chip content is not "incomingcall" and the chip content is not "ack" and the chip content is not "connected" then the chip makecall to the env and the speaker sound turns "ringout"
LSC
when the env receives "ack" to the chip, if the chip content is "ack" then the display shows "connected" and the speaker sound turns "off"
LSC
when the env receives "busy" to the chip, if the chip content is "busy" then the display shows "busy" and the speaker sound turns "off"
LSC
when the user clicks the call and one second elapses, if the speaker sound is "ringout" then the display shows "busy" and the speaker sound changes to "off"
LSC
SpeedDial when the user clicks any Cnumber and the user clicks the call, if the display length is "1" then the memory retreives the Cnumber value and the display shows the memory value Retreive is a function defined in memory class. It reads values from an xml file and stores the number corresponding to each speed dial digit.

Testing scenario: Dial a single digit, then press the call button. Check that the saved number corresponding to the digit is displayed and that the call is forwarded to the number.
LSC
when the memory value changes then the chip content changes to the memory value
LSC
when the memory value changes then the display shows the memory value
LSC
Speaker when the speaker sound turns to "ringout" then the speaker plays. Testing scenario:Dial some digits and click call. The speaker should play the playout tone. Then click the end, which makes the speaker turn off and the tone played stops. Set an incoming call from the env to the chip and check that the speaker plays ring tone. Click the end button to stop the tone.
LSC
when the speaker sound turns "off" then the speaker stops
LSC
when the speaker sound turns to "ringing" then the speaker rings
LSC
Incomingcall when the env receives "incomingcall" to the chip, if the chip content is "incomingcall" then the display shows “incomingcall” and the display state changes to "num" and the speaker sound turns to "ringing"
To generate an external call from the Env, right-click the Env object in the system model and choose 'call other object'. After that right-click the receive method of the chip object and choose 'call message'. When prompted, provide the argument “incomingcall”.

Testing scenario: when the env sets “incomingcall” to the chip, the display will show the “incomingcall” and the speaker will start playing ‘playing’ tone. Click the end or call to turn the speaker to off when the display text is “incoming”
LSC
when the user clicks the call, if the display Text is "incomingcall" then the speaker sound turns "off"
LSC
when the user clicks the call, if the display Text is "incomingcall" then the display Text changes to connected
LSC
Clock when the Clock ticks, if the display state is "Time" then the display shows the Clock stringTime
LSC
when the display state changes to "Time" then the display shows the Clock stringTime
LSC




Download the Phone Example

The phone LSC Project (for development purposes)

Installation Instructions

  1. Extract the downloaded zip.
  2. Download PlayGo.
  3. Import the downloaded project to your workspace:
    1. From the File menu choose Import-->General-->Existing Projects into Workspace.
    2. Click the 'Next' button.
    3. When prompted, select the directory to which you extracted the downloaded phone example.
    4. Click finish.
  4. The phone project is now part of your workspace. You can start playing with it. For details refer to how to play out.