Changeset 332
- Timestamp:
- 03/25/12 10:35:25 (9 years ago)
- Location:
- trunk/Puzzlebox/Synapse
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Puzzlebox/Synapse/Emotiv/Protocol.py
r331 r332 7 7 """ 8 8 9 import os 10 11 #import Configuration as configuration 12 ENABLE_PYSIDE = True 13 14 #if configuration.ENABLE_PYSIDE: 15 if ENABLE_PYSIDE: 16 try: 17 import PySide as PyQt4 18 from PySide import QtCore, QtGui, QtNetwork 19 except Exception, e: 20 print "ERROR: Exception importing PySide:", 21 print e 22 configuration.ENABLE_PYSIDE = False 23 else: 24 print "INFO: [Synapse:Interface] Using PySide module" 25 26 else: 27 print "INFO: [Synapse:Interface] Using PyQt4 module" 28 from PyQt4 import QtCore, QtGui, QtNetwork 29 30 31 os.environ['PATH'].join( \ 32 os.path.join(os.getcwd(), 'Puzzlebox', 'Synapse', 'Emotiv')) 33 34 9 35 from PyEpoc import * 10 11 #####################################################################12 # Globals13 #####################################################################14 15 UserID = 016 36 17 37 EmotivEngine = EpocHandler() … … 21 41 EmotivEngine.ES_Init(statehandle) 22 42 43 44 ##################################################################### 45 # Globals 46 ##################################################################### 47 48 DEBUG = 1 49 50 UserID = 0 51 52 DEFAULT_CHOICE = 'a' # EmoComposer 53 #DEFAULT_CHOICE = 'b' # Emotiv Headset 23 54 24 55 ##################################################################### … … 40 71 self.DEBUG = DEBUG 41 72 self.parent = parent 73 74 self.choice = DEFAULT_CHOICE 42 75 43 76 #self.device_id = device_id … … 67 100 68 101 # Menu 69 print "A - Connect to EmoComposer\nB - Connect to Headset\nQ - Quit"70 while (not isinstance(choice, str)) or ((choice != "a") and (choice != "b") and (choice != "q")):71 choice = raw_input("[A,B,Q] : ").lower()72 if choice == "q":73 quit()102 ## print "A - Connect to EmoComposer\nB - Connect to Headset\nQ - Quit" 103 ## while (not isinstance(choice, str)) or ((choice != "a") and (choice != "b") and (choice != "q")): 104 ## choice = raw_input("[A,B,Q] : ").lower() 105 ## if choice == "q": 106 ## quit() 74 107 75 108 # Connect 76 if choice == "a":109 if self.choice == "a": 77 110 if EmotivEngine.EE_EngineRemoteConnect("127.0.0.1",1726) != ERRCODE['EDK_OK']: 78 111 print "Could not connect!" 79 112 quit() 80 113 else: print "Connected to EmoComposer!" 81 elif choice == "b":114 elif self.choice == "b": 82 115 if EmotivEngine.EE_EngineConnect() != ERRCODE['EDK_OK']: 83 116 print "Could not connect!" -
trunk/Puzzlebox/Synapse/Interface.py
r331 r332 381 381 elif (eeg_headset_model == 'Emotiv EPOC'): 382 382 383 import Emotiv.Protocol as emotiv_protocol 384 385 emotiv_protocol.start() 383 import Emotiv.Protocol 384 385 self.emotiv_protocol = \ 386 Emotiv.Protocol.ProtocolHandler( \ 387 log=self.log, \ 388 serial_device=device_address, \ 389 device_model=eeg_headset_model, \ 390 parent=self) 391 392 self.emotiv_protocol.start() 386 393 387 394
Note: See TracChangeset
for help on using the changeset viewer.