MAV'RIC
mavlink_communication.h
1 /*******************************************************************************
2  * Copyright (c) 2009-2014, MAV'RIC Development Team
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  ******************************************************************************/
31 
32 /*******************************************************************************
33  * \file mavlink_communication.h
34  *
35  * \author MAV'RIC Team
36  * \author Julien Lecoeur
37  *
38  * \brief This module takes care of sending periodic telemetric messages and
39  * handling incoming messages
40  *
41  ******************************************************************************/
42 
43 
44 #ifndef MAVLINK_COMMUNICATION_H_
45 #define MAVLINK_COMMUNICATION_H_
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 #include "scheduler.h"
52 #include "mavlink_stream.h"
53 #include "mavlink_message_handler.h"
54 #include "onboard_parameters.h"
55 
56 
62 typedef void* handling_telemetry_module_struct_t;
63 
64 
68 typedef void (*mavlink_send_msg_function_t) (handling_telemetry_module_struct_t, mavlink_stream_t*, mavlink_message_t*);
69 
70 
74 typedef struct
75 {
76  mavlink_stream_t* mavlink_stream;
77  mavlink_send_msg_function_t function;
78  handling_telemetry_module_struct_t module_struct;
80 
81 
85 typedef struct
86 {
87  uint32_t msg_sending_count;
89  mavlink_send_msg_handler_t msg_send_list[];
91 
95 typedef struct
96 {
98  mavlink_stream_t mavlink_stream;
101 
103 
105 
106 
110 typedef struct
111 {
112  scheduler_conf_t scheduler_config;
116 
119 
120 
121 
132 bool mavlink_communication_init(mavlink_communication_t* mavlink_communication, const mavlink_communication_conf_t* config, byte_stream_t* rx_stream, byte_stream_t* tx_stream);
133 
134 
142 task_return_t mavlink_communication_update(mavlink_communication_t* mavlink_communication);
143 
144 
151 void mavlink_communication_suspend_downstream(mavlink_communication_t* mavlink_communication, uint32_t delay);
152 
167 bool mavlink_communication_add_msg_send( mavlink_communication_t* mavlink_communication, uint32_t repeat_period, task_run_mode_t run_mode, task_timing_mode_t timing_mode, task_priority_t priority, mavlink_send_msg_function_t function, handling_telemetry_module_struct_t module_structure, uint32_t task_id);
168 
176 task_return_t mavlink_communication_send_message(mavlink_send_msg_handler_t* msg_send);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* MAVLINK_COMMUNICATION_H_ */
Scheduler.
Definition: scheduler.h:171
Scheduler configuration.
Definition: scheduler.h:182
Byte stream.
Definition: streams.h:62
Main structure of the module onboard parameters.
Definition: onboard_parameters.h:97
Configuration for the module onboard parameters.
Definition: onboard_parameters.h:108