root / branches / wireless / code / projects / libwireless / wireless_send.c @ 1578
History | View | Annotate | Download (4.09 KB)
1 |
/**
|
---|---|
2 |
* Copyright (c) 2009 Colony Project
|
3 |
*
|
4 |
* Permission is hereby granted, free of charge, to any person
|
5 |
* obtaining a copy of this software and associated documentation
|
6 |
* files (the "Software"), to deal in the Software without
|
7 |
* restriction, including without limitation the rights to use,
|
8 |
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
* copies of the Software, and to permit persons to whom the
|
10 |
* Software is furnished to do so, subject to the following
|
11 |
* conditions:
|
12 |
*
|
13 |
* The above copyright notice and this permission notice shall be
|
14 |
* included in all copies or substantial portions of the Software.
|
15 |
*
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
**/
|
25 |
|
26 |
/**
|
27 |
* @file wireless_send.c
|
28 |
* @brief Wireless library send functions
|
29 |
*
|
30 |
* Implementation of high level wireless communication.
|
31 |
* This is the send functions portion of the library.
|
32 |
*
|
33 |
* @author Colony Project, CMU Robotics Club
|
34 |
**/
|
35 |
|
36 |
#include "wl_defs.h" |
37 |
#include "wireless.h" |
38 |
|
39 |
|
40 |
// the send functions
|
41 |
|
42 |
/**
|
43 |
* @addtogroup wireless Wireless
|
44 |
* @{
|
45 |
**/
|
46 |
|
47 |
|
48 |
/**
|
49 |
* The core send function. This will take all possible arguments and send all types of packets.
|
50 |
*
|
51 |
* @param data pointer to the byte array of data to be included in the packet
|
52 |
* @param length the length of the data array
|
53 |
* @param group the packet group of the packet
|
54 |
* @param scope flag for sending global packet, to your current PAN, or to a specific robot
|
55 |
* @param dest robot ID (for robot to robot packet)
|
56 |
* @param mode flag for using TCP or UDP
|
57 |
*
|
58 |
* @return 0 for OK, or error code (TBD)
|
59 |
**/
|
60 |
int8_t wl_send(char *data, uint8_t length, uint8_t group, uint8_t scope, uint8_t dest, uint8_t mode) {
|
61 |
|
62 |
return 0; |
63 |
} |
64 |
|
65 |
/**
|
66 |
* Wrapper for core send function that will send a global packet across the current channel.
|
67 |
*
|
68 |
* @param data pointer to the byte array of data to be included in the packet
|
69 |
* @param length the length of the data array
|
70 |
* @param group the packet group of the packet
|
71 |
*
|
72 |
* @return 0 for OK, or error code (TBD)
|
73 |
**/
|
74 |
int8_t wl_send_global(char *data, uint8_t length, uint8_t group) {
|
75 |
|
76 |
return 0; |
77 |
} |
78 |
|
79 |
/**
|
80 |
* Wrapper for core send function that will send a packet across the current channel on the current pan.
|
81 |
*
|
82 |
* @param data pointer to the byte array of data to be included in the packet
|
83 |
* @param length the length of the data array
|
84 |
* @param group the packet group of the packet
|
85 |
*
|
86 |
* @return 0 for OK, or error code (TBD)
|
87 |
**/
|
88 |
int8_t wl_send_pan(char *data, uint8_t length, uint8_t group) {
|
89 |
|
90 |
return 0; |
91 |
} |
92 |
|
93 |
/**
|
94 |
* Wrapper for core send function that will send a packet across the current channel to a specific robot.
|
95 |
*
|
96 |
* @param data pointer to the byte array of data to be included in the packet
|
97 |
* @param length the length of the data array
|
98 |
* @param group the packet group of the packet
|
99 |
* @param dest robot ID (for robot to robot packet)
|
100 |
* @param mode flag for using TCP or UDP
|
101 |
*
|
102 |
* @return 0 for OK, or error code (TBD)
|
103 |
**/
|
104 |
int8_t wl_send_robot(char *data, uint8_t length, uint8_t group, uint8_t dest, uint8_t mode) {
|
105 |
|
106 |
return 0; |
107 |
} |
108 |
|
109 |
/**
|
110 |
* Default (i.e. basic) send wrapper.
|
111 |
*
|
112 |
* @param data pointer to the byte array of data to be included in the packet
|
113 |
* @param length the length of the data array
|
114 |
*
|
115 |
* @return 0 for OK, or error code (TBD)
|
116 |
**/
|
117 |
int8_t wl_send_basic(char *data, uint8_t length) {
|
118 |
|
119 |
return 0; |
120 |
} |
121 |
|
122 |
|
123 |
/**
|
124 |
* acknowledgment error
|
125 |
* you call this function periodically to check if any of the packets you have sent have been lost
|
126 |
*
|
127 |
* note that all other error checking will be handled by library, so your user behavior won't have to worry about it
|
128 |
*
|
129 |
* @return an error code (or maybe the # of packets you have lost)
|
130 |
**/
|
131 |
int8_t wl_ack_error(void) {
|
132 |
|
133 |
return 0; |
134 |
} |
135 |
|
136 |
|
137 |
/**@} **/ //end defgroup |
138 |
|
139 |
|
140 |
// Define all private functions down here
|
141 |
|
142 |
|
143 |
|