PX4 Firmware
PX4 Autopilot Software http://px4.io
hott_telemetry.cpp File Reference
#include <fcntl.h>
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/defines.h>
#include <px4_platform_common/tasks.h>
#include <poll.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <systemlib/err.h>
#include <perf/perf_counter.h>
#include "../comms.h"
#include "../messages.h"
Include dependency graph for hott_telemetry.cpp:

Go to the source code of this file.

Macros

#define DEFAULT_UART   "/dev/ttyS6";
 Serial4. More...
 

Functions

__EXPORT int hott_telemetry_main (int argc, char *argv[])
 Deamon management function. More...
 
int hott_telemetry_thread_main (int argc, char *argv[])
 Mainloop of daemon. More...
 
static int recv_req_id (int uart, uint8_t *id)
 
static int send_data (int uart, uint8_t *buffer, size_t size)
 

Variables

static int thread_should_exit = false
 Deamon exit flag. More...
 
static int thread_running = false
 Deamon status flag. More...
 
static int deamon_task
 Handle of deamon task / thread. More...
 
static const char daemon_name [] = "hott_telemetry"
 
static const char commandline_usage []
 
static uint8_t read_log [16]
 
static int timeout_ms = POLL_TIMEOUT_IN_MSECS
 
static int read_delay_us = POST_READ_DELAY_IN_USECS
 
static int write_delay_us = POST_WRITE_DELAY_IN_USECS
 
perf_counter_t reqs_count
 
perf_counter_t connect_count
 
perf_counter_t recon_port
 
perf_counter_t bin_reply
 
perf_counter_t txt_reply
 
perf_counter_t bad_reply
 
perf_counter_t dead_reply
 

Macro Definition Documentation

◆ DEFAULT_UART

#define DEFAULT_UART   "/dev/ttyS6";

Serial4.

Definition at line 62 of file hott_telemetry.cpp.

Referenced by hott_telemetry_thread_main().

Function Documentation

◆ hott_telemetry_main()

int hott_telemetry_main ( int  argc,
char *  argv[] 
)

Deamon management function.

Process command line arguments and start the daemon.

Definition at line 287 of file hott_telemetry.cpp.

References commandline_usage, daemon_name, deamon_task, errx, hott_telemetry_thread_main(), perf_print_counter(), read_delay_us, read_log, thread_running, thread_should_exit, timeout_ms, warnx, and write_delay_us.

Here is the call graph for this function:

◆ hott_telemetry_thread_main()

int hott_telemetry_thread_main ( int  argc,
char *  argv[] 
)

Mainloop of daemon.

Definition at line 167 of file hott_telemetry.cpp.

References BINARY_MODE_REQUEST_ID, build_eam_response(), build_gam_response(), build_gps_response(), commandline_usage, DEFAULT_UART, EAM_SENSOR_ID, errx, GAM_SENSOR_ID, GPS_SENSOR_ID, init_sub_messages(), MAX_MESSAGE_BUFFER_SIZE, open_uart(), PC_COUNT, perf_alloc, perf_count(), perf_free(), perf_reset(), recv_req_id(), send_data(), thread_running, thread_should_exit, and warnx.

Referenced by hott_telemetry_main().

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

◆ recv_req_id()

int recv_req_id ( int  uart,
uint8_t *  id 
)
static

Definition at line 99 of file hott_telemetry.cpp.

References BINARY_MODE_REQUEST_ID, perf_count(), read(), read_log, timeout_ms, and warnx.

Referenced by hott_telemetry_thread_main().

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

◆ send_data()

int send_data ( int  uart,
uint8_t *  buffer,
size_t  size 
)
static

Definition at line 137 of file hott_telemetry.cpp.

References read(), read_delay_us, write(), and write_delay_us.

Referenced by i2cdetect::detect(), and hott_telemetry_thread_main().

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

Variable Documentation

◆ bad_reply

perf_counter_t bad_reply

Definition at line 82 of file hott_telemetry.cpp.

◆ bin_reply

perf_counter_t bin_reply

Definition at line 80 of file hott_telemetry.cpp.

◆ commandline_usage

const char commandline_usage[]
static
Initial value:
=
"usage: hott_telemetry start|status|stop [-d <device>] [-t <timeout ms>] [-r <read delay us>] [-w <write delay us>]"

Definition at line 68 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and hott_telemetry_thread_main().

◆ connect_count

perf_counter_t connect_count

Definition at line 78 of file hott_telemetry.cpp.

◆ daemon_name

const char daemon_name[] = "hott_telemetry"
static

Definition at line 67 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main().

◆ dead_reply

perf_counter_t dead_reply

Definition at line 83 of file hott_telemetry.cpp.

◆ deamon_task

int deamon_task
static

Handle of deamon task / thread.

Definition at line 66 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main().

◆ read_delay_us

int read_delay_us = POST_READ_DELAY_IN_USECS
static

Definition at line 74 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and send_data().

◆ read_log

uint8_t read_log[16]
static

Definition at line 71 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and recv_req_id().

◆ recon_port

perf_counter_t recon_port

Definition at line 79 of file hott_telemetry.cpp.

◆ reqs_count

perf_counter_t reqs_count

Definition at line 77 of file hott_telemetry.cpp.

◆ thread_running

int thread_running = false
static

Deamon status flag.

Definition at line 65 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and hott_telemetry_thread_main().

◆ thread_should_exit

int thread_should_exit = false
static

Deamon exit flag.

Definition at line 64 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and hott_telemetry_thread_main().

◆ timeout_ms

◆ txt_reply

perf_counter_t txt_reply

Definition at line 81 of file hott_telemetry.cpp.

◆ write_delay_us

int write_delay_us = POST_WRITE_DELAY_IN_USECS
static

Definition at line 75 of file hott_telemetry.cpp.

Referenced by hott_telemetry_main(), and send_data().