Вы находитесь на странице: 1из 65

2011 DETAILED DESCRIPTION DESIGN

for

BRAINWAVE BASED CONCENTRATION ENHANCING AND REHABILITATION SYSTEM


GROUP COMPANY STN YILDIRIM BERK ESEROL EVN ASLAN REM GKE AYDIN Course Assistant : MENTALLIGENT : Minder Technology 1629419 1534908 1559921 1550268 : CENG 490 : Levent BAYINDIR

TABLE OF CONTENTS
1 INTRODUCTION ......................................................................................................................................................... 1
1.2 Purpose ............................................................................................................................................................................................. 1 1.3 Scope ................................................................................................................................................................................................. 1 1.4 Overview ........................................................................................................................................................................................... 1

2 SYSTEM OVERVIEW ................................................................................................................................................... 3 3 DESIGN CONSIDERATIONS ......................................................................................................................................... 5


3.1 Design Assumptions, Dependencies and Constraints ....................................................................................................................... 5 3.2 Design Goals and Guidelines ............................................................................................................................................................. 5

4 DATA DESIGN ............................................................................................................................................................ 6


4.1 Data Description ................................................................................................................................................................................ 6 4.2 Data Dictionary.................................................................................................................................................................................. 7 Objects .............................................................................................................................................................................................. 7

5 SYSTEM ARCHITECTURE ........................................................................................................................................... 10


5.1 Architectural Design ........................................................................................................................................................................ 10 5.2 Description of Components............................................................................................................................................................. 12 5.2.1 Manager ................................................................................................................................................................................. 12 5.2.2 Game ...................................................................................................................................................................................... 14 5.2.3 AI ............................................................................................................................................................................................ 16 5.2.4 Analysis .................................................................................................................................................................................. 17 5.2.5 Login....................................................................................................................................................................................... 18 5.2.6 BCID ....................................................................................................................................................................................... 20 5.2.7 Keyboard Mouse ................................................................................................................................................................. 21 5.2.8 GUI ......................................................................................................................................................................................... 21 5.3 Design Rationale.............................................................................................................................................................................. 23

6 USER INTERFACE DESIGN ......................................................................................................................................... 23


6.1 Overview of User Interface ............................................................................................................................................................. 23 6.2 Screen Images ................................................................................................................................................................................. 24 6.3 Screen Objects and Actions ............................................................................................................................................................. 27 6.4 Game Design ................................................................................................................................................................................... 28

7 DETAILED DESIGN .................................................................................................................................................... 30


Relations Of Basic Data Objects ............................................................................................................................................................ 30 Complete Data Model ........................................................................................................................................................................... 31 The Whole Process Of BCES .................................................................................................................................................................. 32 7.1 Manager .......................................................................................................................................................................................... 32 7.2 GAME .............................................................................................................................................................................................. 37 7.3 AI ................................................................................................................................................................................................... 40 7.4 BCID ................................................................................................................................................................................................. 42 7.5 Keyboard Mouse ............................................................................................................................................................................. 46 7.6 Analysis ........................................................................................................................................................................................... 47 7.7 Login ................................................................................................................................................................................................ 50 7.8 GUI .................................................................................................................................................................................................. 54

8 LIBRARIES AND TOOLS ............................................................................................................................................. 57 9 TIME PLANNIG (Gannt Chart)................................................................................................................................... 60


9.1 Term 1 Gannt Chart ......................................................................................................................................................................... 60 9.2 Term 2 Gannt Chart ......................................................................................................................................................................... 62

10 CONCLUSION ......................................................................................................................................................... 63

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

1 INTRODUCTION
1.1 Problem Definition
The lack of concentration is one of the modern life issues and it is shown that it can be overcome by some daily training and basic rehabilitation. Moreover, people can always develop their level of concentration even if that level is not a problem for them. An increased and manageable concentration skill can be used to enhance the efficiency of human life. The main purpose of the BCES project is to create reliable concentration enhancement software using the neurofeedback technology. The software follows and records the brain activities of the user for a long period and tries to increase the users concentration values efficiently. The two main components of the software, small but well designed concentration games and the artificial intelligent system with high planning capabilities that manage the game parameters, will provide an uncomplicated and entertaining training experience to the user.

1.2 Purpose
This document is written to create a common initial design schema of the BCES project. It can be used to write a detailed design document. On the other hand, it can be useful for designers and the programmers of the project during the implementation phase as a brief summary of the detailed design of the software.

1.3 Scope
This document contains the initial description of the design of the BCES project. Since it is an initial report, it contains only the overall system and data architecture and it also contains the main interaction and interface property of the software. In the document, all components are mentioned without much detail. Thus, the detailed design part of the project is not included by this report. For more detailed explanation of the components and for more complex descriptions of the software, use the detailed design document.

1.4 Overview
This initial software design report consists of ten main parts. The first part is introduction. A definition of the problem that the software based on is described in the introduction. General information about the document is also replaced here. The second part is system overview. A general overview of the project and the software system is mentioned here. The goals, objectives and benefits of the project are explained in that part. The third part is design considerations. Special design issues are addressed here. The design assumptions, dependencies and constraints are replaced here. The design goals and guidelines are also explained in that part. The fourth part is data design. The data sets and the explanation of these data sets used by the

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

software are belongs to that part. Moreover, the flow mechanism, derivations and alterations on the data are described here. The fifth part is system architecture. The very high level and overall architecture of the software is depicted here. The system is divided into its main components. The interior structure of these components, the behaviours and missions of them and the communication between the components are detailed in that section. The sixth part is user interface design. The user interaction of the system is described here. A general structure of the graphical user interface is depicted with a series of screenshots. The functionality of the user interface is explained from the user point of view. The seventh part is detailed design. This part contains the internal details of each design entity/component. These details include attribute descriptions for identification, processing and data. The eighth part is libraries and tools. In that section, the properties behaviour and benefit of the the libraries, other helper software and tools for development are introduced. The ninth part is time planning. A detailed time plans and gannt chars are replaced in that section. The scope of the plans is the whole projects, thus all of the development, design and scheduling stages of the project can be found here. The tenth part is conclusion and it involves the end comments and expectations of the final product.

1.5 Definitions, Acronyms and Abbreviations


Definitions User : The person using the software with a BCID Casual user : The possible end user group for the software. Database : Collection of all information about the users. Acronyms and Abbreviations Neurofeedback : Feedback generated by the brain activities of the user. BCID : Brain Computer Interface Device BCES : Brainwave Based Concentration Enhancing Software EPOC : The name of the Brain Computer Interface Device EPOC Library : The library that is provided by the company to get brainwaves from BCID. CVS : Current Version System GPL : General Public License IDE : Integrated Development Environment SWT : Standard Widget Toolkit FFT : Fast Fourier Transform

1.6 References
1. IEEE Std 1016-1998: IEEE Recommended Practice for Software Design Descriptions 2. Mentalligent, 2010: Software Requirements Specification & Software Design Description for Brainwave Based Concentration Enhancing and Rehabilitation System.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

2 SYSTEM OVERVIEW

Figure 1 - A Screenshot from Software

BCES is system which lets the users interact with their brains and see the role of their brains in thinking process and effect of it over acting with these thoughts. The main functionality of the BCES is to keep the user in a concentration state. This functionality will be established by cognitive games that we will design. In these games the user will be expected to handle with some tasks which require different concentration levels. According to the analyzed brainwave distribution of the user as delta, theta, alpha and beta, the parameters of game levels will be change accordingly to make the user be more focused on these tasks. The reason that we will observe the change in concentration of the user via computer games is the reality that computer games can easily take the attention of the user and with attractive features can easily make the players focused itself for long times. So we thought that games can be used to make users concentrated for a period of time to analyze the behaviour of brainwaves during game play. The BCID will help out in this brainwaves extraction process. In BCES, our goal is to try to maximize the duration of concentration state of the user as indicated above. In the game industry, there are many cognitive games that focus on developing concentration of the players in a specific given time. For example, a Nintendo DS game, Brain Age, is asking mathematic calculations to the player and the time is counted. The littleness of the time is the key to get more score.1 Similar to these kinds of games, we will try to take the attention of the user and to make him/her be concentrated. So, in the project the main factor that affects the product and its requirements are the brainwaves of the user and the precisions of the transformation of the brainwaves from the BCID. Because if we can not extract the brainwave information after applying same functions, the raw brainwave information will be useless for the project and the rest of the operations in the software will be meaningless. So, we will plan to get the brainwave information more accurately as possible as we can.

http://www.lumosity.com/brain-games/attention-games

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

Figure 2 - Block Diagram Of BCES

In BCES, the whole system is composed of by two main parts. One of them is hardware, the other one is software. At the fist stage, the user log in the system and to get the brainwaves of the user we need to have a Brain Computer Interface Device which has been provided by the company. In the process, after that we extract the brainwaves by the help of this device, by analyzing the features of different brainwaves (delta, alpha, theta, beta), the user will be asked to play the game application that we will develop. While monitoring the brainwaves, through the levels of the game, user will be wanted to concentrate very well to complete the level. In this process we expect to see the changes in the brainwaves of the user in an effective way. As mentioned above, the aim is to increase the Alpha and Beta brainwaves which are observed at the concentration state. Because the concentration of the user can be varied according to his gender, age, psychology and the environment, we will take these factors into account and will create a game in a way of getting attention and focusing concentration of the user much more easily and quickly. Moreover, to detect the brainwaves by the device correctly and to treat the user accordingly, there will be a continuous literature survey in the whole process. The running mechanism of the software and so the game will be explained in the following sections. The functionality of BCES is to show the brain activities of the users and changing the features of the applications accordingly during process. So the main benefit of the system is to help the user to increase the general concentration, attention and memory level of him. If the user has a lack of concentration then by our system, this situation will be handled. Because we will create the game levels by the help of an AI to decide whether the user is in upper or lower concentration and memory level. The game seems to be more academic but there will be components added to the game to make the game similar to the usual and real computer games. So there will be entertainment and amusement in the game to take the attention of the user more easily. Moreover, this project can be applied for other applications rather than only game. For example

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

