Go to the documentation of this file.
40 #ifndef ECHOLINK_QSO_INCLUDED
41 #define ECHOLINK_QSO_INCLUDED
51 #include <sigc++/sigc++.h>
65 #include <AsyncTimer.h>
66 #include <AsyncIpAddress.h>
67 #include <AsyncAudioSink.h>
68 #include <AsyncAudioSource.h>
146 :
public sigc::trackable,
public Async::AudioSink,
public Async::AudioSource
186 Qso(
const Async::IpAddress& ip,
const std::string& callsign=
"",
187 const std::string& name=
"",
const std::string& info=
"");
202 bool initOk(
void) {
return init_ok; }
215 const std::string&
localCallsign(
void)
const {
return callsign; }
228 const std::string&
localName(
void)
const {
return name; }
241 const std::string&
localInfo(
void)
const {
return local_stn_info; }
301 const Async::IpAddress&
remoteIp(
void)
const
328 void setRemoteName(
const std::string& name) { remote_name = name; }
335 const std::string&
remoteName(
void)
const {
return remote_name; }
348 const std::string&
remoteCallsign(
void)
const {
return remote_call; }
427 virtual int writeSamples(
const float *samples,
int count);
471 static const int KEEP_ALIVE_TIME = 10000;
472 static const int MAX_CONNECT_RETRY_CNT = 5;
473 static const int CON_TIMEOUT_TIME = 50000;
474 static const int RX_INDICATOR_POLL_TIME = 100;
475 static const int RX_INDICATOR_SLACK = 100;
476 static const int RX_INDICATOR_MAX_TIME = 1000;
477 static const int FRAME_COUNT = 4;
478 static const int BUFFER_SIZE = FRAME_COUNT*160;
479 static const int BLOCK_TIME = FRAME_COUNT*1000*160/8000;
482 unsigned char sdes_packet[1500];
486 uint16_t next_audio_seq;
487 Async::Timer * keep_alive_timer;
488 int connect_retry_cnt;
489 Async::Timer * con_timeout_timer;
490 std::string callsign;
492 std::string local_stn_info;
493 short receive_buffer[BUFFER_SIZE];
494 short send_buffer[BUFFER_SIZE];
496 Async::IpAddress remote_ip;
497 Async::Timer * rx_indicator_timer;
498 std::string remote_name;
499 std::string remote_call;
500 bool is_remote_initiated;
501 bool receiving_audio;
507 Qso& operator=(
const Qso&);
508 void printData(
const unsigned char *buf,
int len);
509 void handleCtrlInput(
unsigned char *buf,
int len);
510 inline void handleByePacket(
unsigned char *buf,
int len);
511 inline void handleSdesPacket(
unsigned char *buf,
int len);
512 void handleAudioInput(
unsigned char *buf,
int len);
513 inline void handleNonAudioPacket(
unsigned char *buf,
int len);
514 inline void handleAudioPacket(
unsigned char *buf,
int len);
515 void micAudioRead(
void *buf,
size_t len);
516 bool sendSdesPacket(
void);
517 void sendKeepAlive(Async::Timer *timer);
518 void setState(
State state);
519 void connectionTimeout(Async::Timer *timer);
520 bool setupConnection(
void);
521 void cleanupConnection(
void);
522 bool sendVoicePacket(
void);
523 void checkRxActivity(Async::Timer *timer);
524 bool sendByePacket(
void);
virtual void resumeOutput(void)
Resume audio output to the sink.
sigc::signal< void, RawPacket * > audioReceivedRaw
A signal that is emitted when an audio datagram has been received.
const std::string & remoteCallsign(void) const
Get the remote callsign.
struct EchoLink::Qso::RawPacket __attribute__
Namespace to encapsulate EchoLink communication classes.
@ STATE_DISCONNECTED
No connection to the remote station.
sigc::signal< void, const std::string & > chatMsgReceived
A signal that is emitted when a chat message is received.
void setUseGsmOnly(void)
Setting GSM as only codec for echolink connections.
State currentState(void) const
Get the current state of the connection.
const std::string & localName(void) const
Retrieve the local name.
const Async::IpAddress & remoteIp(void) const
Get the IP address of the remote station.
bool accept(void)
Accept an incoming connection.
bool connect(void)
Initiate a connection to the remote station.
bool isRemoteInitiated(void) const
Find out if the connection is remotely initiated or locally initiated.
bool setLocalCallsign(const std::string &callsign)
Set the local callsign.
VoicePacket * voice_packet
@ STATE_BYE_RECEIVED
Received a disconnect request from remote station.
const std::string & remoteName(void) const
Get the remote name.
bool setLocalName(const std::string &name)
Set the local name (name of station operator)
bool sendInfoData(const std::string &info="")
Send info data to the remote station.
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
struct EchoLink::Qso::VoicePacket::@0 header
@ STATE_CONNECTING
Connecting to remote station (not established)
void setRemoteCallsign(const std::string &call)
Set the callsign of the remote station.
const std::string & localCallsign(void) const
Retrieve the local callsign.
bool sendAudioRaw(RawPacket *raw_packet)
Send a GSM/SPEEX audio packet to the remote station.
bool receivingAudio(void) const
Find out if there is audio coming in on this connection.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
bool disconnect(void)
Initiate a disconnection from the remote station.
bool initOk(void)
Check that the initialization went ok.
bool sendChatData(const std::string &msg)
Send chat data to the remote station.
sigc::signal< void, const std::string & > infoMsgReceived
A signal that is emitted when a station info message is received.
const std::string & localInfo(void) const
Retrieve the local station info.
@ STATE_CONNECTED
Connected to remote station.
sigc::signal< void, State > stateChange
A signal that is emitted when the connection state changes.
sigc::signal< void, bool > isReceiving
A signal that is emitted when the audio receive state changes.
Qso(const Async::IpAddress &ip, const std::string &callsign="", const std::string &name="", const std::string &info="")
Constructor.
void setLocalInfo(const std::string &info)
Set the local info.
State
The type of the connection state.
A class for creating an EchoLink connection.
void setRemoteParams(const std::string &priv)
Set parameters of the remote station connection.
void setRemoteName(const std::string &name)
Set the name of the remote station.