* Added Timer * Added UDPSocket::GetAddr * Added MessageHandlers::SendBeacon() * PoC of starting a timer on PluginEnable * C++11 * Added Timer to xcode project * C++11 in cmake * added Timer to cmake * use function pointer in Timer * moved Timer to namespace + wait for thread to join when stopping the timer * Windows: changed uint to unisgned short * Windows: Added Timer.h/cpp to project * GetAddr static * Send xplane and plugin version with BECN * SendBeacon with params * fixed file copyrights * Include functional to fix Linux compile error * review fixes * Send plugin receive port in BECN * review fixes
30 lines
649 B
C++
30 lines
649 B
C++
// Copyright (c) 2013-2018 United States Government as represented by the Administrator of the
|
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
|
|
|
#ifndef XPCPLUGIN_TIMER_H_
|
|
#define XPCPLUGIN_TIMER_H_
|
|
|
|
#include <stdio.h>
|
|
#include <iostream>
|
|
#include <thread>
|
|
#include <chrono>
|
|
#include <functional>
|
|
|
|
namespace XPC {
|
|
class Timer
|
|
{
|
|
std::atomic_flag running;
|
|
std::thread th;
|
|
|
|
public:
|
|
|
|
using Callback = std::function<void(void)>;
|
|
|
|
void start(const std::chrono::milliseconds, const Callback &callback);
|
|
|
|
void stop();
|
|
};
|
|
}
|
|
|
|
#endif /* Timer_hpp */
|