static void dataCb(hbm::streaming::SubscribedSignal& subscribedSignal, uint64_t ntpTimestamp, const double* pValues, size_t count) { signalInfos_t::iterator iter = signalFiles.find(subscribedSignal.signalNumber()); if(iter==signalFiles.end()) { return; } iter->second->addData(ntpTimestamp, pValues, count); }
static void signalMetaInformationCb(hbm::streaming::SubscribedSignal& subscribedSignal, const std::string& method, const Json::Value& params) { unsigned int signalNumber = subscribedSignal.signalNumber(); if(method=="subscribe") { std::unique_ptr < signalInfo_t > pSignalInfo(new signalInfo_t(subscribedSignal.signalReference())); pSignalInfo->addMetaInfo(method, params); signalFiles.insert(std::pair < unsigned int, std::unique_ptr < signalInfo_t > > (signalNumber, std::move(pSignalInfo))); } else if(method=="unsubscribe") { signalFiles.erase(signalNumber); } else { signalInfos_t::iterator iter = signalFiles.find(signalNumber); if(iter==signalFiles.end()) { std::cerr << "received meta information for signal that is not known to be subscribed" << std::endl; return; } iter->second->addMetaInfo(method, params); } }
static void rawCbVerbose(hbm::streaming::SubscribedSignal& subscribedSignal, uint64_t ntpTimestamp, const uint8_t* pValues, size_t count) { std::cout << subscribedSignal.signalReference() << ": " << std::hex << ntpTimestamp << " "; //std::cout << std::setw(2); std::cout << std::setfill('0'); for (size_t i=0; i<count; ++i) { std::cout << std::setw(2) << (int)*pValues << " "; ++pValues; } std::cout << std::dec << std::endl; }
static void dataCb(hbm::streaming::SubscribedSignal& subscribedSignal, uint64_t timeStamp, const double* pValues, size_t count) { unsigned int signalNumber = subscribedSignal.signalNumber(); lastRampValues_t::iterator iter = m_lastRampValues.find(signalNumber); if(iter==m_lastRampValues.end()) { lastRampValues lastValues; lastValues.timeStamp = timeStamp; lastValues.amplitude = pValues[count-1]; m_lastRampValues.insert(std::make_pair(signalNumber, lastValues)); } else { double valueDiff = pValues[0] - iter->second.amplitude; if(fabs(valueDiff - rampValueDiff) > epsilon) { throw std::runtime_error (subscribedSignal.signalReference() + ": unexpected value in ramp!"); } else if (iter->second.timeStamp>=timeStamp){ throw std::runtime_error (subscribedSignal.signalReference() + ": unexpected time stamp in ramp!"); } else { iter->second.amplitude = pValues[count-1]; } } }
static void signalMetaInformationCb(hbm::streaming::SubscribedSignal& subscribedSignal, const std::string& method, const Json::Value& ) { std::cout << subscribedSignal.signalReference() << ": " << method << std::endl; }