Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rust-mavlink
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
MAVLink
rust-mavlink
Commits
c37b9855
Commit
c37b9855
authored
9 years ago
by
Kevin Mehall
Browse files
Options
Downloads
Patches
Plain Diff
Clean up documentation
parent
65955f7b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/connection.rs
+5
-4
5 additions, 4 deletions
src/connection.rs
src/lib.rs
+10
-11
10 additions, 11 deletions
src/lib.rs
with
15 additions
and
15 deletions
src/connection.rs
+
5
−
4
View file @
c37b9855
...
...
@@ -7,7 +7,7 @@ use std::io::{self, Cursor};
use
std
::
str
::
FromStr
;
/// A
trait for a mavl
ink connection
/// A
MAVL
ink connection
pub
trait
MavConnection
{
/// Receive a mavlink message.
///
...
...
@@ -22,9 +22,10 @@ pub trait MavConnection {
/// Connect to a MAVLink node by address string.
///
/// The address must be in one of the following formats:
/// * tcp:<addr>:<port>
/// * udpin:<addr>:<port>
/// * udpout:<addr>:<port>
///
/// * `tcp:<addr>:<port>`
/// * `udpin:<addr>:<port>`
/// * `udpout:<addr>:<port>`
///
/// The type of the connection is determined at runtime based on the address type, so the
/// connection is returned as a trait object.
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
10
−
11
View file @
c37b9855
...
...
@@ -6,9 +6,12 @@ use std::io;
use
byteorder
::{
ByteOrder
,
LittleEndian
,
ReadBytesExt
,
WriteBytesExt
};
use
std
::
io
::
prelude
::
*
;
pub
mod
connection
;
mod
connection
;
pub
use
connection
::{
MavConnection
,
Tcp
,
Udp
,
connect
};
/// The MAVLink common message set
///
/// https://pixhawk.ethz.ch/mavlink/
#[allow(non_camel_case_types)]
#[allow(non_snake_case)]
#[allow(unused_variables)]
...
...
@@ -23,9 +26,9 @@ const MAV_STX: u8 = 0xFE;
/// Metadata from a MAVLink packet header
pub
struct
Header
{
sequence
:
u8
,
system_id
:
u8
,
component_id
:
u8
,
pub
sequence
:
u8
,
pub
system_id
:
u8
,
pub
component_id
:
u8
,
}
/// Read a MAVLink message from a Read stream.
...
...
@@ -89,13 +92,7 @@ pub fn write<W: Write>(w: &mut W, header: Header, data: &MavMessage) -> io::Resu
Ok
(())
}
pub
fn
parse_mavlink_string
(
buf
:
&
[
u8
])
->
String
{
buf
.iter
()
.take_while
(|
a
|
**
a
!=
0
)
.map
(|
x
|
*
x
as
char
)
.collect
::
<
String
>
()
}
/// Create a heartbeat message
pub
fn
heartbeat_message
()
->
common
::
MavMessage
{
common
::
MavMessage
::
HEARTBEAT
(
common
::
HEARTBEAT_DATA
{
custom_mode
:
0
,
...
...
@@ -107,6 +104,7 @@ pub fn heartbeat_message() -> common::MavMessage {
})
}
/// Create a message requesting the parameters list
pub
fn
request_parameters
()
->
common
::
MavMessage
{
common
::
MavMessage
::
PARAM_REQUEST_LIST
(
common
::
PARAM_REQUEST_LIST_DATA
{
target_system
:
0
,
...
...
@@ -114,6 +112,7 @@ pub fn request_parameters() -> common::MavMessage {
})
}
/// Create a message enabling data streaming
pub
fn
request_stream
()
->
common
::
MavMessage
{
common
::
MavMessage
::
REQUEST_DATA_STREAM
(
common
::
REQUEST_DATA_STREAM_DATA
{
target_system
:
0
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment