Changeset 353 for trunk/Puzzlebox/Synapse/Interface.py
- Timestamp:
- 03/29/12 23:34:26 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Puzzlebox/Synapse/Interface.py
r352 r353 116 116 ##################################################################### 117 117 118 class QtUI(QtGui.QWidget, Design):118 class puzzlebox_synapse_interface(QtGui.QWidget, Design): 119 119 120 120 def __init__(self, log, \ … … 216 216 217 217 # ThinkGear Device 218 self.update ThinkGearDevices()218 self.updateDevices() 219 219 220 220 … … 268 268 def connectWidgets(self): 269 269 270 self.connect(self.comboBoxEEGHeadsetModel, \ 271 QtCore.SIGNAL("currentIndexChanged(int)"), \ 272 self.updateDevices) 273 270 274 self.connect(self.pushButtonBluetoothSearch, \ 271 275 QtCore.SIGNAL("clicked()"), \ 272 self.update ThinkGearDevices)276 self.updateDevices) 273 277 274 278 self.connect(self.pushButtonBluetoothConnect, \ … … 406 410 device_address = str(self.comboBoxDeviceSelect.currentText()) 407 411 412 server_host = configuration.EMOTIV_SERVER_HOST 413 414 if device_address == 'Emotiv EPOC': 415 server_port = configuration.EMOTIV_SERVER_PORT_CONTROL_PANEL 416 else: 417 server_port = configuration.EMOTIV_SERVER_PORT_EMOCOMPOSER 408 418 409 419 self.emotivClient = \ 410 420 emotiv_client.puzzlebox_synapse_client_emotiv( \ 411 421 log=self.log, \ 412 #server_host=device_address, \ 422 server_host=server_host, \ 423 server_port=server_port, \ 413 424 DEBUG=DEBUG, \ 414 425 parent=self) … … 416 427 self.emotivClient.start() 417 428 418 #if emotiv_protocol != None: 419 420 #self.emotiv_protocol = \ 421 #emotiv_protocol.ProtocolHandler( \ 422 #log=self.log, \ 423 #serial_device=device_address, \ 424 #device_model=eeg_headset_model, \ 425 #parent=self) 426 427 #self.emotiv_protocol.start() 428 429 430 #self.progressBarEEGDelta.setValue(0) 431 #self.progressBarEEGTheta.setValue(0) 432 #self.progressBarEEGLowAlpha.setValue(0) 433 #self.progressBarEEGHighAlpha.setValue(0) 434 #self.progressBarEEGLowBeta.setValue(0) 435 #self.progressBarEEGHighBeta.setValue(0) 436 #self.progressBarEEGLowGamma.setValue(0) 437 #self.progressBarEEGMidGamma.setValue(0) 438 439 #self.progressBarAttention.setValue(0) 440 #self.progressBarMeditation.setValue(0) 441 442 443 #self.progressBarEEGDelta.setEnabled(False) 444 #self.progressBarEEGTheta.setEnabled(False) 445 #self.progressBarEEGLowAlpha.setEnabled(False) 446 #self.progressBarEEGHighAlpha.setEnabled(False) 447 #self.progressBarEEGLowBeta.setEnabled(False) 448 #self.progressBarEEGHighBeta.setEnabled(False) 449 #self.progressBarEEGLowGamma.setEnabled(False) 450 #self.progressBarEEGMidGamma.setEnabled(False) 451 452 #self.progressBarAttention.setEnabled(False) 453 #self.progressBarMeditation.setEnabled(False) 429 430 #self.progressBarEEGDelta.setValue(0) 431 #self.progressBarEEGTheta.setValue(0) 432 #self.progressBarEEGLowAlpha.setValue(0) 433 #self.progressBarEEGHighAlpha.setValue(0) 434 #self.progressBarEEGLowBeta.setValue(0) 435 #self.progressBarEEGHighBeta.setValue(0) 436 #self.progressBarEEGLowGamma.setValue(0) 437 #self.progressBarEEGMidGamma.setValue(0) 438 439 #self.progressBarAttention.setValue(0) 440 #self.progressBarMeditation.setValue(0) 441 442 443 #self.progressBarEEGDelta.setEnabled(False) 444 #self.progressBarEEGTheta.setEnabled(False) 445 #self.progressBarEEGLowAlpha.setEnabled(False) 446 #self.progressBarEEGHighAlpha.setEnabled(False) 447 #self.progressBarEEGLowBeta.setEnabled(False) 448 #self.progressBarEEGHighBeta.setEnabled(False) 449 #self.progressBarEEGLowGamma.setEnabled(False) 450 #self.progressBarEEGMidGamma.setEnabled(False) 451 452 #self.progressBarAttention.setEnabled(False) 453 #self.progressBarMeditation.setEnabled(False) 454 454 455 455 … … 875 875 ################################################################## 876 876 877 def hcitoolScanForRemoteDevices(self, thinkgear_devices=[]):877 def hcitoolScanForRemoteDevices(self, devices=[]): 878 878 879 879 bluetooth_devices = [] … … 932 932 933 933 if ((device_name == 'MindSet' or device_name == 'MindWave Mobile') and \ 934 (address not in thinkgear_devices)):935 thinkgear_devices.append(address)934 (address not in devices)): 935 devices.append(address) 936 936 937 937 else: … … 941 941 942 942 943 return ( thinkgear_devices)944 945 946 ################################################################## 947 948 def hcitoolGetActiveConnections(self, thinkgear_devices=[]):943 return (devices) 944 945 946 ################################################################## 947 948 def hcitoolGetActiveConnections(self, devices=[]): 949 949 950 950 bluetooth_devices = [] … … 1003 1003 1004 1004 if ((device_name == 'MindSet' or device_name == 'MindWave Mobile') and \ 1005 (address not in thinkgear_devices)):1006 thinkgear_devices.append(address)1007 1008 1009 return ( thinkgear_devices)1010 1011 1012 ################################################################## 1013 1014 def searchFor ThinkGearDevices(self):1005 (address not in devices)): 1006 devices.append(address) 1007 1008 1009 return (devices) 1010 1011 1012 ################################################################## 1013 1014 def searchForDevices(self): 1015 1015 1016 1016 enable_hcitool = configuration.ENABLE_HCITOOL 1017 1017 1018 thinkgear_devices = []1018 devices = [] 1019 1019 1020 1020 #self.pushButtonBluetoothSearch.setText('Searching') … … 1052 1052 configuration.THINKGEAR_BLUETOOTH_LOOKUP_NAME_TIMEOUT) 1053 1053 if ((device_name == 'MindSet' or device_name == 'MindWave Mobile') and \ 1054 (address not in thinkgear_devices)):1055 thinkgear_devices.append(address)1054 (address not in devices)): 1055 devices.append(address) 1056 1056 1057 1057 … … 1063 1063 # (http://pybluez.googlecode.com/svn/www/docs-0.7/index.html) 1064 1064 1065 if thinkgear_devices == []:1065 if devices == []: 1066 1066 if self.DEBUG: 1067 1067 print "INFO: No devices found through PyBluez module. Falling back to hcitool." 1068 thinkgear_devices = self.hcitoolGetActiveConnections(thinkgear_devices)1068 devices = self.hcitoolGetActiveConnections(devices) 1069 1069 1070 1070 … … 1081 1081 if enable_hcitool: 1082 1082 1083 thinkgear_devices = self.hcitoolScanForRemoteDevices(thinkgear_devices)1084 thinkgear_devices = self.hcitoolGetActiveConnections(thinkgear_devices)1083 devices = self.hcitoolScanForRemoteDevices(devices) 1084 devices = self.hcitoolGetActiveConnections(devices) 1085 1085 1086 1086 1087 1087 if self.DEBUG > 2: 1088 print "Bluetooth ThinkGear devices found:",1089 print thinkgear_devices1090 1091 1092 thinkgear_devices = self.searchForSerialDevices(thinkgear_devices)1088 print "Bluetooth Devices found:", 1089 print devices 1090 1091 1092 devices = self.searchForSerialDevices(devices) 1093 1093 1094 1094 1095 1095 if self.DEBUG: 1096 print "ThinkGear devices found:", 1097 print thinkgear_devices 1098 1099 1100 return(thinkgear_devices) 1101 1102 1103 ################################################################## 1104 1105 def updateThinkGearDevices(self): 1106 1107 devices = self.searchForThinkGearDevices() 1108 1109 #if self.parent == None: 1110 #self.comboBoxDeviceSelect.clear() 1111 #else: 1112 #self.parent.comboBoxDeviceSelect.clear() 1096 print "Devices found:", 1097 print devices 1098 1099 1100 return(devices) 1101 1102 1103 ################################################################## 1104 1105 def updateDevices(self): 1106 1107 model = self.comboBoxEEGHeadsetModel.currentText() 1108 1109 devices = self.searchForDevices() 1113 1110 1114 1111 self.comboBoxDeviceSelect.clear() 1115 devices.insert(0, 'ThinkGear Emulator') 1112 1113 if (model == 'NeuroSky MindWave' or \ 1114 model == 'NeuroSky MindSet' or \ 1115 model == 'NeuroSky MindWave Mobile'): 1116 1117 devices.insert(0, 'ThinkGear Emulator') 1118 1119 elif (model == 'Emotiv EPOC'): 1120 1121 devices.insert(0, 'Emotiv Headset') 1122 devices.insert(0, 'EmoComposer') 1123 1116 1124 1117 1125 for device in devices:
Note: See TracChangeset
for help on using the changeset viewer.