48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef _OWLPS_POSITIONING_POSUTIL_HH_
|
|
#define _OWLPS_POSITIONING_POSUTIL_HH_
|
|
|
|
#include <ctime>
|
|
#include <stdint.h> // <cstdint> is not C++ 98 compliant
|
|
|
|
/* Wi-Fi channel frequencies in Hz */
|
|
#define CHANNEL_1 2412
|
|
#define CHANNEL_2 2417
|
|
#define CHANNEL_3 2422
|
|
#define CHANNEL_4 2427
|
|
#define CHANNEL_5 2432
|
|
#define CHANNEL_6 2437
|
|
#define CHANNEL_7 2442
|
|
#define CHANNEL_8 2447
|
|
#define CHANNEL_9 2452
|
|
#define CHANNEL_10 2457
|
|
#define CHANNEL_11 2462
|
|
#define CHANNEL_12 2467
|
|
#define CHANNEL_13 2472
|
|
#define CHANNEL_14 2477
|
|
|
|
/// Utilitary class
|
|
class PosUtil
|
|
{
|
|
public:
|
|
/** @name Wi-Fi */
|
|
//@{
|
|
/// Converts a Wi-Fi channel to the corresponding frequency in Hz
|
|
static unsigned int channel_to_frequency(const int &channel) ;
|
|
//@}
|
|
|
|
/** @name Time & Dates */
|
|
//@{
|
|
/// Lowers the precision of a \em timespec to ms
|
|
static void timespec_round_to_ms(struct timespec &d) ;
|
|
/// Compares two struct timespec
|
|
static bool timespec_equals(const struct timespec &d1,
|
|
const struct timespec &d2) ;
|
|
/// Converts a struct timespec into a value in milliseconds
|
|
static uint64_t timespec_to_ms(const struct timespec &d) ;
|
|
/// Converts a time value in milliseconds into a struct timespec
|
|
static struct timespec ms_to_timespec(const uint64_t &tms) ;
|
|
//@}
|
|
} ;
|
|
|
|
#endif // _OWLPS_POSITIONING_POSUTIL_HH_
|