A Cinderella-based prototype of a digital camera – a contribution to the SDL’05 Design Contest
3 Architecture
When designing this software prototype, a main focus was on simplicity. In this section I will give an over- view of the architectural solution of the digital camera. According to the requirements, the camera should have a trigger button, four small buttons and an LCD display. The user interacts with the system by push- ing the trigger button or one of the four small buttons.
The LCD display gives output to the user by photos or text messages.
The camera consists of four different units: the
CameraControl, which handles all the interaction
from the environment, a LightSensor, a CCDand a Flash.
The light sensor communicates with the camera control, and gives the current brightness. The flash is set based on the user’s settings and the brightness returned from the light sensor. The CCD is responsi- ble for the actual photographing. This is all illustrated in the block TheCamerain Figure 3.
3.1 Hierarchical structure of the camera system
The camera is modelled like an open system with extensive use of types on all possible levels. As we can see from Cinderella’s explorer view (Figure 4) the system has a hierarchical structure of three levels; block type, process type and procedure. Use of block types provides the possibility of putting the system into packages, which in turn encourages reuse. The memory is modelled separately as a process type within a separate package, and is then used inside the camera package. Package is a concept from SDL’92. 3.2 The design
The hierarchical structure shows that an instance of the block type CameraControlis the top level description of the camera. There is also an instance
Photoof process type PhotoControllerwhich
handles all the communication with the environment.
Photois in turn connected to a local instance of the process type memory (m: memory), which han- dles all the saved photos.
The process instance Photois connected to the envi- ronment through three channels: user_interac-
Figure 3 The camera system
Figure 4 Hierarchical structure Block TheCamera Flash CCD LightSensor CC ; CameraControl [Trigger Button] [Four small Buttons] [LCD Display] 1(1)
tion, lightand CCD(cf. Figure 3). The signals passed in incoming direction over the channel
user_interactionare the user’s interaction
with the camera, while the outgoing signals are the camera’s output to the user. When a photo is to be shot there will be a request to the light sensor about the brightness. The signals passed over the channel
lightare the camera control’s interaction with the light sensor, and CCDcontains signals for actually taking the photo.
The connection to the memory is through the channel
memand includes signals for saving and deleting pho- tos, and also navigating through the saved photos. 3.3 Runtime Environment
The camera system is a stand-alone system and is completely run and simulated in Cinderella. It is modelled as an open SDL system; this means that there are channels which connect the system to the environment. In this case we have three channels which all go through Cinderella.
Figure 5 The top level design
[Brightness]
[GetLight] Block type CameraControl
TriggerPress, TriggerRelease, Button1, Button2, Button 3,
Button 4 light [Brightness] [CCDControl] [CCDControl] [CCDImage] ccd ccd CCD Photo:Photo Controller [CCDImage] [GetData] u_i user_interaction mem AddData, DeleteData, NextData, PreviousData m M:Memory InfoText, WarningText, DisplayText, LCDOutput, LCDStream
u_i InfoText, WarningText, DisplayText, LCDOutput, LCDStream 1(1) PhotoController [GetLight] TriggerPress, TriggerRelease, Button1, Button2, Button 3,
Button 4 CC : CameraControl CCD light user_interaction Cinderella C++ adapter file system Figure 6 Runtime environment
To provide a more user-friendly and realistic view of the SDL camera system and the environment, a graphical user interface was implemented. Cinderella provides the possibility to include source in the form of a Visual Studio C++ project, and the concepts in the GUI are assigned to the signals in the SDL sys- tem. This is illustrated as the C++ adapter in Figure 6. As mentioned in 3.2 there are three different channels (see Figure 3) which connect the camera to the envi- ronment. Figure 6 illustrates how these channels communicate with the runtime environment. The user can give input, like take a photo or change settings, to the camera system using a terminal. The output from the camera, such as text messages or taken photos, will also be shown within the GUI which runs on the
terminal. The CCDcommunicates with a real web camera. We also have the communication with the light sensor, which is a recurrent channel.
The photos taken are saved in the file system, while the memory inside the camera handles the file names. 3.4 User Interface
Figure 7 shows a screenshot of the user interface when the camera is in active mode. The signal list in Figure 8 shows the signals which are relevant to this camera mode.
We have a trigger button which is assigned to the sig- nals TriggerPressand TriggerRelease. We also have four small buttons below the screen. Each of these buttons is assigned to one of the four signals:
Button1, Button2, Button3and Button4.
The buttons are implemented as four different incom- ing signals because they represent four physical dif- ferent units and we need to distinguish which of the buttons is being pushed. The four small buttons are labelled with text, and these signals are independent of the label settings. The text labels are represented by the outgoing signal DisplayText. On top of the LCD screen we have a text line giving us information about the memory usage and number of photos remaining. InfoTexttakes care of this. The LCD- Outputsignal gives us the current picture on the screen.
When a photo is shot, a request is sent to the light sensor. This is represented by the signal GetLight. The light sensor, which is placed in front of the cam- era, returns the Brightness. The outgoing signal
CCDControlis a request to take an image. A sepa- rate flash signal is not implemented, as both this and the exposure time are represented as parameters in the signal CCDControl(cf. Figure 8). The actual taken photo is returned in the signal CCDImage.