40 #ifndef ECHOLINK_QSO_INCLUDED
41 #define ECHOLINK_QSO_INCLUDED
51 #include <sigc++/sigc++.h>
55 #include <speex/speex.h>
68 #include <AsyncTimer.h>
69 #include <AsyncIpAddress.h>
70 #include <AsyncAudioSink.h>
71 #include <AsyncAudioSource.h>
149 :
public SigC::Object,
public Async::AudioSink,
public Async::AudioSource
189 Qso(
const Async::IpAddress& ip,
const std::string& callsign=
"",
190 const std::string& name=
"",
const std::string& info=
"");
231 const std::string&
localName(
void)
const {
return name; }
244 const std::string&
localInfo(
void)
const {
return local_stn_info; }
338 const std::string&
remoteName(
void)
const {
return remote_name; }
430 virtual int writeSamples(
const float *samples,
int count);
465 static const int KEEP_ALIVE_TIME = 10000;
466 static const int MAX_CONNECT_RETRY_CNT = 5;
467 static const int CON_TIMEOUT_TIME = 50000;
468 static const int RX_INDICATOR_HANG_TIME = 200;
469 static const int FRAME_COUNT = 4;
470 static const int BUFFER_SIZE = FRAME_COUNT*160;
480 unsigned char sdes_packet[1500];
490 uint16_t next_audio_seq;
491 Async::Timer * keep_alive_timer;
492 int connect_retry_cnt;
493 Async::Timer * con_timeout_timer;
494 std::string callsign;
496 std::string local_stn_info;
497 short receive_buffer[BUFFER_SIZE];
498 short send_buffer[BUFFER_SIZE];
500 Async::IpAddress remote_ip;
501 Async::Timer * rx_indicator_timer;
502 struct timeval last_audio_packet_received;
503 std::string remote_name;
504 std::string remote_call;
506 bool is_remote_initiated;
507 bool receiving_audio;
510 Qso& operator=(
const Qso&);
511 void printData(
const unsigned char *buf,
int len);
512 void handleCtrlInput(
unsigned char *buf,
int len);
513 inline void handleByePacket(
unsigned char *buf,
int len);
514 inline void handleSdesPacket(
unsigned char *buf,
int len);
515 void handleAudioInput(
unsigned char *buf,
int len);
516 inline void handleNonAudioPacket(
unsigned char *buf,
int len);
517 inline void handleAudioPacket(
unsigned char *buf,
int len);
518 void micAudioRead(
void *buf,
size_t len);
519 bool sendSdesPacket(
void);
520 void sendKeepAlive(Async::Timer *timer);
521 void setState(
State state);
522 void connectionTimeout(Async::Timer *timer);
523 bool setupConnection(
void);
524 void cleanupConnection(
void);
525 bool sendVoicePacket(
void);
526 void checkRxActivity(Async::Timer *timer);
527 bool sendByePacket(
void);