Exemplo n.º 1
0
void DtmfTheme::playTone(const std::string & key) const {

	const Tone * tone = getTone(key);
	if (!tone) {
		LOG_WARN("Could not find a tone for key '" + key + "'");
		return;
	}

	Config & config = ConfigManager::getInstance().getCurrentConfig();
	std::string soundfile = _repertory + tone->getSoundFile();

	if (tone->getLocalAction() == Tone::Play) {
		Sound::play(File::convertPathSeparators(soundfile),
					config.getAudioRingerDeviceId()
		);
	}

	if (tone->getRemoteAction() == Tone::Play) {
		UserProfile * userprofile =
			_wengoPhone.getUserProfileHandler().getCurrentUserProfile();
		if (userprofile) {
			IPhoneLine * iphoneline = userprofile->getActivePhoneLine();
			if (iphoneline) {
				PhoneCall * phonecall = iphoneline->getActivePhoneCall();
				if (phonecall) {
					
					if (tone->getAudioFormat() == Tone::Dtmf) {
						iphoneline->playDtmf(
							phonecall->getCallId(),
							(char)tone->getKey()[0]
						);
					} else {
						iphoneline->playSoundFile(
							phonecall->getCallId(),
							File::convertPathSeparators(soundfile)
						);
					}
				}
			}
		}
	}
}
Exemplo n.º 2
0
int main()
{
	const char *filename = "1.jpg";
	IplImage *pStroke = getStroke(filename);
	IplImage *pTone = getTone(filename);
	Image stroke(pStroke);
	Image tone(pTone);

	cvShowImage("stroke", pStroke);
	cvShowImage("tone", pTone);
	//合并stroke与tone两张图
	for (int i = 0; i < stroke.getH(); i++)
		for (int j = 0; j < stroke.getW(); j++)
			stroke[i][j] = (uchar) sqrt(stroke[i][j] * tone[i][j]);
	
	cvShowImage("result", pStroke);
	cvWaitKey();
	cvDestroyAllWindows();
	cvReleaseImage(&pStroke);
	cvReleaseImage(&pTone);
}
Exemplo n.º 3
0
void mythread ::run()
{
    bool bSended=false;
    //Ponemos todos los bits de los reles como salidas
    for (int n=0;n<m_bReles.count();n++)
        m_gpio.setOutput(m_bReles[n]);

    QSettings settings("/mnt/config/carta.ini",QSettings::IniFormat);
    setAllReles (settings.value ("reles/status").toInt());

//    for (int n=0;n<m_bReles.count();n++)
//        m_gpio.bitClear(m_bReles[n]);

    //Ponemos MOSI como salidas
    m_gpio.setOutput (MOSI);
    m_gpio.setInput  (MISO);
    m_gpio.setOutput (SCLK);
    m_gpio.setOutput (CS);

    m_gpio.setInput (STROBE);
    m_gpio.setInput(TONE_B3);
    m_gpio.setInput(TONE_B2);
    m_gpio.setInput(TONE_B1);
    m_gpio.setInput(TONE_B0);
    m_gpio.setInput(SIGNAL_IN);

    m_gpio.bitSet (MOSI);
    m_gpio.bitSet (SCLK);
    m_gpio.bitClear (CS);
    msleep(1);
    m_gpio.bitSet (CS);

    setAudio(true);

    float   sample=0;
    float   temp;
    int     msecs=1;

    quint8  antTone=0;

    while (1)
    {
        if (m_gpio.bitValue (STROBE))
        {
            quint8 tTone = getTone();

            if (antTone != tTone)
            {
                emit tone(tTone);
                antTone=tTone;
            }
        }
        else
        {
            antTone=0;
            if (--msecs == 0)
            {
                msecs=1;
                temp=0;
                //Leemos la temperatura
                for (int n=0;n<10;n++)
                {
                    sample = getSample (channel0);
                    temp += (((sample)*165)/819)-55;
                }
                emit temperature(temp/10);

                temp=0;
                for (int n=0;n<10;n++)
                {
                    sample= getSample (channel1);
                    temp += (((sample)*2)/819);
                }
                emit wats(temp/10);
            }
        }

        m_bSignalIn = m_gpio.bitValue(SIGNAL_IN);

        if (m_bSignalIn && bSended==false)
        {
            emit signalIn (true);
            bSended=true;
        }

        if (!m_bSignalIn && bSended==true)
        {
            emit signalIn (false);
            bSended=false;
        }
        msleep(100);
    }
}