owlps/owlps-positioning/posutil.hh

37 lines
948 B
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
class PosUtil
{
public:
/* Wi-Fi */
static unsigned int channel_to_frequency(const int &channel) ;
/* Time & Dates */
static uint64_t timespec_to_ms(const struct timespec &d) ;
static struct timespec ms_to_timespec(const uint64_t &tms) ;
static uint64_t timespec_to_ns(const struct timespec &d) ;
static struct timespec ns_to_timespec(const uint64_t &tns) ;
} ;
#endif // _OWLPS_POSITIONING_POSUTIL_HH_