public void configureAndConnectHeadSet() { EHeadSetType type = getAppSettings().getHeadSetType(); if (m_AppSettings.isUsingHeadSet() && m_HeadSet == null) { switch (type) { case MindWave: m_HeadSet = new MindWave(); Logs.info(APP_MANAGER, "Connected to: MINDWAVE :)"); break; case Moker: Logs.info(APP_MANAGER, "Connected to: MOCKER"); m_HeadSet = new MockerHeadSet(); break; } } connectToHeadSet(); }
public void raiseOnHeadSetChangedState(String headSetName, EConnectionState connectionState) { Logs.info(EEGHEADSET_STR, headSetName + " connecetd!"); for (IHeadSetData headSetData : m_HeadSetData) { if (headSetData != null) { headSetData.onHeadSetChangedState(headSetName, connectionState); } } }
public static AppManager getInstance() { if (m_Instance == null) { m_Instance = new AppManager(); Logs.info( APP_MANAGER, "~ * ~ * ~ * Just created AppManager instance (Singleton)! * ~ * ~ * ~"); } return m_Instance; }
public void raiseOnAttention(int attValue) { Logs.info(EEGHEADSET_STR, ATTENTION_STR + ": " + attValue); for (IHeadSetData headSetData : m_HeadSetData) { if (headSetData != null) { headSetData.onAttentionReceived(attValue); } } }
public void connectToHeadSet() { if (m_AppSettings.isUsingHeadSet() && m_HeadSet != null) { m_HeadSet.connect(); Logs.info(APP_MANAGER, "Try to connect to MindWave"); } // mocker else { m_HeadSet.connect(); } }
public void raiseOnMeditation(int medValue) { Logs.info(EEGHEADSET_STR, MEDITATION_STR + ": " + medValue); for (IHeadSetData headSetData : m_HeadSetData) { if (headSetData != null) { headSetData.onMeditationReceived(medValue); } } }
@Override public void onHeadSetChangedState(String headSetName, EConnectionState connectionState) { // While the HeadSet is not connected we try to connect switch (connectionState) { case DEVICE_CONNECTED: case DEVICE_CONNECTING: case BLUETOOTH_NOT_AVAILABLE: break; case DEVICE_NOT_FOUND: case DEVICE_NOT_CONNECTED: connectToHeadSet(); Logs.info(APP_MANAGER, "Connection fail from some reason, try to connect again..."); break; } }
public void raiseOnPoorSignal(int poorSignalValue) { Logs.info(EEGHEADSET_STR, POOR_SIGNAL_STR + ": " + poorSignalValue); ESignalVolume signalVolume = ESignalVolume.getSignalVolume(poorSignalValue); if (signalVolume != ESignalVolume.GOOD_SIGNAL || m_CurrentPoorSignal != poorSignalValue) { for (IHeadSetData headSetData : m_HeadSetData) { if (headSetData != null) { headSetData.onPoorSignalReceived(signalVolume); } } } m_CurrentPoorSignal = poorSignalValue; }
// C'tor private AppManager() { m_AppSettings = new AppSettings(); Logs.info("APP_MANAGER", "APP_MANAGER"); // configureAndConnectHeadSet(); }