Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Hundseder
hundseder-jonas
Commits
8eb6f343
Commit
8eb6f343
authored
Sep 26, 2021
by
Stefan Hackenberg
Browse files
Write further tasks
parent
f69ae358
Changes
9
Hide whitespace changes
Inline
Side-by-side
tasks/optional_coding_style.md
0 → 100644
View file @
8eb6f343
# Optional: Coding Style
## Description
If your code should have a professional look-and-feel it is important to follow a coding style.
There are several tools helping you to avoid mistakes. Two great tools are Clang Format and Clang Tidy's readability-identifier-naming.
### Clang Format
With the help of clang format you can define a code formatting style. This includes line width, indentation style, alignments, ...
It even is able to automatically format your code.
Have a look at the
[
styling options
](
https://clang.llvm.org/docs/ClangFormatStyleOptions.html
)
and define your style.
I personally like the following style:
```
clang-format
BasedOnStyle: WebKit
ColumnLimit: 120
AlignAfterOpenBracket: AlwaysBreak
AlignEscapedNewlines: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
MaxEmptyLinesToKeep: 2
PointerAlignment: Right
```
### Clang Tidy readability-identifier-naming
Clang Tidy has much more power than only observing identifier naming. But for now, let's focus on that option.
If you prefer lower_case for function names and UPPER_CASE for global constants for instance you can configure:
```
Checks: '-*,readability-identifier-naming'
CheckOptions:
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
```
### Integration in VSCode
Both tools integrate perfectly in VSCode:
-
https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting
-
https://marketplace.visualstudio.com/items?itemName=notskm.clang-tidy
To configure your project for Clang Format create a file
`.clang-format`
in the project's root and enter your configuration options.
Enabling Clang Tidy works similar.
## References
-
Clang Format: https://clang.llvm.org/docs/ClangFormat.html
-
Clang Tidy readability-identifier-naming: https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html
tasks/optional_document_code.md
0 → 100644
View file @
8eb6f343
# Optional: Document Code
## Description
Good documentation is a crucial for successful projects.
Although C does not define a standard documentation process (like most of the modern programming languages).
But there are several best practices:
-
Only English language.
-
Short header in each file explaining it's purpose. (And usually a copyright)
-
Structuring a file by separation of includes, defines, global, declarations, implementation
-
Header above each function explaining it's purpose, all parameter, and return values.
### File scope
Usually a new file is built from a template. Template we are using is:
```
c
/**
* Purpose.
*/
//___includes_____________________________________________________________________
//___defines______________________________________________________________________
//___typedefs_____________________________________________________________________
//___statics______________________________________________________________________
//___implementation_______________________________________________________________
```
### Function scope
The "standard" for documenting C code is given by the program
[
Doxygen
](
https://www.doxygen.nl/index.html
)
.
It parses code and it's comments and generates a browsable html documentation.
How to make Doxygen compliant comments can be seen in the example below.
## Example
Consider this small unittest module equipped with documentation:
```
c
/**
* Module containing unittests.
*/
//___includes_____________________________________________________________________
#include
<mbed.h>
#include
<unity.h>
//___globals______________________________________________________________________
/// A magic value
const
uint8_t
MAGIC_VALUE
=
42
;
//___implementation_______________________________________________________________
/**
* Test equality of to unsigned values.
*
* @param[in] value Value to be tested
*/
void
test_equality
(
uint8_t
value
)
{
TEST_ASSERT_EQUAL
(
MAGIC_VALUE
,
value
);
}
/**
* Main entry point for unittest framework.
*
* @return Exit status
*/
int
main
(
void
)
{
UNITY_BEGIN
();
test_a_well_known_truth
(
7
);
UNITY_END
();
return
0
;
}
```
## References
-
Documenting the code: https://www.doxygen.nl/manual/docblocks.html
-
Special commands: https://www.doxygen.nl/manual/commands.html
tasks/optional_read_image_snippet_ansi.md
0 → 100644
View file @
8eb6f343
# Optional: Read Image Snippet ANSI
## Description
Image snippets can be "displayed" on the terminal console using the following endpoint:
|
**/getsnippet_ansi**
| |
| :-- | :-- |
|
<-
|
`<
NFC_UID:
7
>
<INDEX:
1
>
` |
| -> | `
<IMAGE_SNIPPET_ANSI:
~1000
>
` |
The returned data is directly printable on the terminal:
```c
printf(response->get_body_as_string().c_str());
``
`
## Prerequisites
### Tasks done
-
[
Test HTTP Request
](
./test_http_request.md
)
-
[
Read NFC UID
](
./read_nfc_uid.md
)
### State
-
WiFi instance must be connected.
## Acceptance criteria
-
Image snippet visible on terminal.
## References
-
HTTP Request header file: https://gitlab.elektrotechnik.hs-augsburg.de/hackenbs/mbed-http/-/blob/main/src/https_request.h
-
HTTP Response header file: https://gitlab.elektrotechnik.hs-augsburg.de/hackenbs/mbed-http/-/blob/main/src/http_response.h
## Further information
-
ANSI escape code colors: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
-
Python climage: https://github.com/pnappa/CLImage
tasks/order.dot
View file @
8eb6f343
// dot -Tsvg order.dot -o order.svg
digraph
G
{
graph
[
fontname
=
"helvetica"
]
;
node
[
fontname
=
"helvetica"
]
;
edge
[
fontname
=
"helvetica"
]
;
install_vscode_and_platformio
[
URL
=
"install_vscode_and_platformio.md"
]
;
clone_repository_smi21
[
URL
=
"clone_repository_smi21.md"
]
;
compile_smi21
[
URL
=
"compile_smi21.md"
]
;
connect_psoc6_with_rc522
[
URL
=
"connect_psoc6_with_rc522.md"
]
;
install_platform_cypress_psoc6
[
URL
=
"install_platform_cypress_psoc6.md"
]
;
optional_install_further_extensions
[
URL
=
"optional_install_further_extensions.md"
]
;
test_connection_psoc6_with_rc522
[
URL
=
"test_connection_psoc6_with_rc522.md"
]
;
test_http_request
[
URL
=
"test_http_request.md"
]
;
test_wifi_connection
[
URL
=
"test_wifi_connection.md"
]
;
upload_smi21
[
URL
=
"upload_smi21.md"
]
;
write_first_test
[
URL
=
"write_first_test.md"
]
;
read_nfc_uid
[
URL
=
"read_nfc_uid.md"
]
;
read_nfc_hashtable
[
URL
=
"read_nfc_hashtable.md"
]
;
install_vscode_and_platformio
clone_repository_smi21
compile_smi21
connect_psoc6_with_rc522
install_platform_cypress_psoc6
optional_install_further_extensions
test_connection_psoc6_with_rc522
test_http_request
test_wifi_connection
upload_smi21
write_first_test
read_nfc_uid
read_nfc_hashtable
read_image_snippet
optional_read_image_snippet_ansi
optional_document_code
optional_coding_style
install_platform_cypress_psoc6
->
compile_smi21
;
clone_repository_smi21
->
compile_smi21
;
...
...
@@ -29,4 +34,8 @@ digraph G {
install_vscode_and_platformio
->
optional_install_further_extensions
;
test_connection_psoc6_with_rc522
->
read_nfc_uid
;
read_nfc_uid
->
read_nfc_hashtable
;
test_http_request
->
read_image_snippet
read_nfc_uid
->
read_image_snippet
test_http_request
->
optional_read_image_snippet_ansi
read_nfc_uid
->
optional_read_image_snippet_ansi
}
tasks/order.svg
View file @
8eb6f343
...
...
@@ -4,199 +4,208 @@
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: G Pages: 1 -->
<svg
width=
"
811
pt"
height=
"548pt"
viewBox=
"0.00 0.00
810.88
548.00"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<svg
width=
"
1428
pt"
height=
"548pt"
viewBox=
"0.00 0.00
1427.63
548.00"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<g
id=
"graph0"
class=
"graph"
transform=
"scale(1 1) rotate(0) translate(4 544)"
>
<title>
G
</title>
<polygon
fill=
"white"
stroke=
"transparent"
points=
"-4,4 -4,-544
806.88,-544 806.88
,4 -4,4"
/>
<polygon
fill=
"white"
stroke=
"transparent"
points=
"-4,4 -4,-544
1423.63,-544 1423.63
,4 -4,4"
/>
<!-- install_vscode_and_platformio -->
<g
id=
"node1"
class=
"node"
>
<title>
install_vscode_and_platformio
</title>
<g
id=
"a_node1"
><a
xlink:href=
"install_vscode_and_platformio.md"
xlink:title=
"install_vscode_and_platformio"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"281.89"
cy=
"-522"
rx=
"129.18"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"281.89"
y=
"-518.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
install_vscode_and_platformio
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"845.74"
cy=
"-522"
rx=
"129.18"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"845.74"
y=
"-518.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
install_vscode_and_platformio
</text>
</g>
<!-- install_platform_cypress_psoc6 -->
<g
id=
"node5"
class=
"node"
>
<title>
install_platform_cypress_psoc6
</title>
<g
id=
"a_node5"
><a
xlink:href=
"install_platform_cypress_psoc6.md"
xlink:title=
"install_platform_cypress_psoc6"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"133.89"
cy=
"-450"
rx=
"133.78"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"133.89"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
install_platform_cypress_psoc6
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"697.74"
cy=
"-450"
rx=
"133.78"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"697.74"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
install_platform_cypress_psoc6
</text>
</g>
<!-- install_vscode_and_platformio->install_platform_cypress_psoc6 -->
<g
id=
"edge3"
class=
"edge"
>
<title>
install_vscode_and_platformio
->
install_platform_cypress_psoc6
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
247.19
,-504.59C
226.48
,-494.79
199.99
,-482.26
177.83
,-471.78"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
179.16
,-468.54
168.63
,-467.43
176.17
,-474.87
179.16
,-468.54"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
811.04
,-504.59C
790.33
,-494.79
763.84
,-482.26
741.68
,-471.78"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
743.02
,-468.54
732.48
,-467.43
740.02
,-474.87
743.02
,-468.54"
/>
</g>
<!-- optional_install_further_extensions -->
<g
id=
"node6"
class=
"node"
>
<title>
optional_install_further_extensions
</title>
<g
id=
"a_node6"
><a
xlink:href=
"optional_install_further_extensions.md"
xlink:title=
"optional_install_further_extensions"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"430.89"
cy=
"-450"
rx=
"145.67"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"430.89"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
optional_install_further_extensions
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"994.74"
cy=
"-450"
rx=
"145.67"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"994.74"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
optional_install_further_extensions
</text>
</g>
<!-- install_vscode_and_platformio->optional_install_further_extensions -->
<g
id=
"edge10"
class=
"edge"
>
<title>
install_vscode_and_platformio
->
optional_install_further_extensions
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
316.82
,-504.59C
337.59
,-494.83
364.15
,-482.35
386.41
,-471.9"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
388.09
,-474.97
3
95
.66
,-467.55
385.12
,-468.64
388.09
,-474.97"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
880.68
,-504.59C
901.45
,-494.83
928
,-482.35
950.26
,-471.9"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
951.95
,-474.97 95
9.51
,-467.55
948.97
,-468.64
951.95
,-474.97"
/>
</g>
<!-- clone_repository_smi21 -->
<g
id=
"node2"
class=
"node"
>
<title>
clone_repository_smi21
</title>
<g
id=
"a_node2"
><a
xlink:href=
"clone_repository_smi21.md"
xlink:title=
"clone_repository_smi21"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"698.89"
cy=
"-450"
rx=
"103.98"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"698.89"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
clone_repository_smi21
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"441.74"
cy=
"-450"
rx=
"103.98"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"441.74"
y=
"-446.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
clone_repository_smi21
</text>
</g>
<!-- compile_smi21 -->
<g
id=
"node3"
class=
"node"
>
<title>
compile_smi21
</title>
<g
id=
"a_node3"
><a
xlink:href=
"compile_smi21.md"
xlink:title=
"compile_smi21"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"415.89"
cy=
"-378"
rx=
"70.39"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"415.89"
y=
"-374.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
compile_smi21
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"569.74"
cy=
"-378"
rx=
"70.39"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"569.74"
y=
"-374.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
compile_smi21
</text>
</g>
<!-- clone_repository_smi21->compile_smi21 -->
<g
id=
"edge2"
class=
"edge"
>
<title>
clone_repository_smi21
->
compile_smi21
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
641.96,-434.92C593.34
,-422.8
9
5
2
3.
67
,-40
5.66 474.55,-393.51
"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
475.26,-390.08 464.71,-391.08 473.57,-396.87 475.26,-390.08
"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
471.75,-432.59C489.87
,-422.
6
8 5
1
3.
1
,-40
9.97 532.4,-399.42
"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
534.14,-402.46 541.24,-394.59 530.78,-396.32 534.14,-402.46
"
/>
</g>
<!-- upload_smi21 -->
<g
id=
"node10"
class=
"node"
>
<title>
upload_smi21
</title>
<g
id=
"a_node10"
><a
xlink:href=
"upload_smi21.md"
xlink:title=
"upload_smi21"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"415.89"
cy=
"-306"
rx=
"65.79"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"415.89"
y=
"-302.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
upload_smi21
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"569.74"
cy=
"-306"
rx=
"65.79"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"569.74"
y=
"-302.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
upload_smi21
</text>
</g>
<!-- compile_smi21->upload_smi21 -->
<g
id=
"edge7"
class=
"edge"
>
<title>
compile_smi21
->
upload_smi21
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
415.89
,-359.7C
415.89
,-351.98
415.89
,-342.71
415.89
,-334.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
419.39
,-334.1
415.89
,-324.1
412.39
,-334.1
419.39
,-334.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
569.74
,-359.7C
569.74
,-351.98
569.74
,-342.71
569.74
,-334.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
573.24
,-334.1
569.74
,-324.1
566.24
,-334.1
573.24
,-334.1"
/>
</g>
<!-- connect_psoc6_with_rc522 -->
<g
id=
"node4"
class=
"node"
>
<title>
connect_psoc6_with_rc522
</title>
<g
id=
"a_node4"
><a
xlink:href=
"connect_psoc6_with_rc522.md"
xlink:title=
"connect_psoc6_with_rc522"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"186.89"
cy=
"-234"
rx=
"116.98"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"186.89"
y=
"-230.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
connect_psoc6_with_rc522
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"340.74"
cy=
"-234"
rx=
"116.98"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"340.74"
y=
"-230.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
connect_psoc6_with_rc522
</text>
</g>
<!-- test_connection_psoc6_with_rc522 -->
<g
id=
"node7"
class=
"node"
>
<title>
test_connection_psoc6_with_rc522
</title>
<g
id=
"a_node7"
><a
xlink:href=
"test_connection_psoc6_with_rc522.md"
xlink:title=
"test_connection_psoc6_with_rc522"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"186.89"
cy=
"-162"
rx=
"147.57"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"186.89"
y=
"-158.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_connection_psoc6_with_rc522
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"340.74"
cy=
"-162"
rx=
"147.57"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"340.74"
y=
"-158.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_connection_psoc6_with_rc522
</text>
</g>
<!-- connect_psoc6_with_rc522->test_connection_psoc6_with_rc522 -->
<g
id=
"edge4"
class=
"edge"
>
<title>
connect_psoc6_with_rc522
->
test_connection_psoc6_with_rc522
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
186.89
,-215.7C
186.89
,-207.98
186.89
,-198.71
186.89
,-190.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
190.39
,-190.1
186.89
,-180.1
183.39
,-190.1
190.39
,-190.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
340.74
,-215.7C
340.74
,-207.98
340.74
,-198.71
340.74
,-190.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
344.24
,-190.1
340.74
,-180.1
337.24
,-190.1
344.24
,-190.1"
/>
</g>
<!-- install_platform_cypress_psoc6->compile_smi21 -->
<g
id=
"edge1"
class=
"edge"
>
<title>
install_platform_cypress_psoc6
->
compile_smi21
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
194.73,-433.9C242.95,-421.93 309.9,-405.31 357.48,-393.5
"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
35
8.
4
6,-396.
86 367.32,-391.06 356.77,-390.07 35
8.
4
6,-396.
86
"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
667.41,-432.41C649.28,-422.5 626.12,-409.83 606.9,-399.32
"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
60
8.
5
6,-396.
24 598.1,-394.51 605.2,-402.38 60
8.
5
6,-396.
24
"
/>
</g>
<!-- read_nfc_uid -->
<g
id=
"node12"
class=
"node"
>
<title>
read_nfc_uid
</title>
<g
id=
"a_node12"
><a
xlink:href=
"read_nfc_uid.md"
xlink:title=
"read_nfc_uid"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"186.89"
cy=
"-90"
rx=
"61.99"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"186.89"
y=
"-86.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
read_nfc_uid
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"340.74"
cy=
"-90"
rx=
"61.99"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"340.74"
y=
"-86.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
read_nfc_uid
</text>
</g>
<!-- test_connection_psoc6_with_rc522->read_nfc_uid -->
<g
id=
"edge11"
class=
"edge"
>
<title>
test_connection_psoc6_with_rc522
->
read_nfc_uid
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
186.89
,-143.7C
186.89
,-135.98
186.89
,-126.71
186.89
,-118.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
190.39
,-118.1
186.89
,-108.1
183.39
,-118.1
190.39
,-118.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
340.74
,-143.7C
340.74
,-135.98
340.74
,-126.71
340.74
,-118.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
344.24
,-118.1
340.74
,-108.1
337.24
,-118.1
344.24
,-118.1"
/>
</g>
<!-- test_http_request -->
<g
id=
"node8"
class=
"node"
>
<title>
test_http_request
</title>
<g
id=
"a_node8"
><a
xlink:href=
"test_http_request.md"
xlink:title=
"test_http_request"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"441.89"
cy=
"-90"
rx=
"78.79"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"441.89"
y=
"-86.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_http_request
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"595.74"
cy=
"-90"
rx=
"78.79"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"595.74"
y=
"-86.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_http_request
</text>
</g>
<!-- read_image_snippet -->
<g
id=
"node14"
class=
"node"
>
<title>
read_image_snippet
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"597.74"
cy=
"-18"
rx=
"90.98"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"597.74"
y=
"-14.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
read_image_snippet
</text>
</g>
<!-- test_http_request->read_image_snippet -->
<g
id=
"edge13"
class=
"edge"
>
<title>
test_http_request
->
read_image_snippet
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M596.24,-71.7C596.46,-63.98 596.72,-54.71 596.97,-46.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"600.47,-46.2 597.25,-36.1 593.47,-46 600.47,-46.2"
/>
</g>
<!-- optional_read_image_snippet_ansi -->
<g
id=
"node15"
class=
"node"
>
<title>
optional_read_image_snippet_ansi
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"340.74"
cy=
"-18"
rx=
"147.57"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"340.74"
y=
"-14.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
optional_read_image_snippet_ansi
</text>
</g>
<!-- test_http_request->optional_read_image_snippet_ansi -->
<g
id=
"edge15"
class=
"edge"
>
<title>
test_http_request
->
optional_read_image_snippet_ansi
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M547.48,-75.75C507.88,-64.88 451.38,-49.37 407.46,-37.31"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"408.29,-33.91 397.72,-34.64 406.43,-40.66 408.29,-33.91"
/>
</g>
<!-- test_wifi_connection -->
<g
id=
"node9"
class=
"node"
>
<title>
test_wifi_connection
</title>
<g
id=
"a_node9"
><a
xlink:href=
"test_wifi_connection.md"
xlink:title=
"test_wifi_connection"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"441.89"
cy=
"-162"
rx=
"89.88"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"441.89"
y=
"-158.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_wifi_connection
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"595.74"
cy=
"-162"
rx=
"89.88"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"595.74"
y=
"-158.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
test_wifi_connection
</text>
</g>
<!-- test_wifi_connection->test_http_request -->
<g
id=
"edge9"
class=
"edge"
>
<title>
test_wifi_connection
->
test_http_request
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
441.89
,-143.7C
441.89
,-135.98
441.89
,-126.71
441.89
,-118.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
445.39
,-118.1
441.89
,-108.1
438.39
,-118.1
445.39
,-118.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
595.74
,-143.7C
595.74
,-135.98
595.74
,-126.71
595.74
,-118.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
599.24
,-118.1
595.74
,-108.1
592.24
,-118.1
599.24
,-118.1"
/>
</g>
<!-- write_first_test -->
<g
id=
"node11"
class=
"node"
>
<title>
write_first_test
</title>
<g
id=
"a_node11"
><a
xlink:href=
"write_first_test.md"
xlink:title=
"write_first_test"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"415.89"
cy=
"-234"
rx=
"67.69"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"415.89"
y=
"-230.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
write_first_test
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"569.74"
cy=
"-234"
rx=
"67.69"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"569.74"
y=
"-230.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
write_first_test
</text>
</g>
<!-- upload_smi21->write_first_test -->
<g
id=
"edge6"
class=
"edge"
>
<title>
upload_smi21
->
write_first_test
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
415.89
,-287.7C
415.89
,-279.98
415.89
,-270.71
415.89
,-262.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
419.39
,-262.1
415.89
,-252.1
412.39
,-262.1
419.39
,-262.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
569.74
,-287.7C
569.74
,-279.98
569.74
,-270.71
569.74
,-262.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
573.24
,-262.1
569.74
,-252.1
566.24
,-262.1
573.24
,-262.1"
/>
</g>
<!-- write_first_test->test_connection_psoc6_with_rc522 -->
<g
id=
"edge5"
class=
"edge"
>
<title>
write_first_test
->
test_connection_psoc6_with_rc522
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
373.35,-220C338.29
,-209.28
288.1
,-193.94
248.62
,-181.87"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
249.42
,-178.45
238.83
,-178.88
247.37
,-185.15
249.42
,-178.45"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
527.21,-220C492.15
,-209.28
441.96
,-193.94
402.48
,-181.87"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
403.27
,-178.45
392.69
,-178.88
401.23
,-185.15
403.27
,-178.45"
/>
</g>
<!-- write_first_test->test_wifi_connection -->
<g
id=
"edge8"
class=
"edge"
>
<title>
write_first_test
->
test_wifi_connection
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M
422.18
,-216.05C
425.11
,-208.18
428.66
,-198.62
431.94
,-189.79"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
435.27
,-190.87
435.47
,-180.28
428.71
,-188.43
435.27
,-190.87"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M
576.04
,-216.05C
578.96
,-208.18
582.51
,-198.62
585.79
,-189.79"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"
589.12
,-190.87
589.33
,-180.28
582.56
,-188.43
589.12
,-190.87"
/>
</g>
<!-- read_nfc_hashtable -->
<g
id=
"node13"
class=
"node"
>
<title>
read_nfc_hashtable
</title>
<g
id=
"a_node13"
><a
xlink:href=
"read_nfc_hashtable.md"
xlink:title=
"read_nfc_hashtable"
>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"186.89"
cy=
"-18"
rx=
"87.99"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"186.89"
y=
"-14.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
read_nfc_hashtable
</text>
</a>
</g>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"87.74"
cy=
"-18"
rx=
"87.99"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"87.74"
y=
"-14.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
read_nfc_hashtable
</text>
</g>
<!-- read_nfc_uid->read_nfc_hashtable -->
<g
id=
"edge12"
class=
"edge"
>
<title>
read_nfc_uid
->
read_nfc_hashtable
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M186.89,-71.7C186.89,-63.98 186.89,-54.71 186.89,-46.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"190.39,-46.1 186.89,-36.1 183.39,-46.1 190.39,-46.1"
/>
<path
fill=
"none"
stroke=
"black"
d=
"M297.54,-77.05C256.25,-65.62 193.66,-48.3 147.58,-35.56"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"148.29,-32.12 137.72,-32.83 146.42,-38.87 148.29,-32.12"
/>
</g>
<!-- read_nfc_uid->read_image_snippet -->
<g
id=
"edge14"
class=
"edge"
>
<title>
read_nfc_uid
->
read_image_snippet
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M384.34,-77.13C426.19,-65.73 489.78,-48.41 536.67,-35.64"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"537.67,-38.99 546.4,-32.98 535.83,-32.23 537.67,-38.99"
/>
</g>
<!-- read_nfc_uid->optional_read_image_snippet_ansi -->
<g
id=
"edge16"
class=
"edge"
>
<title>
read_nfc_uid
->
optional_read_image_snippet_ansi
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M340.74,-71.7C340.74,-63.98 340.74,-54.71 340.74,-46.11"
/>
<polygon
fill=
"black"
stroke=
"black"
points=
"344.24,-46.1 340.74,-36.1 337.24,-46.1 344.24,-46.1"
/>
</g>
<!-- optional_document_code -->
<g
id=
"node16"
class=
"node"
>
<title>
optional_document_code
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1102.74"
cy=
"-522"
rx=
"109.38"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1102.74"
y=
"-518.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
optional_document_code
</text>
</g>
<!-- optional_coding_style -->
<g
id=
"node17"
class=
"node"
>
<title>
optional_coding_style
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"1324.74"
cy=
"-522"
rx=
"94.78"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"1324.74"
y=
"-518.3"
font-family=
"Helvetica,sans-Serif"
font-size=
"14.00"
>
optional_coding_style
</text>
</g>
</g>
</svg>
tasks/read_image_snippet.md
0 → 100644
View file @
8eb6f343
# Read Image Snippet
## Description
Image snippets are stored on the server. They can be requested at the following endpoint:
|
**/getsnippet**
| |
| :-- | :-- |
|
<-
|
`<
NFC_UID:
7
>
<INDEX:
1
>
` |
| -> | `
<IMAGE_SNIPPET_JPG:
800
-
4500
>
` |
## Prerequisites
### Tasks done
- [Test HTTP Request](./test_http_request.md)
- [Read NFC UID](./read_nfc_uid.md)
### State
- WiFi instance must be connected.
## Acceptance criteria
- Image snippet can be read, i.e.
- Server returns status code 200
- Between 800 - 4500 bytes binary data of snippet present in response body.
- Received image snippet visible on server screen.
- Positive test written.
- Negative test written.
## References
- HTTP Request header file: https://gitlab.elektrotechnik.hs-augsburg.de/hackenbs/mbed-http/-/blob/main/src/https_request.h
- HTTP Response header file: https://gitlab.elektrotechnik.hs-augsburg.de/hackenbs/mbed-http/-/blob/main/src/http_response.h
## Hints
- Explanation of the notation for the endpoint:
- "**/getsnippet**": The URL after the host address.
- "<-": This data needs to be sent to the server.
- "->": This data is returned by the server.
- "`
<NFC_UID:
7
>
`": 7 bytes of binary data containing the NFC UID.
- There is already a define for the number of bytes of a tag's UID in `
smi.h
`:
```c
/// Length nfc tag identifier
#define SMI_TAGID_LENGTH 7
```
- Copying binary in data in C need a call to `
memcpy
`:
```c
uint8_t buffer[SMI_TAGID_LENGTH + 1];
memcpy(buffer, nfc.uid.uidByte, SMI_TAGID_LENGTH);
``
`
tasks/read_nfc_hashtable.md
View file @
8eb6f343
...
...
@@ -30,7 +30,7 @@ Note that always a buffer of 18 bytes need to be passed but only the first 4 byt
### Hashtable