Stay Awake is designed for the detection of wakefulness / sleepiness in drivers and workers. It is the first to come out on the market for use with mobile devices, such as those based on iOS (iPhone and iPad) with the purpose of contributing to the reduction of personal and social risk derived from a state of drowsiness (e.g. to anticipate sleep attack).
The app requires the use of MindWave Mobile for reading brainwaves.
The algorithm for determining the state of drowsiness is obtained from scientific publications, such as "Development of Drowsiness Detector System for Late Night Shift Worker Using Support Vector Machine Method with NeuroSky Mindwave Mobile" (Izzat AA et al) but you can find it similar to many other online.