#8 Move sending of id frames to own function

pull/11/head
Geoffrey Merck 4 years ago
parent aecbc44ae0
commit cb5797df1a

@ -163,8 +163,21 @@ void CAPRSWriter::clock(unsigned int ms)
if(m_idFrameProvider != nullptr) {
m_idFrameProvider->clock(ms);
if(m_idFrameProvider->wantsToSend()) {
sendIdFrames();
}
}
for (auto it = m_array.begin(); it != m_array.end(); ++it) {
if(it->second != NULL)
it->second->clock(ms);
}
}
if(m_idFrameProvider->wantsToSend() && m_thread->isConnected()) {
void CAPRSWriter::sendIdFrames()
{
if(m_thread->isConnected())
{
for(auto entry : m_array) {
std::vector<std::string> frames;
if(m_idFrameProvider->buildAPRSFrames(m_gateway, entry.second, frames)) {
@ -176,12 +189,6 @@ void CAPRSWriter::clock(unsigned int ms)
}
}
for (auto it = m_array.begin(); it != m_array.end(); ++it) {
if(it->second != NULL)
it->second->clock(ms);
}
}
bool CAPRSWriter::isConnected() const
{
return m_thread->isConnected();

@ -65,7 +65,7 @@ private:
std::unordered_map<std::string,CAPRSEntry *> m_array;
CAPRSIdFrameProvider * m_idFrameProvider;
void sendIdFramesMobile();
void sendIdFrames();
};
#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.