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

Last change on this file since 304 was 304, checked in by sc, 10 years ago

Interface:

  • Fixed Bluetooth scanning for devices under recent distributions of Linux
  • added hcitoolScanForRemoteDevices
  • added hcitoolGetActiveConnections

Various:

  • Cleanup of calls to PyQt4 versus PySide? in all modules
  • Consistant passing of DEBUG value between modules
File size: 6.2 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010-2011)
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: 2011.12.04
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 = False
29ENABLE_HCITOOL = False
30
31INTERFACE_CHART_STYLES = { \
32        'attention': 'r-', \
33        'meditation': 'b-', \
34        'delta': 'g-', \
35        'theta': 'y-', \
36        'lowAlpha': 'c-', \
37        'highAlpha': 'b-', \
38        'lowBeta': 'r-', \
39        'highBeta': 'm-', \
40        'lowGamma': 'k-', \
41        'highGamma': 'k-', \
42}
43
44INTERFACE_TAB_POSITION = 'North'
45
46#The following color abbreviations are supported:
47#character      color
48#‘b’        blue
49#‘g’        green
50#‘r’        red
51#‘c’        cyan
52#‘m’        magenta
53#‘y’        yellow
54#‘k’        black
55#‘w’        white
56
57#The following format string characters are accepted to control the line style or marker:
58#character      description
59#'-'    solid line style
60#'--'   dashed line style
61#'-.'   dash-dot line style
62#':'    dotted line style
63#'.'    point marker
64#','    pixel marker
65#'o'    circle marker
66#'v'    triangle_down marker
67#'^'    triangle_up marker
68#'<'    triangle_left marker
69#'>'    triangle_right marker
70#'1'    tri_down marker
71#'2'    tri_up marker
72#'3'    tri_left marker
73#'4'    tri_right marker
74#'s'    square marker
75#'p'    pentagon marker
76#'*'    star marker
77#'h'    hexagon1 marker
78#'H'    hexagon2 marker
79#'+'    plus marker
80#'x'    x marker
81#'D'    diamond marker
82#'d'    thin_diamond marker
83#'|'    vline marker
84#'_'    hline marker
85
86
87#####################################################################
88# Network addresses
89#####################################################################
90
91THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
92#THINKGEAR_SERVER_HOST = '127.0.0.1'
93THINKGEAR_SERVER_HOST = '*'
94THINKGEAR_SERVER_PORT = 13854
95
96
97#####################################################################
98# ThinkGear Device configuration
99#####################################################################
100
101DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS = 'COM2'
102DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX = '/dev/rfcomm0'
103
104if (sys.platform == 'win32'):
105        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS
106else:
107        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX
108
109# Use Bluetooth MAC address for Linux
110THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = ''
111# THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = '00:13:EF:xx:xx:xx' # Linux example
112
113THINKGEAR_DEVICE_ID = None
114
115#####################################################################
116# Server configuration
117#####################################################################
118
119CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
120
121
122#####################################################################
123# ThinkGear Connect configuration
124#####################################################################
125
126THINKGEAR_DELIMITER = '\r'
127
128THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
129
130ENABLE_THINKGEAR_AUTHORIZATION = False
131
132THINKGEAR_AUTHORIZATION_REQUEST = { \
133        "appName": "Puzzlebox Brainstorms", \
134        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
135        }
136
137THINKGEAR_EEG_POWER_BAND_ORDER = ['delta', \
138                                  'theta', \
139                                  'lowAlpha', \
140                                  'highAlpha', \
141                                  'lowBeta', \
142                                  'highBeta', \
143                                  'lowGamma', \
144                                  'highGamma']
145
146THINKGEAR_EMULATION_MAX_ESENSE_VALUE = 100
147THINKGEAR_EMULATION_MAX_EEG_POWER_VALUE = 16384
148
149THINKGEAR_ATTENTION_MULTIPLIER = 1.0
150THINKGEAR_MEDITATION_MULTIPLIER = 1.0
151
152THINKGEAR_EEG_POWER_MULTIPLIERS = { \
153        'delta': 1.0, \
154        'theta': 1.0, \
155        'lowAlpha': 1.0, \
156        'highAlpha': 1.0, \
157        'lowBeta': 1.0, \
158        'highBeta': 1.0, \
159        'lowGamma': 1.0, \
160        'highGamma': 1.0, \
161}
162
163
164#####################################################################
165# ThinkGear Connect Server Emulator configuration
166#####################################################################
167
168THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
169
170THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
171                                    # (6 seconds is listed by Wikipedia
172                                    # as being the average number of times
173                                    # an adult blinks in a laboratory setting)
174
175THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
176                                         # and back to 0 for any given
177                                         # detection value below
178
179
180#####################################################################
181# Flash socket policy handling
182#####################################################################
183
184FLASH_POLICY_FILE_REQUEST = \
185        '<policy-file-request/>%c' % 0 # NULL byte termination
186FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
187<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
188<cross-domain-policy>
189   <site-control permitted-cross-domain-policies="all" />
190   <allow-access-from domain="*" to-ports="%i" />
191</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
192
193
194#####################################################################
195# Configuration File Parser
196#####################################################################
197
198if os.path.exists(CONFIGURATION_FILE_PATH):
199       
200        file = open(CONFIGURATION_FILE_PATH, 'r')
201       
202        for line in file.readlines():
203                line = line.strip()
204                if len(line) == 0:
205                        continue
206                if line[0] == '#':
207                        continue
208                if line.find('=') == -1:
209                        continue
210                if (line == "THINKGEAR_DEVICE_SERIAL_PORT = ''"):
211                        # use operating system default if device not set manually
212                        continue
213                try:
214                        exec line
215                except:
216                        if DEBUG:
217                                print "Error recognizing configuration option:",
218                                print line
219
Note: See TracBrowser for help on using the repository browser.