PX4 Firmware
PX4 Autopilot Software http://px4.io
MavlinkShell Class Reference

#include <mavlink_shell.h>

Collaboration diagram for MavlinkShell:

Public Member Functions

 MavlinkShell ()=default
 
 ~MavlinkShell ()
 
int start ()
 Start the mavlink shell. More...
 
size_t write (uint8_t *buffer, size_t len)
 Write to the shell. More...
 
size_t read (uint8_t *buffer, size_t len)
 Read from the shell. More...
 
size_t available ()
 Get the number of bytes that can be read. More...
 

Private Member Functions

 MavlinkShell (const MavlinkShell &)=delete
 
MavlinkShell operator= (const MavlinkShell &)=delete
 

Static Private Member Functions

static int shell_start_thread (int argc, char *argv[])
 

Private Attributes

int _to_shell_fd = -1
 
int _from_shell_fd = -1
 fd to write to the shell More...
 
int _shell_fds [2] = { -1, -1}
 fd to read from the shell More...
 
px4_task_t _task
 stdin & out used by the shell More...
 

Detailed Description

Definition at line 48 of file mavlink_shell.h.

Constructor & Destructor Documentation

◆ MavlinkShell() [1/2]

MavlinkShell::MavlinkShell ( )
default

◆ ~MavlinkShell()

MavlinkShell::~MavlinkShell ( )

Definition at line 57 of file mavlink_shell.cpp.

References _from_shell_fd, and _to_shell_fd.

◆ MavlinkShell() [2/2]

MavlinkShell::MavlinkShell ( const MavlinkShell )
privatedelete

Member Function Documentation

◆ available()

size_t MavlinkShell::available ( )

Get the number of bytes that can be read.

Definition at line 171 of file mavlink_shell.cpp.

References _from_shell_fd, and OK.

Referenced by Mavlink::task_main().

Here is the caller graph for this function:

◆ operator=()

MavlinkShell MavlinkShell::operator= ( const MavlinkShell )
privatedelete

◆ read()

size_t MavlinkShell::read ( uint8_t *  buffer,
size_t  len 
)

Read from the shell.

This is blocking, if 0 bytes are available, this will block.

Parameters
lenbuffer length
Returns
number of bytes read.

Definition at line 166 of file mavlink_shell.cpp.

References _from_shell_fd, and read().

Referenced by Mavlink::task_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shell_start_thread()

int MavlinkShell::shell_start_thread ( int  argc,
char *  argv[] 
)
staticprivate

Definition at line 150 of file mavlink_shell.cpp.

Referenced by start().

Here is the caller graph for this function:

◆ start()

int MavlinkShell::start ( )

Start the mavlink shell.

Returns
0 on success.

Definition at line 70 of file mavlink_shell.cpp.

References _from_shell_fd, _shell_fds, _task, _to_shell_fd, and shell_start_thread().

Referenced by Mavlink::get_shell().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

size_t MavlinkShell::write ( uint8_t *  buffer,
size_t  len 
)

Write to the shell.

Returns
number of written bytes

Definition at line 161 of file mavlink_shell.cpp.

References _to_shell_fd, and write().

Referenced by MavlinkReceiver::handle_message_serial_control().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _from_shell_fd

int MavlinkShell::_from_shell_fd = -1
private

fd to write to the shell

Definition at line 83 of file mavlink_shell.h.

Referenced by available(), read(), start(), and ~MavlinkShell().

◆ _shell_fds

int MavlinkShell::_shell_fds[2] = { -1, -1}
private

fd to read from the shell

Definition at line 84 of file mavlink_shell.h.

Referenced by start().

◆ _task

px4_task_t MavlinkShell::_task
private

stdin & out used by the shell

Definition at line 85 of file mavlink_shell.h.

Referenced by start().

◆ _to_shell_fd

int MavlinkShell::_to_shell_fd = -1
private

Definition at line 82 of file mavlink_shell.h.

Referenced by start(), write(), and ~MavlinkShell().


The documentation for this class was generated from the following files: