The PSM for the BarrierI interface is rather simple. We choose a synchronous version of the operation open, which means that the client waits until the barrier is closed again. Thus, from a client perspective, the open operation can be called all the time.
The barrier component is implemented by a BarrierController class, which also implements the BarrierI interface. In addition it uses the class Barrier, which just understands two commands, up and down. The third class is the Sensor class, which detects if a car has passed the barrier and sends the message carPassed to the barrier controller.
The bahviour of the barrier is defined by the following LSM:
When the controller receives an open message, he sends the message up to the barrier to open the barrier. Then, either the sensor sends the message carPassed or after 1 minute waiting period, the barrier controller closes the barrier again.
The barrier class has a simple LSM with two states and two messages up and down.
Finally, the sensor sends the message carPassed to the barrier controller when the car has passed the sensor.