mbgtools-lx  4.2.8
mbgstatus.c File Reference
#include <mbgdevio.h>
#include <mbgutil.h>
#include <mbgtime.h>
#include <pcpslstr.h>
#include <toolutil.h>
#include <lan_util.h>
#include <deviohlp.h>
#include <timeutil.h>
#include <str_util.h>
#include <nanotime.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define MBG_FIRST_COPYRIGHT_YEAR   2001
 
#define MBG_LAST_COPYRIGHT_YEAR   0
 

Functions

static void show_invt_reason (void)
 
static void print_pcps_time (const char *s, const PCPS_TIME *tp, const char *tail)
 
static void print_dms (const char *s, const DMS *p, const char *tail)
 
static void print_position (const char *s, const POS *p, const char *tail)
 
static void show_signal (MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, int signal)
 
static void show_time_and_status (MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const char *tail)
 
static void show_sync_time (MBG_DEV_HANDLE dh, const char *tail)
 
static void show_ext_stat_info (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *tail)
 
static void show_gps_pos (MBG_DEV_HANDLE dh, const char *tail)
 
static void show_utc_info (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev)
 
static void show_irig_ctrl_bits (MBG_DEV_HANDLE dh)
 
static char * str_raw_irig_utc_offs_hours (char *s, size_t max_len, const MBG_RAW_IRIG_DATA *p)
 
static void show_raw_irig_data (MBG_DEV_HANDLE dh)
 
static void show_irig_debug_status (MBG_DEV_HANDLE dh)
 
static void show_lan_intf_state (MBG_DEV_HANDLE dh)
 
static void show_ptp_state (MBG_DEV_HANDLE dh)
 
static int check_irq_unsafe (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev)
 
static int do_mbgstatus (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev)
 
static void usage (void)
 
int main (int argc, char *argv[])
 

Variables

static const char * pname = "mbgstatus"
 
static int loops
 
static int list_only
 
static int list_only_unique_names
 
static long sleep_secs
 
static long sleep_usecs
 
static unsigned int verbose
 
static const char * ref_name [N_PCPS_REF] = PCPS_REF_NAMES_ENG
 
static const char * icode_rx_names [N_ICODE_RX] = DEFAULT_ICODE_RX_NAMES
 
static const char * osc_name [N_GPS_OSC] = DEFAULT_GPS_OSC_NAMES
 
static int year_limit = 1990
 
static int max_ref_offs_h = MBG_REF_OFFS_MAX / MINS_PER_HOUR
 
static int invt_reason
 
static const char * wdays [7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }
 
LANGUAGE language
 
CTRY ctry
 
static MBG_DEV_HANDLER_FNC do_mbgstatus
 

Macro Definition Documentation

◆ MBG_FIRST_COPYRIGHT_YEAR

#define MBG_FIRST_COPYRIGHT_YEAR   2001

Definition at line 101 of file mbgstatus.c.

Referenced by main().

◆ MBG_LAST_COPYRIGHT_YEAR

#define MBG_LAST_COPYRIGHT_YEAR   0

Definition at line 102 of file mbgstatus.c.

Referenced by main().

Function Documentation

◆ check_irq_unsafe()

static int check_irq_unsafe ( MBG_DEV_HANDLE  dh,
const PCPS_DEV p_dev 
)
static

◆ do_mbgstatus()

◆ main()

◆ print_dms()

static void print_dms ( const char *  s,
const DMS p,
const char *  tail 
)
static

Definition at line 176 of file mbgstatus.c.

References DMS::deg, DMS::min, DMS::prefix, and DMS::sec.

Referenced by print_position().

◆ print_pcps_time()

static void print_pcps_time ( const char *  s,
const PCPS_TIME tp,
const char *  tail 
)
static

◆ print_position()

static void print_position ( const char *  s,
const POS p,
const char *  tail 
)
static

Definition at line 196 of file mbgstatus.c.

References ALT, LAT, POS::latitude, POS::lla, LON, POS::longitude, PI, print_dms(), r2d, verbose, XP, POS::xyz, YP, and ZP.

Referenced by show_gps_pos().

◆ show_ext_stat_info()

◆ show_gps_pos()

static void show_gps_pos ( MBG_DEV_HANDLE  dh,
const char *  tail 
)
static

Definition at line 596 of file mbgstatus.c.

References mbg_cond_err_msg(), mbg_get_gps_pos(), and print_position().

Referenced by do_mbgstatus().

◆ show_invt_reason()

static void show_invt_reason ( void  )
static

Definition at line 131 of file mbgstatus.c.

References DEFAULT_STR_IRIG_INVT_EN, DEFAULT_STR_IRIG_NOT_CFGD_EN, and invt_reason.

Referenced by do_mbgstatus().

◆ show_irig_ctrl_bits()

static void show_irig_ctrl_bits ( MBG_DEV_HANDLE  dh)
static

Definition at line 695 of file mbgstatus.c.

References _pcps_tfom_from_irig_ctrl_bits, mbg_cond_err_msg(), and mbg_get_irig_ctrl_bits().

Referenced by do_mbgstatus().

◆ show_irig_debug_status()

static void show_irig_debug_status ( MBG_DEV_HANDLE  dh)
static

Definition at line 759 of file mbgstatus.c.

References mbg_cond_err_msg(), MBG_DEBUG_STATUS_STRS, mbg_get_debug_status(), and N_MBG_DEBUG_BIT.

Referenced by do_mbgstatus().

◆ show_lan_intf_state()

◆ show_ptp_state()

static void show_ptp_state ( MBG_DEV_HANDLE  dh)
static

Definition at line 823 of file mbgstatus.c.

References PTP_CLOCK_ID::b, PTP_STATE::clock_accuracy, PTP_STATE::clock_class, PTP_STATE::clock_offset_scaled_log_variance, PTP_STATE::delay_asymmetry, PTP_STATE::delay_mech, PTP_CFG_SETTINGS::delay_mech, PTP_CFG_SETTINGS::delay_req_intv, PTP_STATE::domain_number, PTP_CFG_SETTINGS::domain_number, PTP_STATE::flags, PTP_STATE::gm_id, PTP_STATE::log_delay_req_intv, MAC_SEP_CHAR_ALT, mbg_cond_err_msg(), mbg_get_ptp_cfg_info(), mbg_get_ptp_state(), PTP_STATE::mean_path_delay, N_PTP_CLOCK_ACCURACY, N_PTP_DELAY_MECH, N_PTP_NW_PROT, N_PTP_PORT_STATE, N_PTP_ROLES, PTP_TABLE::name, PTP_STATE::nw_prot, PTP_CFG_SETTINGS::nw_prot, PTP_STATE::offset, PTP_STATE::path_delay, PTP_STATE::port_state, PTP_CLOCK_ACCURACY_NUM_BIAS, ptp_clock_accuracy_strs, PTP_CLOCK_ACCURACY_STRS, PTP_DELAY_MECH_NAMES, PTP_FLAG_MSK_IS_UNICAST, PTP_FLAG_MSK_LS_ANN, PTP_FLAG_MSK_LS_ANN_NEG, PTP_FLAG_MSK_ONE_STEP, PTP_FLAG_MSK_TIMESCALE_IS_PTP, PTP_FLAG_MSK_UTC_VALID, PTP_NW_PROT_STRS, PTP_PORT_STATE_MASTER, PTP_PORT_STATE_PASSIVE, PTP_PORT_STATE_PRE_MASTER, PTP_PORT_STATE_SLAVE, PTP_PORT_STATE_STRS, PTP_PORT_STATE_UNCALIBRATED, PTP_STATE::ptp_prot_version, PTP_CFG_SETTINGS::ptp_role, PTP_ROLE_MSK_MASTERS, PTP_ROLE_MSK_SLAVES, ptp_role_strs, PTP_ROLE_STRS, PTP_TIME_SOURCE_TABLE, PTP_CFG_INFO::settings, snprint_nano_time(), snprint_octets(), str_not_avail, str_undefined, str_unknown, PTP_STATE::time_source, PTP_STATE::utc_offset, PTP_TABLE::value, and verbose.

Referenced by do_mbgstatus().

◆ show_raw_irig_data()

static void show_raw_irig_data ( MBG_DEV_HANDLE  dh)
static

◆ show_signal()

◆ show_sync_time()

static void show_sync_time ( MBG_DEV_HANDLE  dh,
const char *  tail 
)
static

Definition at line 441 of file mbgstatus.c.

References mbg_cond_err_msg(), mbg_get_sync_time(), and print_pcps_time().

Referenced by do_mbgstatus().

◆ show_time_and_status()

◆ show_utc_info()

◆ str_raw_irig_utc_offs_hours()

static char* str_raw_irig_utc_offs_hours ( char *  s,
size_t  max_len,
const MBG_RAW_IRIG_DATA p 
)
static

Definition at line 713 of file mbgstatus.c.

References MBG_RAW_IRIG_DATA::data_bytes, and mbg_snprintf().

Referenced by show_raw_irig_data().

◆ usage()

static void usage ( void  )
static

Variable Documentation

◆ ctry

CTRY ctry

Definition at line 126 of file mbgstatus.c.

Referenced by ctry_next(), and ctry_setup().

◆ do_mbgstatus

MBG_DEV_HANDLER_FNC do_mbgstatus
static

Definition at line 1155 of file mbgstatus.c.

Referenced by main().

◆ icode_rx_names

const char* icode_rx_names[N_ICODE_RX] = DEFAULT_ICODE_RX_NAMES
static

Definition at line 115 of file mbgstatus.c.

Referenced by show_signal().

◆ invt_reason

int invt_reason
static

Definition at line 121 of file mbgstatus.c.

Referenced by show_invt_reason(), and show_time_and_status().

◆ language

◆ list_only

int list_only
static

Definition at line 108 of file mbgstatus.c.

Referenced by do_mbgstatus(), and main().

◆ list_only_unique_names

int list_only_unique_names
static

Definition at line 109 of file mbgstatus.c.

Referenced by main().

◆ loops

int loops
static

Definition at line 107 of file mbgstatus.c.

Referenced by do_mbgstatus(), and main().

◆ max_ref_offs_h

int max_ref_offs_h = MBG_REF_OFFS_MAX / MINS_PER_HOUR
static

Definition at line 120 of file mbgstatus.c.

Referenced by show_signal().

◆ osc_name

const char* osc_name[N_GPS_OSC] = DEFAULT_GPS_OSC_NAMES
static

Definition at line 116 of file mbgstatus.c.

Referenced by show_ext_stat_info().

◆ pname

const char* pname = "mbgstatus"
static

Definition at line 104 of file mbgstatus.c.

Referenced by main(), and usage().

◆ ref_name

const char* ref_name[N_PCPS_REF] = PCPS_REF_NAMES_ENG
static

Definition at line 114 of file mbgstatus.c.

Referenced by show_signal().

◆ sleep_secs

long sleep_secs
static

Definition at line 110 of file mbgstatus.c.

Referenced by do_mbgstatus(), and main().

◆ sleep_usecs

long sleep_usecs
static

Definition at line 111 of file mbgstatus.c.

Referenced by do_mbgstatus(), and main().

◆ verbose

◆ wdays

const char* wdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }
static

Definition at line 123 of file mbgstatus.c.

Referenced by show_utc_info().

◆ year_limit

int year_limit = 1990
static

Definition at line 118 of file mbgstatus.c.

Referenced by pcps_str_tm_gps_date_time(), and print_pcps_time().