Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Distributed Autonomous Networked Control Lab
MicroCART
Commits
8a16e58b
Commit
8a16e58b
authored
8 years ago
by
burneykb
Browse files
Options
Downloads
Patches
Plain Diff
Correcting function signatures
parent
8ecb55c4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quad/src/commands/cb_default.h
+1
-2
1 addition, 2 deletions
quad/src/commands/cb_default.h
quad/src/quad_app/callbacks.c
+13
-12
13 additions, 12 deletions
quad/src/quad_app/callbacks.c
with
14 additions
and
14 deletions
quad/src/commands/cb_default.h
+
1
−
2
View file @
8a16e58b
#include
"commands.h"
#include
"commands.h"
/* The cb_default used on the groundStation. This file MUST NOT BE INCLUDED
/* The cb_default used on the groundStation. This file MUST NOT BE INCLUDED
* by anything except for commands.c */
* by anything except for commands.c */
/* cb_default used by portable commands.c */
/* cb_default used by portable commands.c */
int
cb_default
(
struct
modular_structs
*
structs
)
int
cb_default
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
{
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
quad/src/quad_app/callbacks.c
+
13
−
12
View file @
8a16e58b
...
@@ -16,7 +16,7 @@ static size_t total_payload_received = 0;
...
@@ -16,7 +16,7 @@ static size_t total_payload_received = 0;
/**
/**
* Currently does nothing.
* Currently does nothing.
*/
*/
int
cb_debug
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u
8
*
data
,
u16
length
)
int
cb_debug
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u
nsigned
char
*
data
,
unsigned
short
length
)
{
{
char
buf
[
255
];
char
buf
[
255
];
...
@@ -33,7 +33,7 @@ int cb_debug(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 le
...
@@ -33,7 +33,7 @@ int cb_debug(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 le
/**
/**
* counts the number of packet logs.
* counts the number of packet logs.
*/
*/
int
cb_packetlog
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_packetlog
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
n_msg_received
+=
1
;
n_msg_received
+=
1
;
total_payload_received
+=
length
;
total_payload_received
+=
length
;
return
0
;
return
0
;
...
@@ -43,7 +43,7 @@ int cb_packetlog(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
...
@@ -43,7 +43,7 @@ int cb_packetlog(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
* Handles a get packet logs request and sends a response
* Handles a get packet logs request and sends a response
* with the packet log data.
* with the packet log data.
*/
*/
int
cb_getpacketlogs
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_getpacketlogs
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
char
buf
[
255
];
char
buf
[
255
];
// Message logging number of messages received and size of payload received
// Message logging number of messages received and size of payload received
...
@@ -56,7 +56,7 @@ int cb_getpacketlogs(modular_structs_t* structs, struct metadata *meta, u8 *data
...
@@ -56,7 +56,7 @@ int cb_getpacketlogs(modular_structs_t* structs, struct metadata *meta, u8 *data
/*
/*
* Handles receiving new location updates.
* Handles receiving new location updates.
*/
*/
int
cb_update
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u
8
*
data
,
u16
length
)
int
cb_update
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u
nsigned
char
*
data
,
unsigned
short
length
)
{
{
//processUpdate(packet, &(structs->raw_sensor_struct.currentQuadPosition));
//processUpdate(packet, &(structs->raw_sensor_struct.currentQuadPosition));
...
@@ -94,7 +94,7 @@ int cb_update(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 l
...
@@ -94,7 +94,7 @@ int cb_update(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 l
/**
/**
* This is called on the ground station to begin sending VRPN to the quad.
* This is called on the ground station to begin sending VRPN to the quad.
*/
*/
int
cb_beginupdate
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u
8
*
data
,
u16
length
)
{
int
cb_beginupdate
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u
nsigned
char
*
data
,
unsigned
short
length
)
{
structs
->
user_input_struct
.
receivedBeginUpdate
=
1
;
structs
->
user_input_struct
.
receivedBeginUpdate
=
1
;
return
0
;
return
0
;
}
}
...
@@ -137,7 +137,7 @@ struct node_ids get_node_ids(u8 *data) {
...
@@ -137,7 +137,7 @@ struct node_ids get_node_ids(u8 *data) {
*
*
* Does not send anything in response.
* Does not send anything in response.
*/
*/
int
cb_setparam
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u
8
*
data
,
u16
length
)
int
cb_setparam
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
u
nsigned
char
*
data
,
unsigned
short
length
)
{
{
// Check if the data length is correct
// Check if the data length is correct
if
(
length
!=
8
)
{
return
-
1
;}
if
(
length
!=
8
)
{
return
-
1
;}
...
@@ -176,7 +176,7 @@ int cb_setparam(modular_structs_t *structs, struct metadata *meta, u8 *data, u16
...
@@ -176,7 +176,7 @@ int cb_setparam(modular_structs_t *structs, struct metadata *meta, u8 *data, u16
* | bytes || 2 | 2 | 4 |
* | bytes || 2 | 2 | 4 |
* |--------------------------------------------------------|
* |--------------------------------------------------------|
*/
*/
int
cb_getparam
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
int
cb_getparam
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
{
// Check if the data length is correct
// Check if the data length is correct
if
(
length
!=
4
)
{
return
-
1
;}
if
(
length
!=
4
)
{
return
-
1
;}
...
@@ -217,7 +217,7 @@ int cb_getparam(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
...
@@ -217,7 +217,7 @@ int cb_getparam(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
*
*
* Does not send anything in response.
* Does not send anything in response.
*/
*/
int
cb_setsource
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_setsource
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
if
(
length
!=
8
)
{
return
-
1
;}
if
(
length
!=
8
)
{
return
-
1
;}
int16_t
dest_node
=
build_short
(
data
);
int16_t
dest_node
=
build_short
(
data
);
int16_t
dest_input
=
build_short
(
data
+
2
);
int16_t
dest_input
=
build_short
(
data
+
2
);
...
@@ -254,7 +254,7 @@ int cb_setsource(modular_structs_t* structs, struct metadata *meta, u8 *data, u
...
@@ -254,7 +254,7 @@ int cb_setsource(modular_structs_t* structs, struct metadata *meta, u8 *data, u
* | bytes || 2 | 2 | 2 | 2 |
* | bytes || 2 | 2 | 2 | 2 |
* |---------------------------------------------------------------------------|
* |---------------------------------------------------------------------------|
*/
*/
int
cb_getsource
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_getsource
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
if
(
length
!=
4
)
{
return
-
1
;}
if
(
length
!=
4
)
{
return
-
1
;}
u16
msg_id
=
meta
->
msg_id
;
u16
msg_id
=
meta
->
msg_id
;
// Get requested IDs
// Get requested IDs
...
@@ -276,7 +276,7 @@ int cb_getsource(modular_structs_t* structs, struct metadata *meta, u8 *data, u
...
@@ -276,7 +276,7 @@ int cb_getsource(modular_structs_t* structs, struct metadata *meta, u8 *data, u
* Handles a command to get a node output value from the quad.
* Handles a command to get a node output value from the quad.
* Packet structure is the same as getparam
* Packet structure is the same as getparam
*/
*/
int
cb_getoutput
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
int
cb_getoutput
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
{
// Check if the data length is correct
// Check if the data length is correct
if
(
length
!=
4
)
{
return
-
1
;}
if
(
length
!=
4
)
{
return
-
1
;}
...
@@ -315,7 +315,7 @@ int cb_getoutput(modular_structs_t* structs, struct metadata *meta, u8 *data, u
...
@@ -315,7 +315,7 @@ int cb_getoutput(modular_structs_t* structs, struct metadata *meta, u8 *data, u
* | bytes || 2*N | 2*N | < 4096 |
* | bytes || 2*N | 2*N | < 4096 |
* |---------------------------------------------------------------|
* |---------------------------------------------------------------|
*/
*/
int
cb_getnodes
(
modular_structs
_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_getnodes
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
const
struct
computation_graph
*
graph
=
structs
->
parameter_struct
.
graph
;
const
struct
computation_graph
*
graph
=
structs
->
parameter_struct
.
graph
;
if
(
graph
->
n_nodes
>=
150
)
{
if
(
graph
->
n_nodes
>=
150
)
{
static
char
*
error_msg
=
"Over 150 nodes. Not responding to cb_getnodes for fear of buffer overflow."
;
static
char
*
error_msg
=
"Over 150 nodes. Not responding to cb_getnodes for fear of buffer overflow."
;
...
@@ -381,7 +381,8 @@ int cb_getnodes(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
...
@@ -381,7 +381,8 @@ int cb_getnodes(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
* | bytes || 2 |
* | bytes || 2 |
* |-----------------------------|
* |-----------------------------|
*/
*/
int
cb_addnode
(
modular_structs_t
*
structs
,
struct
metadata
*
meta
,
u8
*
data
,
u16
length
)
{
int
cb_addnode
(
struct
modular_structs
*
structs
,
struct
metadata
*
meta
,
unsigned
char
*
data
,
unsigned
short
length
)
{
const
struct
computation_graph
*
graph
=
structs
->
parameter_struct
.
graph
;
if
(
length
<
2
)
{
return
-
1
;}
if
(
length
<
2
)
{
return
-
1
;}
// Size of name
// Size of name
size_t
name_len
=
length
-
2
;
size_t
name_len
=
length
-
2
;
...
...
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