Example #1
0
Transmitter::Transmitter(Recorder *rec, Rsa *r)
	: recorder(rec), rsa(r)
{
	setName("Transmitter");
	s = -1;
	salen = sizeof(sa);
	total = bytes = 0;
	rate = 0;
	outFile = NULL;
	state = NULL;
	blowfish = NULL;
	speexmode = 0;
	_enable_sctp = false;
	ready = 0;
	working = false;
	recording = false;
	ringing = false;
	transmitting = false;
	readBuffer = NULL;

	ttl = 100;

	if ((out = (char *) malloc(MAXBUFSIZE))==NULL)
		throw Error(Error::DRTA_ERR_MEMORY);
	if ((buffer = (float *) malloc(MAXBUFSIZE*sizeof(float)))==NULL)
		throw Error(Error::DRTA_ERR_MEMORY);
	if ((prebuffer = (float *) malloc(REC_BUFSIZE*sizeof(float)))==NULL)
		throw Error(Error::DRTA_ERR_MEMORY);
	timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(sendRing()));
	connect(recorder, SIGNAL(data(float*, int)), this, SLOT(processData(float*,int)));
	status = TRANSMITTER_STATUS_WAITING;
}
Example #2
0
// renyang - 要撥打出去的電話(ip address, port, protype)
void Call::call(QString host, int port, int prot)
{
#ifdef REN_DEBUG
	qWarning(QString("Call::call(QString %1, int %2, int %3)").arg(host).arg(port).arg(prot));
#endif
	try
	{
		readyFrames = 0;
		// renyang-modify - 設定stream no
		transmitter->setStreamNo(streamno);
		// renyang - 由transmitter連線到server端, 回傳表示peer端的socket
		sd = transmitter->call(host, port, prot);
		// renyang - 接收端開始接收由對方回傳的資料並且判斷對方的動作
		// renyang - 開始查看是否有新的資料由peer端傳送過來
		receiver->start(sd, prot);
		// renyang-modify - 開始計時啦
		sctpiphandler->start();
		// renyang - 送出響鈴的封包
		sendRing(true);
		callFree = false;
		active = true;
		aborted = false;
	}
	catch (Error e)
	{
		aborted = true;
		e.setCallId(id);
		throw e;
	}
}
Example #3
0
// renyang - 連線成功(不論是本地端接受通話或是遠端接受通話)
void Call::connected()
{
#ifdef REN_DEBUG
	qWarning("Call::connected()");
#endif
	// renyang - 連線成功就不需要ring啦
	sendRing(false);
	// renyang - 告知Phone,目前此Call id連線成功啦
	emit connectedSignal(id);
	emit warning(QString("Connected with %1 (%2)").arg(getCallerName()).arg(getCallerIp()));
}
Example #4
0
void Transmitter::ring(bool on)
{
	if (on)
	{
		transmitting = false;
		ringing = true;
		sendRing();
	}
	else
	{
		ringing = false;
	}
}
Example #5
0
Transmitter::Transmitter(Rsa *r) : rsa(r)
{
#ifdef REN_DEBUG
	qWarning(QString("Transmitter::Transmitter(Rsa *r):rsa(r)"));
#endif
	setName("Transmitter");
	salen = sizeof(sa);
	outFile = NULL;
	blowfish = NULL;
	crypted = false;
	timer = new QTimer(this);
	reset();
	connect(timer, SIGNAL(timeout()), this, SLOT(sendRing()));
}
Example #6
0
// renyang - 請傳送出去, 叫對方送出鈴聲
void Transmitter::ring(bool on)
{
#ifdef REN_DEBUG
	qWarning(QString("Transmitter::ring(bool %1)").arg(on));
#endif
	if (on)
	{
		tx = false;
		ringing = true;
		sendRing();
	}
	else
	{
		ringing = false;
	}
}
Example #7
0
void Call::stop()
{
#ifdef REN_DEBUG
	qWarning("Call::stop()");
#endif
	if (active)
	{
		active = false;
		recording = false;
		sendRing(false);
		// renyang - 隔一段時間之後, 才正真close掉
		stopTimer->start(STOP_TIME, true);
		transmitter->end();
		receiver->end();
		// renyang-modify - 把所有的iphander內的資料全部清掉
		sctpiphandler->end();
		// renyang-modify - 初始化stream no
		resetStream();
	}
}
Example #8
0
void HL1606::setRing(unsigned char *buffer, int start, int len) {
  sendRing(buffer, start, len, _LEDCount);
  latch();
}