an music player application that plays music which of genre is decided according to the mood of the user. Because the frequencies of brainwaves are distributed according to mood of the user (including concentration), the AI part can be designed for different purposes like this. For example, if the user is unhappy than the player will play funny and cheering musics from the pre-defined database. The examples of these applications are present and used.

3 DESIGN CONSIDERATIONS
In BCES, the brainwave extraction part would be over-work for us. Because the BCID gets brainwaves as raw data and apply some transformations like FFT, classification, clustering and feature extraction, all these are a subject of signal processing which we are not very familiar with. So the company, Minder, has provided us a .jar file, namely epoclib, which include some libraries to access the raw and band data (already processed data) via some classes and methods. By the help of these libraries we will be able to manipulate and work on the brainwave data easily. In the design of the BCES, the accuracy of the Alpha-Beta brainwave interval is important for us, because the whole application will depends on the amplitude and interval of them. Furthermore, for the game design we have had to consider the communication between the game component in which ActionScript(in Flash) programming language will be used and other components of the system in which JAVA language will be used. For this purpose a Flash Player API Java package, named JFlashPlayer, has been chosen that lets developers play and interact with Flash swf files within Java applications. Hence, by this package we will be able to change the game parameters from our java code.

3.1 Design Assumptions, Dependencies and Constraints


Because we will use a hardware, BCID, and because the extraction level of the brainwaves depends on the users condition such as the thickness of the scalp, age, gender or etc., the threshold value for each brainwaves is decided by taking this fact into consideration. The other main standard that we will establish is to maintain the interfaces as simple as possible for the users. Because the number of types of brainwaves is known as a fact, the number of brainwaves types we will observe will be equal to that number. Moreover, the time of the training is limited and only one user can run the application at a time of process. Which means we will expect an improvement in the lack of concentration of one user in a specific interval. The security of the database of brainwaves history of the users is important and for the privacy rights of the users we will develop our database part as secure as possible.

3.2 Design Goals and Guidelines


The goal of the system is to success in increment of the concentration level of the user with the help of computer games. For this purpose, we will create more than one game. In fact, the priority of the system will be to establish the games as modular. Because the portability of the games is important, we will form a isolated relation between the game, AI and user components. All the inputs will be received by a main manager component and the communication between these components will be across by this manager component. So, there will be no specification in the software for individual games. AI will change the parameters of the game, which will be common in the games, according to the incoming inputs via manager component. The guideline of the BCES

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

is keeping the application as simple as possible. Because of the fact that focusing is important in game-play, the distracting factors will be kept at minimum. For example, the interface of BCES will be simple and the brainwave information will be shown in another tab interface. Only needed parts such as, game play, status of BCID and the Alpha-Beta brainwave stick indicator will be used. In the game design, the environment, game characters and tasks will be attractive and will not bore the users. In our system there will be no need for speed or memory usage considerations. Because we simply run a .swf file and the database, that we will keep the tracks of the history of the users, will not need to keep and/or access much complex data. The usability of the project is easy to understand. The user will only put on the BCID on his head and play one of the games. The results will be calculated and kept behind the user interface. Then, the end-user will be able to see the changes on his mind during this treatment in the analysis part.

4 DATA DESIGN
4.1 Data Description
The data structures which are passing among components of the software are grouped by the components they are related to as in the followings. The following components will be represented and explained

in section 5. Main Component: Manage Class: Manage class is the manager of whole system. Considering only information domain of the system, it is a bridge for every data transfer between different component of the system. It stores previous game level completion information as a class with an integer for completion time, an integer for game score and an integer for current rank of user. This information is asked by AI component to determine next level difficulty. Also next level difficulty is stored as integer which is requested by Game component. Manage class stores concentration data as EEGBandData which is provided by epoclib API. Concentration data is used for analysis of users current concentration. A float array of instantaneous concentration levels is stored to find users cumulative concentration. Current tab information is stored as an integer so that, manager decides which tab to be shown. Finally, user login data is stored as a composition of user information such as name and password. This information is used at login phase for confirmation. Database Component: Login: The User Login Table is the first table in the database. At first it is created as an empty table. The table is composed of four columns. The first column is the user id and stored as Integer object. The user id is unique for all users, namely it is the key of the User Login table. The second column is the user name and stored as a String object. The third column of the table is the password field; this field is String type too. The empty table is updated when users create new accounts. The last column is the user rank and it is stored as Integer object. The table columns are updated when the user change his/her information or deletes them via User Account Information tab of the user interface. If the user changes or deletes the User Login information, then the changes have to be made in the User History table too. The details will be mentioned in that section. As a result this table is only affected by user account information changes. This table only will be accessible by Login class. Analysis: The User History table is the second table in the database. At first it is created as an empty table. The table is composed of seven columns. The first column is the user id, which is unique to all users, and it is the key of the User History table. It is stored as Integer object. The

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

second column is the user experience field. Experience is stored as an Integer object. Its value is decided by the AI of the software. The third column is the user rank, which is decided by the AI of the software. Rank also is stored as an Integer Object. The fourth column is the Concentration data that is taken from the user while the user played the game. This brainwave is stored as Float object. The fifth column is the id of the game, in order to specify which game was played by the user. The sixth column is the history id column, which is stored as Integer object. The seventh column is the date column, which keeps date when the game is played. The empty table is filled whenever a user logs in and plays a game. Then the related data is taken via Manager and the table is updated. This User History table is accessible from Analysis class. Game Component: Game Class: In game class, general information about any applicable game is stored. Users concentration experience and concentration rank are stored as integers. Initially this information is taken from database but as user plays the game, these parameters will be updated by a function. Game score, current level difficulty and completion time is also stored as integers. This information is taken from the game. Besides game score, level completion time and current rank information is packed as a class called game level completion information. Because AI component sends this three data as a package. They are taken via Manager. To show user their instantaneous concentration level, a concentration data is stored as float. Later on in order to obtain a cumulative concentration, these instantaneous data are stored as float array. AI Component: AI Class: Main purpose of AI class is to determine next level difficulty. Next level difficulty is stored as integer and it is calculated using three information. These are previous level score, completion time and user rank. All this information is packed in the game level completion information class. UI Component: BCID Class: This class is provided with epoclib API. It includes one instance of EEGRawData class and one instance of EEGBandData. These instances stores raw and processed brainwave data. GUI Class: GUI class stores current tab information as integer. This information decides which tab is currently active and visible. Login data is also stored for GUI to receive login information such as username and password and then to send them to confirmation.

4.2 Data Dictionary


Objects - AI : Attributes : -nextLevelDifficulty : int -previousGameLevelCompletionInformation : GameLevelCompletionInformation Methods : +calculateNextLevel() : void +getNextLevelDifficulty() : int - ANALYSIS Attributes : -userConcentrationHistory : float[]

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

Methods : +addToConcentrationHistory(float []) : void +deleteConcentrationHistory() : void +getConcentrationHistory() : userConcentrationHistory - BCID Attributes : -EEGRawData : HashMap<Integer, Queue<Double>> -EEGBandData : HashMap<Integer, List<EEGBandData>> Methods : +addEEGRawDataListener(EEGRawDataListener, long) : void +addEEGBandDataListener(EEGBandDataListener, long) : void +connectToBCI() : bool +exitApplication() : void +getEEGSampleBandData(long duration) : EEGSampleBandData +getInstantConcentrationData(EEGSampleBandData) : float +removeEEGBandDataListener(EEGBandDataListener) : void +removeEEGRawDataListener(EEGRawDataListener) : void - GAME Attributes : -currentLevelDifficulty : int -gameScore : int -instantConcentrationData : float -levelCompletionInformation : Class -levelCompletionTime : int -sampleConcentrationData : float[] -userConcentrationExperience : int -userConcentrationRank : int Methods : +getGameLevelCompletionInformation() : LevelCompletionInformation +getInstantConcentrationData() : float +getMouseKeyboardInformation() : Event +getSampleConcentrationData() : float [] +initializeGameWithGameDiffiuculty(GameLevelDifficulty) : void +updateConcentrationExperience() : void +updateRank() : void +updateSampleConcentrationData() : void - GUI Attributes : -currentTab : int -loginData : LoginData Methods : +displayAnalysisInterface() : void +displayCalibrationInterface() : void +displayGamePlay() : void +displayLoginInterface() : void

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

