Skip to content

Commit ea458c3

Browse files
committed
Move scripts in nxt.command module, and add manual pages
nxt_filer is still in scripts directory, it might be split out of NXT-Python project.
1 parent d9ae104 commit ea458c3

25 files changed

Lines changed: 524 additions & 111 deletions

.builds/debian-testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ image: debian/testing
22
packages:
33
- python3-usb
44
- python3-bluetooth
5+
- python3-pil
56
- python3-sphinx
67
- python3-sphinx-rtd-theme
78
- python3-pytest

.builds/debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ environment:
55
packages:
66
- python3-usb
77
- python3-bluetooth
8+
- python3-pil
89
- python3-sphinx
910
- python3-sphinx-rtd-theme
1011
- python3-pytest

.builds/freebsd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ packages:
66
- python311
77
- py311-pytest
88
- py311-pyusb
9+
- py311-pillow
910
- py311-pip
1011
- py311-tox
1112
sources:

docs/commands/common_options.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Common options
2+
--------------
3+
4+
Those options are common to programs using NXT-Python.
5+
6+
--backend NAME
7+
Enable given backend. Can be used several times to enable several backends.
8+
One of :mod:`~nxt.backend.usb`, :mod:`~nxt.backend.bluetooth`,
9+
:mod:`~nxt.backend.socket` or :mod:`~nxt.backend.devfile`.
10+
11+
--config NAME
12+
Name of configuration file section to use.
13+
14+
--config-filename PATH
15+
Path to configuration file. Can be used several times to use several
16+
configuration files.
17+
18+
--name NAME
19+
Name of NXT brick (for example: NXT). Useful to find the right brick if
20+
several bricks are connected.
21+
22+
--host ADDRESS
23+
Bluetooth address of the NXT brick (for example: 00:16:53:01:02:03).
24+
25+
--server-host HOST
26+
Server address or name to connect to when using :mod:`~nxt.backend.socket`
27+
backend.
28+
29+
--server-port PORT
30+
Server port to connect to when using :mod:`~nxt.backend.socket` backend.
31+
32+
--filename FILENAME
33+
Device filename (for example: :file:`/dev/rfcomm0`), when using
34+
`~nxt.backend.devfile` backend.

docs/commands/common_see_also.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. only:: man
2+
3+
See also
4+
--------
5+
6+
NXT-Python documentation <https://ni.srht.site/nxt-python/latest/>

docs/commands/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Commands
2+
========
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
nxt-push
8+
nxt-screenshot
9+
nxt-server
10+
nxt-test

docs/commands/nxt-push.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Manual page for nxt-push
2+
========================
3+
4+
Synopsis
5+
--------
6+
7+
**nxt-push**
8+
[**--backend** *NAME*]
9+
[**--config** *NAME*]
10+
[**--config-filename** *PATH*]
11+
[**--name** *NAME*]
12+
[**--host** *ADDRESS*]
13+
[**--server-host** *HOST*]
14+
[**--server-port** *PORT*]
15+
[**--filename** *FILENAME*]
16+
[**--log-level** *LEVEL*]
17+
*FILE*...
18+
19+
Description
20+
-----------
21+
22+
:program:`nxt-push` uploads files to a connected NXT brick file system.
23+
24+
The NXT brick can be connected using USB, Bluetooth or over the network.
25+
26+
27+
Options
28+
-------
29+
30+
*FILE*...
31+
Names of files to send to the NXT brick.
32+
33+
--log-level LEVEL
34+
Set the log level. One of **DEBUG**, **INFO**, **WARNING**, **ERROR**, or
35+
**CRITICAL**. Messages whose level is below the current log level will not
36+
be displayed.
37+
38+
39+
.. include:: common_options.rst
40+
41+
42+
Example
43+
-------
44+
45+
``nxt-push --host 00:16:53:01:02:03 MotorControl22.rxe``
46+
Sends the ``MotorControl22.rxe`` file to a connected NXT using its
47+
Bluetooth address to find it.
48+
49+
50+
.. include:: common_see_also.rst

