mbgtools-lx  4.2.8
mbgutil.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: mbgutil.h 1.21 2018/09/21 08:18:05 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions used with mbgutil.c.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: mbgutil.h $
13  * Revision 1.21 2018/09/21 08:18:05 martin
14  * New version code 0x0308, compatibility version still 0x0110.
15  * Revision 1.20 2018/08/13 14:54:24Z martin
16  * Updated function prototypes.
17  * Revision 1.19 2018/08/07 15:09:11Z martin
18  * New version code 0x0370, compatibility version still 0x0110.
19  * Revision 1.18 2017/07/05 16:44:35 martin
20  * New version code 0x0400, compatibility version still 0x0110.
21  * Include timeutil.h.
22  * windows.h is now included in mbg_tgt.h.
23  * Updated function prototypes.
24  * Revision 1.17 2012/10/15 10:08:32 martin
25  * Include stdlib.h.
26  * Cleaned up handling of pragma pack().
27  * Revision 1.16 2009/08/14 10:11:53Z daniel
28  * New version code 306, compatibility version still 110.
29  * Revision 1.15 2009/06/09 08:57:47Z daniel
30  * Rev No. 305
31  * Revision 1.14 2009/03/19 09:06:00Z daniel
32  * New version code 304, compatibility version still 110.
33  * Revision 1.13 2009/01/12 09:35:41Z daniel
34  * New version code 303, compatibility version still 110.
35  * Updated function prototypes.
36  * Revision 1.12 2008/01/17 10:15:26Z daniel
37  * New version code 302, compatibility version still 110.
38  * Revision 1.11 2007/10/16 10:01:17Z daniel
39  * New version code 301, compatibility version still 110.
40  * Revision 1.9 2007/03/21 16:48:31Z martin
41  * New version code 219, compatibility version still 110.
42  * Revision 1.8 2006/08/09 13:18:18Z martin
43  * New version code 218, compatibility version still 110.
44  * Revision 1.7 2006/06/08 10:48:52Z martin
45  * New version code 217, compatibility version still 110.
46  * Added macro _mbg_strncpy().
47  * Revision 1.6 2006/05/10 10:56:54Z martin
48  * Updated function prototypes.
49  * Revision 1.5 2006/05/02 13:24:49Z martin
50  * New version code 216, compatibility version still 110.
51  * Revision 1.4 2006/01/11 12:24:05Z martin
52  * New version code 215, compatibility version still 110.
53  * Revision 1.3 2005/12/15 10:01:51Z martin
54  * New version 214, compatibility version still 110.
55  * Revision 1.2 2005/02/18 15:13:42Z martin
56  * Updated function prototypes.
57  * Revision 1.1 2005/02/18 10:39:49Z martin
58  * Initial revision
59  *
60  **************************************************************************/
61 
62 #ifndef _MBGUTIL_H
63 #define _MBGUTIL_H
64 
65 
66 /* Other headers to be included */
67 
68 #include <mbg_tgt.h>
69 #include <timeutil.h>
70 #include <use_pack.h>
71 #include <pcpsdefs.h>
72 #include <mbggeo.h>
73 #include <pci_asic.h>
74 
75 #include <stdlib.h>
76 
77 
78 #define MBGUTIL_VERSION 0x0308
79 
80 #define MBGUTIL_COMPAT_VERSION 0x0110
81 
82 
83 #if defined( MBG_TGT_WIN32 )
84 
85 
86 #elif defined( MBG_TGT_LINUX )
87 
88 
89 #elif defined( MBG_TGT_OS2 )
90 
91 
92 #elif defined( MBG_TGT_DOS )
93 
94  #if !defined( MBG_USE_DOS_TSR )
95  #endif
96 
97 #else
98 
99 #endif
100 
101 #ifdef _MBGUTIL
102  #define _ext
103  #define _DO_INIT
104 #else
105  #define _ext extern
106 #endif
107 
108 
109 /* Start of header body */
110 
111 #if defined( _USE_PACK )
112  #pragma pack( 1 ) // set byte alignment
113  #define _USING_BYTE_ALIGNMENT
114 #endif
115 
116 
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120 
121 
122 // The macro below can be used to simplify the API call if
123 // a string variable is used rather than a char *.
124 #define _mbg_strncpy( _s, _src ) \
125  mbg_strncpy( _s, sizeof( _s ), _src )
126 
127 
128 /* ----- function prototypes begin ----- */
129 
130 /* This section was generated automatically */
131 /* by MAKEHDR, do not remove the comments. */
132 
148 
166  _MBG_API_ATTR int _MBG_API mbgutil_check_version( int header_version ) ;
167 
184  _MBG_API_ATTR int __attribute__( ( format( printf, 3, 4 ) ) ) _MBG_API mbg_snprintf( char *s, size_t max_len, const char * fmt, ... ) ;
185 
197  _MBG_API_ATTR int _MBG_API mbg_strncpy( char *s, size_t max_len, const char *src ) ;
198 
211  _MBG_API_ATTR int _MBG_API mbg_strchar( char *s, size_t max_len, char c, size_t n ) ;
212 
225  _MBG_API_ATTR int _MBG_API mbg_str_date_short( char *s, int max_len, int mday, int month ) ;
226 
240  _MBG_API_ATTR int _MBG_API mbg_str_date( char *s, int max_len, int mday, int month, int year ) ;
241 
254  _MBG_API_ATTR int _MBG_API mbg_str_time_short( char *s, int max_len, int hour, int min ) ;
255 
269  _MBG_API_ATTR int _MBG_API mbg_str_time( char *s, int max_len, int hour, int min, int sec ) ;
270 
286  _MBG_API_ATTR int _MBG_API mbg_str_time_long( char *s, int max_len, int hour, int min, int sec, int sec100 ) ;
287 
302  _MBG_API_ATTR int _MBG_API mbg_str_tm_gps_date_time( char *s, int max_len, const TM_GPS *pt ) ;
303 
315  _MBG_API_ATTR int _MBG_API mbg_str_pcps_date_short( char *s, int max_len, const PCPS_TIME *pt ) ;
316 
328  _MBG_API_ATTR int _MBG_API mbg_str_pcps_date( char *s, int max_len, const PCPS_TIME *pt ) ;
329 
341  _MBG_API_ATTR int _MBG_API mbg_str_pcps_time_short( char *s, int max_len, const PCPS_TIME *pt ) ;
342 
354  _MBG_API_ATTR int _MBG_API mbg_str_pcps_time( char *s, int max_len, const PCPS_TIME *pt ) ;
355 
367  _MBG_API_ATTR int _MBG_API mbg_str_pcps_time_long( char *s, int max_len, const PCPS_TIME *pt ) ;
368 
384  _MBG_API_ATTR int _MBG_API mbg_str_pcps_date_time( char *s, int max_len, const PCPS_TIME *pt, const char *tz_str ) ;
385 
397  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_date( char *s, int max_len, uint32_t sec ) ;
398 
410  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_time( char *s, int max_len, uint32_t sec ) ;
411 
426  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_date_time_utc( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
427 
442  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_date_time_loc( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
443 
455  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_time_frac( char *s, int max_len, uint32_t frac ) ;
456 
470  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_time_offs( char *s, int max_len, const PCPS_HR_TIME *pt, const char *info ) ;
471 
483  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_tstamp_utc( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
484 
496  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_tstamp_loc( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
497 
509  _MBG_API_ATTR int _MBG_API mbg_str_pcps_tstamp_raw( char *s, int max_len, const PCPS_TIME_STAMP *pt ) ;
510 
524  _MBG_API_ATTR int _MBG_API mbg_str_pcps_hr_time_raw( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
525 
537  _MBG_API_ATTR int _MBG_API mbg_str_ucap( char *s, int max_len, const PCPS_HR_TIME *pt ) ;
538 
551  _MBG_API_ATTR int _MBG_API mbg_str_pos_dms( char *s, int max_len, const DMS *pdms, int prec ) ;
552 
564  _MBG_API_ATTR int _MBG_API mbg_str_pos_alt( char *s, int max_len, double alt ) ;
565 
578  _MBG_API_ATTR int _MBG_API mbg_str_pos( char *s, int max_len, const POS *ppos, int prec ) ;
579 
593  _MBG_API_ATTR int _MBG_API mbg_str_dev_name( char *s, int max_len, const char *short_name, uint16_t fw_rev_num, PCI_ASIC_VERSION asic_ver_num ) ;
594 
595 
596 /* ----- function prototypes end ----- */
597 
598 #ifdef __cplusplus
599 }
600 #endif
601 
602 
603 #if defined( _USING_BYTE_ALIGNMENT )
604  #pragma pack() // set default alignment
605  #undef _USING_BYTE_ALIGNMENT
606 #endif
607 
608 /* End of header body */
609 
610 
611 #undef _ext
612 #undef _DO_INIT
613 
614 #endif /* _MBGUTIL_H */
615 
int mbg_str_tm_gps_date_time(char *s, int max_len, const TM_GPS *pt)
Write a full date and time string to a string buffer.
Definition: mbgutil.c:375
int mbg_str_pcps_date_short(char *s, int max_len, const PCPS_TIME *pt)
Write the short date given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:400
int mbg_str_ucap(char *s, int max_len, const PCPS_HR_TIME *pt)
Write time capture / user capture time stamp to a string buffer.
Definition: mbgutil.c:856
Local date and time computed from GPS time.
Definition: gpsdefs.h:2593
int mbg_str_pcps_time_short(char *s, int max_len, const PCPS_TIME *pt)
Write the short time given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:442
unsigned short uint16_t
Definition: words.h:213
int mbg_str_date(char *s, int max_len, int mday, int month, int year)
Write a date string "dd.mm.yyyy" to a string buffer.
Definition: mbgutil.c:268
int mbg_str_pcps_hr_time(char *s, int max_len, uint32_t sec)
Write time derived from seconds-since-epoch to a string buffer.
Definition: mbgutil.c:563
int mbg_str_pcps_hr_date(char *s, int max_len, uint32_t sec)
Write date derived from seconds-since-epoch to a string buffer.
Definition: mbgutil.c:536
int mbg_strchar(char *s, size_t max_len, char c, size_t n)
Write a character multiple times to a string buffer.
Definition: mbgutil.c:205
int mbgutil_check_version(int header_version)
Check if the DLL/shared library is compatible with a given version.
Definition: mbgutil.c:128
int mbg_str_date_short(char *s, int max_len, int mday, int month)
Write a short date string "dd.mm." to a string buffer.
Definition: mbgutil.c:243
int mbg_str_pcps_hr_date_time_utc(char *s, int max_len, const PCPS_HR_TIME *pt)
Write UTC date and time given as PCPS_HR_TIME structure to a string buffer.
Definition: mbgutil.c:629
#define _MBG_API_ATTR
Definition: mbg_tgt.h:1024
Geographic longitude or latitude in [degrees, minutes, seconds].
Definition: mbggeo.h:90
int mbg_snprintf(char *s, size_t max_len, const char *fmt,...)
A portable, safe implementation of snprintf()
Definition: mbgutil.c:157
int mbg_str_pcps_hr_time_frac(char *s, int max_len, uint32_t frac)
Print binary PCPS_FRAC_32 fractions in decimal to a string buffer.
Definition: mbgutil.c:679
int mbgutil_get_version(void)
Get the version number of the precompiled DLL/shared object library.
Definition: mbgutil.c:102
int mbg_str_pos(char *s, int max_len, const POS *ppos, int prec)
Write geographic coordinates to a string buffer.
Definition: mbgutil.c:925
int mbg_str_pos_alt(char *s, int max_len, double alt)
Write a position&#39;s altitude parameter to a string buffer.
Definition: mbgutil.c:904
int mbg_str_pcps_hr_date_time_loc(char *s, int max_len, const PCPS_HR_TIME *pt)
Write local date and time given as PCPS_HR_TIME structure to a string buffer.
Definition: mbgutil.c:655
int mbg_str_pcps_date(char *s, int max_len, const PCPS_TIME *pt)
Write the date given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:421
int mbg_str_time_long(char *s, int max_len, int hour, int min, int sec, int sec100)
Write a long time string "hh:mm:ss.cc" to a string buffer.
Definition: mbgutil.c:348
A geographic position represented in different formats.
Definition: mbggeo.h:113
int mbg_str_pcps_hr_tstamp_loc(char *s, int max_len, const PCPS_HR_TIME *pt)
Write a high resolution local time stamp including fractions to a string buffer.
Definition: mbgutil.c:765
int mbg_str_pcps_hr_time_offs(char *s, int max_len, const PCPS_HR_TIME *pt, const char *info)
Print the UTC offset from a PCPS_HR_TIME structure to a string buffer.
Definition: mbgutil.c:703
int mbg_str_pcps_hr_time_raw(char *s, int max_len, const PCPS_HR_TIME *pt)
Write a raw high resolution time stamp plus converted local time to a string buffer.
Definition: mbgutil.c:831
High resolution time including status and local time offset.
Definition: pcpsdefs.h:1085
int mbg_str_time_short(char *s, int max_len, int hour, int min)
Write a short time string "hh:mm" to a string buffer.
Definition: mbgutil.c:297
int mbg_str_pcps_time(char *s, int max_len, const PCPS_TIME *pt)
Write the time given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:463
int mbg_str_pos_dms(char *s, int max_len, const DMS *pdms, int prec)
Write a geographic coordinate in degrees - minutes - seconds to a string buffer.
Definition: mbgutil.c:881
uint32_t PCI_ASIC_VERSION
A data type to hold the PCI ASIC version code.
Definition: pci_asic.h:151
Local calendar date and time, plus sync status.
Definition: pcpsdefs.h:1128
A high resolution time stamp.
Definition: pcpsdefs.h:972
#define _MBG_API
Definition: mbg_tgt.h:1020
int mbg_str_dev_name(char *s, int max_len, const char *short_name, uint16_t fw_rev_num, PCI_ASIC_VERSION asic_ver_num)
Write device info to a string buffer.
Definition: mbgutil.c:963
int mbg_str_pcps_hr_tstamp_utc(char *s, int max_len, const PCPS_HR_TIME *pt)
Write a high resolution UTC time stamp including fractions to a string buffer.
Definition: mbgutil.c:736
int mbg_strncpy(char *s, size_t max_len, const char *src)
A portable, safe implementation of strncpy()
Definition: mbgutil.c:184
int mbg_str_pcps_tstamp_raw(char *s, int max_len, const PCPS_TIME_STAMP *pt)
Write a raw high resolution time stamp to a string buffer.
Definition: mbgutil.c:808
int mbg_str_pcps_time_long(char *s, int max_len, const PCPS_TIME *pt)
Write the time including sec100ths given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:484
int mbg_str_time(char *s, int max_len, int hour, int min, int sec)
Write a time string "hh:mm:ss" to a string buffer.
Definition: mbgutil.c:320
int mbg_str_pcps_date_time(char *s, int max_len, const PCPS_TIME *pt, const char *tz_str)
Write date and time given as PCPS_TIME structure to a string buffer.
Definition: mbgutil.c:509