#8 Move sending of id frames to own function

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

@ -163,16 +163,8 @@ void CAPRSWriter::clock(unsigned int ms)
if(m_idFrameProvider != nullptr) {
m_idFrameProvider->clock(ms);
if(m_idFrameProvider->wantsToSend() && m_thread->isConnected()) {
for(auto entry : m_array) {
std::vector<std::string> frames;
if(m_idFrameProvider->buildAPRSFrames(m_gateway, entry.second, frames)) {
for(auto frame : frames) {
m_thread->write(frame.c_str());
}
}
}
if(m_idFrameProvider->wantsToSend()) {
sendIdFrames();
}
}
@ -182,6 +174,21 @@ void CAPRSWriter::clock(unsigned int ms)
}
}
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)) {
for(auto frame : frames) {
m_thread->write(frame.c_str());
}
}
}
}
}
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.