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

Last change on this file since 392 was 392, checked in by sc, 9 years ago
  • Trending styles
File size: 7.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010-2012)
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: 2012.05.07
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
114
115#####################################################################
116# ThinkGear Device configuration
117#####################################################################
118
119DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS = 'COM2'
120DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX = '/dev/rfcomm0'
121
122if (sys.platform == 'win32'):
123        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS
124else:
125        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX
126
127# Use Bluetooth MAC address for Linux
128THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = ''
129# THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = '00:13:EF:xx:xx:xx' # Linux example
130
131#THINKGEAR_DEVICE_ID = None
132
133# Timeouts sent to PyBluez
134
135#THINKGEAR_BLUETOOTH_SEARCH = True
136THINKGEAR_BLUETOOTH_SEARCH = False
137THINKGEAR_BLUETOOTH_DISCOVER_DEVICES_TIMEOUT = 8 # default 8
138THINKGEAR_BLUETOOTH_LOOKUP_NAME_TIMEOUT = 10 # default 10
139
140
141#####################################################################
142# Synapse Server configuration
143#####################################################################
144
145CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
146
147SYNAPSE_DELIMITER = '\r'
148
149#####################################################################
150# ThinkGear Connect configuration
151#####################################################################
152
153THINKGEAR_DELIMITER = '\r'
154
155#THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
156THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": True, "format": "Json"}
157
158ENABLE_THINKGEAR_AUTHORIZATION = False
159
160THINKGEAR_AUTHORIZATION_REQUEST = { \
161        "appName": "Puzzlebox Brainstorms", \
162        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
163        }
164
165THINKGEAR_EEG_POWER_BAND_ORDER = ['delta', \
166                                  'theta', \
167                                  'lowAlpha', \
168                                  'highAlpha', \
169                                  'lowBeta', \
170                                  'highBeta', \
171                                  'lowGamma', \
172                                  'highGamma']
173
174THINKGEAR_EMULATION_MAX_ESENSE_VALUE = 100
175THINKGEAR_EMULATION_MAX_EEG_POWER_VALUE = 16384
176
177THINKGEAR_ATTENTION_MULTIPLIER = 1.0
178THINKGEAR_MEDITATION_MULTIPLIER = 0.8
179THINKGEAR_MEDITATION_PLOT_OFFSET = 5
180
181THINKGEAR_EEG_POWER_MULTIPLIERS = { \
182        'delta': 1.0, \
183        'theta': 1.0, \
184        'lowAlpha': 1.0, \
185        'highAlpha': 1.0, \
186        'lowBeta': 1.0, \
187        'highBeta': 1.0, \
188        'lowGamma': 1.0, \
189        'highGamma': 1.0, \
190}
191
192
193#####################################################################
194# ThinkGear Connect Server Emulator configuration
195#####################################################################
196
197THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
198
199THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
200                                    # (6 seconds is listed by Wikipedia
201                                    # as being the average number of times
202                                    # an adult blinks in a laboratory setting)
203
204THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
205                                         # and back to 0 for any given
206                                         # detection value below
207
208
209#####################################################################
210# Emotiv configuration
211#####################################################################
212
213EMULATE_THINKGEAR_FOR_EMOTIV = True
214
215
216#####################################################################
217# Flash socket policy handling
218#####################################################################
219
220FLASH_POLICY_FILE_REQUEST = \
221        '<policy-file-request/>%c' % 0 # NULL byte termination
222FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
223<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
224<cross-domain-policy>
225   <site-control permitted-cross-domain-policies="all" />
226   <allow-access-from domain="*" to-ports="%i" />
227</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
228
229
230#####################################################################
231# Configuration File Parser
232#####################################################################
233
234if os.path.exists(CONFIGURATION_FILE_PATH):
235       
236        file = open(CONFIGURATION_FILE_PATH, 'r')
237       
238        for line in file.readlines():
239                line = line.strip()
240                if len(line) == 0:
241                        continue
242                if line[0] == '#':
243                        continue
244                if line.find('=') == -1:
245                        continue
246                if (line == "THINKGEAR_DEVICE_SERIAL_PORT = ''"):
247                        # use operating system default if device not set manually
248                        continue
249                try:
250                        exec line
251                except:
252                        if DEBUG:
253                                print "Error recognizing configuration option:",
254                                print line
255
Note: See TracBrowser for help on using the repository browser.