EchoLib
1.3.3
|
A class for accessing an EchoLink directory server. More...
#include <EchoLinkDirectory.h>
Public Member Functions | |
Directory (const std::vector< std::string > &servers, const std::string &callsign, const std::string &password, const std::string &description="", const Async::IpAddress &bind_ip=Async::IpAddress()) | |
Constructor. More... | |
~Directory (void) | |
Destructor. More... | |
void | makeOnline (void) |
Login to the directory server and set status to online. More... | |
void | makeBusy (void) |
Login to the directory server and set status to busy. More... | |
void | makeOffline (void) |
Logout from the directory server. More... | |
void | refreshRegistration (void) |
Refresh the current registration in the directory server. More... | |
StationData::Status | status (void) const |
Return the current status of the registration. More... | |
std::string | statusStr (void) const |
Return the current status of the registration in string representation. More... | |
void | getCalls (void) |
Get the station list from the directory server. More... | |
void | setServers (const std::vector< std::string > &servers) |
Set the hostname or IP-address of the EchoLink servers to use. More... | |
const std::vector< std::string > & | servers (void) const |
Get the name of the remote host. More... | |
void | setCallsign (const std::string &callsign) |
Set the callsign to use when logging in to the server. More... | |
const std::string & | callsign (void) const |
Get the callsign that is used when logging in to the server. More... | |
void | setPassword (const std::string &password) |
Set the password to use when logging in to the server. More... | |
const std::string & | password (void) const |
Get the password that is used when logging in to the server. More... | |
void | setDescription (const std::string &description) |
Set the description to register in the server. More... | |
const std::string & | description (void) const |
Get the description that is used when registering in the server. More... | |
const std::list< StationData > & | links (void) const |
Get a list of all active links. More... | |
const std::list< StationData > & | repeaters (void) const |
Get a list of all active repeasters. More... | |
const std::list< StationData > & | conferences (void) const |
Get a list of all active conferences. More... | |
const std::list< StationData > & | stations (void) const |
Get a list of all active "normal" stations. More... | |
const std::string & | message (void) const |
Get the message returned by the directory server. More... | |
const StationData * | findCall (const std::string &call) |
Find a callsign in the station list. More... | |
const StationData * | findStation (int id) |
Find a station in the station list given a station ID. More... | |
void | findStationsByCode (std::vector< StationData > &stns, const std::string &code, bool exact=true) |
Find stations from their mapping code. More... | |
Public Attributes | |
sigc::signal< void, StationData::Status > | statusChanged |
A signal that is emitted when the registration status changes. More... | |
sigc::signal< void > | stationListUpdated |
A signal that is emitted when the station list has been updated. More... | |
sigc::signal< void, const std::string & > | error |
A signal that is emitted when an error occurs. More... | |
Static Public Attributes | |
static const unsigned | MAX_DESCRIPTION_SIZE = 27 |
A class for accessing an EchoLink directory server.
Use this class to access an EchoLink directory server. The primary purpose of the EchoLink directory server is to map between callsigns and IP-addresses. It is also used to see which stations are online. An example usage that lists all connected stations is shown below.
Definition at line 130 of file EchoLinkDirectory.h.
EchoLink::Directory::Directory | ( | const std::vector< std::string > & | servers, |
const std::string & | callsign, | ||
const std::string & | password, | ||
const std::string & | description = "" , |
||
const Async::IpAddress & | bind_ip = Async::IpAddress() |
||
) |
Constructor.
servers | The EchoLink directory servers to connect to |
callsign | The callsign to register in the server |
password | The password for the given callsign |
description | A description/location string |
bind_ip | The source IP address to use |
EchoLink::Directory::~Directory | ( | void | ) |
Destructor.
|
inline |
Get the callsign that is used when logging in to the server.
Definition at line 233 of file EchoLinkDirectory.h.
References setPassword().
|
inline |
Get a list of all active conferences.
Use this function to get a list of all active conferences. Conferences are stations where the callsign is surrounded with "*". For this function to return anything, a previous call to Directory::getCalls must have been made.
Definition at line 295 of file EchoLinkDirectory.h.
|
inline |
Get the description that is used when registering in the server.
Definition at line 261 of file EchoLinkDirectory.h.
Referenced by password().
const StationData* EchoLink::Directory::findCall | ( | const std::string & | call | ) |
Find a callsign in the station list.
call | The callsign to find |
Referenced by message().
const StationData* EchoLink::Directory::findStation | ( | int | id | ) |
Find a station in the station list given a station ID.
id | The ID to find |
Referenced by message().
void EchoLink::Directory::findStationsByCode | ( | std::vector< StationData > & | stns, |
const std::string & | code, | ||
bool | exact = true |
||
) |
Find stations from their mapping code.
stns | This list is filled in by this function |
code | The code to searh for |
exact | true if it should be an exact match or else false |
Find stations matching the given code. For a description of how the callsign to code mapping is done see
Referenced by message().
void EchoLink::Directory::getCalls | ( | void | ) |
Get the station list from the directory server.
Use this function to initiate a transfer of the station list from the directory server. When the list has been completely transfered the Directory::stationListUpdated signal will be emitted. If this function is called while a previous getCalls is in progress, the request will be ignored.
After the transfer is done. There may be a server message to read. Get this message by using the Directory::message function.
Referenced by statusStr().
|
inline |
Get a list of all active links.
Use this function to get a list of all active links. Links are stations where the callsign end with "-L". For this function to return anything, a previous call to Directory::getCalls must have been made.
Definition at line 271 of file EchoLinkDirectory.h.
void EchoLink::Directory::makeBusy | ( | void | ) |
Login to the directory server and set status to busy.
Use this function to login to the directory server and set the status to busy. The registration will automatically be refreshed to keep the registration from timing out.
void EchoLink::Directory::makeOffline | ( | void | ) |
Logout from the directory server.
void EchoLink::Directory::makeOnline | ( | void | ) |
Login to the directory server and set status to online.
Use this function to login to the directory server and set the status to online. The registration will automatically be refreshed to keep the registration from timing out.
|
inline |
Get the message returned by the directory server.
This function is used to get the message returned by the directory server after getting the station list. It is valid until a getCalls function call is made again.
Definition at line 314 of file EchoLinkDirectory.h.
References findCall(), findStation(), and findStationsByCode().
|
inline |
Get the password that is used when logging in to the server.
Definition at line 245 of file EchoLinkDirectory.h.
References description(), and setDescription().
|
inline |
Refresh the current registration in the directory server.
Definition at line 179 of file EchoLinkDirectory.h.
|
inline |
Get a list of all active repeasters.
Use this function to get a list of all active repeaters. Repeaters are stations where the callsign end with "-R". For this function to return anything, a previous call to Directory::getCalls must have been made.
Definition at line 281 of file EchoLinkDirectory.h.
|
inline |
Get the name of the remote host.
Definition at line 221 of file EchoLinkDirectory.h.
References setCallsign().
void EchoLink::Directory::setCallsign | ( | const std::string & | callsign | ) |
Set the callsign to use when logging in to the server.
callsign | The new callsign to use |
Referenced by servers().
void EchoLink::Directory::setDescription | ( | const std::string & | description | ) |
Set the description to register in the server.
description | The new description to use |
Use this function to set the description used when registering in the directory server. The description will not be updated in the directory server until makeOnline, makeBusy or refreshRegistration is called.
Referenced by password().
void EchoLink::Directory::setPassword | ( | const std::string & | password | ) |
Set the password to use when logging in to the server.
password | The new password to use |
Referenced by callsign().
void EchoLink::Directory::setServers | ( | const std::vector< std::string > & | servers | ) |
Set the hostname or IP-address of the EchoLink servers to use.
servers | The new servers to use |
Referenced by statusStr().
|
inline |
Get a list of all active "normal" stations.
Definition at line 304 of file EchoLinkDirectory.h.
|
inline |
Return the current status of the registration.
Definition at line 185 of file EchoLinkDirectory.h.
|
inline |
Return the current status of the registration in string representation.
Definition at line 192 of file EchoLinkDirectory.h.
References getCalls(), setServers(), and EchoLink::StationData::statusStr().
sigc::signal<void, const std::string&> EchoLink::Directory::error |
A signal that is emitted when an error occurs.
msg | The error message |
Definition at line 360 of file EchoLinkDirectory.h.
|
static |
Definition at line 133 of file EchoLinkDirectory.h.
sigc::signal<void> EchoLink::Directory::stationListUpdated |
A signal that is emitted when the station list has been updated.
Definition at line 354 of file EchoLinkDirectory.h.
sigc::signal<void, StationData::Status> EchoLink::Directory::statusChanged |
A signal that is emitted when the registration status changes.
status | The new status |
Definition at line 349 of file EchoLinkDirectory.h.