EchoLinkStationData.h
Go to the documentation of this file.00001
00030 #ifndef ECHOLINK_STATION_DATA_INCLUDED
00031 #define ECHOLINK_STATION_DATA_INCLUDED
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <netinet/in.h>
00041
00042 #include <string>
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include <AsyncIpAddress.h>
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 namespace EchoLink
00077 {
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00108 class StationData
00109 {
00110 public:
00114 typedef enum
00115 {
00116 STAT_UNKNOWN,
00117 STAT_OFFLINE,
00118 STAT_ONLINE,
00119 STAT_BUSY
00120 } Status;
00121
00122 static const int MAXCALL = 15;
00123 static const int MAXDATA = 45;
00124 static const int MAXDESC = 27;
00125 static const int MAXID = 7;
00126 static const int MAXIP = 20;
00127
00133 static std::string statusStr(Status status);
00134
00138 StationData(void);
00139
00143 StationData(const StationData& rhs) { *this = rhs; }
00144
00148 void clear(void);
00149
00154 void setCallsign(const std::string& callsign);
00155
00160 const std::string& callsign(void) const { return m_callsign; }
00161
00173 void setData(const char *data);
00174
00179 void setStatus(Status status) { m_status = status; }
00180
00185 Status status(void) const { return m_status; }
00186
00191 std::string statusStr(void) const { return statusStr(m_status); }
00192
00197 void setTime(const std::string& time) { m_time = time; }
00198
00203 const std::string& time(void) const { return m_time; }
00204
00209 void setDescription(const std::string& desc) { m_description = desc; }
00210
00215 const std::string& description(void) const { return m_description; }
00216
00221 void setId(int id) { m_id = id; }
00222
00227 int id(void) const { return m_id; }
00228
00233 void setIp(const Async::IpAddress& ip) { m_ip = ip; }
00234
00239 const Async::IpAddress ip(void) const { return m_ip; }
00240
00245 std::string ipStr(void) const { return m_ip.toString(); }
00246
00259 std::string code(void) const { return m_code; }
00260
00266 StationData& operator=(const StationData& rhs);
00267
00273 friend std::ostream& operator<<(std::ostream& os,
00274 const StationData& station);
00275
00276
00277 protected:
00278
00279 private:
00280 std::string m_callsign;
00281 Status m_status;
00282 std::string m_time;
00283 std::string m_description;
00284 int m_id;
00285 Async::IpAddress m_ip;
00286 std::string m_code;
00287
00288 void removeTrailingSpaces(std::string& str);
00289 std::string callToCode(const std::string& call);
00290
00291 };
00292
00293
00294 }
00295
00296 #endif
00297
00298
00299
00300
00301
00302
00303