source: trunk/synapse-protocol.py @ 353

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

Puzzlebox Synapse:

  • split out into separate repository from Puzzlebox Brainstorms
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010)
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.Protocol as tgProtocol
10import Puzzlebox.Synapse.Configuration as tgConf
11import signal, sys
12
13try:
14        import PySide as PyQt4
15        from PySide import QtCore
16except:
17        print "Using PyQt4 module"
18        from PyQt4 import QtCore
19else:
20        print "Using PySide module"
21
22signal.signal(signal.SIGINT, signal.SIG_DFL)
23
24log = None
25DEBUG = 2
26
27device_address = None
28
29for each in sys.argv:
30        if each.startswith("--device="):
31                device_address = each[ len("--device="): ]
32
33if device_address == None:
34        if tgConf.THINKGEAR_DEVICE_BLUETOOTH_ADDRESS == '':
35                device_address = tgConf.THINKGEAR_DEVICE_SERIAL_PORT
36        else:
37                device_address = tgConf.THINKGEAR_DEVICE_BLUETOOTH_ADDRESS
38       
39app = QtCore.QCoreApplication(sys.argv)
40serial_device = tgProtocol.SerialDevice(log, device_address, DEBUG=DEBUG)
41protocol = tgProtocol.ProtocolHandler(log, serial_device, DEBUG=DEBUG)
42protocol.start()
43serial_device.run()
Note: See TracBrowser for help on using the repository browser.