source: trunk/synapse-server.py @ 363

Last change on this file since 363 was 363, checked in by sc, 9 years ago
  • continued refactoring
  • Property svn:executable set to *
File size: 1.9 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
9import Puzzlebox.Synapse.Server as synapse_server
10import Puzzlebox.Synapse.Configuration as configuration
11
12import sys, signal
13
14try:
15        import PySide as PyQt4
16        from PySide import QtCore
17except:
18        print "Using PyQt4 module"
19        from PyQt4 import QtCore
20else:
21        print "Using PySide module"
22
23DEBUG = 1
24
25# Perform correct KeyboardInterrupt handling
26signal.signal(signal.SIGINT, signal.SIG_DFL)
27log = None
28
29server_interface = configuration.THINKGEAR_SERVER_INTERFACE
30server_port = configuration.THINKGEAR_SERVER_PORT
31device_address = configuration.THINKGEAR_DEVICE_SERIAL_PORT
32#device_id = configuration.THINKGEAR_DEVICE_ID
33
34for each in sys.argv:
35        if each.startswith("--interface="):
36                server_interface = each[ len("--interface="): ]
37        if each.startswith("--port="):
38                server_port = each[ len("--port="): ]
39        if each.startswith("--device="):
40                device_address = each[ len("--device="): ]
41        if each.startswith("--debug="):
42                DEBUG = int (each[ len("--debug="): ] )
43        if each.startswith("--id="):
44                device_id = int (each[ len("--id="): ] )
45
46app = QtCore.QCoreApplication(sys.argv)
47server = synapse_server.puzzlebox_synapse_server_thinkgear(log, \
48                                                           server_interface, \
49                                                           server_port, \
50                                                           device_address, \
51                                                           #device_id, \
52                                                           emulate_headset_data = configuration.THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA, \
53                                                           DEBUG=DEBUG)
54server.start()
55sys.exit(app.exec_())
Note: See TracBrowser for help on using the repository browser.