Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / testing / robot_routine_reg_test / colonet.h @ 13

History | View | Annotate | Download (1.02 KB)

1
/** @file colonet.h
2
 * @brief Colonet library for colony robots
3
 * @author Eugene Marinelli
4
 * @date 10/26/06
5
 */
6

    
7
#ifndef COLONET_H_
8
#define COLONET_H_
9

    
10
#include <colonet_defs.h>
11

    
12
/** @brief Handles colonet packets.  Should be called by parse_buffer 
13
 * when it is determined that a colonet message has been received.
14
 *
15
 * @param robot_id The robot id
16
 * @param pkt_buf The packet buffer (e.g. wl_buf)
17
 * 
18
 * @return -1 on error (invalid msgId), 0 on success
19
 */
20
int colonet_handle_message(unsigned char robot_id, char* packet);
21

    
22
/** @brief Registers a new colonet message handler function.  If a message
23
 * with msgId is received, then handler will be called.
24
 * 
25
 * @param msgId The message id of the handler to be registered.  Must be
26
 * between USER_DEFINED_MSG_ID_START and USER_DEFINED_MSG_ID_END
27
 * @param handler The function to be called if a colonet packet with message
28
 * id msgId is received
29
 * 
30
 * @return -1 on error (invalid msgId), 0 on success
31
 */
32
int colonet_add_message(unsigned char msgId, void (*handler)(void));
33

    
34
#endif