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

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