root / branches / wireless / code / projects / libwireless / wireless_send.c @ 1581
History | View | Annotate | Download (4.57 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 or your current PAN
|
55 |
* @param dest robot ID (for robot to robot packet)
|
56 |
* @param mode flag for using FAST or RELIABLE sending
|
57 |
*
|
58 |
* @return positive packet number for tracking acks, or error code (TBD)
|
59 |
**/
|
60 |
int16_t wl_send(char *data, uint8_t length, uint8_t group, uint8_t scope, uint16_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 positive packet number for tracking acks, or error code (TBD)
|
73 |
**/
|
74 |
int16_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 positive packet number for tracking acks, or error code (TBD)
|
87 |
**/
|
88 |
int16_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 FAST or RELIABLE sending
|
101 |
*
|
102 |
* @return positive packet number for tracking acks, or error code (TBD)
|
103 |
**/
|
104 |
int16_t wl_send_robot(char *data, uint8_t length, uint8_t group, uint16_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 positive packet number for tracking acks, or error code (TBD)
|
116 |
**/
|
117 |
int16_t wl_send_basic(char *data, uint8_t length) {
|
118 |
|
119 |
return 0; |
120 |
} |
121 |
|
122 |
|
123 |
/**
|
124 |
* acknowledgment error
|
125 |
* 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,
|
128 |
* so your user behavior won't have to worry about it
|
129 |
*
|
130 |
* @return the # of packets lost (up to 255)
|
131 |
**/
|
132 |
int8_t wl_ack_error(void) {
|
133 |
|
134 |
return 0; |
135 |
} |
136 |
|
137 |
/**
|
138 |
* acknowledgement error check
|
139 |
* check if a specific packet has been lost
|
140 |
* note: buffer will overflow ever 255 packets
|
141 |
*
|
142 |
* @param packet number
|
143 |
*
|
144 |
* @return 0=still sending,1=ack received,-1=ack failure
|
145 |
**/
|
146 |
int8_t wl_ack_check(uint8_t packet) { |
147 |
|
148 |
return 0; |
149 |
} |
150 |
|
151 |
/**
|
152 |
* acknowledgement reset
|
153 |
* reset the acknowledgement buffer
|
154 |
**/
|
155 |
void wl_ack_reset(void) { |
156 |
|
157 |
} |
158 |
|
159 |
|
160 |
/**@} **/ //end defgroup |
161 |
|
162 |
|
163 |
// Define all private functions down here
|
164 |
|
165 |
|
166 |
|