+getCurrentTab() : int +getLoginData() : LoginData - KEYBOARD - MOUSE Attributes : -key_UP -key_DOWN -key_RIGHT -key_LEFT -left_MOUSE_CLICK -right_MOUSE_CLICK -mouse_POSITION Methods : +getKeyboardMouseEvent() - LOGIN Attributes : -name : String -password : String -userRank : int Methods : +confirmLoginData() : bool +createNewUser(String) : void +deleteUserLoginData(String) : void +readUserLoginData(String) : String +updateUserLoginName(String) : void +updateUserLoginPassword(String) : void - MANAGER Attributes : -concentrationData : ConcantrationData -currentTab : int -nextLevelDifficulty : int -previousGameLevelCompletionInformation : GameLevelCompletionInformation -sampleConcentrationData : float[] -userLoginData : LoginData Methods : +deleteUserAnalysisDataAlert() : void +getInstantConcentrationData() : ConcentrationData +getMouseKeyboardInformation() : Event +getNextLevelDifficulty() : int +getPreviousGameLevelCompletionInformation() : GameLevelCompletionInformation +getSampleConcentrationData() : float [] +getUserConcentrationHistory() : float [] +manageInterfaceTabs(int) : void +updateUser(String name) : void +updateUserAnalysis(String name) : void

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

10

5 SYSTEM ARCHITECTURE

Figure 3 - Package Diagram Of BCES

Program architecture is composed of three packages which are the main package, database interface package and user interface package. Each package contains two or three parts which are the actual components of the whole system. The main package consists of three components which are manager, game and AI. Moreover the game component is in interaction with an internal game module, the actual played game which is a swf file for example. So the swf file, the game, has its own internal classes. The database package contains two sub components, log-in and analyze. The user interface package includes three components which are BCID , keyboard-mouse and GUI.

Figure 4 - Component Diagram Of BCES

5.1 Architectural Design


Among the packages, the control duties are given to the manager component. All other components interact only with the manager component and interconnections between other components are not allowed. Therefore, the manager component not only manages the system but also provides communication medium for other components. The relationships between these components are represented by the following use-case and class diagram. The other state and entity relation diagrams of the whole system are in section 7.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

11

Figure 5.1 - Use Case Diagram of Manager-GUI

Figure 5.2 - Use Case Diagram of Manager - Other Components

Figure 5.3 - Use Case Diagram of Manager-Game Figure 5.4 - Use Case Diagram Of User - BECS

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

12

Figure 6 - Class Diagram Of the Whole System

5.2 Description of Components


5.2.1 Manager 5.2.1.1 Processing Narrative for Manager It manages the whole system. All other components are connected to that component and they communicate via that manager component. Manager component is actually contains many event listener to answer other components needs. Moreover, it contains the exception system of the software. When a run time error occurs, this component tries to handle it. 5.2.1.2 The Interface Description for Manager Inputs: - Current keyboard and mouse state from relevant component. - Instant alterations of brainwave data from BCID component.. - The next game level parameters from the AI component. - End level score from the Game component. - Cummulative concentration information from the Game component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

13

- End game rank information from the Game component. - Current tab information from GUI component. - User log-in data from the Log-in component. - Confirmation message from the Log-in component. - The user historical data from Analysis component. - Confirmation message from the Analysis component. Outputs: - GUI warning to GUI component. - Related alteration information to the GUI component. - End level data to the AI component. - End level score information to- the AI component. - Cumulative concentration information to the AI component. - Current keyboard and mouse information to the Game component. - Instant concentration information to the Game component. - Next level parameters to the Game component. - Current rank information to the Game component. - Cumulative concentration information to the Analysis component. - Related create, update, delete messages to the Login component. 5.2.1.3 Manager Component Processing Detail - It contains the main function of the software and becomes active when the software starts. - Firstly, it receives the given login data from the GUI component. - It sends the login data to the Login component. - If it receives confirmation information from the Login component, allows the access to the main state of the program. - It receives the current tab information from the GUI. - If the Game tab is active, it runs the Game component and starts the communication between user interface, AI and the Game and Analysis components. - If Analysis tab is active, It requests the user history from the Analysis component and send it the the GUI component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

14

5.2.1.4 Manager Dynamic Behavior

Figure 7 - Sequence Diagram of Manager

5.2.2 Game 5.2.2.1 Processing Narrative For Game It provides the communication between the games attached to the system. Loading a game or removing a game is done by that component at run time. It also collect the game related data during the session and send them to the manager at the end of each game level. It also calculated the parameters and rank information if they does not need AI decisions. 5.2.2.2 The Interface Description for Game Inputs: - Current keyboard, mouse information from the Manager component. - Initial game file name form the Manager component. - Instant concentration data from the Manager component. - Next level game parameters from the Manager component. - End level score from the game executable.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

15

Output: - End level cumulative concentration data to the Manager component. - End level score information to the Manager component. - Current keyboard, mouse information to the game executable. - Instant concentration data to the game executable. - Next level game parameters to the game executable. - End level score to the Manager component. 5.2.2.3 Game Component Processing Detail - It is started by the manager component. - It receives related parameters from the Manager component. - It stars and initiates the game executable with the coming parameters. - It delivers the coming concentration information and keyboard, mouse states to the game executable. - The end level information coming from the executable is sent to the Manager component. - It stores some samples information from the instant concentration data. - At the end of each game level, it receives the score information and from the game executable and sends it to the Manager component. - At the end of each game level, it sends the cumulative concentration data to the Manager component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

16

5.2.2.4 Game Dynamic Behavior

Figure 7 - Sequence Diagram Of Game

5.2.3 AI 5.2.3.1 Processing Narrative for AI The AI component is started at the end of each game level by the manager component and it is used for determining the next level game parameters. 5.2.3.2 The Interface Description for AI Inputs: - Previous level parameters from the Manager component. - Previous level concentration data from the Manager component. - Previous level score data. - User current rank data.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

17

Outputs: - Next level game parameters. 5.2.3.3 Game Component Processing Detail - It is started by the Manager component. - It receives required data which is related with the previous game level session. - It uses the internal planning algorithm. - The obtained result is returned to the Manager component. 5.2.3.4 AI Dynamic Behavior

Figure 8 - Sequence Diagram of AI

5.2.4 Analysis 5.2.4.1 Processing Narrative for Analysis This component is a kind of database interface. It is used by the Manager component when a database access is needed. It also stores the current session data which includes the logged in user information. 5.2.4.2 The Interface Description for Analysis Inputs: - Database read, write, update access request from the Manager - New cumulative concentration data. - New rank data. - New score data.

component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

18

Outputs: - The requested data from the database to Manager Component. - Confirmation message to the Manager component. 5.2.4.3 Analysis Component Processing Detail - This component is started by the Manager component. - The requested database query is created and sent. - The received answer is transferred to the Manager component. 5.2.4.4 Analysis Dynamic Behavior

Figure 9 - Sequence Diagram Of Analysis

5.2.5 Login 5.2.5.1 Processing Narrative for Login Login component is used only for authentication purposes. It communicates with the database for the user data in order to decide whether the user is registered earlier or not. After login process, this component is not called again unless a log-out operation is done.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

19

5.2.5.2 The Interface Description for Login Inputs: - User-name information from the Manager component. - Password information from the Manager component. Outputs: - The confirmation or rejection message to the Manager component. 5.2.5.3 Login Component Processing Detail - Manager component start this component. - Manager component initiates Login component with the user data. - Login component communicates with the database and received the rejection message. - It transfers the coming message to the Manager component. 5.2.5.4 Login Dynamic Behavior

confirmation or

Figure 10 - Sequence Diagram Of Login

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

20

5.2.6 BCID 5.2.6.1 Processing Narrative for BCID BCID is one of the user interface components. It provides the communication between the Manager component and the device. Moreover it does the corresponding calculation in order to make the coming input more understandable for the Manager component such as transform domain alterations.

5.2.6.2 The Interface Description for BCID Inputs: - Raw data from the interface Device. - Data request from the Manager component. Outputs: - Processed data to the Manager component. 5.2.6.3 BCID Component Processing Detail - It is started by the Manager component. - It receives the raw data from the interface device. - It applies the required calculations on the raw data and produces the data type required from the Manager component. - The result is sent the the Manager component. 5.2.6.4 BCID Dynamic Behavior

Figure 11 - Sequence Diagram of BCID API

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

21

5.2.7 Keyboard Mouse 5.2.7.1 Processing Narrative for Keyboard, Mouse Since the system have a game playing purposes, we need a qualified communication between keyboard and mouse. This component provides the state information of both keyboard and mouse. 5.2.7.2 The Interface Description for Keyboard, Mouse Inputs: - State information from keyboard and mouse. - Data request from the Manager component. Outputs: - Obtained data to the Manager component. 5.2.7.3 Keyboard, Mouse Component Processing Detail - It is started by the Manager component. - It receives the state data from the keyboard and mouse. - The result is sent to the the Manager component. 5.2.7.4 Keyboard, Mouse Dynamic Behavior

Figure 12 - Sequence Diagram Of Keyboard-Mouse

5.2.8 GUI 5.2.8.1 Processing Narrative for GUI This component deals with the graphical user interface. It receives user input and applies the corresponding alterations accordingly. Moreover, the warning and error messages are also transmitted to the user via this component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

22

5.2.8.2 The Interface Description for GUI Inputs: - Keyboard and mouse state from the Manager component. - Alteration request from the Manager component. - Warning or error messages from the Manager component. Outputs: - Current selected game file name to the Manager component. - User request messages to the Manager component.

5.2.8.3 GUI Component Processing Detail - It is the firstly created component by the Manage component. - It receives the login information from the user at the authentication part and passes them to the Manage component. - If authentication is done, it shows the main interface. - It reports each user alteration to the Manage component. - It manages the game files and displays the game choices for the user 5.2.8.4 GUI Dynamic Behavior

Figure 13 - Sequence Diagram Of GUI

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

23

5.3 Design Rationale


During the design process, our first consideration about the system is the communication issue. The communication traffic of the each component is needed to manage. Therefore, after determining our main software components, we add the Manager component to the system in order to manage the communication and data transfer between other components. Therefore, each component communicates only with the Manager class and this feature makes the software more modular. The second problem we faced with was the modularity issues of the games in the system. We may need adding more games to the system in the future, thus game handling mechanism must be modular. At that point we discussed about the user interface and game interactions. Leaving the game and user interface communication as free decreases the modularity of the game. Hence we decided to let this communication issue is also handled by the Manager component and that feature makes adding new games to the system easier.

6 USER INTERFACE DESIGN


6.1 Overview of User Interface
The user interface of the system will first expect from the user to input his/her password by the provided Login interface. If the user has not had an account yet, he/she will be able to create an account by this interface also. If the user inputs wrong log in data the interface will warn the user informing that wrong log in data is inputted. Unless the user input his/her existing account or create one, he/she will not be able to see any further information about the product. After creating an account or using an existing account, and logging in the user will be able to see the actual interface of the product. This interface is composed of seven tabs. They are: -Start Up -Calibration -Game -Brainwave Analysis -User Account Information -Help After logging; in the Start Up tab will be seen at the user interface. At this tab the user will be able to see the previous information about his/herself. Users previous concentration rank and concentration experience will be displayed. After having seen the Start Up tab, user can pass to Calibration tab. In this Calibration tab the user will be see the instructions that describes how to wear the BCID, how to understand whether the device is functioning properly etc. The user will see a representative scene of the device showing all the nodes on it. The nodes that are functioning properly will be seen in red color, the ones that functioning properly will be seen in green color. The user has to make sure that all the nodes functioning properly. Otherwise the user will not be able to start the game and play it. In the Game tab user will see available game(s) names and a small picture taken from the game

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

24

scene. The user will be able to choose the game he/she wants. Then the user will see the game opening. After the game is opened the user will play the game until the session is over. User then will see the current concentration rank and concentration experience. Then the game will be over. In the Brainwave Analysis tab the user will see his/her previous (history) information represented in a graphic. The user will be able to see how his /her brainwaves were acted during the game in the previous sessions and therefore see the changes time by time. At User Account Information tab, the user will be able to see his/her user name and password information. User can delete his/her account or make some modifications on it. If user account is deleted also the user history information is deleted automatically. At the Help tab the user will see the frequently confronted problems solution, and the basic information about the software. For example; what are the functionalities of tabs that are present in the interface, if a problem exists device what to do, how to learn playing the game etc. Also there will be a BCID status figures present all the time. So that the user will be able to see the device status all the time also while playing the game. The user will see whether the device lacks functionality or works with full functionality at that instant. If there are nodes that lack at functionality, the problematic nodes, they will be displayed with red circle, the full functionality ones will be displayed with green circles. Hence the user will be aware of the dis-functionalities while playing the game.

6.2 Screen Images

Figure 14 - Interface Of Start-Up Tab

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

25

Figure 15 - Interface of Calibration Tab

Figure 16 - Interface Of Game Tab

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

26

Figure 17 - Interface of Analysis Tab

Figure 18 - Interface of User Account

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

27

Figure 19 - Interface of BCID

6.3 Screen Objects and Actions


In the user interface, the user will be welcomed by a login interface to the system. In login interface there will be User Name and User Password screen objects.

User Name and User Password : Whenever the user logging in to the system with the correct information, the related user account data including login data and analysis history data will be taken from the database. The analysis history data will be represented graphically in the analysis tab in the following interface. After logging in, as indicated in the section 6.1 and in the former figure, there will be 5 tabs as screen objects. The transitions between these tabs will be managed by Manager Component Start-up : In the Start-up tab the background information of the user will be displayed. The information about user previous activities like user concentration rank and concentration experience will be taken from the database with the related user login account information. Calibration : In this tab, the displayed BCID status information will be extracted form BCID component. The BCID status information shows a picture of a representative brain with the following: if the device is placed properly, the 16 sensor of the headset which are placed on the user scalp will be displayed in green color in the representative figure. If there is a sensor that can not tune into electric signals produced by the brain of user effeciently, then its color will be red. Therefore, in this tab the user will be led to turn all the color of the sensors into green by some instructions. Games : In this tab there will be a concentration-meter bar showing the real-time amplitude of beta brainwave of user. This information will be extracted from the BCID component. In this tab, there will be thumbnails of different games. When the user chooses one of them, the SWF file of

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

28

the related Flash game will run. While playing the game, the user can see the changes in the concentration-meter simultaneously. Brainwave Analysis : In this screen object, the current behaviour of the brainwaves bill be displayed. The brainwave status information will be extracted from BCID component in real-time. Additional to these, there will be also User Account Information, BCID Status and Help objects in the interface. User Account Information : In this part of the interface, the current user informations will be seen. If needed the user will be able to update the user name or password information or even can delete yourself from the database completely. If user deletes the account all the information related to that user including user name, password and the history data will be deleted from the database. BCID Status : In this part of the interface, the current BCID connection status will be displayed continuously during the running application. If the sensors changes their proper positions, then the user should placed them until all are in green color again. Help : With the help of this object, the functionality of other tabs will be explained to the user. Only a text message will be displayed on the screen as a pop-up.

6.4 Game Design


The game we will have these main features; - The main aim of the game will be feeding the animals (the black ones in the Figure), which are the same kind and identical (size and color are the same) and continuously moving, in the screen. After feeding the animals there will be no change in the appearances of the animals. So the user should concentrate on which animal did he/she feed before, which he/she didnt.

- The number of fodder is equal to the number of animals on the screen. The user should feed each animal only once. If not, the user has time punishment (the time, which begins from 0 and counts from the beginning of the level, will increase suddenly). - The animals can have different speed and move features. For example, some of them move quickly on the screen, some of them are slow and moves by jumping. - According to the value in the Beta brainwave bar, we call it concentration-meter, the difficulty of the next level will be decided. For example, if the users concentration level is very high during a level, in the next level the number of animals to feed will more rapidly increase. - The main aim of the game is feeding the moving animals by clicking over each of them and keep this feeding time as short as possible, which means keeping the concentration state of the user as long as possible.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

29

The main data objects in the BCES related to the game are; Brainwaves : This data object has a name, representation (density), unit and range attributes. This data object can be inherited as Delta, Theta, Alpha and Beta brainwaves. Game Levels : This data object has a name, representation, quantity and parameters(such as the number of animals, the movement type of them, time to finish the level..) attributes. Game Level Completion Time : This sub-data object has range and quantity attributes. When the user consumes all the fodder, time will stop for that level. As mentioned previously, the time starts counting from zero for every second and if the user feed the animals that he has fed previously more seconds will be added to the current time. For example while counting seconds one by one, if this situation occurs, an extra 5 seconds will added to the time variable. If the time will be out of the previously decided range, for example the user are not feeding the animals for a long time during the training, then level will end and next level will be decided considering this lack of concentration stage. Game Level Score : This sub-data object has range and quantity attributes. While feeding the animals that has not been fed before, an +10 points will be added to the score variable. Feeding wrong animal that has been fed before will not contribute to the score.

User Data : This data object has a name, representation(including age and password variables) and parameters(User Rank, User Concentration Experience) attributes.

User Concentration Experience : This sub-data object has range and quantity attributes. At the end of each level, the user will gain concentration experience according to the time that the user completes each level and score of previous level variables. User Rank : This sub-data object has only a name, quantity and range. And after this concentration experiences reached the decided upper bounds, the rank of the user will increase one by one. In other words, if the users rank value is high then this means that this user has high ability of being in concentration state for long time. In this situation, this high ranked user has completed the levels in shorter time and got more scores in each played level by being concentrated during these levels not to make mistakes.

The process between brainwave and game level runs as in the following. -In a game level;

After feeding each animal on the screen, 3 seconds will pass to enable the animals change their position and during this time interval the user can not feed the animals and should wait and observe the animals to feed. The concentration-meter will show the amount of Beta Brainwaves of the user. This information will come from the BCID and some mentioned transformations following to it. While playing the game, according to the moving number of animals in the screen, the user will be expected to concentrate on the level. Meanwhile, the value in concentration-meter will change naturally. Because human cannot be fully focused in what he is doing all the time.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

30

While feeding the animals (correct or wrong), the time and score will be changing continuously. These time and score features of the levels makes the application more resembled to the usual computer games. When the concentration-meter reach the top limit, the color of the remaining unfed animals will be lightened for one second. This is an award for the concentrated users. All the values of the Beta brainwaves during time of the level will be represented as graphically (the descents and rises) in the analysis tab and be kept in the user database for long-term feedback.

- Deciding next level;

The difficulty stage of the next level will be calculated according to the cumulative average of the concentration-meter during the completion time of the previous level. Because the level of the Beta brainwaves in the concentration-meter is changing all the time. There will be a constant incrementation in the number of animals for the next level(for example 2 animal more), but by taking into consideration of the cumulative average of concentration state of the user, this incrementation will be additionally more.(instead of 2 animal, increase 5 animal) According to the completion time of previous level, the user will gain concentration experience. If this experience is enough to jump to next rank, the rank of the user will be increased by one. So the completion time and concentration experience are inversely correlated.

