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
423369b1
Commit
423369b1
authored
13 years ago
by
Sven Robertz
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
bb636c49
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
wiki_example/example.cs
+0
-170
0 additions, 170 deletions
wiki_example/example.cs
wiki_example/log_message.java
+0
-119
0 additions, 119 deletions
wiki_example/log_message.java
wiki_example/run
+1
-1
1 addition, 1 deletion
wiki_example/run
with
1 addition
and
290 deletions
wiki_example/example.cs
deleted
100644 → 0
+
0
−
170
View file @
bb636c49
using
System
;
using
se.lth.control.labcomm
;
/*
sample struct {
int sequence;
struct {
boolean last;
string data;
} line[_];
} log_message;
*/
public
class
log_message
:
LabCommSample
{
public
static
class
struct_line
{
public
boolean
last
;
public
String
data
;
}
public
int
sequence
;
public
struct_line
[]
line
;
public
interface
Handler
:
LabCommHandler
{
void
handle
(
log_message
value
);
}
public
static
void
register
(
LabCommDecoder
d
,
Handler
h
)
{
d
.
register
(
new
Dispatcher
(),
h
);
}
public
static
void
register
(
LabCommEncoder
e
)
{
e
.
register
(
new
Dispatcher
());
}
private
class
Dispatcher
:
LabCommDispatcher
{
public
Type
getSampleClass
()
{
return
typeof
(
log_message
);
}
public
String
getName
()
{
return
"log_message"
;
}
public
byte
[]
getSignature
()
{
return
signature
;
}
public
void
decodeAndHandle
(
LabCommDecoder
d
,
LabCommHandler
h
)
{
((
Handler
)
h
).
handle
(
log_message
.
decode
(
d
));
}
}
public
static
void
encode
(
LabCommEncoder
e
,
log_message
value
)
{
e
.
begin
(
typeof
(
log_message
));
e
.
encodeInt
(
value
.
sequence
);
e
.
encodeInt
(
value
.
line
.
GetLength
(
0
));
int
i_0_max
=
value
.
line
.
GetLength
(
0
);
for
(
int
i_0
=
0
;
i_0
<
i_0_max
;
i_0
++)
{
e
.
encodeBoolean
(
value
.
line
[
i_0
].
last
);
e
.
encodeString
(
value
.
line
[
i_0
].
data
);
}
e
.
end
(
typeof
(
log_message
));
}
public
static
log_message
decode
(
LabCommDecoder
d
)
{
log_message
result
;
result
=
new
log_message
();
result
.
sequence
=
d
.
decodeInt
();
{
int
i_0_max
=
d
.
decodeInt
();
result
.
line
=
new
struct_line
[
i_0_max
]
;
for
(
int
i_0
=
0
;
i_0
<
i_0_max
;
i_0
++)
{
result
.
line
[
i_0
]
=
new
struct_line
();
result
.
line
[
i_0
].
last
=
d
.
decodeBoolean
();
result
.
line
[
i_0
].
data
=
d
.
decodeString
();
}
}
return
result
;
}
private
static
byte
[]
signature
=
new
byte
[]
{
// struct { 2 fields
0
,
0
,
0
,
17
,
0
,
0
,
0
,
2
,
// int 'sequence'
0
,
0
,
0
,
8
,
115
,
101
,
113
,
117
,
101
,
110
,
99
,
101
,
0
,
0
,
0
,
35
,
// array [_] 'line'
0
,
0
,
0
,
4
,
108
,
105
,
110
,
101
,
// array [_]
0
,
0
,
0
,
16
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
// struct { 2 fields
0
,
0
,
0
,
17
,
0
,
0
,
0
,
2
,
// boolean 'last'
0
,
0
,
0
,
4
,
108
,
97
,
115
,
116
,
0
,
0
,
0
,
32
,
// string 'data'
0
,
0
,
0
,
4
,
100
,
97
,
116
,
97
,
0
,
0
,
0
,
39
,
// }
// }
// }
};
}
/*
sample float data;
*/
public
class
data
:
LabCommSample
{
public
interface
Handler
:
LabCommHandler
{
void
handle
(
float
value
);
}
public
static
void
register
(
LabCommDecoder
d
,
Handler
h
)
{
d
.
register
(
new
Dispatcher
(),
h
);
}
public
static
void
register
(
LabCommEncoder
e
)
{
e
.
register
(
new
Dispatcher
());
}
private
class
Dispatcher
:
LabCommDispatcher
{
public
Type
getSampleClass
()
{
return
typeof
(
data
);
}
public
String
getName
()
{
return
"data"
;
}
public
byte
[]
getSignature
()
{
return
signature
;
}
public
void
decodeAndHandle
(
LabCommDecoder
d
,
LabCommHandler
h
)
{
((
Handler
)
h
).
handle
(
data
.
decode
(
d
));
}
}
public
static
void
encode
(
LabCommEncoder
e
,
float
value
)
{
e
.
begin
(
typeof
(
data
));
e
.
encodeFloat
(
value
);
e
.
end
(
typeof
(
data
));
}
public
static
float
decode
(
LabCommDecoder
d
)
{
float
result
;
result
=
d
.
decodeFloat
();
return
result
;
}
private
static
byte
[]
signature
=
new
byte
[]
{
0
,
0
,
0
,
37
,
};
}
This diff is collapsed.
Click to expand it.
wiki_example/log_message.java
deleted
100644 → 0
+
0
−
119
View file @
bb636c49
/*
sample struct {
int sequence;
struct {
boolean last;
string data;
} line[_];
} log_message;
*/
import
java.io.IOException
;
import
se.lth.control.labcomm.LabCommDecoder
;
import
se.lth.control.labcomm.LabCommDispatcher
;
import
se.lth.control.labcomm.LabCommEncoder
;
import
se.lth.control.labcomm.LabCommHandler
;
import
se.lth.control.labcomm.LabCommSample
;
public
class
log_message
implements
LabCommSample
{
public
static
class
struct_line
{
public
boolean
last
;
public
String
data
;
}
public
int
sequence
;
public
struct_line
[]
line
;
public
interface
Handler
extends
LabCommHandler
{
public
void
handle_log_message
(
log_message
value
)
throws
Exception
;
}
public
static
void
register
(
LabCommDecoder
d
,
Handler
h
)
throws
IOException
{
d
.
register
(
new
Dispatcher
(),
h
);
}
public
static
void
register
(
LabCommEncoder
e
)
throws
IOException
{
e
.
register
(
new
Dispatcher
());
}
private
static
class
Dispatcher
implements
LabCommDispatcher
{
public
Class
getSampleClass
()
{
return
log_message
.
class
;
}
public
String
getName
()
{
return
"log_message"
;
}
public
byte
[]
getSignature
()
{
return
signature
;
}
public
void
decodeAndHandle
(
LabCommDecoder
d
,
LabCommHandler
h
)
throws
Exception
{
((
Handler
)
h
).
handle_log_message
(
log_message
.
decode
(
d
));
}
}
public
static
void
encode
(
LabCommEncoder
e
,
log_message
value
)
throws
IOException
{
e
.
begin
(
log_message
.
class
);
e
.
encodeInt
(
value
.
sequence
);
e
.
encodeInt
(
value
.
line
.
length
);
int
i_0_max
=
value
.
line
.
length
;
for
(
int
i_0
=
0
;
i_0
<
i_0_max
;
i_0
++)
{
e
.
encodeBoolean
(
value
.
line
[
i_0
].
last
);
e
.
encodeString
(
value
.
line
[
i_0
].
data
);
}
e
.
end
(
log_message
.
class
);
}
public
static
log_message
decode
(
LabCommDecoder
d
)
throws
IOException
{
log_message
result
;
result
=
new
log_message
();
result
.
sequence
=
d
.
decodeInt
();
{
int
i_0_max
=
d
.
decodeInt
();
result
.
line
=
new
struct_line
[
i_0_max
];
for
(
int
i_0
=
0
;
i_0
<
i_0_max
;
i_0
++)
{
result
.
line
[
i_0
]
=
new
struct_line
();
result
.
line
[
i_0
].
last
=
d
.
decodeBoolean
();
result
.
line
[
i_0
].
data
=
d
.
decodeString
();
}
}
return
result
;
}
private
static
byte
[]
signature
=
new
byte
[]
{
// struct { 2 fields
0
,
0
,
0
,
17
,
0
,
0
,
0
,
2
,
// int 'sequence'
0
,
0
,
0
,
8
,
115
,
101
,
113
,
117
,
101
,
110
,
99
,
101
,
0
,
0
,
0
,
35
,
// array [_] 'line'
0
,
0
,
0
,
4
,
108
,
105
,
110
,
101
,
// array [_]
0
,
0
,
0
,
16
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
// struct { 2 fields
0
,
0
,
0
,
17
,
0
,
0
,
0
,
2
,
// boolean 'last'
0
,
0
,
0
,
4
,
108
,
97
,
115
,
116
,
0
,
0
,
0
,
32
,
// string 'data'
0
,
0
,
0
,
4
,
100
,
97
,
116
,
97
,
0
,
0
,
0
,
39
,
// }
// }
// }
};
}
This diff is collapsed.
Click to expand it.
wiki_example/run
+
1
−
1
View file @
423369b1
#!/bin/sh
#!/bin/sh
# Auto generate code from .lc file
# Auto generate code from .lc file
java
-jar
/opt/robot/java
/labComm.jar
\
java
-jar
..
/labComm.jar
\
--c
=
example.c
--h
=
example.h
\
--c
=
example.c
--h
=
example.h
\
--java
=
.
\
--java
=
.
\
--cs
=
example.cs
\
--cs
=
example.cs
\
...
...
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