source: trunk/Puzzlebox/Synapse/Configuration.py @ 413

Last change on this file since 413 was 407, checked in by sc, 6 years ago
File size: 7.5 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010-2015)
5#
6# This code is released under the GNU Pulic License (GPL) version 2
7# For more information please refer to http://www.gnu.org/copyleft/gpl.html
8
9__changelog__ = """\
10Last Update: 2015.01.17
11"""
12
13import os, sys
14
15#####################################################################
16# General configuration
17#####################################################################
18
19DEBUG = 1
20
21CONFIGURATION_FILE_PATH = 'puzzlebox_synapse_configuration.ini'
22
23if (sys.platform != 'win32'):
24        if not os.path.exists(CONFIGURATION_FILE_PATH):
25                CONFIGURATION_FILE_PATH = \
26                        os.path.join('/etc/puzzlebox_synapse', CONFIGURATION_FILE_PATH)
27
28ENABLE_PYSIDE = True
29#ENABLE_PYSIDE = False
30ENABLE_HCITOOL = False
31
32INTERFACE_CHART_STYLES = { \
33        'attention': 'r-', \
34        'meditation': 'b-', \
35        'delta': 'g-', \
36        'theta': 'y-', \
37        'lowAlpha': 'c-', \
38        'highAlpha': 'b-', \
39        'lowBeta': 'r-', \
40        'highBeta': 'm-', \
41        'lowGamma': 'k-', \
42        'highGamma': 'k-', \
43        'excitement': 'r-', \
44        'longTermExcitement': 'm-', \
45        'frustration': 'y-', \
46        'engagementBoredom': 'c-', \
47        'cognitiv': 'k-', \
48        'trendingGreen': 'g-', \
49        'trendingBlack': 'k-', \
50        'trendingRed': 'r-', \
51        'FFT': 'g-', \
52}
53
54INTERFACE_TAB_POSITION = 'North'
55
56#The following color abbreviations are supported:
57#character      color
58#‘b’        blue
59#‘g’        green
60#‘r’        red
61#‘c’        cyan
62#‘m’        magenta
63#‘y’        yellow
64#‘k’        black
65#‘w’        white
66
67#The following format string characters are accepted to control the line style or marker:
68#character      description
69#'-'    solid line style
70#'--'   dashed line style
71#'-.'   dash-dot line style
72#':'    dotted line style
73#'.'    point marker
74#','    pixel marker
75#'o'    circle marker
76#'v'    triangle_down marker
77#'^'    triangle_up marker
78#'<'    triangle_left marker
79#'>'    triangle_right marker
80#'1'    tri_down marker
81#'2'    tri_up marker
82#'3'    tri_left marker
83#'4'    tri_right marker
84#'s'    square marker
85#'p'    pentagon marker
86#'*'    star marker
87#'h'    hexagon1 marker
88#'H'    hexagon2 marker
89#'+'    plus marker
90#'x'    x marker
91#'D'    diamond marker
92#'d'    thin_diamond marker
93#'|'    vline marker
94#'_'    hline marker
95
96
97#####################################################################
98# Network addresses
99#####################################################################
100
101SYNAPSE_SERVER_INTERFACE = '' # listen on all of server's network interfaces
102SYNAPSE_SERVER_HOST = '*'
103SYNAPSE_SERVER_PORT = 13854
104
105THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
106#THINKGEAR_SERVER_HOST = '127.0.0.1'
107THINKGEAR_SERVER_HOST = '*'
108THINKGEAR_SERVER_PORT = 13854
109
110EMOTIV_SERVER_HOST = '127.0.0.1'
111EMOTIV_SERVER_PORT_CONTROL_PANEL = 3008
112EMOTIV_SERVER_PORT_EMOCOMPOSER = 1726
113
114MUSE_SERVER_HOST = '127.0.0.1'
115MUSE_SERVER_PORT = 5001
116
117#####################################################################
118# ThinkGear Device configuration
119#####################################################################
120
121DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS = 'COM2'
122DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX = '/dev/rfcomm0'
123
124if (sys.platform == 'win32'):
125        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS
126else:
127        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX
128
129# Use Bluetooth MAC address for Linux
130THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = ''
131# THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = '00:13:EF:xx:xx:xx' # Linux example
132
133#THINKGEAR_DEVICE_ID = None
134
135# Timeouts sent to PyBluez
136
137#THINKGEAR_BLUETOOTH_SEARCH = True
138THINKGEAR_BLUETOOTH_SEARCH = False
139THINKGEAR_BLUETOOTH_DISCOVER_DEVICES_TIMEOUT = 8 # default 8
140THINKGEAR_BLUETOOTH_LOOKUP_NAME_TIMEOUT = 10 # default 10
141
142
143#####################################################################
144# Synapse Server configuration
145#####################################################################
146
147CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
148
149SYNAPSE_DELIMITER = '\r'
150
151#####################################################################
152# ThinkGear Connect configuration
153#####################################################################
154
155THINKGEAR_DELIMITER = '\r'
156
157#THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
158THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": True, "format": "Json"}
159
160ENABLE_THINKGEAR_AUTHORIZATION = False
161
162THINKGEAR_AUTHORIZATION_REQUEST = { \
163        "appName": "Puzzlebox Brainstorms", \
164        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
165        }
166
167THINKGEAR_EEG_POWER_BAND_ORDER = ['delta', \
168                                  'theta', \
169                                  'lowAlpha', \
170                                  'highAlpha', \
171                                  'lowBeta', \
172                                  'highBeta', \
173                                  'lowGamma', \
174                                  'highGamma']
175
176THINKGEAR_EMULATION_MAX_ESENSE_VALUE = 100
177THINKGEAR_EMULATION_MAX_EEG_POWER_VALUE = 16384
178
179THINKGEAR_ATTENTION_MULTIPLIER = 1.0
180THINKGEAR_MEDITATION_MULTIPLIER = 0.8
181THINKGEAR_MEDITATION_PLOT_OFFSET = 5
182
183THINKGEAR_EEG_POWER_MULTIPLIERS = { \
184        'delta': 1.0, \
185        'theta': 1.0, \
186        'lowAlpha': 1.0, \
187        'highAlpha': 1.0, \
188        'lowBeta': 1.0, \
189        'highBeta': 1.0, \
190        'lowGamma': 1.0, \
191        'highGamma': 1.0, \
192}
193
194
195#####################################################################
196# ThinkGear Connect Server Emulator configuration
197#####################################################################
198
199THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
200
201THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
202                                    # (6 seconds is listed by Wikipedia
203                                    # as being the average number of times
204                                    # an adult blinks in a laboratory setting)
205
206THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
207                                         # and back to 0 for any given
208                                         # detection value below
209
210
211#####################################################################
212# Emotiv configuration
213#####################################################################
214
215EMULATE_THINKGEAR_FOR_EMOTIV = True
216
217
218#####################################################################
219# Muse configuration
220#####################################################################
221
222EMULATE_THINKGEAR_FOR_MUSE = True
223
224
225#####################################################################
226# Flash socket policy handling
227#####################################################################
228
229FLASH_POLICY_FILE_REQUEST = \
230        '<policy-file-request/>%c' % 0 # NULL byte termination
231FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
232<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
233<cross-domain-policy>
234   <site-control permitted-cross-domain-policies="all" />
235   <allow-access-from domain="*" to-ports="%i" />
236</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
237
238
239#####################################################################
240# Configuration File Parser
241#####################################################################
242
243if os.path.exists(CONFIGURATION_FILE_PATH):
244       
245        file = open(CONFIGURATION_FILE_PATH, 'r')
246       
247        for line in file.readlines():
248                line = line.strip()
249                if len(line) == 0:
250                        continue
251                if line[0] == '#':
252                        continue
253                if line.find('=') == -1:
254                        continue
255                if (line == "THINKGEAR_DEVICE_SERIAL_PORT = ''"):
256                        # use operating system default if device not set manually
257                        continue
258                try:
259                        exec line
260                except:
261                        if DEBUG:
262                                print "Error recognizing configuration option:",
263                                print line
264
Note: See TracBrowser for help on using the repository browser.