7 DETAILED DESIGN
The followings are the class diagram, activation diagram, and state diagrams of the whole system.

Relations Of Basic Data Objects

Figure 20 - ERD of The Simple Data Objects

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

31

Complete Data Model

Figure 21 - Complete Data Model

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

32

The Whole Process Of BCES

Figure 22 - State Transition Diagram of The Software

7.1 Manager
Classification: Class Definition: It represents the spine of the whole system. This is the only class that can communicate with all other classes of the system. Responsibilities: - Communication : The main responsibility of the manager class is to provide a communication environment between other components of the system. It has the capability to transmit the information from a component to the other.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

33

- Management : This class determines the working order of the other parts of the software. According to the generated events, the corresponding class awakened by the Manager class calling the relevant method of that class. - Handling : Error and exception handling is another responsibility of that class. If one of the all other classes faces a situation that needs the activation of the handling mechanism, it needs to indicate that situation to the Manager class. Processing: There are five distinct states of the Manager class, namely, initialization state transmission state, decision state, exception state and listen (idle) state. Initialization State: Initialize all other components. Subscribe event listeners. Go to Listen State. Decision State: Decide which component to run. If data transmission is needed go to Transmission state. If data transmission is not needed, active the next class and go to Listen state. Transmission State: Send data to relevant class. Go to listen state. Listen State: Wait until an event is generated. If an event is generated, go to decision state. If an exception is generated, go to exception state. Exception State: Handle the exception. According to the result of handling go to listen or decision.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

34

Figure 23 - Activity Diagram of Manager Component

Constraints: States : The state constraints are the following: At the beginning it is in initialization state. After the initialization of the program, the first state is decision state. If the manager class is in the decision state, it can switch all other stages. If the manager class is in a state other than the listen state, it can only switch to the listen state. Communication and Data Transmission: Communication with the manager class can be done two ways. One way is to generate an event and the other one is to call related method. The communication constraints are the following: Maximum five events can be generated unless the response of that events. If a class need a method call from the manager class, firstly it must generate an event that request a method call communication. Data transmission is can be done only method call communication type as method parameters. Data transmission limits: Game -> Manager --- 128KB per game level. Manager -> Analysis --- 128KB per game level. BCID -> Manager --- 80 times size of double per second. (1KB approximation) Timing : Timing constraints alter according to the state of the class. Timing constraints are the following: In transmission state, if an EGG data is transmitted, the manager class must wait at least 2 seconds in order to request another EGG data. In others states there is no timing constraint. The policy to handle exceptions and event is the earlier the request comes, the sooner the response generated.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

35

Uses / Interactions: Interaction: The manager class has right to direct interaction between each class component of the system. The types and procedures of the interactions are as follows: - Manager Class - Other Classes: Only the event generation types of interactions are possible. Other classes do not have right to access the methods of the manager class and they can only generate events in order to communicate with the manager class because of the security purposes. On the other hand, manager class have right to access the get and set methods of other classes. - Collaboration : Since the manager class has right to direct interaction between all other classes in the system, collaboration type of interaction is not valid for it. Resources: RAM : Manager class allocates memory for the following attributes: - previousGameLevelCompletioningInformation : object - concentrationData : object - nextLevelDifficulty : int - sampleConcentrationData : float[]; - currentTab : int; - userLoginData : object CPU : Manager class uses CPU every time except it activates another component. GPU : Manager class does not use that component. Database : Manager class does not use that component. EPOC Library : Manager class does not use that component. EPOC : Manager class does not use that component. Keyboard and Mouse : Manager class does not use that component. Interface / Exports: There are three subroutines of the Manager component. getInstantConcentrationData(): - It is a method of Manager Class. - It requires Transmission state. - Runs once at each two second. - Gets the EGG data from the BCID class. - Return ConcentrationData object. getMouseKeyboardInformation(): - It is a method of Manager class. - It requires Transmission state. - Runs after related event generated by the KeyboardMouse class. - Gets the keyboard and mouse state changing from the Keyboard-Mouse class. - Generates event for GUI class.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

36

- Returns void. getInstantSampleData(): - It is a method of Manager class. - It requires Transmission state. - Runs at the end of each game level. - Gets the concentration data from the Game class. - Returns float array. getNextLevelDifficulty(): - It is a method of Manager class. - It requires Transmission state. - Runs at the end of each game level. - Gets the game difficulty parameters for the next game level from the AI class. - Returns integer. getPreviousGameLevelCompilationInformation(): - It is a method of Manager class. - It requires Transmission state. - Runs at the end of each game level. - Gets the end game packet information from the game class. - Returns GameLevelCompilation object. getUserConcentrationHistory(): - It is a method of Manager Class. - It requires Transmission state. - Runs when user goes to the analysis tab, after GUI event. - Gets the user history data from the database using the analysis class. - Returns float array manageInterfaceTabs(): - It is a method of Manager class. - It requires Decision state. - Updates the GUI according to the generated events. - Take the tab ID as argument. - Returns void. updateUser(): - It is a method of Manager class. - It requires Transmission state. - It updates the login information of the user, after GUI event. - Takes user ID as argument. - Returns void. updateUserAnalysis(): - It is a method of Manager class. - It requires Transmission state. - It updates the analysis information of the user, after GUI event. - Takes user ID as argument. - Returns void.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

37

7.2 GAME
Classification: Class Definition: This class does not contain the actual game classes. Game class is the component of the software and it is designed to manage the game modules attached to the system. It provides an interface to the game module to make them communicate with the rest of the system. Responsibilities: Communication : The game class establishes the communication between the manager class and the game module. The game modules can interact with the system using this class only. Game Playing : The game class is also responsible for the execution of the game. It must fulfill the requirements of the game module. Therefore, it provides a standard interface to the game modules. Data Collection : It collects data during the game session for each level and at the end of the level, sends that data to the manager class. Processing: There are four states of the class which are the idle state, the game play state, transmission state and the exception state. Idle State: After being initialized by the manager class, it is in idle state. If it is activated, goes to game play state. Game Play State: Loads the game module and starts the game. Communicates with manager class for user inputs. At the end of the game level, goes to transmission state. Transmission State: Sends the end level information to the manager. Receives the game parameters for the next level. Goes to game play state. Exception State: Reports the exception to the manager class. Goes to the idle state.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

38

Figure 24 - Activity Diagram of Game Component

Constraints: - States : The state constraints are the following: If the class is in the idle state, it can only go to the transmission state. In order to go the game play state, it previously must be in the transmission state. After game play state it goes to the transmission state only. - Communication and Data Transmission: If the class is not in the idle state, game class and manager class communication continues. There are two types of data transmission between game module, game class and manager class. One is the end level data transmission and the other one is the during level input transmission. The communication constraints are the following: Only manager class can reach the methods of game class Only game module and manager class can make data transmission with the game class. At a game session only one game module can communicate with the game class. Data transmission limits: Game -> Manager --- 128KB per game level. - Timing : Timing constraints alter according to the state of the class. Timing constraints are the following: - In the game play state, input transmissions must be done in 25 milliseconds. - In the transmission state, all transmissions must be done in 2 seconds. Uses / Interactions: Interactions : There are two system components that can make direct interaction with the game class. These are manager class and game module. The types and procedures of the interactions are as follows:

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

39

- Game Class - Manager Class : Two way interactions are possible. Manager class have right to access the methods of the game class, however game class does not have that right. Game class can interact with the manager class only using the event generations. - Game Class - Game Module : Two way interactions are possible. However game module cannot access all methods of the game class. It can only use the game module interface. On the other hand, game class can have full access on the game module. Collaboration : The game class has collaboration with five main classes. These are analysis class, BCID class, AI class, GUI class and KeyboardMouse class. Resources: RAM : Game class allocates memory for the following attributes: - userConcentrationExperience : int - userConcentrationRank : int - currentLevelDifficulty : int - instantConcentrationData : float - levelCompletionTime : int - gameScore : int - levelComplationInformation : object - sampleConcentrationData : float[] CPU : Game class uses CPU only in game play state and transmission states. GPU : Game class does not use that component. Database : Game class does not use that component. EPOC Library : Game class does not use that component. EPOC : Game class does not use that component. Keyboard and Mouse : Game class does not use that component. Interface / Exports: There are three subroutines of the Game component. updateConcentrationExperience(): - It is a method of Game class. - It requires Transmission state. - Runs at the end of each game level. - Updates the concentration experience data. - Returns void. updateRank(): - It is a method of Game class. - It requires Transmission state. - Runs at the end of each game level.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

40

- Updates the concentration rank data. - Returns void. initializeGameWithGameDifficulty(): - It is a method of Game class. - It requires Game Play state. - Runs at the end of the state by the manager class once. - Sends the parameters for the new game to the game module. - Returns void. getMouseKeyboardInformation(): - It is a method of Game class. - It requires Game Play state. - Runs in every 25 milliseconds and generates an event. - Sends the information the the game module. getInstantConcentrationData(): - It is a method of Game class. - It requires Game Play state. - Gets concentration data from the manager class in every 2 seconds generating an event. - Sends the information the the game module. getGameLevelComplationInformation(): - It is a method of Game class. - It requires Transmission state. - It is run by the manager class at the end of each game level. - Sends the information to the manager class. getSampleConcentrationData(): - It is a method of Game class. - It requires Game Play state. - It is run by the game module in every two seconds. - Sends the sampled data to the game module. updateSampleConcentrationData(): - It is a method of Game class. - It requires Game Play state. - Runs after the getSampleConcentrationData method - Stores the sent information also in the game class.

