File indexing completed on 2024-04-28 03:50:13

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Wes Hardaker <hardaker@users.sourceforge.net>
0004 //
0005 
0006 #ifndef APRSSOURCE_H
0007 #define APRSSOURCE_H
0008 
0009 class QIODevice;
0010 class QString;
0011 
0012 namespace Marble {
0013 
0014     class AprsGatherer;
0015 
0016     class AprsSource {
0017       public:
0018         explicit AprsSource( QIODevice *insocket = nullptr );
0019         virtual ~AprsSource();
0020 
0021         virtual QIODevice *openSocket() = 0;
0022         virtual QString sourceName() const = 0;
0023 
0024         QIODevice *socket();
0025         void       setSocket( QIODevice * );
0026 
0027         // @brief Checks the results of an executed read() code.
0028         //
0029         // Checks the results of read() return code specified in @p
0030         // length from the socket created by this source to see if the
0031         // socket needs to be reopened.  If it needs to be reopened a
0032         // new socket will be placed into the @p socket pointer.  
0033         // @p gatherer should be a pointer to the gatherer that called
0034         // the function and implements a thread-safe sleep().
0035         virtual void       checkReadReturn( int length, QIODevice **socket,
0036                                             AprsGatherer *gatherer ) = 0;
0037 
0038         // Specifies whether or not this type of source can directly
0039         // hear the transmitting station.  Only sources for devices
0040         // that are actually capable of receiving radio signals will
0041         // return true.
0042         virtual bool       canDoDirect() const = 0;
0043 
0044       private:
0045         QIODevice *m_socket;
0046     };
0047 
0048 }
0049 
0050 
0051 #endif /* APRSSOURCE_H */