Skip to content

Commit

Permalink
Meant to move the tag v1.0 to v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusw committed Aug 18, 2010
1 parent cfd98dd commit 0a78da6
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 471 deletions.
File renamed without changes.
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
include docs/*.html *.url *.css *.txt
include README LICENSE
include examples/*.py
include README.txt LICENSE.txt
19 changes: 5 additions & 14 deletions README → README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ Releases halted in May 2007.
NXT-Python is based on NXT_Python, but is significantly newer, and, as time
goes on, different/better. This is NXT-Python.

For support, you can ask on the mailing list at:
http://groups.google.com/group/nxt-python
You can report bugs to the bug tracker here:
http://code.google.com/p/nxt-python/issues/list

Note: NXT-Python has not been tested and may not work with
custom nxt firmware versions (if you don't know what that means, you don't
need to worry about it).

Requirements:

* Python 2.6 (http://www.python.org)
Expand All @@ -31,11 +22,11 @@ Installation:
* In package directory, run "python setup.py install" (as root), or if
under windows, copy the nxt folder to the site-packages
directory in your python installation.
* For USB on Linux, at a root terminal type:
groupadd lego
usermod -a -G lego [username]
echo 'BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"' > \
/etc/udev/rules.d/70-lego.rules
* For USB on Linux, create udev rule:

Create file at /etc/udev/rules.d/70-lego.rules, containing one line:

BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"

Contact:
NXT_Python's Author:
Expand Down
16 changes: 0 additions & 16 deletions docs/nxt_python.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ <h2>Requirements</h2>
</li>
</ul>
<h2>Download</h2>
<ul>
<li>Version 1.1<br/>
&mdash;New motor functions, namely run() and stop().<br/>
&mdash;Motor braking is finally usable!<br/>
&mdash;Slightly changed behavior when there are errors searching for a brick.<br/>
&mdash;New server functionality for light sensor illumination.
<ul>
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.zip'>nxt-python-1.1.zip</a>
source ZIP archive</li>
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.win32.exe'>nxt-python-1.1.win32.exe</a>
source ZIP archive</li>
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.win-amd64.exe'>nxt-python-1.1.win-amd64.exe</a>
source ZIP archive</li>
</ul>
</li>
</ul>
<ul>
<li>Version 1.0<br/>
&mdash;Experimental support for motor braking.<br/>
Expand Down
97 changes: 47 additions & 50 deletions nxt/bluesock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,67 +12,64 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

try:
import bluetooth
except ImportError:
import lightblueglue as bluetooth
import bluetooth
import os
from .brick import Brick
from nxt.brick import Brick

class BlueSock(object):

bsize = 118 # Bluetooth socket block size
PORT = 1 # Standard NXT rfcomm port
bsize = 118 # Bluetooth socket block size
PORT = 1 # Standard NXT rfcomm port

def __init__(self, host):
self.host = host
self.sock = None
self.debug = False
def __init__(self, host):
self.host = host
self.sock = None
self.debug = False

def __str__(self):
return 'Bluetooth (%s)' % self.host
def __str__(self):
return 'Bluetooth (%s)' % self.host

def connect(self):
if self.debug:
print 'Connecting via Bluetooth...'
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((self.host, BlueSock.PORT))
self.sock = sock
if self.debug:
print 'Connected.'
return Brick(self)
def connect(self):
if self.debug:
print 'Connecting via USB...'
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((self.host, BlueSock.PORT))
self.sock = sock
if self.debug:
print 'Connected.'
return Brick(self)

def close(self):
if self.debug:
print 'Closing Bluetooth connection...'
self.sock.close()
if self.debug:
print 'Bluetooth connection closed.'
def close(self):
if self.debug:
print 'Closing USB connection...'
self.sock.close()
if self.debug:
print 'USB connection closed.'

def send(self, data):
if self.debug:
print 'Send:',
print ':'.join('%02x' % ord(c) for c in data)
l0 = len(data) & 0xFF
l1 = (len(data) >> 8) & 0xFF
d = chr(l0) + chr(l1) + data
self.sock.send(d)
def send(self, data):
if self.debug:
print 'Send:',
print ':'.join('%02x' % ord(c) for c in data)
l0 = len(data) & 0xFF
l1 = (len(data) >> 8) & 0xFF
d = chr(l0) + chr(l1) + data
self.sock.send(d)

def recv(self):
data = self.sock.recv(2)
l0 = ord(data[0])
l1 = ord(data[1])
plen = l0 + (l1 << 8)
data = self.sock.recv(plen)
if self.debug:
print 'Recv:',
print ':'.join('%02x' % ord(c) for c in data)
return data
def recv(self):
data = self.sock.recv(2)
l0 = ord(data[0])
l1 = ord(data[1])
plen = l0 + (l1 << 8)
data = self.sock.recv(plen)
if self.debug:
print 'Recv:',
print ':'.join('%02x' % ord(c) for c in data)
return data

def _check_brick(arg, value):
return arg is None or arg == value
return arg is None or arg == value

def find_bricks(host=None, name=None):
for h, n in bluetooth.discover_devices(lookup_names=True):
if _check_brick(host, h) and _check_brick(name, n):
yield BlueSock(h)
for h, n in bluetooth.discover_devices(lookup_names=True):
if _check_brick(host, h) and _check_brick(name, n):
yield BlueSock(h)
108 changes: 0 additions & 108 deletions nxt/htcompass.py

This file was deleted.

53 changes: 0 additions & 53 deletions nxt/lightblueglue.py

This file was deleted.

Loading

0 comments on commit 0a78da6

Please sign in to comment.