729 const auto delay = boost::posix_time::seconds(5);
731 const Time &tm = get<0>(dat);
733 const array<uint32_t,40> &clk = get<1>(dat);
734 const array<int16_t,160> &tmp = get<2>(dat);
739 static list<pair<Time,array<uint32_t,40>>> listclk;
740 listclk.emplace_back(tm, clk);
745 static list<pair<Time,array<int16_t,160>>> listtmp;
746 listtmp.emplace_back(tm, tmp);
750 static Time oldt(boost::date_time::neg_infin);
763 auto it=listclk.begin();
764 if (it==listclk.end() || it->first+delay>tm)
774 Clock() { memset(
this, 0,
sizeof(Clock)); }
778 vector<uint16_t> clknum(40);
781 avgclk.num = listclk.size();
782 for (
auto it=listclk.begin(); it!=listclk.end(); it++)
783 for (
int i=0;
i<40;
i++)
784 if (it->second[
i]!=UINT32_MAX)
786 avgclk.val[
i] += it->second[
i];
789 for (
int i=0;
i<40;
i++)
790 avgclk.val[
i] *= 2.048/clknum[
i];
803 auto it=listtmp.begin();
804 if (it==listtmp.end() || it->first+delay>tm)
814 Temp() { memset(
this, 0,
sizeof(Temp)); }
818 vector<uint32_t> tmpnum(160);
821 avgtmp.num = listtmp.size();
822 for (
auto it=listtmp.begin(); it!=listtmp.end(); it++)
823 for (
int i=0;
i<160;
i++)
824 if (it->second[
i]!=INT16_MIN)
826 avgtmp.val[
i] += it->second[
i];
829 for (
int i=0;
i<160;
i++)
830 avgtmp.val[
i] /= tmpnum[
i]*16;
struct EventBuilderWrapper::EventData __attribute__((__packed__))
Adds some functionality to boost::posix_time::ptime for our needs.
DimDescribedService fDimTemperature
DimDescribedService fDimRefClock
void setData(const void *ptr, size_t sz)