Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
6554806c
Commit
6554806c
authored
10 years ago
by
Sven Gestegård Robertz
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.cs.lth.se:robotlab/labcomm-core
parents
9a724313
e7155139
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/tech_report.tex
+20
-60
20 additions, 60 deletions
doc/tech_report.tex
with
20 additions
and
60 deletions
doc/tech_report.tex
+
20
−
60
View file @
6554806c
% *** en embryo of a technical report describing the labcomm design rationale and implementation ***
\documentclass
[a4paper]
{
article
}
\usepackage
{
listings
}
%\usepackage{verbatims}
%\usepackage{todo}
...
...
@@ -253,73 +254,29 @@ But
With the following `example.lc` file:
\begin{verbatim}
sample struct
{
int sequence;
struct
{
boolean last;
string data;
}
line[
_
];
}
log
_
message;
sample float data;
\end{verbatim}
\lstinputlisting
[basicstyle=\footnotesize]
{
../examples/wiki
_
example/example.lc
}
and this
\verb
+
example_encoder.c
+
file
\lstinputlisting
[basicstyle=\footnotesize,language=C]
{
../examples/wiki
_
example/example
_
encoder.c
}
\begin{verbatim}
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <labcomm
_
fd
_
reader.h>
#include <labcomm
_
fd
_
writer.h>
#include "example.h"
int main(int argc, char *argv[])
{
int fd;
struct labcomm
_
encoder *encoder;
int i, j;
fd = open("example.encoded", O
_
WRONLY|O
_
CREAT|O
_
TRUNC, 0644);
encoder = labcomm
_
encoder
_
new(labcomm
_
fd
_
writer,
&
fd);
labcomm
_
encoder
_
register
_
example
_
log
_
message(encoder);
labcomm
_
encoder
_
register
_
example
_
data(encoder);
for (i = 0 ; i < argc ; i++)
{
example
_
log
_
message message;
message.sequence = i + 1;
message.line.n
_
0 = i;
message.line.a = malloc(message.line.n
_
0*sizeof(message.line));
for (j = 0 ; j < i ; j++)
{
message.line.a[j].last = (j == message.line.n
_
0 - 1);
message.line.a[j].data = argv[j + 1];
}
labcomm
_
encode
_
example
_
log
_
message(encoder,
&
message);
free(message.line.a);
}
for (i = 0 ; i < argc ; i++)
{
float f = i;
labcomm
_
encode
_
example
_
data(encoder,
&
f);
}
}
\end{verbatim}
Running
\verb
+
./example_encoder one two
+
, will yield the following result in example.encoded:
\begin{verbatim}
00000000 02 40 0b 6c 6f 67 5f 6d 65 73 73 61 67 65 11 02 |.@.log
_
message..|
00000010 08 73 65 71 75 65 6e 63 65 23 04 6c 69 6e 65 10 |.sequence#.line.|
00000020 01 00 11 02 04 6c 61 73 74 20 04 64 61 74 61 27 |.....last .data'|
00000030 02 41 04 64 61 74 61 25 40 00 00 00 01 00 40 00 |.A.data
%@.....@.|
00000040 00 00 02 01 01 03 6f 6e 65 40 00 00 00 03 02 00 |......one@......|
00000050 03 6f 6e 65 01 03 74 77 6f 41 00 00 00 00 41 3f |.one..twoA....A?|
00000060 80 00 00 41 40 00 00 00 |...A@...|
00000068
00000000 01 0c 0b 4c 61 62 43 6f 6d 6d 32 30 31 34 02 30 |...LabComm2014.0|
00000010 40 0b 6c 6f 67 5f 6d 65 73 73 61 67 65 22 11 02 |@.log
_
message"..|
00000020 08 73 65 71 75 65 6e 63 65 23 04 6c 69 6e 65 10 |.sequence#.line.|
00000030 01 00 11 02 04 6c 61 73 74 20 04 64 61 74 61 27 |.....last .data'|
00000040 02 08 41 04 64 61 74 61 01 25 40 04 00 00 00 01 |..A.data.
%@.....|
00000050 00 40 09 00 00 00 02 01 01 03 6f 6e 65 40 0e 00 |.@........one@..|
00000060 00 00 03 02 00 03 6f 6e 65 01 03 74 77 6f 41 04 |......one..twoA.|
00000070 00 00 00 00 41 04 3f 80 00 00 41 04 40 00 00 00 |....A.?...A.@...|
00000080
\end{verbatim}
i.e.,
\begin{verbatim}
<sample
_
decl> <user
_
id: 0x40> <string: <len: 11> <"log
_
message">
<version> <length: 12> <string: <len: 11> <"LabComm2014">>
<sample
_
decl> <length: 48 <user
_
id: 0x40> <string: <len: 11> <"log
_
message">
<signature
_
length: 34>
<struct
_
decl:
<number
_
of
_
fields: 2>
<string: <len: 8> <"sequence"> <type: <integer
_
type>>
...
...
@@ -332,8 +289,11 @@ i.e.,
>>
>
>
<sample
_
decl> <user
_
id: 0x41>
...
<sample
_
decl> <length: 8> <user
_
id: 0x41> <string: <len: 4> <"data">>
<signature
_
length: 1> <float
_
type>
<sample
_
data> <user
_
id: 40> <length: 4> <packed
_
sample
_
data>
<sample
_
data> <user
_
id: 40> <length: 9> <packed
_
sample
_
data>
<sample
_
data> <user
_
id: 40> <length: 14> <packed
_
sample
_
data>
\end{verbatim}
\section
{
Ideas/Discussion
}
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment