/*
Copyright (C) 2012 Intel Corporation
+ Copyright (C) 2015 AWTC Europe
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#include "chrony.h"
+#include "ambplugin.h"
#include "abstractroutingengine.h"
#include "debugout.h"
#include "listplusplus.h"
#include <sys/time.h>
#include <math.h>
-#define GPSTIME "GpsTime"
-
extern "C" void create(AbstractRoutingEngine* routingEngine, map<string, string> config)
{
- new ChronySink(routingEngine, config);
+ auto plugin = new AmbPlugin<ChronySink>(routingEngine, config);
+ plugin->init();
+}
+
+ChronySink::ChronySink(AbstractRoutingEngine* re, const std::map<std::string, std::string>& config, AbstractSource& parent)
+ :AmbPluginImpl(re, config, parent)
+{
+ supportedChanged(re->supported());
}
-ChronySink::ChronySink(AbstractRoutingEngine* engine, map<string, string> config): AbstractSink(engine, config)
+void ChronySink::init()
{
- routingEngine->subscribeToProperty(GPSTIME, this);
- supportedChanged(engine->supported());
+ routingEngine->subscribeToProperty("GpsTime", &source);
}
PropertyList ChronySink::subscriptions()
close(sockfd);
}
-const string ChronySink::uuid()
-{
- return "35324592-db72-11e4-b432-0022684a4a24";
-}
/*
Copyright (C) 2012 Intel Corporation
+ Copyright (C) 2015 AWTC Europe
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#ifndef CHRONYSINK_H
#define CHRONYSINK_H
-#include "abstractsink.h"
+#include "ambpluginimpl.h"
#define CHRONYD_SOCKET "/tmp/chrony.gps.sock"
int magic;
};
-class ChronySink : public AbstractSink
+class ChronySink : public AmbPluginImpl
{
public:
- ChronySink(AbstractRoutingEngine* engine, map<string, string> config);
+ ChronySink(AbstractRoutingEngine* re, const std::map<std::string, std::string>& config, AbstractSource& parent);
+ ~ChronySink() { };
+ const std::string uuid() const { return "35324592-db72-11e4-b432-0022684a4a24"; }
+ virtual void init();
virtual PropertyList subscriptions();
virtual void supportedChanged(const PropertyList & supportedProperties);
virtual void propertyChanged( AbstractPropertyType* value);
- virtual const std::string uuid();
+
};
#endif // CHRONYSINK_H