Guest User

Untitled

a guest
Jun 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. /**
  2. * A Handler for ThinkGear, a way to handle messages from the MindWave to an Android device
  3. */
  4. private final Handler handler = new Handler() {
  5. @Override
  6. public void handleMessage(Message msg) {
  7.  
  8. switch (msg.what) {
  9. case TGDevice.MSG_STATE_CHANGE :
  10. switch (msg.arg1) {
  11. case TGDevice.STATE_IDLE :
  12. break;
  13.  
  14. case TGDevice.STATE_CONNECTING :
  15. myTextView = (TextView) findViewById(R.id.connectStatus);
  16. myTextView.setText("Connecting ...");
  17.  
  18. break;
  19.  
  20. case TGDevice.STATE_CONNECTED :
  21. myTextView = (TextView) findViewById(R.id.connectStatus);
  22. myTextView.setText("Connected");
  23. tgDevice.start();
  24.  
  25. break;
  26.  
  27. case TGDevice.STATE_NOT_FOUND :
  28. myTextView = (TextView) findViewById(R.id.connectStatus);
  29. myTextView.setText("Connection Not Found, reset and try again.");;
  30.  
  31. break;
  32.  
  33. case TGDevice.STATE_NOT_PAIRED :
  34. myTextView = (TextView) findViewById(R.id.connectStatus);
  35. myTextView.setText("There is not Mindset paired to this device.");
  36.  
  37. break;
  38.  
  39. case TGDevice.STATE_DISCONNECTED :
  40. myTextView = (TextView) findViewById(R.id.connectStatus);
  41. myTextView.setText("Disconnected");
  42. }
  43.  
  44. break;
  45.  
  46. case TGDevice.MSG_POOR_SIGNAL :
  47. myTextView = (TextView) findViewById(R.id.signal);
  48.  
  49. if (msg.arg1 == 0) {
  50. myTextView.setText("Great");
  51. } else if (msg.arg1 > 50) {
  52. myTextView.setText("Poor, please readjust headset.");
  53. }
  54.  
  55. break;
  56. /**
  57. * The eSens Attention meter indicates the intensity of a user's level of mental focus
  58. * or attention, such as that occures during intense concentration and directed
  59. * (but stable) mental activity.
  60. * Generally, Attention can be controller through a visual focus.
  61. * Focus on a singular idea.
  62. * Try to funnel your concentration and focus your train of thought toward pushing up
  63. * the meter.
  64. * Other suggestions include picking a point on the screen to stare at or imaging the
  65. * action you are trying to accomplish happening.
  66. * For example, look at the Attention meter and imagine the dial moving towards higher
  67. * numbers.
  68. * Distractions, wandering thoughts, lack of focus, or anxiety may lower the Attention
  69. * meter level.
  70. */
  71. case TGDevice.MSG_ATTENTION :
  72. mProgress = (ProgressBar) findViewById(R.id.attentionBar);
  73. mProgress.setProgress(msg.arg1);
  74.  
  75. break;
  76. /**
  77. * The eSens Meditation meter indicates the level of a user's mental calmness or
  78. * relaxation.
  79. * Meditation is related to reduce activity by the active mental processes in the
  80. * brain.
  81. * For Meditation, it typically helps to try to relax.
  82. * Connect to a sens of peace and calm by clearing your mind of thought and
  83. * distractions.
  84. * For most people, relaxing the bodyoften an effective method for increasing
  85. * the Meditation, close your eyes to see how the meter has responded.
  86. * Distractions, wandering thoughts, anxiety, agitation, and sensory stimuli may
  87. * lower the Meditation meter level.
  88. */
  89. case TGDevice.MSG_MEDITATION :
  90. mProgress = (ProgressBar) findViewById(R.id.meditationBar);
  91. mProgress.setProgress(msg.arg1);
  92. break;
  93.  
  94. case TGDevice.MSG_BLINK :
  95. myTextView = (TextView) findViewById(R.id.blink);
  96. myTextView.setText("Blink " + msg.arg1);
  97. break;
  98.  
  99. case TGDevice.MSG_EEG_POWER :
  100. fbands = (TGEegPower) msg.obj;
  101. points.add(fbands);
  102. /**
  103. * HIGH BETA 13 ~ 40 Hz
  104. * onde la plus rapide
  105. * assicée etat d'éveil actif, le cerveau est éveillé et engagé dans une activité
  106. * mentale
  107. */
  108. myTextView = (TextView) findViewById(R.id.ch1);
  109. myTextView.setText("High Beta " + fbands.highBeta);
  110. /**
  111. * LOW BETA
  112. * Lorsque vous lisez avant de dormir vous êtes probablement en basse frèquence
  113. * bêta.
  114. * Plus l'activité est intence, peur, colère, faim, surprise plus la frêquence est
  115. * rapide.
  116. */
  117. myTextView = (TextView) findViewById(R.id.ch2);
  118. myTextView.setText("Low Beta " + fbands.lowBeta);
  119. /**
  120. * LOW ALPHA 8 ~ 13 Hz
  121. * Apparaissent quand nous sommes détendu mais non somnolents, dans une vigilence
  122. * sans effort état de quiètude, comme la méditation légère, la réflexion, le rêve
  123. * éveillé
  124. * - le biofeedback [rétroaction biologique
  125. * - intégration corps/esprit
  126. * - l'hypnose légère
  127. * - la visualisation créatrice
  128. * - les processus artistiques etintuitifs
  129. * - l'immersion dans la nature
  130. * - le repos et l'exércice
  131. */
  132. myTextView = (TextView) findViewById(R.id.ch3);
  133. myTextView.setText("Low Alpha " + fbands.lowAlpha);
  134. /**
  135. * HIGH ALPHA
  136. */
  137. myTextView = (TextView) findViewById(R.id.ch4);
  138. myTextView.setText("High Alpha " + fbands.highAlpha);
  139. /**
  140. * THETA 4 ~ 8 Hz
  141. * Associés à la somnolence (le premier stade du sommeil)
  142. * au rêve
  143. * -à la méditation profonde
  144. * - à la création inspirée par l'imgination
  145. * -aux souvenirs plus clairs
  146. * - états mystiques de perception intuitive
  147. * - peut ressembler à la transe comme :
  148. * être sur une autoroute
  149. * prendre une douche et se détendre
  150. * quand on perds la notion du temps
  151. * un libre flux d'idées ou visions fait surface dans notre esprit
  152. */
  153. myTextView = (TextView) findViewById(R.id.ch5);
  154. myTextView.setText("Theta " + fbands.theta);
  155. /**
  156. * DELTA 1/2 ~ 4 Hz
  157. * se manifestent durant le sommeil profond
  158. * liées au somnebulisme et la somniloquie ainsi qu'à la transe profonde
  159. * liés aux processus d'autoguérison
  160. */
  161. myTextView = (TextView) findViewById(R.id.ch7);
  162. myTextView.setText("Mid Gamma " + fbands.delta);
  163. /**
  164. * LOW GAMMA
  165. */
  166. myTextView = (TextView) findViewById(R.id.ch6);
  167. myTextView.setText("Low Gamma " + fbands.lowGamma);
  168. /**
  169. * HIGH GAMMA
  170. */
  171. myTextView = (TextView) findViewById(R.id.ch6);
  172. myTextView.setText("Low Gamma " + fbands.highGamma);
  173.  
  174. break;
  175.  
  176. case TGDevice.MSG_LOW_BATTERY :
  177. Toast.makeText(getApplicationContext(), "Low battery!", Toast.LENGTH_SHORT).show();
  178.  
  179. break;
  180.  
  181. default :
  182. break;
  183. }
  184.  
  185. }
  186. };
Add Comment
Please, Sign In to add comment