docs/commands/nxt-screenshot.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Manual page for nxt-screenshot
2+
==============================
3+
4+
Synopsis
5+
--------
6+
7+
**nxt-screenshot**
8+
[**--backend** *NAME*]
9+
[**--config** *NAME*]
10+
[**--config-filename** *PATH*]
11+
[**--name** *NAME*]
12+
[**--host** *ADDRESS*]
13+
[**--server-host** *HOST*]
14+
[**--server-port** *PORT*]
15+
[**--filename** *FILENAME*]
16+
[**--log-level** *LEVEL*]
17+
*FILE*
18+
19+
Description
20+
-----------
21+
22+
:command:`nxt-screenshot` takes a capture of a connected NXT brick and write
23+
the captured image to a *FILE*.
24+
25+
The NXT brick can be connected using USB, Bluetooth or over the network.
26+
27+
A wide range of image formats is supported, thanks to the Python Imaging
28+
Library.
29+
30+
31+
Options
32+
-------
33+
34+
*FILE*
35+
Filename to write captured image to.
36+
37+
--log-level LEVEL
38+
Set the log level. One of **DEBUG**, **INFO**, **WARNING**, **ERROR**, or
39+
**CRITICAL**. Messages whose level is below the current log level will not
40+
be displayed.
41+
42+
43+
.. include:: common_options.rst
44+
45+
46+
Example
47+
-------
48+
49+
``nxt-screenshot --host 00:16:53:01:02:03 capture.png``
50+
Capture screen from connected NXT using its Bluetooth address. Save the
51+
result image in ``capture.png``.
52+
53+
54+
.. include:: common_see_also.rst

docs/commands/nxt-server.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Manual page for nxt-server
2+
==========================
3+
4+
Synopsis
5+
--------
6+
7+
**nxt-server**
8+
[**--backend** *NAME*]
9+
[**--config** *NAME*]
10+
[**--config-filename** *PATH*]
11+
[**--name** *NAME*]
12+
[**--host** *ADDRESS*]
13+
[**--server-host** *HOST*]
14+
[**--server-port** *PORT*]
15+
[**--filename** *FILENAME*]
16+
[**-p|--port** *PORT*]
17+
[**--log-level** *LEVEL*]
18+
19+
Description
20+
-----------
21+
22+
:command:`nxt-server` serves an interface to a connected NXT brick over the
23+
network.
24+
25+
The NXT brick can be connected using USB, Bluetooth or over the network.
26+
27+
28+
Options
29+
-------
30+
31+
-p|--port *PORT*
32+
Set the bind port. Same value must be given to the client using
33+
**--server-port** or inside Python code. Default port is 2727.
34+
35+
--log-level LEVEL
36+
Set the log level. One of **DEBUG**, **INFO**, **WARNING**, **ERROR**, or
37+
**CRITICAL**. Messages whose level is below the current log level will not
38+
be displayed.
39+
40+
41+
.. include:: common_options.rst
42+
43+
Example
44+
-------
45+
46+
``nxt-server --host 00:16:53:01:02:03``
47+
Starting the server on a computer connected to a NXT brick, accepting
48+
connection on default port 2727.
49+
50+
``nxt-test --server-host 192.168.1.2``
51+
Assuming the first computer has address 192.168.1.2, remotely connect to
52+
the server to run a test.
53+
54+
55+
.. include:: common_see_also.rst

docs/commands/nxt-test.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Manual page for nxt-test
2+
========================
3+
4+
Synopsis
5+
--------
6+
7+
**nxt-test**
8+
[**--backend** *NAME*]
9+
[**--config** *NAME*]
10+
[**--config-filename** *PATH*]
11+
[**--name** *NAME*]
12+
[**--host** *ADDRESS*]
13+
[**--server-host** *HOST*]
14+
[**--server-port** *PORT*]
15+
[**--filename** *FILENAME*]
16+
[**--no-sound**]
17+
[**--log-level** *LEVEL*]
18+
19+
Description
20+
-----------
21+
22+
:command:`nxt-test` tests connection with a NXT brick. It allows to debug the
23+
NXT-Python setup.
24+
25+
The NXT brick can be connected using USB, Bluetooth or over the network.
26+
27+
28+
Options
29+
-------
30+
31+
--no-sound
32+
Be quiet, disable the sound test.
33+
34+
--log-level LEVEL
35+
Set the log level. One of **DEBUG**, **INFO**, **WARNING**, **ERROR**, or
36+
**CRITICAL**. Messages whose level is below the current log level will not
37+
be displayed.
38+
39+
40+
.. include:: common_options.rst
41+
42+
Examples
43+
--------
44+
45+
Running for a NXT brick connected using USB::
46+
47+
$ nxt-test
48+
Finding brick...
49+
NXT brick name: NXT
50+
Host address: 00:16:53:01:02:03
51+
Bluetooth signal strengths: (0, 0, 0, 0)
52+
Free user flash: 48480
53+
Protocol version 1.124
54+
Firmware version 1.29
55+
Battery level 8433 mV
56+
Play test sound...done
57+
58+
To report problems, please enable debug logs::
59+
60+
$ nxt-test --log-level DEBUG
61+
62+
When debugging Bluetooth connection problems, try to give the address
63+
explicitly::
64+
65+
$ nxt-test --log-level DEBUG --host 00:16:53:01:02:03
66+
67+
The address can be found in the "Settings" menu, under "NXT Version" screen,
68+
it is the last line labeled "ID". Add the colon to separate each pair of
69+
digits.
70+
71+
72+
.. include:: common_see_also.rst

0 commit comments

Comments
 (0)