Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * A Handler for ThinkGear, a way to handle messages from the MindWave to an Android device
- */
- private final Handler handler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case TGDevice.MSG_STATE_CHANGE :
- switch (msg.arg1) {
- case TGDevice.STATE_IDLE :
- break;
- case TGDevice.STATE_CONNECTING :
- myTextView = (TextView) findViewById(R.id.connectStatus);
- myTextView.setText("Connecting ...");
- break;
- case TGDevice.STATE_CONNECTED :
- myTextView = (TextView) findViewById(R.id.connectStatus);
- myTextView.setText("Connected");
- tgDevice.start();
- break;
- case TGDevice.STATE_NOT_FOUND :
- myTextView = (TextView) findViewById(R.id.connectStatus);
- myTextView.setText("Connection Not Found, reset and try again.");;
- break;
- case TGDevice.STATE_NOT_PAIRED :
- myTextView = (TextView) findViewById(R.id.connectStatus);
- myTextView.setText("There is not Mindset paired to this device.");
- break;
- case TGDevice.STATE_DISCONNECTED :
- myTextView = (TextView) findViewById(R.id.connectStatus);
- myTextView.setText("Disconnected");
- }
- break;
- case TGDevice.MSG_POOR_SIGNAL :
- myTextView = (TextView) findViewById(R.id.signal);
- if (msg.arg1 == 0) {
- myTextView.setText("Great");
- } else if (msg.arg1 > 50) {
- myTextView.setText("Poor, please readjust headset.");
- }
- break;
- /**
- * The eSens Attention meter indicates the intensity of a user's level of mental focus
- * or attention, such as that occures during intense concentration and directed
- * (but stable) mental activity.
- * Generally, Attention can be controller through a visual focus.
- * Focus on a singular idea.
- * Try to funnel your concentration and focus your train of thought toward pushing up
- * the meter.
- * Other suggestions include picking a point on the screen to stare at or imaging the
- * action you are trying to accomplish happening.
- * For example, look at the Attention meter and imagine the dial moving towards higher
- * numbers.
- * Distractions, wandering thoughts, lack of focus, or anxiety may lower the Attention
- * meter level.
- */
- case TGDevice.MSG_ATTENTION :
- mProgress = (ProgressBar) findViewById(R.id.attentionBar);
- mProgress.setProgress(msg.arg1);
- break;
- /**
- * The eSens Meditation meter indicates the level of a user's mental calmness or
- * relaxation.
- * Meditation is related to reduce activity by the active mental processes in the
- * brain.
- * For Meditation, it typically helps to try to relax.
- * Connect to a sens of peace and calm by clearing your mind of thought and
- * distractions.
- * For most people, relaxing the bodyoften an effective method for increasing
- * the Meditation, close your eyes to see how the meter has responded.
- * Distractions, wandering thoughts, anxiety, agitation, and sensory stimuli may
- * lower the Meditation meter level.
- */
- case TGDevice.MSG_MEDITATION :
- mProgress = (ProgressBar) findViewById(R.id.meditationBar);
- mProgress.setProgress(msg.arg1);
- break;
- case TGDevice.MSG_BLINK :
- myTextView = (TextView) findViewById(R.id.blink);
- myTextView.setText("Blink " + msg.arg1);
- break;
- case TGDevice.MSG_EEG_POWER :
- fbands = (TGEegPower) msg.obj;
- points.add(fbands);
- /**
- * HIGH BETA 13 ~ 40 Hz
- * onde la plus rapide
- * assicée etat d'éveil actif, le cerveau est éveillé et engagé dans une activité
- * mentale
- */
- myTextView = (TextView) findViewById(R.id.ch1);
- myTextView.setText("High Beta " + fbands.highBeta);
- /**
- * LOW BETA
- * Lorsque vous lisez avant de dormir vous êtes probablement en basse frèquence
- * bêta.
- * Plus l'activité est intence, peur, colère, faim, surprise plus la frêquence est
- * rapide.
- */
- myTextView = (TextView) findViewById(R.id.ch2);
- myTextView.setText("Low Beta " + fbands.lowBeta);
- /**
- * LOW ALPHA 8 ~ 13 Hz
- * Apparaissent quand nous sommes détendu mais non somnolents, dans une vigilence
- * sans effort état de quiètude, comme la méditation légère, la réflexion, le rêve
- * éveillé
- * - le biofeedback [rétroaction biologique
- * - intégration corps/esprit
- * - l'hypnose légère
- * - la visualisation créatrice
- * - les processus artistiques etintuitifs
- * - l'immersion dans la nature
- * - le repos et l'exércice
- */
- myTextView = (TextView) findViewById(R.id.ch3);
- myTextView.setText("Low Alpha " + fbands.lowAlpha);
- /**
- * HIGH ALPHA
- */
- myTextView = (TextView) findViewById(R.id.ch4);
- myTextView.setText("High Alpha " + fbands.highAlpha);
- /**
- * THETA 4 ~ 8 Hz
- * Associés à la somnolence (le premier stade du sommeil)
- * au rêve
- * -à la méditation profonde
- * - à la création inspirée par l'imgination
- * -aux souvenirs plus clairs
- * - états mystiques de perception intuitive
- * - peut ressembler à la transe comme :
- * être sur une autoroute
- * prendre une douche et se détendre
- * quand on perds la notion du temps
- * un libre flux d'idées ou visions fait surface dans notre esprit
- */
- myTextView = (TextView) findViewById(R.id.ch5);
- myTextView.setText("Theta " + fbands.theta);
- /**
- * DELTA 1/2 ~ 4 Hz
- * se manifestent durant le sommeil profond
- * liées au somnebulisme et la somniloquie ainsi qu'à la transe profonde
- * liés aux processus d'autoguérison
- */
- myTextView = (TextView) findViewById(R.id.ch7);
- myTextView.setText("Mid Gamma " + fbands.delta);
- /**
- * LOW GAMMA
- */
- myTextView = (TextView) findViewById(R.id.ch6);
- myTextView.setText("Low Gamma " + fbands.lowGamma);
- /**
- * HIGH GAMMA
- */
- myTextView = (TextView) findViewById(R.id.ch6);
- myTextView.setText("Low Gamma " + fbands.highGamma);
- break;
- case TGDevice.MSG_LOW_BATTERY :
- Toast.makeText(getApplicationContext(), "Low battery!", Toast.LENGTH_SHORT).show();
- break;
- default :
- break;
- }
- }
- };
Add Comment
Please, Sign In to add comment