Phone Specification

From WeizmannWiki
Revision as of 13:50, 20 December 2015 by Smadar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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".
PhoneLSC01.png
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.
PhoneLSC2.png
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"
PhoneLSC03.png
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.

PhoneLSC04.png
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.

PhoneLSC07.png
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.
PhoneLSC05.png
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.

PhoneLSC06.png
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.
PhoneLSC08.png
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"
PhoneLSC11.png
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"
PhoneLSC010.png
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"
PhoneLSC0011.png
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"
PhoneLSC24.png
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.
LSC012.png
when the memory value changes then the chip content changes to the memory value
PhoneLSC013.png
when the memory value changes then the display shows the memory value
PhoneLSC18.png
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.
PhoneLSC14.png
when the speaker sound turns "off" then the speaker stops
PhoneLSC15.png
when the speaker sound turns to "ringing" then the speaker rings
PhoneLSC16.png
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”
PhoneLSC12.png
when the user clicks the call, if the display Text is "incomingcall" then the speaker sound turns "off"
PhoneLSC17.png
when the user clicks the call, if the display Text is "incomingcall" then the display Text changes to connected
PhoneLSC20.png
Clock when the Clock ticks, if the display state is "Time" then the display shows the Clock stringTime
PhoneLSC23.png
when the display state changes to "Time" then the display shows the Clock stringTime
PhoneLSC22.png

Phone LSC project

To work with the phone application, you can create it in your PlayGo workspace:

  1. Download PlayGo.
  2. From the 'File' menu choose New-->Example....-->PlayGo Examples-->Phone
  3. Click the 'Finish' button.
  4. The phone example project is now part of your workspace. You can start playing with it. For details refer to how to play out and how to play in.