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=
"");
 
  228    const std::string& 
localName(
void)
 const { 
return name; }
 
  241    const std::string& 
localInfo(
void)
 const { 
return local_stn_info; }
 
  335    const std::string& 
remoteName(
void)
 const { 
return remote_name; }
 
  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);
 
 
 
A class for creating an EchoLink connection.
const std::string & localName(void) const
Retrieve the local name.
bool accept(void)
Accept an incoming connection.
bool isRemoteInitiated(void) const
Find out if the connection is remotely initiated or locally initiated.
sigc::signal< void, State > stateChange
A signal that is emitted when the connection state changes.
bool disconnect(void)
Initiate a disconnection from the remote station.
bool sendAudioRaw(RawPacket *raw_packet)
Send a GSM/SPEEX audio packet to the remote station.
virtual void resumeOutput(void)
Resume audio output to the sink.
bool sendChatData(const std::string &msg)
Send chat data to the remote station.
const std::string & localCallsign(void) const
Retrieve the local callsign.
const std::string & remoteName(void) const
Get the remote name.
sigc::signal< void, const std::string & > infoMsgReceived
A signal that is emitted when a station info message is received.
struct EchoLink::Qso::RawPacket __attribute__
void setRemoteParams(const std::string &priv)
Set parameters of the remote station connection.
State currentState(void) const
Get the current state of the connection.
sigc::signal< void, bool > isReceiving
A signal that is emitted when the audio receive state changes.
void setLocalInfo(const std::string &info)
Set the local info.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
const std::string & localInfo(void) const
Retrieve the local station info.
const std::string & remoteCallsign(void) const
Get the remote callsign.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
sigc::signal< void, RawPacket * > audioReceivedRaw
A signal that is emitted when an audio datagram has been received.
const Async::IpAddress & remoteIp(void) const
Get the IP address of the remote station.
bool sendInfoData(const std::string &info="")
Send info data to the remote station.
void setRemoteName(const std::string &name)
Set the name of the remote station.
bool setLocalName(const std::string &name)
Set the local name (name of station operator)
Qso(const Async::IpAddress &ip, const std::string &callsign="", const std::string &name="", const std::string &info="")
Constructor.
bool initOk(void)
Check that the initialization went ok.
bool setLocalCallsign(const std::string &callsign)
Set the local callsign.
void setRemoteCallsign(const std::string &call)
Set the callsign of the remote station.
State
The type of the connection state.
@ STATE_DISCONNECTED
No connection to the remote station.
@ STATE_BYE_RECEIVED
Received a disconnect request from remote station.
@ STATE_CONNECTING
Connecting to remote station (not established)
@ STATE_CONNECTED
Connected to remote station.
void setUseGsmOnly(void)
Setting GSM as only codec for echolink connections.
bool connect(void)
Initiate a connection to the remote station.
bool receivingAudio(void) const
Find out if there is audio coming in on this connection.
sigc::signal< void, const std::string & > chatMsgReceived
A signal that is emitted when a chat message is received.
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
Namespace to encapsulate EchoLink communication classes.
VoicePacket * voice_packet
struct EchoLink::Qso::VoicePacket::@0 header