Skip to content

Commit 8dcc63d

Browse files
author
Synaptics GitLab CI
committed
Documentation version 0.4.0
1 parent b267e8d commit 8dcc63d

File tree

12 files changed

+236
-79
lines changed

12 files changed

+236
-79
lines changed

docs/dl_7450/code.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In addition, you will be provided with a dock identifier, that looks like
2727
2828
Send code
2929
---------
30-
With these four pieces of information, the ``samples/send_code.py`` script can be used for deploying code to the board:
30+
With these four pieces of information, the :githubSamples:`send_code.py <scripts/send_code.py>` script can be used for deploying code to the board:
3131

3232
.. code-block:: bash
3333
@@ -87,9 +87,9 @@ The Access Token must be provided as an *Authorization* header in calls to deplo
8787
Authorization: Bearer <ACCESS-TOKEN>
8888
```
8989

90-
See ``scripts/send_code.py`` for an example using the Python requests module.
90+
See :githubSamples:`send_code.py <scripts/send_code.py>` for an example using the Python requests module.
9191

92-
In order to send a Python application, it must be Base64 encoded. In ``scripts/send_code.py``, the application code is read from a file as a byte string and then Base64 encoded, like this:
92+
In order to send a Python application, it must be Base64 encoded. In :githubSamples:`send_code.py <scripts/send_code.py>`, the application code is read from a file as a byte string and then Base64 encoded, like this:
9393

9494
.. code-block:: python
9595
@@ -135,7 +135,7 @@ You can also send a text message to the dock. The message is displayed on the sp
135135
.. warning::
136136
Please make sure that the sent message starts with ``t``. Otherwise, the message will not be consumed by the started application on the dock.
137137

138-
The ``scripts/send_text.py`` script can be used to send a text message to the dock:
138+
The :githubSamples:`send_text.py <scripts/send_text.py>` script can be used to send a text message to the dock:
139139

140140
.. code-block:: bash
141141
@@ -166,7 +166,7 @@ You can also send an image to the dock. The image is displayed on the splash scr
166166
.. warning::
167167
Please make sure that the raw image data starts with ``i``. Otherwise, the image will not be consumed by the started application on the dock.
168168

169-
The ``scripts/send_image.py`` script can be used to send an image to the dock:
169+
The :githubSamples:`send_image.py <scripts/send_image.py>` script can be used to send an image to the dock:
170170

171171
.. code-block:: bash
172172
@@ -175,4 +175,4 @@ The ``scripts/send_image.py`` script can be used to send an image to the dock:
175175
-s <APPLICATION-SECRET> \
176176
-e <ENTERPRISE-ID> \
177177
-d <DOCK-ID> \
178-
-t <LOCAL_PATH_TO_IMAGE_FILE>
178+
-t <LOCAL_PATH_TO_IMAGE_FILE>

docs/library/binascii.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
This module implements conversions between binary data and various
88
encodings of it in ASCII form (in both directions).
99

10-
.. admonition:: Coming soon
10+
.. admonition:: Note
1111
:class: attention
1212

13-
This is a very limited implementation of :py:mod:`binascii` compared to the standard CPython
13+
This is a limited implementation of :py:mod:`binascii` from the standard CPython
1414
implementation.
1515

1616

docs/library/dock.DockControl.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ The DockControl class provides DL-7450 management services to applications.
1010

1111
Construct a DockControl object.
1212

13-
.. admonition:: Coming soon
14-
:class: tip
15-
16-
In later releases, the DockControl interface will give the application developer
17-
more control of the dock including:
1813

19-
- set the attached screens to different resolutions.
20-
- show different content on different attached monitors.
21-
- set WiFi credentials such as SSID and password.
2214

2315
.. method:: DockControl.suspend_host_connection(suspend: bool) -> None
2416

@@ -64,10 +56,10 @@ The DockControl class provides DL-7450 management services to applications.
6456
If an attempt is made to set a timezone that does not exist a `ValueError` exception is raised.
6557
For an invalid type a `TypeError` is raised.
6658

67-
.. admonition:: Coming soon
59+
.. admonition:: Note
6860
:class: tip
6961

70-
In this preview a limited subset of the IANA timezones are supported.
62+
The following subset of the IANA timezones are supported.
7163

7264
+----------------------+-----------------------------------------------------+
7365
| Zone Code | Notes |

docs/library/http.rst

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ application developers to create a wide variety of features for end users. In
1111
simple cases the DL-7450 could fetch splash screen content from content provider
1212
hosted in the cloud or within a corporate network.
1313

14-
.. admonition:: Coming soon
15-
:class: tip
16-
17-
In this preview only the GET and POST methods are available. In the first
18-
release this module will also support PATCH and DELETE requests.
19-
2014

2115
Synchronous HTTP requests
2216
-------------------------
@@ -59,21 +53,6 @@ user may still provide ``data`` for an `http.get()` call if it suits their
5953
use case.
6054

6155

62-
.. admonition:: Coming soon
63-
:class: tip
64-
65-
The PATCH and DELETE request functions have not yet been implemented. They
66-
will act in a similar way to the GET and POST requests.
67-
68-
.. function:: patch(url, headers=None, data=None)
69-
70-
Send an HTTP PATCH request to the given ``url``.
71-
72-
.. function:: delete(url, headers=None, data=None)
73-
74-
Send an HTTP DELETE request to the given ``url``.
75-
76-
7756
Asynchronous HTTP requests
7857
--------------------------
7958

@@ -103,22 +82,6 @@ These functions perform an HTTP request and return the response.
10382
object.
10483

10584

106-
.. admonition:: Coming soon
107-
:class: tip
108-
109-
Asynchronous versions of PATCH and DELETE are planned:
110-
111-
.. function:: patch_async(url, on_complete, headers=None, data=None)
112-
113-
Send an HTTP PATCH request to the given ``url`` without blocking program
114-
flow.
115-
116-
.. function:: delete_async(url, on_complete, headers=None, data=None)
117-
118-
Send an HTTP DELETE request to the given ``url`` without blocking program
119-
flow.
120-
121-
12285
Classes
12386
-------
12487

docs/library/splashscreen.Splashscreen.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@ Methods
4141
- *image_type* is a constant defined in the :py:mod:`image` module describing the format of the image.
4242

4343

44-
.. admonition:: Coming soon
45-
:class: tip
46-
47-
In this preview only `image.PNG` is supported. The data must represent a
48-
1920x1080 image. The background images stored in the factory data store for
49-
the workshop are in the correct format, as are those that are retreived from
50-
the network for the carousel sample. In the first release of the SDK these
51-
restrictions will be removed and other formats such as BMP or JPG will be
52-
allowed. The SDK will also allow different sized background images to be used
53-
and either centred or scaled on the screen. The interface will also allow different
54-
screen resolutions to be set.
55-
5644

5745
.. method:: Splashscreen.add_text_box(text, attributes)
5846

docs/library/usb.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
.. module:: usb
77
:synopsis: USB Peripheral Management
88

9-
.. admonition:: Coming soon
10-
:class: tip
11-
12-
In this preview, we provide a very minimal usb module, which is only capable of
13-
a simple enumeration of USB devices which are connected to the DL-7450. In a
14-
subsequent release, this module will contain much fuller functionality for enumerating
15-
by Vendor ID and Product ID, or USB class. It will enable application developers to
16-
read USB device descriptors and write drivers for connected USB peripherals.
179

1810
Functions
1911
---------

samples/dock_management/host_connection_control.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class HostConnection:
11-
host_status = dock_info.host_status()
11+
host_status = None
1212
timer = None
1313

1414
def __init__(self):
@@ -39,7 +39,7 @@ def revoke_access_on_connection(self):
3939

4040
if self.host_status == dock_info.HOST_CONNECTED:
4141
# If we have just connected a dock, suspend the connection.
42-
if previous_status == dock_info.HOST_NOT_CONNECTED:
42+
if previous_status in [None, dock_info.HOST_NOT_CONNECTED]:
4343
self.revoke_access()
4444
else:
4545
self.display_connection_status()
@@ -54,4 +54,4 @@ def revoke_access_on_connection(self):
5454

5555

5656
host_connection = HostConnection()
57-
gc_prevention = wakeup(host_connection.revoke_access_on_connection, 500, 500)
57+
timer = wakeup(host_connection.revoke_access_on_connection, 0, 500)

samples/factory/rosewood_test.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
from datastore import CodeStore, ImageStore, KvStore
2+
from dock import DockControl
3+
from splashscreen import Splashscreen
4+
from wakeup import wakeup
5+
6+
7+
splashscreen = Splashscreen()
8+
9+
10+
class Result:
11+
aborted = """<span color="red" weight="bold">Aborted</span>"""
12+
failure = """<span color="red" weight="bold">Failed</span>"""
13+
success = """<span color="green" weight="bold">Success</span>"""
14+
started = """<span color="orange" weight="bold">Started</span>"""
15+
16+
17+
class Test:
18+
total_tests = 0
19+
20+
def __init__(self, name):
21+
self.id = self.total_tests
22+
self.name = name
23+
Test.total_tests += 1
24+
self.start()
25+
26+
def aborted(self):
27+
splashscreen.add_text_box(
28+
f"{self.name}: {Result.started}",
29+
{"x": 960, "y": 480 + (60 * self.id)},
30+
)
31+
32+
def start(self):
33+
splashscreen.add_text_box(
34+
f"{self.name}: {Result.started}",
35+
{"x": 960, "y": 480 + (60 * self.id)},
36+
)
37+
38+
def success(self):
39+
splashscreen.add_text_box(
40+
f"{self.name}: {Result.success}",
41+
{"x": 960, "y": 480 + (60 * self.id)},
42+
)
43+
44+
def failure(self):
45+
splashscreen.add_text_box(
46+
f"{self.name}: {Result.failure}",
47+
{"x": 960, "y": 480 + (60 * self.id)},
48+
)
49+
50+
51+
# Verbose testing of the ROM store, likely largely unnecessary - a subset should be sufficient to verify things have flashed correctly.
52+
class TestFactorySettings:
53+
def __init__(self, on_fail, on_pass):
54+
self.key_store = KvStore()
55+
self.image_store = ImageStore()
56+
self.completed_checks = []
57+
self.on_pass = on_pass
58+
self.on_fail = on_fail
59+
self.test()
60+
61+
def test(self):
62+
self.image_test = Test("Images")
63+
self.key_test = Test("Key Values")
64+
self.code_test = Test("Factory App")
65+
self.image_timer = wakeup(self.test_images, 0)
66+
self.key_timer = wakeup(self.test_key_values, 0)
67+
self.code_timer = wakeup(self.test_factory_app, 0)
68+
69+
def show_next_image(self):
70+
if not self.images:
71+
self.image_timer.cancel()
72+
# self.on_pass(self.scenario)
73+
self.image_test.success()
74+
self.check_complete("images")
75+
else:
76+
image = self.images.pop()
77+
token = self.image_store.get_token(image)
78+
splashscreen.set_background(token)
79+
80+
def test_images(self):
81+
self.images = self.image_store.list()
82+
expected_images = ["default"]
83+
if self.images != expected_images:
84+
self.image_timer = wakeup(self.show_next_image, 0, 2000)
85+
else:
86+
self.image_test.failure()
87+
self.abort()
88+
89+
def test_key_values(self):
90+
self.keys = self.key_store.list()
91+
if self.keys != []:
92+
self.key_test.failure()
93+
self.abort()
94+
else:
95+
self.key_test.success()
96+
self.check_complete("key_values")
97+
98+
def test_factory_app(self):
99+
self.code_store = CodeStore()
100+
checksum = self.code_store.info()["checksum"]
101+
if checksum != 2340183109:
102+
self.code_test.failure()
103+
self.abort()
104+
else:
105+
self.code_test.success()
106+
self.check_complete("factory_app")
107+
108+
def abort(self):
109+
self.image_timer.cancel()
110+
self.key_timer.cancel()
111+
self.code_timer.cancel()
112+
self.on_fail("", "")
113+
114+
def check_complete(self, check):
115+
self.completed_checks.append(check)
116+
if len(self.completed_checks) == 3:
117+
self.on_pass("")
118+
119+
120+
class TestRosewood:
121+
def __init__(self):
122+
self.dock_control = DockControl()
123+
self.tests = [TestFactorySettings]
124+
125+
def next_test(self):
126+
if self.tests:
127+
test_class = self.tests.pop()
128+
test = test_class(self.fail, self.passed)
129+
else:
130+
self.exit_test_mode(True)
131+
132+
def fail(self, scenario, reason):
133+
splashscreen.add_text_box(
134+
f"Overall: {Result.failure}",
135+
{"x": 960, "y": 800},
136+
)
137+
self.exit_test_mode(False)
138+
139+
def enter_test_mode(self):
140+
splashscreen.add_text_box("ROSEWOOD TEST MODE")
141+
# self.dock_control.set_test_mode(True)
142+
wakeup(self.next_test, 2000)
143+
144+
def exit_test_mode(self, passed):
145+
if passed:
146+
splashscreen.add_text_box(
147+
f"Final result: {Result.success}",
148+
{"x": 960, "y": 800},
149+
)
150+
# self.dock_control.set_test_mode(False)
151+
152+
def passed(self, scenario):
153+
self.next_test()
154+
155+
156+
application = TestRosewood()
157+
application.enter_test_mode()

scripts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ board - see below.
121121
A helper script, [send_rom_store.py], is provided.
122122

123123
```bash
124-
python3 send_rom_store -k <APPLICATION-KEY> -s <APPLICATION-SECRET> -e <ENTERPRISE-ID> -d <DOCK-ID> -c <ROM_STORE_CONFIG_FILE>
124+
python3 send_rom_store.py -k <APPLICATION-KEY> -s <APPLICATION-SECRET> -e <ENTERPRISE-ID> -d <DOCK-ID> -c <ROM_STORE_CONFIG_FILE>
125125
```
126126
The application key and secret and the enterprise ID are the same as described
127127
above in the section on sending code, and are used in the same way to obtain an
1.85 MB
Loading

0 commit comments

Comments
 (0)