Skip to content
Snippets Groups Projects
Commit 7c422af1 authored by burneykb's avatar burneykb
Browse files

Correcting function signatures

parent 3b5a6b2b
No related branches found
No related tags found
No related merge requests found
#include "commands.h"
/* The cb_default used on the groundStation. This file MUST NOT BE INCLUDED
* by anything except for 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;
}
......@@ -16,7 +16,7 @@ static size_t total_payload_received = 0;
/**
* Currently does nothing.
*/
int cb_debug(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 length)
int cb_debug(struct modular_structs *structs, struct metadata *meta, unsigned char *data, unsigned short length)
{
char buf[255];
......@@ -33,7 +33,7 @@ int cb_debug(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 le
/**
* 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;
total_payload_received += length;
return 0;
......@@ -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
* 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];
// 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
/*
* Handles receiving new location updates.
*/
int cb_update(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 length)
int cb_update(struct modular_structs *structs, struct metadata *meta, unsigned char *data, unsigned short length)
{
//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
/**
* This is called on the ground station to begin sending VRPN to the quad.
*/
int cb_beginupdate(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 length) {
int cb_beginupdate(struct modular_structs *structs, struct metadata *meta, unsigned char *data, unsigned short length) {
structs->user_input_struct.receivedBeginUpdate = 1;
return 0;
}
......@@ -137,7 +137,7 @@ struct node_ids get_node_ids(u8 *data) {
*
* Does not send anything in response.
*/
int cb_setparam(modular_structs_t *structs, struct metadata *meta, u8 *data, u16 length)
int cb_setparam(struct modular_structs *structs, struct metadata *meta, unsigned char *data, unsigned short length)
{
// Check if the data length is correct
if (length != 8) {return -1;}
......@@ -176,7 +176,7 @@ int cb_setparam(modular_structs_t *structs, struct metadata *meta, u8 *data, u16
* | 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
if (length != 4) {return -1;}
......@@ -217,7 +217,7 @@ int cb_getparam(modular_structs_t* structs, struct metadata *meta, u8 *data, u1
*
* 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;}
int16_t dest_node = build_short(data);
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
* | 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;}
u16 msg_id = meta->msg_id;
// Get requested IDs
......@@ -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.
* 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
if (length != 4) {return -1;}
......@@ -315,7 +315,7 @@ int cb_getoutput(modular_structs_t* structs, struct metadata *meta, u8 *data, u
* | 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;
if (graph->n_nodes >= 150) {
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
* | 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;}
// Size of name
size_t name_len = length - 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment