mbgtools-lx  4.2.8
cfg_hlp.c File Reference
#include <cfg_hlp.h>
#include <mbgerror.h>
#include <timeutil.h>
#include <str_util.h>
#include <myutil.h>
#include <mbgtime.h>
#include <mbgmktm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

Go to the source code of this file.

Macros

#define _CFG_HLP
 

Functions

int chk_sw_rev_name (SW_REV *p, int verbose)
 Check if a software revision name should be displayed. More...
 
int get_str_idx (const char *search, const char *str_table[], int n_entries)
 
int get_baud_rate_idx (BAUD_RATE baud_rate)
 
int get_framing_idx (const char *framing)
 
void port_settings_from_port_parm_mode (PORT_SETTINGS *p_ps, uint8_t pp_mode, int cap_str_idx)
 Convert PORT_PARM::mode to PORT_SETTINGS::mode. More...
 
void port_parm_mode_from_port_settings (uint8_t *pp_mode, const PORT_SETTINGS *p_ps, int cap_str_idx)
 Convert a PORT_SETTINGS::mode to a legacy PORT_PARM::mode. More...
 
void port_settings_from_port_parm (PORT_SETTINGS *p_ps, int port_idx, const PORT_PARM *p_pp, int cap_str_idx)
 Set up a PORT_SETTINGS structure from a legacy PORT_PARM structure. More...
 
void port_parm_from_port_settings (PORT_PARM *p_pp, int port_idx, const PORT_SETTINGS *p_ps, int cap_str_idx)
 Set up a a legacy PORT_PARM structure from a PORT_SETTINGS structure. More...
 
uint32_t check_valid_port_info (const PORT_INFO *p_pi, const STR_TYPE_INFO_IDX str_type_info_idx[], int n_str_type)
 
int valid_port_info (const PORT_INFO *p_pi, const STR_TYPE_INFO_IDX str_type_info_idx[], int n_str_type)
 
int setup_port_info_from_port_parm (PORT_INFO_IDX pii[], const PORT_PARM *p_pp, const RECEIVER_INFO *p_ri)
 Setup an array of PORT_INFO_IDX structures from a PORT_PARM. More...
 
int setup_default_str_type_info_idx (STR_TYPE_INFO_IDX stii[], const RECEIVER_INFO *p_ri)
 
int chk_set_n_gnss_supp (ALL_GNSS_INFO *p_agi)
 
void setup_gps_only_sat_info_idx_from_statinfo (ALL_GNSS_INFO *p_agi)
 

Setup GNSS info from stat_info so we can use the same printing routine

More...
 
int setup_gps_only_gnss_info_from_statinfo (ALL_GNSS_INFO *p_agi)
 Setup GNSS info from stat_info so we can use the same printing routine. More...
 
void chk_free_dev_hw_id (DEVICE_INFO *p)
 
int alloc_dev_hw_id (DEVICE_INFO *p, size_t len)
 
const char * get_fw_id_from_hw_id (const char *hw_id)
 
const char * get_hw_id_from_fw_id (const char *fw_id)
 
MBG_IO_PORT_TYPE_INFOget_io_port_type_info (const MBG_IO_PORT *port, uint16_t port_type)
 Returns the currently used MBG_IO_PORT_TYPE_INFO for the appropriate MBG_IO_PORT. More...
 
void mbg_tlv_announce_init (MBG_TLV_ANNOUNCE *tlv, MBG_TLV_UID uid, MBG_TLV_TYPE tlv_feat_type, uint32_t total_bytes)
 Initializes a MBG_TLV_ANNOUNCE structure. More...
 
void mbg_tlv_init (MBG_TLV *tlv, MBG_TLV_UID uid, MBG_TLV_TYPE tlv_type, uint32_t total_bytes)
 Initializes a MBG_TLV. More...
 
void mbg_tlv_rcv_state_init (MBG_TLV_RCV_STATE *state, MBG_TLV_UID uid, uint32_t total_bytes)
 Initializes MBG_TLV_RCV_STATE structure. More...
 
int mbg_snprint_revision (char *buf, size_t buflen, const char *prefix, const char *suffix, uint32_t rev)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_receiver_info (const RECEIVER_INFO *p)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xbp_supp_nodes (const ALL_XBP_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_net_cfg_supp_stage_2 (const ALL_NET_CFG_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ntp_supp_client (const ALL_NTP_CFG_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ntp_supp_server (const ALL_NTP_CFG_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_mrf_none (const ALL_XMULTI_REF_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_ext_src_info (const ALL_XMULTI_REF_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_holdover_status (const ALL_XMULTI_REF_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_ext_source_stats (const ALL_XMULTI_REF_INFO *info, int type)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_ext_source_metrics (const ALL_XMULTI_REF_INFO *info, int type)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ims_has_fdm (const ALL_IMS_INFO *info)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ims_is_volt_out_enabled (const ALL_IMS_STATE *ims_state, unsigned idx)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ims_is_volt_out_overload (const ALL_IMS_STATE *ims_state, unsigned idx)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_ims_is_pll_locked (const ALL_IMS_STATE *ims_state, unsigned idx)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_gpio_supp_ass_idx (const ALL_GPIO_INFO *gpio_info, unsigned idx)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_gpio_dep_on_ass_idx (const ALL_GPIO_INFO *gpio_info, unsigned idx)
 
_NO_MBG_API_ATTR int _MBG_API chk_dev_gpio_has_status (const ALL_GPIO_INFO *info)
 Checks whether GPIO supports status function. More...
 
void free_all_xbp_info (ALL_XBP_INFO *p)
 Free an ALL_XBP_INFO structure. More...
 
void free_all_net_cfg_info (ALL_NET_CFG_INFO *p)
 Free an ALL_NET_CFG_INFO structure. More...
 
void free_all_net_status_info (ALL_NET_STATUS_INFO *p)
 Free an ALL_NET_STATUS_INFO structure. More...
 
void free_all_snmp_info (ALL_SNMP_INFO *p)
 Free an ALL_SNMP_INFO structure. More...
 
void free_all_syslog_info (ALL_SYSLOG_INFO *p)
 Free an ALL_SYSLOG_INFO structure. More...
 
void free_all_monitoring_info (ALL_MONITORING_INFO *p)
 Free an ALL_MONITORING_INFO structure. More...
 
void free_all_events (ALL_EVENTS *p)
 Free an ALL_EVENTS structure. More...
 
void free_all_xmulti_ref_info (ALL_XMULTI_REF_INFO *p)
 Free an ALL_XMULTI_REF_INFO structure. More...
 
void free_all_xmulti_ref_status (ALL_XMULTI_REF_STATUS *p)
 Free an ALL_XMULTI_REF_STATUS structure. More...
 
void free_all_ptp_v1_common_datasets (ALL_PTP_V1_COMMON_DATASETS *p)
 Free an ALL_PTP_V1_COMMON_DATASETS structure allocated by mbgextio_get_all_ptp_v1_common_datasets. More...
 
void free_all_ptp_v2_common_datasets (ALL_PTP_V2_COMMON_DATASETS *p)
 Free an ALL_PTP_V2_COMMON_DATASETS structure allocated by mbgextio_get_all_ptp_v2_common_datasets. More...
 
void free_all_ntp_cfg_info (ALL_NTP_CFG_INFO *p)
 Free an ALL_NTP_CFG_INFO structure. More...
 
void free_all_ntp_status (ALL_NTP_STATUS *p)
 Free an ALL_NTP_STATUS structure. More...
 
void free_all_ims_info (ALL_IMS_INFO *p)
 Free memory allocated by mbgextio_get_all_ims_info. More...
 
void free_all_ims_state (ALL_IMS_STATE *p)
 Free memory allocated by mbgextio_get_all_ims_state. More...
 
void free_all_gpio_info (ALL_GPIO_INFO *p)
 Free memory allocated by mbgextio_get_all_gpio_info. More...
 
void free_all_io_ports (ALL_MBG_IO_PORTS *p)
 Free memory allocated by mbgextio_get_all_io_ports. More...
 
void free_all_gpio_state (ALL_GPIO_STATE *p)
 Free memory allocated by mbgextio_get_all_gpio_state. More...
 
UCAP_ENTRYcalloc_ucap_entry (void)
 
void free_all_ucap_info (ALL_UCAP_INFO *p)
 Free memory allocated by mbgextio_get_all_ucap_info. More...
 
void free_all_ucap_net_info (ALL_UCAP_NET_INFO *p)
 Free an ALL_UCAP_NET_INFO structure. More...
 
void free_all_user_info (ALL_USER_INFO *p)
 Free an ALL_USER_INFO structure. More...
 
void free_all_svc_info (ALL_SERVICE_INFO *p)
 Free an ALL_SERVICE_INFO structure. More...
 
void free_all_firmware_info (ALL_FIRMWARE_INFO *p)
 Free an ALL_FIRMWARE_INFO structure. More...
 
void free_all_database_info (ALL_DATABASE_INFO *p)
 Free an ALL_DATABASE_INFO structure. More...
 
void str_ntp_hex_to_ntp_tstamp (const char *s, NTP_TSTAMP *p)
 Set up a NTP_TSTAMP structure from a hex string with a time in seconds and binary fractions. More...
 
void ntp_tstamp_to_nanotime_64 (const NTP_TSTAMP *p_nts, NANO_TIME_64 *p_nt64)
 Convert a NTP_TSTAMP structure to a NANO_TIME_64 structure. More...
 
void str_ntp_hex_to_nano_time_64 (const char *s, NANO_TIME_64 *p)
 Set up a NANO_TIME_64 structure from a hex string with a time in seconds and binary fractions. More...
 

Macro Definition Documentation

◆ _CFG_HLP

#define _CFG_HLP

Definition at line 51 of file cfg_hlp.c.

Function Documentation

◆ alloc_dev_hw_id()

int alloc_dev_hw_id ( DEVICE_INFO p,
size_t  len 
)

Definition at line 515 of file cfg_hlp.c.

References _DEVICE_INFO::hw_id, MBG_ERR_ALREADY_ALLOC, MBG_ERR_NO_MEM, and MBG_SUCCESS.

Referenced by mbg_tlv_create_id().

◆ calloc_ucap_entry()

UCAP_ENTRY* calloc_ucap_entry ( void  )

Allocates memory for a new UCAP_ENTRY structure

Returns
The new allocated UCAP_ENTRY or NULL if the calloc call was not successful

Definition at line 1531 of file cfg_hlp.c.

References UCAP_ENTRY::head, and mbg_klist_init().

Referenced by mbg_get_all_ucap_info(), and mbg_tlv_create_id().

◆ check_valid_port_info()

◆ chk_dev_gpio_dep_on_ass_idx()

_NO_MBG_API_ATTR int _MBG_API chk_dev_gpio_dep_on_ass_idx ( const ALL_GPIO_INFO gpio_info,
unsigned  idx 
)

◆ chk_dev_gpio_has_status()

_NO_MBG_API_ATTR int _MBG_API chk_dev_gpio_has_status ( const ALL_GPIO_INFO info)

Checks whether GPIO supports status function.

Parameters
[out]infoPointer to a ALL_GPIO_INFO structure to be filled up
Returns
One of the MBG_RETURN_CODES
See also
mbgextio_dev_has_gpio
mbg_chk_dev_has_gpio
free_all_gpio_info

Definition at line 974 of file cfg_hlp.c.

References ALL_GPIO_INFO::cfg_limits, MBG_GPIO_CFG_LIMITS::flags, MBG_ERR_NOT_SUPP_BY_DEV, MBG_GPIO_CFG_LIMIT_FLAG_MASK_STATUS_SUPP, and MBG_SUCCESS.

Referenced by mbg_tlv_create_id().

◆ chk_dev_gpio_supp_ass_idx()

◆ chk_dev_ims_has_fdm()

_NO_MBG_API_ATTR int _MBG_API chk_dev_ims_has_fdm ( const ALL_IMS_INFO info)

◆ chk_dev_ims_is_pll_locked()

◆ chk_dev_ims_is_volt_out_enabled()

◆ chk_dev_ims_is_volt_out_overload()

◆ chk_dev_net_cfg_supp_stage_2()

◆ chk_dev_ntp_supp_client()

◆ chk_dev_ntp_supp_server()

◆ chk_dev_receiver_info()

◆ chk_dev_xbp_supp_nodes()

_NO_MBG_API_ATTR int _MBG_API chk_dev_xbp_supp_nodes ( const ALL_XBP_INFO info)

◆ chk_dev_xmulti_ref_supp_ext_source_metrics()

◆ chk_dev_xmulti_ref_supp_ext_source_stats()

◆ chk_dev_xmulti_ref_supp_ext_src_info()

◆ chk_dev_xmulti_ref_supp_holdover_status()

_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_holdover_status ( const ALL_XMULTI_REF_INFO info)

◆ chk_dev_xmulti_ref_supp_mrf_none()

_NO_MBG_API_ATTR int _MBG_API chk_dev_xmulti_ref_supp_mrf_none ( const ALL_XMULTI_REF_INFO info)

◆ chk_free_dev_hw_id()

void chk_free_dev_hw_id ( DEVICE_INFO p)

Definition at line 502 of file cfg_hlp.c.

References _DEVICE_INFO::hw_id.

Referenced by mbg_tlv_create_id().

◆ chk_set_n_gnss_supp()

◆ chk_sw_rev_name()

int chk_sw_rev_name ( SW_REV p,
int  verbose 
)

Check if a software revision name should be displayed.

The software revision name is usually empty, except if the firmware is a customized version, in which case the field contains an identifier string.

There are some standard firmware versions where this string is not empty but padded with spaces, etc., so we try to clean this up and display the string properly, if appropriate.

Parameters
[in,out]pThe SW_REV name to check
[in]verboseThe app's verbosity level
Returns
!= 0 if SW name should be displayed

Definition at line 89 of file cfg_hlp.c.

References SW_REV::name, and trim_whitespace().

Referenced by mbg_get_show_dev_info(), and mbg_tlv_create_id().

◆ free_all_database_info()

void free_all_database_info ( ALL_DATABASE_INFO p)

Free an ALL_DATABASE_INFO structure.

Parameters
[in]pPointer to the ALL_DATABASE_INFO structure to be freed
See also
mbgextio_get_all_database_info

Definition at line 1722 of file cfg_hlp.c.

References ALL_DATABASE_INFO::dbs, ALL_DATABASE_INFO::glb_info, MBG_DATABASE_GLB_INFO::num_dbs, and mbg_database::release_priv.

Referenced by mbg_tlv_create_id().

◆ free_all_events()

void free_all_events ( ALL_EVENTS p)

Free an ALL_EVENTS structure.

Parameters
[in]pPointer to the ALL_EVENTS structure to be freed

Definition at line 1170 of file cfg_hlp.c.

References mbg_event::dict_entries, ALL_EVENTS::events, ALL_EVENTS::num_events, mbg_event::release_backref, and mbg_event::release_priv.

Referenced by free_all_monitoring_info(), and mbg_tlv_create_id().

◆ free_all_firmware_info()

◆ free_all_gpio_info()

void free_all_gpio_info ( ALL_GPIO_INFO p)

Free memory allocated by mbgextio_get_all_gpio_info.

Parameters
[in]pPointer to the ALL_GPIO_INFO structure to be freed
Returns
One of the MBG_RETURN_CODES
See also
mbgextio_dev_has_gpio
mbgextio_get_all_gpio_info

Definition at line 1445 of file cfg_hlp.c.

References ALL_GPIO_INFO::infos.

Referenced by mbg_tlv_create_id().

◆ free_all_gpio_state()

void free_all_gpio_state ( ALL_GPIO_STATE p)

Free memory allocated by mbgextio_get_all_gpio_state.

Parameters
[in]pPointer to the ALL_GPIO_STATE structure to be freed
Returns
One of the MBG_RETURN_CODES
See also
mbgextio_dev_has_gpio
mbgextio_get_all_gpio_state

Definition at line 1511 of file cfg_hlp.c.

References ALL_GPIO_STATE::states.

Referenced by mbg_tlv_create_id().

◆ free_all_ims_info()

void free_all_ims_info ( ALL_IMS_INFO p)

Free memory allocated by mbgextio_get_all_ims_info.

Parameters
[in]pPointer to the ALL_IMS_INFO structure to be freed
See also
mbgextio_dev_has_ims
mbgextio_get_all_ims_info
mbgextio_get_all_ims_state

Definition at line 1384 of file cfg_hlp.c.

References ALL_IMS_INFO::fdm_info, ALL_IMS_INFO::fdm_limits, and ALL_IMS_INFO::fdm_outinfo_idx.

Referenced by mbg_tlv_create_id().

◆ free_all_ims_state()

void free_all_ims_state ( ALL_IMS_STATE p)

Free memory allocated by mbgextio_get_all_ims_state.

Parameters
[in]pPointer to the ALL_IMS_STATE structure to be freed
See also
mbgextio_dev_has_ims
mbgextio_get_all_ims_info
mbgextio_get_all_ims_state

Definition at line 1414 of file cfg_hlp.c.

References ALL_IMS_STATE::fdm_output_state_idx, ALL_IMS_STATE::fdm_state, and ALL_IMS_STATE::sensor_state_idx.

Referenced by mbg_tlv_create_id().

◆ free_all_io_ports()

void free_all_io_ports ( ALL_MBG_IO_PORTS p)

◆ free_all_monitoring_info()

void free_all_monitoring_info ( ALL_MONITORING_INFO p)

◆ free_all_net_cfg_info()

void free_all_net_cfg_info ( ALL_NET_CFG_INFO p)

◆ free_all_net_status_info()

void free_all_net_status_info ( ALL_NET_STATUS_INFO p)

◆ free_all_ntp_cfg_info()

◆ free_all_ntp_status()

void free_all_ntp_status ( ALL_NTP_STATUS p)

Free an ALL_NTP_STATUS structure.

Parameters
[in]pPointer to the ALL_NTP_STATUS structure to be freed
See also
mbgextio_get_all_ntp_status

Definition at line 1357 of file cfg_hlp.c.

References ALL_NTP_STATUS::peer_states, and ALL_NTP_STATUS::refclk_states.

Referenced by mbg_tlv_create_id().

◆ free_all_ptp_v1_common_datasets()

void free_all_ptp_v1_common_datasets ( ALL_PTP_V1_COMMON_DATASETS p)

Free an ALL_PTP_V1_COMMON_DATASETS structure allocated by mbgextio_get_all_ptp_v1_common_datasets.

Parameters
[in]pPointer to the ALL_PTP_V1_COMMON_DATASETS structure to be freed
See also
mbgextio_get_all_ptp_v1_common_datasets

Definition at line 1267 of file cfg_hlp.c.

References ALL_PTP_V1_COMMON_DATASETS::port_datasets.

Referenced by mbg_tlv_create_id().

◆ free_all_ptp_v2_common_datasets()

void free_all_ptp_v2_common_datasets ( ALL_PTP_V2_COMMON_DATASETS p)

Free an ALL_PTP_V2_COMMON_DATASETS structure allocated by mbgextio_get_all_ptp_v2_common_datasets.

Parameters
[in]pPointer to the ALL_PTP_V2_COMMON_DATASETS structure to be freed
See also
mbgextio_get_all_ptp_v2_common_datasets

Definition at line 1289 of file cfg_hlp.c.

References ALL_PTP_V2_COMMON_DATASETS::port_datasets.

Referenced by mbg_tlv_create_id().

◆ free_all_snmp_info()

void free_all_snmp_info ( ALL_SNMP_INFO p)

Free an ALL_SNMP_INFO structure.

Parameters
[in]pPointer to the ALL_SNMP_INFO structure to be freed

Definition at line 1084 of file cfg_hlp.c.

References ALL_SNMP_INFO::v12_infos, ALL_SNMP_INFO::v12_trap_infos, ALL_SNMP_INFO::v3_infos, and ALL_SNMP_INFO::v3_trap_infos.

Referenced by free_all_monitoring_info(), and mbg_tlv_create_id().

◆ free_all_svc_info()

void free_all_svc_info ( ALL_SERVICE_INFO p)

Free an ALL_SERVICE_INFO structure.

Parameters
[in]pPointer to the ALL_SERVICE_INFO structure to be freed
See also
mbgextio_get_all_user_info

Definition at line 1642 of file cfg_hlp.c.

References ALL_SERVICE_INFO::mgmt_info, MBG_SERVICE_MGMT_INFO::num_services, mbg_service::release_backref, mbg_service::release_priv, and ALL_SERVICE_INFO::svcs.

Referenced by mbg_tlv_create_id().

◆ free_all_syslog_info()

void free_all_syslog_info ( ALL_SYSLOG_INFO p)

◆ free_all_ucap_info()

void free_all_ucap_info ( ALL_UCAP_INFO p)

◆ free_all_ucap_net_info()

void free_all_ucap_net_info ( ALL_UCAP_NET_INFO p)

Free an ALL_UCAP_NET_INFO structure.

Parameters
[in]pPointer to the ALL_UCAP_NET_INFO structure to be freed
See also
mbgextio_get_all_ucap_net_info

Definition at line 1583 of file cfg_hlp.c.

References ALL_UCAP_NET_INFO::recv_infos.

Referenced by mbg_tlv_create_id().

◆ free_all_user_info()

void free_all_user_info ( ALL_USER_INFO p)

◆ free_all_xbp_info()

void free_all_xbp_info ( ALL_XBP_INFO p)

Free an ALL_XBP_INFO structure.

Parameters
[in]pPointer to the ALL_XBP_INFO structure to be freed
See also
mbgextio_get_all_xbp_info

Definition at line 993 of file cfg_hlp.c.

References ALL_XBP_INFO::node_infos, and ALL_XBP_INFO::node_limits.

Referenced by mbg_tlv_create_id().

◆ free_all_xmulti_ref_info()

void free_all_xmulti_ref_info ( ALL_XMULTI_REF_INFO p)

Free an ALL_XMULTI_REF_INFO structure.

Parameters
[in]pPointer to the ALL_XMULTI_REF_INFO structure to be freed
See also
mbgextio_get_all_xmulti_ref_info
mbg_get_all_xmulti_ref_info

Definition at line 1210 of file cfg_hlp.c.

References ALL_XMULTI_REF_INFO::ext_src_infos, and ALL_XMULTI_REF_INFO::infos.

Referenced by mbg_get_all_xmulti_ref_info(), and mbg_tlv_create_id().

◆ free_all_xmulti_ref_status()

◆ get_baud_rate_idx()

int get_baud_rate_idx ( BAUD_RATE  baud_rate)

◆ get_framing_idx()

int get_framing_idx ( const char *  framing)

◆ get_fw_id_from_hw_id()

const char* get_fw_id_from_hw_id ( const char *  hw_id)

Definition at line 533 of file cfg_hlp.c.

References device_list, _DEVICE_INFO::fw_id, _DEVICE_INFO::hw_id, and N_SUPP_DEV_TOTAL.

Referenced by mbg_tlv_create_id().

◆ get_hw_id_from_fw_id()

const char* get_hw_id_from_fw_id ( const char *  fw_id)

Definition at line 563 of file cfg_hlp.c.

References device_list, _DEVICE_INFO::fw_id, _DEVICE_INFO::hw_id, and N_SUPP_DEV_TOTAL.

Referenced by mbg_tlv_create_id().

◆ get_io_port_type_info()

MBG_IO_PORT_TYPE_INFO* get_io_port_type_info ( const MBG_IO_PORT port,
uint16_t  port_type 
)

◆ get_str_idx()

int get_str_idx ( const char *  search,
const char *  str_table[],
int  n_entries 
)

Definition at line 113 of file cfg_hlp.c.

Referenced by get_framing_idx(), and mbg_tlv_create_id().

◆ mbg_snprint_revision()

int mbg_snprint_revision ( char *  buf,
size_t  buflen,
const char *  prefix,
const char *  suffix,
uint32_t  rev 
)

Definition at line 709 of file cfg_hlp.c.

References _int_from_size_t, _mbg_decode_revision, major, minor, and snprintf_safe().

Referenced by mbg_tlv_create_id().

◆ mbg_tlv_announce_init()

void mbg_tlv_announce_init ( MBG_TLV_ANNOUNCE tlv,
MBG_TLV_UID  uid,
MBG_TLV_TYPE  tlv_feat_type,
uint32_t  total_bytes 
)

Initializes a MBG_TLV_ANNOUNCE structure.

Parameters
[out]tlvPointer to a MBG_TLV_ANNOUNCE structure
[in]uidUnique sender ID used as identifier with all subsequent messages related to this transaction.
[in]tlv_feat_typeOne of the MBG_TLV_FEAT_TYPES
[in]total_bytesTotal number of bytes of all upcoming TLVs

Definition at line 642 of file cfg_hlp.c.

References MBG_TLV_ANNOUNCE::data, MBG_TLV_DATA::reserved_1, MBG_TLV_ANNOUNCE::reserved_1, MBG_TLV_ANNOUNCE::reserved_2, MBG_TLV_DATA::total_bytes, MBG_TLV_DATA::type, and MBG_TLV_DATA::uid.

Referenced by mbg_tlv_create_id().

◆ mbg_tlv_init()

void mbg_tlv_init ( MBG_TLV tlv,
MBG_TLV_UID  uid,
MBG_TLV_TYPE  tlv_type,
uint32_t  total_bytes 
)

Initializes a MBG_TLV.

Parameters
[out]tlvPointer to a valid MBG_TLV structure
[in]uidUnique sender ID used as identifier for each further TLV message related to this type.
[in]tlv_typeType identifier, see MBG_TLV_TYPES
[in]total_bytesTotal number of bytes belonging to this TLV transaction (which is very likely split into several TLVs)

Definition at line 668 of file cfg_hlp.c.

References MBG_TLV_HDR::cur_bytes, MBG_TLV::hdr, MBG_TLV_HDR::reserved_1, MBG_TLV_HDR::reserved_2, MBG_TLV_HDR::reserved_3, MBG_TLV_HDR::tlv_type, MBG_TLV_HDR::total_bytes, MBG_TLV_HDR::trans_bytes, and MBG_TLV_HDR::uid.

Referenced by mbg_tlv_create_id().

◆ mbg_tlv_rcv_state_init()

void mbg_tlv_rcv_state_init ( MBG_TLV_RCV_STATE state,
MBG_TLV_UID  uid,
uint32_t  total_bytes 
)

Initializes MBG_TLV_RCV_STATE structure.

Parameters
[in,out]statePointer to MBG_TLV_RCV_STATE structure
[in]uidUnique sender ID used as identifier for each further TLV message related to this type.
[in]total_bytesTotal number of bytes belonging to this TLV transaction (which is very likely split into several TLVS)

Definition at line 695 of file cfg_hlp.c.

References MBG_TLV_RCV_STATE::data, MBG_TLV_RCV_STATE::read_bytes, MBG_TLV_DATA::reserved_1, MBG_TLV_RCV_STATE::reserved_1, MBG_TLV_DATA::total_bytes, MBG_TLV_DATA::type, and MBG_TLV_DATA::uid.

Referenced by mbg_tlv_create_id().

◆ ntp_tstamp_to_nanotime_64()

void ntp_tstamp_to_nanotime_64 ( const NTP_TSTAMP p_nts,
NANO_TIME_64 p_nt64 
)

Convert a NTP_TSTAMP structure to a NANO_TIME_64 structure.

Parameters
[in]p_ntsThe NTP_TSTAMP structure to be converted
[out]p_nt64The NANO_TIME_64 structure to be filled up

Definition at line 1787 of file cfg_hlp.c.

References bin_frac_32_to_dec_frac(), NTP_TSTAMP::fractions, NANO_TIME_64::nano_secs, NSEC_PER_SEC, NTP_SEC_BIAS, NTP_TSTAMP::seconds, and NANO_TIME_64::secs.

Referenced by mbg_tlv_create_id(), and str_ntp_hex_to_nano_time_64().

◆ setup_default_str_type_info_idx()

int setup_default_str_type_info_idx ( STR_TYPE_INFO_IDX  stii[],
const RECEIVER_INFO p_ri 
)

◆ setup_gps_only_gnss_info_from_statinfo()

int setup_gps_only_gnss_info_from_statinfo ( ALL_GNSS_INFO p_agi)

◆ setup_gps_only_sat_info_idx_from_statinfo()

void setup_gps_only_sat_info_idx_from_statinfo ( ALL_GNSS_INFO p_agi)

◆ str_ntp_hex_to_nano_time_64()

void str_ntp_hex_to_nano_time_64 ( const char *  s,
NANO_TIME_64 p 
)

Set up a NANO_TIME_64 structure from a hex string with a time in seconds and binary fractions.

Parameters
[in]sA string with a time in seconds since epoch 1900-01-01, with binary fractions separated by decimal point, e.g. 'dc763e43.73bd5a8f' as printed by the ntpq utility
[out]pAddress of a NANO_TIME_64 structure to be set up
See also
str_ntp_hex_to_ntp_tstamp

Definition at line 1807 of file cfg_hlp.c.

References ntp_tstamp_to_nanotime_64(), and str_ntp_hex_to_ntp_tstamp().

Referenced by mbg_tlv_create_id().

◆ str_ntp_hex_to_ntp_tstamp()

void str_ntp_hex_to_ntp_tstamp ( const char *  s,
NTP_TSTAMP p 
)

Set up a NTP_TSTAMP structure from a hex string with a time in seconds and binary fractions.

Parameters
[in]sA string with a time in seconds since NTP epoch 1900-01-01, with binary fractions separated by decimal point, e.g. 'dc763e43.73bd5a8f' as printed by the ntpq utility
[out]pAddress of a NTP_TSTAMP structure to be set up
See also
str_ntp_hex_to_nano_time_64

Definition at line 1759 of file cfg_hlp.c.

References NTP_TSTAMP::fractions, and NTP_TSTAMP::seconds.

Referenced by mbg_tlv_create_id(), and str_ntp_hex_to_nano_time_64().

◆ valid_port_info()

int valid_port_info ( const PORT_INFO p_pi,
const STR_TYPE_INFO_IDX  str_type_info_idx[],
int  n_str_type 
)

Definition at line 367 of file cfg_hlp.c.

References check_valid_port_info().

Referenced by mbg_tlv_create_id().