PX4 Firmware
PX4 Autopilot Software http://px4.io
|
The driver for the Rockblock 9602 and 9603 RockBlock module for satellite communication over the Iridium satellite system. More...
#include <IridiumSBD.h>
Public Member Functions | |
IridiumSBD () | |
int | ioctl (struct file *filp, int cmd, unsigned long arg) |
Public Member Functions inherited from cdev::CDev | |
CDev (const char *devname) | |
Constructor. More... | |
CDev (const CDev &)=delete | |
CDev & | operator= (const CDev &)=delete |
CDev (CDev &&)=delete | |
CDev & | operator= (CDev &&)=delete |
virtual | ~CDev () |
virtual int | init () |
virtual int | open (file_t *filep) |
Handle an open of the device. More... | |
virtual int | close (file_t *filep) |
Handle a close of the device. More... | |
virtual ssize_t | read (file_t *filep, char *buffer, size_t buflen) |
Perform a read from the device. More... | |
virtual ssize_t | write (file_t *filep, const char *buffer, size_t buflen) |
Perform a write to the device. More... | |
virtual off_t | seek (file_t *filep, off_t offset, int whence) |
Perform a logical seek operation on the device. More... | |
virtual int | ioctl (file_t *filep, int cmd, unsigned long arg) |
Perform an ioctl operation on the device. More... | |
virtual int | poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup) |
Perform a poll setup/teardown operation. More... | |
const char * | get_devname () const |
Get the device name. More... | |
Static Public Member Functions | |
static int | start (int argc, char *argv[]) |
static int | stop () |
static void | status () |
static void | test (int argc, char *argv[]) |
Private Member Functions | |
void | main_loop (int argc, char *argv[]) |
void | standby_loop (void) |
void | csq_loop (void) |
void | sbdsession_loop (void) |
void | test_loop (void) |
void | start_csq (void) |
void | start_sbd_session (void) |
void | start_test (void) |
ssize_t | write (struct file *filp, const char *buffer, size_t buflen) |
ssize_t | read (struct file *filp, char *buffer, size_t buflen) |
void | write_tx_buf () |
void | read_rx_buf () |
void | write_at (const char *command) |
satcom_result_code | read_at_command (int16_t timeout=100) |
satcom_result_code | read_at_msg (int16_t timeout=100) |
satcom_result_code | read_at (uint8_t *rx_buf, int *rx_len, int16_t timeout=100) |
void | schedule_test (void) |
bool | clear_mo_buffer () |
satcom_uart_status | open_uart (char *uart_name) |
bool | is_modem_ready (void) |
pollevent_t | poll_state (struct file *filp) |
void | publish_iridium_status (void) |
void | publish_subsystem_status () |
virtual int | open_first (struct file *filep) override |
Notification of the first open of CDev. More... | |
virtual int | close_last (struct file *filep) override |
Notification of the last close of CDev. More... | |
Static Private Member Functions | |
static void | main_loop_helper (int argc, char *argv[]) |
Static Private Attributes | |
static IridiumSBD * | instance |
static int | task_handle |
Additional Inherited Members | |
Protected Member Functions inherited from cdev::CDev | |
virtual pollevent_t | poll_state (file_t *filep) |
Check the current state of the device for poll events from the perspective of the file. More... | |
virtual void | poll_notify (pollevent_t events) |
Report new poll events. More... | |
virtual void | poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events) |
Internal implementation of poll_notify. More... | |
virtual int | open_first (file_t *filep) |
Notification of the first open. More... | |
virtual int | close_last (file_t *filep) |
Notification of the last close. More... | |
virtual int | register_class_devname (const char *class_devname) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
virtual int | unregister_class_devname (const char *class_devname, unsigned class_instance) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
void | lock () |
Take the driver lock. More... | |
void | unlock () |
Release the driver lock. More... | |
int | unregister_driver_and_memory () |
First, unregisters the driver. More... | |
Protected Attributes inherited from cdev::CDev | |
px4_sem_t | _lock |
lock to protect access to all class members (also for derived classes) More... | |
Static Protected Attributes inherited from cdev::CDev | |
static const px4_file_operations_t | fops = {} |
Pointer to the default cdev file operations table; useful for registering clone devices etc. More... | |
The driver for the Rockblock 9602 and 9603 RockBlock module for satellite communication over the Iridium satellite system.
The MavLink 1 protocol should be used to ensure that the status message is 50 bytes (RockBlock bills every 50 bytes per transmission).
TODO:
Definition at line 102 of file IridiumSBD.h.
IridiumSBD::IridiumSBD | ( | ) |
Definition at line 59 of file IridiumSBD.cpp.
Referenced by start().
|
private |
Definition at line 975 of file IridiumSBD.cpp.
References _rx_command_buf, read_at_command(), SATCOM_RESULT_OK, VERBOSE_INFO, and write_at().
Referenced by standby_loop().
|
overrideprivatevirtual |
Notification of the last close of CDev.
This function is called when the device open count transitions from one to zero. The driver lock is held for the duration of the call.
Notes that CDev is not used anymore and allows stopping the driver.
filep | Pointer to the NuttX file structure. |
Definition at line 1142 of file IridiumSBD.cpp.
References _cdev_used.
|
private |
Definition at line 441 of file IridiumSBD.cpp.
References _new_state, _rx_command_buf, _signal_quality, read_at_command(), SATCOM_RESULT_NA, SATCOM_RESULT_OK, SATCOM_STATE_STANDBY, and VERBOSE_INFO.
Referenced by main_loop().
int IridiumSBD::ioctl | ( | struct file * | filp, |
int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 187 of file IridiumSBD.cpp.
References _rx_msg_end_idx, _rx_msg_read_idx, _tx_buf_write_idx, OK, SATCOM_MAX_MESSAGE_LENGTH, and SATCOM_TX_BUF_LEN.
|
private |
Definition at line 1009 of file IridiumSBD.cpp.
References read_at_command(), SATCOM_RESULT_OK, and write_at().
Referenced by read_rx_buf(), start_csq(), start_sbd_session(), start_test(), and write_tx_buf().
|
private |
Definition at line 230 of file IridiumSBD.cpp.
References _new_state, _param_read_interval_s, _param_session_timeout_s, _param_stacking_time_ms, _rx_buf_mutex, _start_completed, _state, _task_should_exit, _tx_buf_mutex, _verbose, counter, csq_loop(), ToneAlarmInterface::init(), open_uart(), param_find(), param_get(), publish_iridium_status(), publish_subsystem_status(), read_at_command(), SATCOM_RESULT_OK, SATCOM_STATE_CSQ, SATCOM_STATE_SBDSESSION, SATCOM_STATE_STANDBY, satcom_state_string, SATCOM_STATE_TEST, SATCOM_UART_OK, sbdsession_loop(), standby_loop(), test_loop(), VERBOSE_INFO, and write_at().
Referenced by main_loop_helper().
|
staticprivate |
Definition at line 216 of file IridiumSBD.cpp.
References cdev::CDev::close(), instance, main_loop(), task_handle, and uart_fd.
Referenced by start().
|
overrideprivatevirtual |
Notification of the first open of CDev.
This function is called when the device open count transitions from zero to one. The driver lock is held for the duration of the call.
Notes that CDev is used and blocks stopping the driver.
filep | Pointer to the NuttX file structure. |
Definition at line 1136 of file IridiumSBD.cpp.
References _cdev_used.
|
private |
Definition at line 987 of file IridiumSBD.cpp.
References cdev::CDev::open(), SATCOM_UART_OK, SATCOM_UART_OPEN_FAIL, uart_fd, and VERBOSE_INFO.
Referenced by main_loop().
|
private |
Definition at line 1021 of file IridiumSBD.cpp.
References _rx_msg_end_idx, _rx_msg_read_idx, _tx_buf_write_idx, and SATCOM_TX_BUF_LEN.
|
private |
Definition at line 1036 of file IridiumSBD.cpp.
References _failed_sbd_sessions, _iridiumsbd_status_pub, _last_heartbeat, _num_tx_buf_reset, _ring_pending, _rx_msg_end_idx, _rx_msg_read_idx, _rx_read_pending, _rx_session_pending, _signal_quality, _state, _status, _successful_sbd_sessions, _tx_buf_write_idx, _tx_buf_write_pending, _tx_session_pending, iridiumsbd_status_s::failed_sbd_sessions, hrt_absolute_time(), iridiumsbd_status_s::last_heartbeat, iridiumsbd_status_s::num_tx_buf_reset, uORB::Publication< T >::publish(), iridiumsbd_status_s::ring_pending, iridiumsbd_status_s::rx_buf_end_index, iridiumsbd_status_s::rx_buf_read_index, iridiumsbd_status_s::rx_read_pending, iridiumsbd_status_s::rx_session_pending, iridiumsbd_status_s::signal_quality, iridiumsbd_status_s::state, iridiumsbd_status_s::successful_sbd_sessions, iridiumsbd_status_s::timestamp, iridiumsbd_status_s::tx_buf_write_index, iridiumsbd_status_s::tx_buf_write_pending, and iridiumsbd_status_s::tx_session_pending.
Referenced by main_loop().
|
private |
Definition at line 1118 of file IridiumSBD.cpp.
References _info, _status, _subsystem_pub, subsystem_info_s::enabled, hrt_absolute_time(), iridiumsbd_status_s::last_heartbeat, subsystem_info_s::ok, subsystem_info_s::present, uORB::PublicationQueued< T >::publish(), subsystem_info_s::subsystem_type, and subsystem_info_s::timestamp.
Referenced by main_loop().
|
private |
Definition at line 751 of file IridiumSBD.cpp.
References _rx_buf_mutex, _rx_msg_buf, _rx_msg_end_idx, _rx_msg_read_idx, and VERBOSE_INFO.
Referenced by read_at().
|
private |
Definition at line 905 of file IridiumSBD.cpp.
References _ring_pending, _rx_session_pending, cdev::CDev::poll(), read(), SATCOM_RESULT_ERROR, SATCOM_RESULT_HWFAIL, SATCOM_RESULT_NA, SATCOM_RESULT_OK, SATCOM_RESULT_READY, SATCOM_RESULT_SBDRING, uart_fd, and VERBOSE_INFO.
Referenced by read_at_command(), and read_at_msg().
|
private |
Definition at line 895 of file IridiumSBD.cpp.
References _rx_command_buf, _rx_command_len, and read_at().
Referenced by clear_mo_buffer(), csq_loop(), is_modem_ready(), main_loop(), sbdsession_loop(), standby_loop(), start_test(), test_loop(), and write_tx_buf().
|
private |
Definition at line 900 of file IridiumSBD.cpp.
References _rx_msg_buf, _rx_msg_end_idx, and read_at().
Referenced by read_rx_buf().
|
private |
Definition at line 837 of file IridiumSBD.cpp.
References _rx_buf_mutex, _rx_msg_buf, _rx_msg_end_idx, _rx_msg_read_idx, _rx_read_pending, is_modem_ready(), read_at_msg(), SATCOM_RESULT_OK, VERBOSE_INFO, and write_at().
Referenced by standby_loop().
|
private |
Definition at line 471 of file IridiumSBD.cpp.
References _failed_sbd_sessions, _last_heartbeat, _last_read_time, _new_state, _param_session_timeout_s, _ring_pending, _rx_command_buf, _rx_read_pending, _rx_session_pending, _session_start_time, _signal_quality, _successful_sbd_sessions, _tx_buf_mutex, _tx_buf_write_idx, _tx_session_pending, hrt_absolute_time(), read_at_command(), SATCOM_RESULT_NA, SATCOM_RESULT_OK, SATCOM_STATE_STANDBY, and VERBOSE_INFO.
Referenced by main_loop().
|
private |
Definition at line 970 of file IridiumSBD.cpp.
References _test_pending.
Referenced by test().
|
private |
Definition at line 375 of file IridiumSBD.cpp.
References _last_read_time, _last_signal_check, _last_write_time, _new_state, _param_read_interval_s, _param_stacking_time_ms, _rx_msg_end_idx, _rx_msg_read_idx, _rx_read_pending, _rx_session_pending, _signal_quality, _test_command, _test_pending, _test_timer, _tx_buf_write_pending, _tx_session_pending, clear_mo_buffer(), hrt_absolute_time(), read_at_command(), read_rx_buf(), SATCOM_SIGNAL_REFRESH_DELAY, SATCOM_STATE_STANDBY, start_csq(), start_sbd_session(), start_test(), write(), and write_tx_buf().
Referenced by main_loop().
|
static |
Definition at line 68 of file IridiumSBD.cpp.
References _start_completed, _task_should_exit, counter, IridiumSBD(), main_loop_helper(), and task_handle.
Referenced by iridiumsbd_main().
|
private |
Definition at line 600 of file IridiumSBD.cpp.
References _last_signal_check, _new_state, _state, hrt_absolute_time(), is_modem_ready(), SATCOM_STATE_CSQ, SATCOM_STATE_STANDBY, VERBOSE_INFO, and write_at().
Referenced by standby_loop().
|
private |
Definition at line 621 of file IridiumSBD.cpp.
References _new_state, _ring_pending, _session_start_time, _state, _tx_buf_mutex, hrt_absolute_time(), is_modem_ready(), SATCOM_STATE_SBDSESSION, SATCOM_STATE_STANDBY, VERBOSE_INFO, and write_at().
Referenced by standby_loop().
|
private |
Definition at line 650 of file IridiumSBD.cpp.
References _new_state, _rx_command_buf, _rx_command_len, _state, _test_command, is_modem_ready(), read_at_command(), SATCOM_RESULT_NA, SATCOM_STATE_STANDBY, SATCOM_STATE_TEST, and write_at().
Referenced by standby_loop().
|
static |
Definition at line 145 of file IridiumSBD.cpp.
References _last_heartbeat, _last_signal_check, _rx_read_pending, _rx_session_pending, _signal_quality, _state, _tx_buf_write_idx, _tx_session_pending, hrt_absolute_time(), instance, and satcom_state_string.
Referenced by iridiumsbd_main().
|
static |
Definition at line 107 of file IridiumSBD.cpp.
References _cdev_used, _task_should_exit, cdev::CDev::close(), instance, OK, task_handle, and uart_fd.
Referenced by iridiumsbd_main().
|
static |
Definition at line 164 of file IridiumSBD.cpp.
References _state, _test_command, _test_pending, instance, SATCOM_STATE_STANDBY, and schedule_test().
Referenced by iridiumsbd_main().
|
private |
Definition at line 583 of file IridiumSBD.cpp.
References _new_state, _rx_command_buf, _rx_command_len, _test_timer, hrt_absolute_time(), read_at_command(), SATCOM_RESULT_NA, and SATCOM_STATE_STANDBY.
Referenced by main_loop().
|
private |
Definition at line 691 of file IridiumSBD.cpp.
References _last_write_time, _num_tx_buf_reset, _packet_length, _tx_buf, _tx_buf_mutex, _tx_buf_write_idx, _tx_buf_write_pending, _writing_mavlink_packet, hrt_absolute_time(), SATCOM_TX_BUF_LEN, and VERBOSE_INFO.
Referenced by standby_loop(), write_at(), and write_tx_buf().
|
private |
Definition at line 887 of file IridiumSBD.cpp.
References uart_fd, VERBOSE_INFO, and write().
Referenced by clear_mo_buffer(), is_modem_ready(), main_loop(), read_rx_buf(), start_csq(), start_sbd_session(), start_test(), and write_tx_buf().
|
private |
Definition at line 776 of file IridiumSBD.cpp.
References _rx_command_buf, _tx_buf, _tx_buf_mutex, _tx_buf_write_idx, _tx_buf_write_pending, _tx_session_pending, command, is_modem_ready(), read_at_command(), SATCOM_RESULT_OK, SATCOM_RESULT_READY, uart_fd, VERBOSE_INFO, write(), and write_at().
Referenced by standby_loop().
|
private |
Definition at line 331 of file IridiumSBD.h.
Referenced by close_last(), open_first(), and stop().
|
private |
Definition at line 301 of file IridiumSBD.h.
Referenced by publish_iridium_status(), and sbdsession_loop().
|
private |
Definition at line 347 of file IridiumSBD.h.
Referenced by publish_subsystem_status().
|
private |
Definition at line 308 of file IridiumSBD.h.
Referenced by publish_iridium_status().
|
private |
Definition at line 335 of file IridiumSBD.h.
Referenced by publish_iridium_status(), sbdsession_loop(), and status().
|
private |
Definition at line 334 of file IridiumSBD.h.
Referenced by sbdsession_loop(), and standby_loop().
|
private |
Definition at line 299 of file IridiumSBD.h.
Referenced by standby_loop(), start_csq(), and status().
|
private |
Definition at line 333 of file IridiumSBD.h.
Referenced by standby_loop(), and write().
|
private |
Definition at line 339 of file IridiumSBD.h.
Referenced by csq_loop(), main_loop(), sbdsession_loop(), standby_loop(), start_csq(), start_sbd_session(), start_test(), and test_loop().
|
private |
Definition at line 303 of file IridiumSBD.h.
Referenced by publish_iridium_status(), and write().
|
private |
Definition at line 306 of file IridiumSBD.h.
Referenced by write().
|
private |
Definition at line 295 of file IridiumSBD.h.
Referenced by main_loop(), and standby_loop().
|
private |
Definition at line 296 of file IridiumSBD.h.
Referenced by main_loop(), and sbdsession_loop().
|
private |
Definition at line 297 of file IridiumSBD.h.
Referenced by main_loop(), and standby_loop().
|
private |
Definition at line 326 of file IridiumSBD.h.
Referenced by publish_iridium_status(), read_at(), sbdsession_loop(), and start_sbd_session().
|
private |
Definition at line 342 of file IridiumSBD.h.
Referenced by main_loop(), read(), and read_rx_buf().
|
private |
Definition at line 315 of file IridiumSBD.h.
Referenced by clear_mo_buffer(), csq_loop(), read_at_command(), sbdsession_loop(), start_test(), test_loop(), and write_tx_buf().
|
private |
Definition at line 316 of file IridiumSBD.h.
Referenced by read_at_command(), start_test(), and test_loop().
|
private |
Definition at line 318 of file IridiumSBD.h.
Referenced by read(), read_at_msg(), and read_rx_buf().
|
private |
Definition at line 319 of file IridiumSBD.h.
Referenced by ioctl(), poll_state(), publish_iridium_status(), read(), read_at_msg(), read_rx_buf(), and standby_loop().
|
private |
Definition at line 320 of file IridiumSBD.h.
Referenced by ioctl(), poll_state(), publish_iridium_status(), read(), read_rx_buf(), and standby_loop().
|
private |
Definition at line 328 of file IridiumSBD.h.
Referenced by publish_iridium_status(), read_rx_buf(), sbdsession_loop(), standby_loop(), and status().
|
private |
Definition at line 327 of file IridiumSBD.h.
Referenced by publish_iridium_status(), read_at(), sbdsession_loop(), standby_loop(), and status().
|
private |
Definition at line 336 of file IridiumSBD.h.
Referenced by sbdsession_loop(), and start_sbd_session().
|
private |
Definition at line 300 of file IridiumSBD.h.
Referenced by csq_loop(), publish_iridium_status(), sbdsession_loop(), standby_loop(), and status().
|
private |
Definition at line 292 of file IridiumSBD.h.
Referenced by main_loop(), and start().
|
private |
Definition at line 338 of file IridiumSBD.h.
Referenced by main_loop(), publish_iridium_status(), start_csq(), start_sbd_session(), start_test(), status(), and test().
|
private |
Definition at line 346 of file IridiumSBD.h.
Referenced by publish_iridium_status(), and publish_subsystem_status().
|
private |
Definition at line 309 of file IridiumSBD.h.
Referenced by publish_subsystem_status().
|
private |
Definition at line 302 of file IridiumSBD.h.
Referenced by publish_iridium_status(), and sbdsession_loop().
|
private |
Definition at line 291 of file IridiumSBD.h.
Referenced by main_loop(), start(), and stop().
|
private |
Definition at line 312 of file IridiumSBD.h.
Referenced by standby_loop(), start_test(), and test().
|
private |
Definition at line 311 of file IridiumSBD.h.
Referenced by schedule_test(), standby_loop(), and test().
|
private |
Definition at line 313 of file IridiumSBD.h.
Referenced by standby_loop(), and test_loop().
|
private |
Definition at line 322 of file IridiumSBD.h.
Referenced by write(), and write_tx_buf().
|
private |
Definition at line 341 of file IridiumSBD.h.
Referenced by main_loop(), sbdsession_loop(), start_sbd_session(), write(), and write_tx_buf().
|
private |
Definition at line 323 of file IridiumSBD.h.
Referenced by ioctl(), poll_state(), publish_iridium_status(), sbdsession_loop(), status(), write(), and write_tx_buf().
|
private |
Definition at line 325 of file IridiumSBD.h.
Referenced by publish_iridium_status(), standby_loop(), write(), and write_tx_buf().
|
private |
Definition at line 329 of file IridiumSBD.h.
Referenced by publish_iridium_status(), sbdsession_loop(), standby_loop(), status(), and write_tx_buf().
|
private |
Definition at line 344 of file IridiumSBD.h.
Referenced by main_loop().
|
private |
Definition at line 305 of file IridiumSBD.h.
Referenced by write().
|
staticprivate |
Definition at line 289 of file IridiumSBD.h.
Referenced by main_loop_helper(), status(), stop(), and test().
|
staticprivate |
Definition at line 290 of file IridiumSBD.h.
Referenced by main_loop_helper(), start(), and stop().
|
private |
Definition at line 293 of file IridiumSBD.h.
Referenced by main_loop_helper(), open_uart(), read_at(), stop(), write_at(), and write_tx_buf().