7.3 AI
Classification: Class Definition: The AI class determines the parameters for the next game level during a game play session. Its aim is to find the optimal game parameters in order to increase the user concentration level without making the game boringly easy or too hard. Responsibilities: Planning : Using the planning algorithms and the previous level user concentration information, determines the game parameters for the next level.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

41

Processing: There are two states for the AI class which are idle state and calculation state. - Idle state : After being initialized by the manager class, it is in idle state. If it is activated, goes to calculation state. - Calculation State : Receives the game parameters and concentration information from the manager class. Calculates the next state parameters. Sends the result to the manager class. Goes to idle state.

Figure 25 - Activity Diagram Of AI Component

Constraints: - States : There is no state constraint for the AI class. Its states alters according to the manager class demands. - Communication and Data Transmission: The AI class does its communication and transmission with only manager class. There is no data transmission constraints because these transmissions is done using one object function parameters. - Timing : Since between each level section, the time limit of the game class is 2 seconds, the AI class must return its results in the calculation state in 1 seconds. Uses / Interactions: Interactions : The AI class has interaction only with the manager class. The types and procedures of the interactions are as follows: - AI Class - Manager Class : Two way interactions are possible. However AI class cannot access the methods of the manager class. It can only use the event system to send messages to the manager class. On the other hand, manager class can have full access on the AI class and has right to access all methods of the class.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

42

Collaboration : The AI class has a collaboration only with the game class. Resources: RAM : AI class allocates memory for the following attributes: - previousGameLevelComplationInformation : object - nextLevelDifficulty : int CPU : AI class uses CPU only in the calculation state. GPU : AI class does not use that component. Database : AI class does not use that component. EPOC Library : AI class does not use that component. EPOC : AI class does not use that component. Keyboard and Mouse : AI class does not use that component. Interface / Exports: There are three subroutines of the AI component. calculateNextLevel(): - It is a method of AI class. - It requires Calculation state. - Calculates the next level parameters using optimal planning algorithm. - Runs after getNextLevelDifficulty method. - Return integer. getNextLevelDifficulty(): - It is a method of AI class. - It requires Calculation state. - It is run by the manager class at the end of each game level. - Runs the calculateNextLevel method. - Returns integer.

7.4 BCID
Classification: Class Definition: This class gets the raw output from the BCID and provides a converted band brainwave data to the manager component. It provides a communication between the device and BCES. Responsibilities: - Gathering Device Output : The first action that the class executes is to extracting the raw brainwave data from the device.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

43

- Processing Input Data : The raw input which got from the device is applied some transformations. Because the brainwaves are electrical signals to process over them and perform some operations according to them, there are some converting transactions. This transaction occurs as mapping raw data from EEG channels to a queue structure. - Transforming to Band Data : The mapped raw data is transformed to the simple frequency values to easily used in the BECS. After FFT operations, the coming signals from the device will be converted to processed signals which has an frequency and so distinguished types such as delta, theta, alpha and beta. Processing: There are three distinct states reading raw data, transforming to band data, writing raw and band data. While doing this EEG Raw Data Listener and EEG Band Data Listener interfaces are used. These interfaces are implemented in the Input Handler sub-class which is provided by the company. - Reading Raw Data : In this state, by the reader thread, which is initialized immediately after connected to device, all queued channel data is retrieved as EEG raw data. - Transforming To Band Data : In this state EEGBandData values are calculated with Fast-Fourier-Transform (FFT) on EEGRawData. In the sample Band Data, list of Band Data is kept because there are more than one Band Data for each time interval Windowing in FFT which is 250 ms. FFT converts the data from time domain to frequency domain. Raw Data values in this time interval are processed to find total power on frequency bands. The resulting Band Data is informed to the receiver. - Writing Raw/Band Data : The write thread continuously write the raw data and converted band data to a write buffer in a loop after reading it. These stored data will be requested by manager component by and band/raw data listener. -Exception State: In this state it reports the exception to the manager class. Waits for reply from the Manager, if not goes to the final termination state.

Figure 26 - Activity Diagram Of BCID Component

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

44

Constraints: - States : After initialized by manager component, it is in read state. The read and write states are working in synchronized and continuously. But before writing state the raw or band data should be read first. If an listener from the manager component is created, before going to converting from raw to band data state, there should be a raw data stored during at least 250 ms. Before Transforming to Band Data state, the manager should have created an event and called getEEGSampleBandData method from BCID class. - Communication and Data Transmission : This class only responds requests that come from manager component. The Band Data and Raw Data listeners should be created by the manager components to add its listener to the listener list and then answering its need as reading the sample band data. The data transmitted between BCID and manager component will be the Sample Band Data type. So; It holds the total powers on specific frequency ranges: - Alpha waves 7 to 13 Hz - Beta waves 13 to 30 Hz - Theta waves 4 to 7 Hz - Delta waves 1 to 4 Hz The relation between the raw data and band data conversion is as the following: - 2000 ms measured Single EEGRawData object is transformed into a List containing 36 EEGBandData objects with different alpha, beta, theta, delta power values. Timing : Windowing determines the length of the time interval, whose values will be processed. Our time interval for a window is 250 ms. We perform FFT on windows by 50 ms shifts and 200 ms overlapping. For example, for the previous 2000 ms measured Single EEGRawData the sampling time is 250, the interval between each sampling is 50 ms and overlapping is 200 ms as in the figure. The main reason for this overlapping is to handle with loss of different types of band data and create continuity between samples. Uses / Interactions: - Interaction : BCID class only interacts with the manager component. Two way interactions are possible. However BCID class cannot access the methods of the manager class. It can only use the listener interface to send informing messages to the manager class. On the other hand, manager class can have full access on the BCID class and has right to access all methods of the class. There is a timer for each listener. Each timer periodically performs inform. So when a listener is created by the manager component, for regular intervals the manager will be informed with the converted Sample Band Data retrieved from the device. There are three sub-classes that help to this interaction: public class EEGRawData stores HashMap<Integer, Queue<Double>>() data format which is a map from EEG Channel Number to related ConcurrentLinkedQueue structure public class EEGSampleBandData stores HashMap<Integer, List<EEGBandData> >() data format which is a map from EEG Channel Number to related list of EEGBandData class. public class EEGBandData which stores 4 types of brainwave values as double.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

45

- Collaboration : The BCID class has a collaboration only with the EPOC BCID hardware besides from manager component. Resources: RAM : BCID class allocates memory for the following attributes: - EEGRawData : HashMap<Integer, Queue<Double>>() - EEGBandData : 4*sizeOf(double) - EEGSampleBandData : HashMap<Integer, List<EEGBandData> >() CPU : BCID class uses CPU only in the converting raw data to band data by FFT calculations. GPU : BCID class does not use that component. Database : BCID class does not use that component. EPOC Library : BCID class uses that component to track brainwave data. EPOC : BCID class uses that component to get EEG Signal Channels. Keyboard and Mouse : BCID class does not use that component. Interface / Exports: public boolean connectToBCI(): -Call at the application startup -Emotiv should have been connected -Two new threads are started; one for reading and one for writing raw EEG data public void addEEGRawDataListener(EEGRawDataListener, long): -Any tool requesting periodic callback of EEG Raw Data should subscribe to library -Subscribing should be as interface EEGRawDataListener -Period should be given in miliseconds public void removeEEGRawDataListener(EEGRawDataListener): - The listener which came from manager component is terminated. - No more EEG Raw Data can be extracted from BCID component. public void addEEGBandDataListener(EEGBandDataListener, long): -Any tool requesting periodic callback of EEG Band Data should subscribe to library -Subscribing should be as interface EEGBandDataListener (implemented) -Period should be given in miliseconds public void removeEEGBandDataListener(EEGBandDataListener): - The Band Data listener which came from manager component is terminated. - No more EEG Band Data can be converted from the raw data which is extracted from BCID Component. public EEGSampleBandData getEEGSampleBandData(long duration): -Converted EEG Band Data for a selected time interval is returned -Time interval is selected by duration parameter (last X milliseconds) public void exitApplication(); - The library terminates the BCID processes. - Removes the connection with the device.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

46

The followings are the additional interfaces which will be used in this component to help the manager communicate with it: public interface EEGRawDataListener which includes informEEGRawDataUpdate(EEGRawData eegRawData) function to inform the manager about the raw data input. public interface EEGBandDataListener which includes informEEGBandDataUpdate EEGSampleBandData eegSampleBandData) function to inform the manager about the converted band data input.

7.5 Keyboard Mouse


Classification: Class Definition: This class gets mouse/keyboard inputs from keyboard and mouse. It provides an interaction between the user and BCES. Responsibilities: The main responsibility of it is to transfer the keyboard/mouse inputs to the manager component. Processing: There is mainly two states in the component, Idle and Alert Event states. Idle State: If there is no input from the keyboard or mouse this component will be in that state. Alert Event State: This class sends an alert to the manager component according to the related keyboard or mouse input. For example Special Keyboard Keys or Left/Right Mouse Click generates an event to transmit to the manager component to urge other components like GUI or Game.

Figure 27 - Activity Diagram Of Keyboard-Mouse Component

Constraints: - States : After initialization by manager component the first state is idle state. If there is an input, goes to Alert Event state by creating an event to send to the manager. - Communication and Data Transmission : The only communication is with manager component. The manager waits for an keyboardmouse input. When an event occurs, the manager will retrieve the keyboard key or mouse click data from this component. And deliver this event to the related component as game or GUI. So,

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

47

there are two way communications, from this class to manager and from manager to this class for event listener. Uses / Interactions: Interaction: Keyboard-Mouse class only interacts with the manager component. Two way interactions are possible. However this class cannot access the methods of the manager class. It can only use the key/mouse event listener for inputs of the manager to send input data to the manager class. On the other hand, manager class can have full access on this class and has right to access all methods of the class. Collaboration : The Keyboard-Mouse class has collaboration only with the keyboard hardware besides from manager component. Resources: RAM : Keyboard-Mouse class allocates memory for only a Keyboard-Mouse event listener. CPU : Keyboard-Mouse class does not use CPU. Because there will be no usage over transmitted data. GPU : Keyboard-Mouse class does not use that component. Database : Keyboard-Mouse class does not use that component. EPOC Library : Keyboard-Mouse class does not use that component. EPOC : Keyboard-Mouse class does not use that component. Keyboard and Mouse : Keyboard-Mouse class uses these resources for getting input indirectly from the user. Interface / Exports: There is one sub-routine for this class which is Event Listener. getKeyboardMouseEvent(char input) : returns the event to be received by the manager component and transmitted to the related components. The inputs can be realized with the followings: --key_up(); --key_down(); --left_MOUSE_CLICK() --right_MOUSE_CLICK()

7.6 Analysis
Classification: The Analysis component representing a class in the software. is

Definition: The main purpose of the Analysis component is to keep track of users concentration history at the specific times. Users all concentration history data is stored in the database to let users to see their concentration history; namely their experience, rank and

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

48

concentration level (Beta brainwave value), of all sessions until the current time and let them to see how their concentration enhanced during the time interval that users used the software. Responsibilities: Data Storage: The main responsibility of the Analysis class is storing current session data and the history data of the users. Responding to Manager: -The Analysis class is responsible to respond the Managers User History data requests. It has to go to the User History table of the database take the related data and send them to the Manager. -It is also responsible for adding or deleting User History data. If a new user logs in or users history data has to be updated or deleted Manager notifies the Analysis class and necessary changes made in the User History table by Analysis class.

Processing: Sequential Processing: The normal processing sequence of the Analysis component is following: - The component is initialized by the Manager component. - After initialization it is in the idle state. - If any request comes from the Manager component it goes to the read/write state. - After read/ write state it goes to send state if needed - If any unexpected action happened it goes to exception state. - The read/ write or send or exception state switches to idle state immediately after confirmation message is sent to the Manager component. Below the conditions required to be in these states are explained; Idle State: There exist two conditions to be in this state - Initialization from the Manager component - Termination of read/write, send and exception states. Read/Write State: Requests coming from Manager Component that need database access and/or update, causes Analysis component to be in this state. These requests are following; - getConcentrationHistory() method call from the Manager - addToConcentrationHistory() method call from the Manager - deleteConcentrationHistory() method call from the Manager Send State: Analysis component is in this state only if request coming from Manager needs a return value. The component is in this state only after getConcentrationHistory() request come, the relevant data obtained from the database and it is ready to send the data to the Manager component. Exception State: If the component is not able to connect to database or the connection closed unexpectedly then database exception is thrown.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

49

Figure 2810 - Activity Diagram Of Analysis Component

Constraints: States: There exist four states of the Analysis class. The first one is the idle (listen) state, the second state is read/write state, third one is the send state and the last one is exception state. The constraints are following: After initialization it is in idle state. It switches to read/write state by only notification of the Manager component. It switches to send state only if it is sending the data to the Manager component. It goes to exception state only if it is throwing an exception to the Manager component. It can switch to idle state from read/write, send or exception state only after sending a confirmation message to the Manager component. Communication: Communication with this component is made only via Manager Component, like all other components. Uses / Interactions: Interaction: Analysis component directly interact only with Manager Component. Since all the communication between components is done through Manager. Collaboration: Analysis component is collaborated with two other components indirectly; namely Login and GUI. - Collaboration with Login component is necessary since the User History data includes the user name information and it is used for identification of the user. Therefore any change made on user name should also be applied to the User History data. - This component should also collaborate with GUI component. Since if the user wants to see his/her history data, that data will be seen in the GUI through Manager Component. Resources: RAM: Analysis component allocates memory for the following attribute; - userConcentrationHistory : float[] CPU: The component uses CPU immediately after it is activated by the Manager component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

50

GPU: Analysis component does not use that component. Database: This resource is used for - storing user history data - updating and deleting the user history data Epoc: Analysis component does not use that component. Epoc Library: Analysis component does not use that component. Keyboard & Mouse: Analysis component does not use that component. Interface / Exports: There are three subroutines of the Analysis component. getConcentrationHistory() : - Method of the Analysis component - Called only from Manager component - Gets and sends history information of the user - Only resource is the database. - Active only in read/write and send state - Returns history data of the user to the Manager component addToConcentrationHistory(): - Method of the Analysis component - Called only from Manager component - Adds history information of the user - Only resource is the database. - Active only in read/write state - Returns void deleteConcentrationHistory(): - Method of the Analysis component - Called only from Manager component - Deletes history information of the user - Only resource is the database. - Active only in read/write state - Returns void

7.7 Login
Classification: The Login component is representing a class in the software. Definition: The main purpose of the Login component is to store users name and their password in order to let them log to the system. Thus users have access to all components of the software. Responsibilities: Authentication: The main responsibility of the Login component is authentication. It is accomplished by matching

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

51

the user name and password data that is inputted to the system with the existing user names and passwords. If a match is found, than user is allowed to log in to the system. Data Storage: The other responsibility of the Login component is storing user name and password data of users. User Management: The Login component is also responsible for managing users, namely creating new user, updating user information or deleting them. Processing: Sequential Processing: The normal processing sequence of the Login component is following: The component is initialized by the Manager component. After initialization it is in the idle state. If any request comes from the Manager component it goes to the running state. If any unexpected action happened it goes to exception state. The running or exception state switches to idle state immediately after confirmation message is sent to the Manager component. Below the conditions required to be in these states are explained; Idle State: There exist two conditions to be in this state Initialization from the Manager component Termination of running or exception states. Running State: Requests coming from Manager Component that need database access such as; add/remove, update or send user information causes Login component to be in this state. These requests are following; confirmLoginData() method call from the Manager createNewUser() method call from the Manager readUserLoginData() method call from Manager deleteUserLoginData() method call from Manager updateUserLoginName() method call from the Manager updateUserPassword() method call from the Manager Exception State: If the component is not able to connect to database or the connection closed unexpectedly then database exception is thrown.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

52

Figure 29 - Activity Diagram Of Login Component

Constraints: States: There exist three states of the Login class. The first one is the idle (listen) state, the second state running is state and the last one is exception state. The constraints are following: After initialization it is in idle state. It switches to running state by only notification of the Manager component. It goes to exception state only if it is throwing an exception to the Manager component. It can switch to idle state from running or exception state only after sending a confirmation message to the Manager component. Communication: Communication with this component is made only via Manager Component, like all other components. Uses / Interactions: Interaction: Login component directly interact only with Manager component. Since all the communication between components is done through Manager. Collaboration: Login component is collaborated with two other components indirectly; namely Analysis and GUI. Collaboration with Analysis component is necessary since the user name here also used in Analysis component in order to identify the user. This component should also collaborate with GUI component. Since at first the user expected to log in with an existing account or create one and then log in. If the user is confirmed then all the system will be seen by the user. Resources: RAM: Login component allocates memory for the following attributes; - name : String - password : String - userRank : int CPU: The component uses CPU immediately after it is activated by the Manager component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

53

GPU: Login component does not use that component. Database: This resource is used for - storing user name, password and userRank Epoc: Login component does not use that component. Epoc Library: Login component does not use that component. Keyboard & Mouse: Login component does not use that component. Interface / Exports: There are six subroutines of the Login component. confirmLoginData() : - Method of the Login component - Called only from Manager Component - Compares the name and user information coming from the user with database and authenticate the user if a match is found. - Only resource is the database - Active only in running state - Returns boolen value indicating whether a match is found or not createNewUser(): - Method of the Login component - Called only from Manager Component - Creates a new account for the user and updates the database accordingly - Only resource is the database - Active only in running state - Returns void readUserLoginData(): - Method of the Login component - Called only from Manager Component - Reads the user login data from database - Only resource is the database - Active only in running state - Returns user login data deleteUserLoginData(): - Method of the Login component - Called only from Manager component - Deletes the user login data from database - Only resource is the database - Active only in running state - Returns void updateUserLoginName(): - Method of the Login component - Called only from Manager component - Updates the user name in the database - Only resource is the database - Active only in running state - Returns void

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

54

updateUserPassword(): - Method of the Login component - Called only from Manager component - Updates the user password in the database - Only resource is the database - Active only in running state - Returns void The relation between Login and Analysis components is as in the following figure:

Figure 30 - ER Diagram Of Login&Analysis Components

7.8 GUI
Classification: The GUI component is representing a class in the software. Definition: The main purpose of the GUI component is to provide all the interaction with graphical user interface of the system. Responsibilities: Input Receiving: The component is responsible for receiving all the input that are coming from the user and send them to the Manager in order to Manager do the necessary job for that. Interface Display : The component is responsible for changing the display of the user interface according to current tab information, requests and data that come from Manager component. Processing: Sequential Processing: The normal processing sequence of the GUI component is following: The component is initialized by the Manager component. After initialization it is in login input state. If the user authenticated via Manager component it goes to the display state. If any request come from Manager component that needs to update the user interface it goes to update state. If any unexpected action happened it goes to exception state. The login input, display, update or exception state switches to idle state immediately after confirmation message is sent to the Manager component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

55

Below the conditions required to be in these states are explained; Login Input State: The component is in this state only the user first log in to the system. If while in this state the user authenticated via Manager the user is able to see the main interface0 of the system. Otherwise it goes to idle state until the user has the authentication. The component to be in this state the following request has to come from Manager - displayLoginInterface() Display State: Requests coming from Manager component that needs a specific component to be displayed cause GUI component to be in this state. These requests are following; - displayCalibrationInterface() method call from the Manager - displayGameInterface() method call from the Manager - displayAnalysisInterface() method call from the Manager Update State: GUI component is in this state only if request coming from Manager needs updating the main interface. The component is in this state only when return value of the getCurrentTab() method differs the previous one. According to the return value the main interface is updated by request of Manager component and the component goes to display state. Idle State: There exist a condition to be in this state; - If display, update, exception states are terminated or the user waits and do nothing in the Login Input state. Exception State: If an unexpected action happened while updating and displaying the main interface the component throws an exception and goes back to idle state and waits for Manager for any request.

Figure 31 - Activity Diagram Of GUI

Constraints: States: There exist five states of the GUI component. The first one is the Login Input state, the second state is display state, third one is the update state, fourth one is idle and the last one is exception state. The constraints are following: After initialization it is in login input state. It switches to display state by only notification of the Manager component.

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

56

It switches to update state by only notification of the Manager component. It goes to exception state only if it is throwing an exception to the Manager component. It can switch to idle state from login input, display, update or exception state only after sending a confirmation message to the Manager component. Communication: Communication with this component is made only via Manager component, like all other components. Uses / Interactions: Interaction: GUI component directly interact only with Manager component. Since all the communication between components is done through Manager. Collaboration: GUI component is collaborated with three other components indirectly; namely Login, Analysis, Game and KeyboardMouse. Collaboration with Login component is necessary since at first the system will expect from user to log in, if the user authenticated then the main interface will be available. This component should also collaborate with GUI component. Since if the user wants to see his/her history data, that data will be seen in the GUI will come from Analysis component through Manager component. Collaboration with Game component is necessary since the chosen game will be displayed in the GUI. Since the display content will be changed or updated according to keyboard and mouse actions collaboration with KeyboardMouse component is necessary. Resources: RAM: GUI component allocates memory for the following attributes; - currentTab : int - loginData : LoginData CPU: The component uses CPU immediately after it is activated by the Manager component. GPU: GUI component use GPU since it displays a graphical user interface. Database: GUI component does not use a resource directly. Epoc: GUI component does not use that component directly. Epoc Library: GUI component does not use that component directly. Keyboard & Mouse: GUI component does not use that component directly. Interface / Exports:
There are six subroutines of the GUI component. displayLoginInterface() : - Method of the GUI component - Called only from Manager Component - Displays the login interface of the system - Active only in Login Input state - Returns void

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

57

displayCalibrationInterface(): - Method of the GUI component - Called only from Manager Component - Displays the calibration interface of the system - Active only in display state - Returns void displayGameInterface(): - Method of the GUI component - Called only from Manager Component - Displays the chosen game by the user in the main interface - Active only in display state - Returns void displayAnalysisInterface(): - Method of the GUI component - Called only from Manager Component - Displays the history of the user in the main interface. - Active only in display state - Returns void getLoginData(): - Method of the GUI component - Called only from Manager Component - Gets the login data, user name and password data that the user inputs to the system. - Active only in login input state - Returns LoginData of the user inputted to the system getCurrentTab(): - Method of the GUI component - Called only from Manager Component - Gets the currently chosen tab by the user - Active only in update state - Returns currently chosen tab by the user in the main interface

8 LIBRARIES AND TOOLS


As mentioned before; since we are going to use BCID, the product that we are going to deliver is going to work only on Windows operating system. This is because development and interface of Emotiv SDK is developed on Windows operating system therefore only usable on Windows. However we are going to use Emotiv SDK in an indirect way. Because the company that we are working with are developing a Java library while using this BCID. They are making things easier for us by providing some public methods. By using these methods we are not going to deal by receiving raw data and then do some exhaustive operations like Fourier transformations, data acquisition, signal enhancement, feature extraction and so on in order to have a meaningful data that we are going to use. Instead these methods will give us what we need to without dealing the internal details of them and the device. Since we are going to be a group of four people, we are going to do different parts of the product. Therefore we are going to need a tool to integrate the parts that we developed individually to the whole project and make sure that all group members are aware of the change that we made and maybe use it for some purpose. Having look at some tools we find a really nice tool named TortoiseSVN. This tool is a really easy to use revision control/ version control / source control

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

58

software for Windows. It is based on subversion. TortoiseSVN provides a nice and easy user interface for subversion. It is developed under the GPL. Which means it is completely free, including the source code. Since it's not an integration for a specific IDE like Visual Studio, Eclipse, Netbeans or others, we are going to able to use it with whatever development tools we like. As a Subversion client, TortoiseSVN has all the features of Subversion itself, including: Most current CVS features. Directories, renames, and file meta-data are versioned. Commits are truly atomic. Branching and tagging are cheap (constant time) operations. Efficient handling of binary files.

Therefore using such a tool will help us a lot while developing integrating and while releasing the sub-versions of our product. We were thinking to use an object oriented programming language since we started this project. This object oriented programming candidates were C++ and Java. It is known that C++ is regarded as a "middle-level" language, as it comprises a combination of both high level and low level language features.2 However; Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible and it is intended to let application developers "write once, run anywhere" and currently one of the most popular programming languages in use. Therefore the language that we decided to use is Java.3 Moreover since the library that will be provided to us by the company is going to be a Java library using Java will be more compatible. Since the project is a long term and complicated project we are going to need a user friendly and secure IDE. Looking at IDEs we find Eclipse more usable for us. Because Eclipse is a free, opensource, a very good GUI form editor, and easy to install Integrated Development Environment. Furthermore it gives immediate error messages; therefore you are able to fix the erroneous code before it causes bigger problems. It provides indentation, braces and renaming which we will need a lot during this project. Moreover it is easy to get all the tools and plug-ins that we will need, to develop our project with the Java platform.4 The final product will be used by people from almost all ages as we mentioned before. Therefore we need to have a very user friendly, nice looking, high-performance user interface. Therefore we decided to use SWT for this purpose. Because SWT is a graphical widget toolkit for use with the Java platform and it is high performance GUI toolkit; faster, more responsive and lighter on system resource usage than the other toolkit. Moreover SWT widgets have the same look and feel as native widgets because they often are the same native widgets.5 In order to keep track of users; their names, passwords and history we need to have a database. For this purpose we decided to use MySQL. Because it is an open-source, more compatible than other databases, a very good performance, and a secure database. These are all what we need in
2 3 4 5 http://en.wikipedia.org/wiki/C%2B%2B http://en.wikipedia.org/wiki/Java_%28programming_language%29 http://en.wikipedia.org/wiki/Eclipse_%28software%29 http://en.wikipedia.org/wiki/Standard_Widget_Toolkit

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

59

terms of user history privacy, high performance while showing existing data and the user account security. Finally for the game that we are going to design we need a very attractive, entertaining, nice looking game. Because our product is going to be used by people from almost all ages, and people that suffer from lack of concentration. Therefore we have to have and keep their attention. Therefore we decided to use Adobe Flash for our game. Moreover Flash is pre-installed with Windows on corporate machines; therefore users dont need to install further t hings. Furthermore the main advantage of using Flash is that it's simply well-suited to the task of making games.6

http://www.flashmagazine.com/tutorials/detail/advantages_of_flash/

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

60

9 TIME PLANNIG (Gannt Chart)


9.1 Term 1 Gannt Chart

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

61

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

62

9.2 Term 2 Gannt Chart

D e t a i l e d

D e s i g n

D e s c r i p t i o n

f o r

B r a i n w a v e

B a s e d

C o n c e n t r a t i o n

E n h a n c i n g

63

10 CONCLUSION
BCID is a new way of human and computer interaction. Most probably, in a decade, these devices will be used in many applications. Not only for medical applications but also the applications for casual users, they would become a major component. BCES project is based on this foresight. This project tries to discover new areas of BCID usage and combine them with the existing ones generating a compact daily life solution. Moreover, the modular game integrity system of the software leaves the door open to develop more concentration based games for the software in the future. That property will make the life time of the software become longer. Therefore, the BCES project is designed as a long term solution to make the neurofeedback technology a daily life concentration enhancement assistant of users.

Вам также может понравиться