char *
profile_get_type (
    const char *key)
{
    const QString  myKey = key;
    const char   *retval = NULL;

    SYS_WARNING ("*** key = %s", SYS_STR(myKey));
    if (myKey.endsWith(".tone"))
        retval = "SOUNDFILE";
    else if (myKey == "clock.alarm.enabled")
        retval = "BOOLEAN";
    else if (myKey == "ringing.alert.type")
        retval = "STRING \"Ringing\" \"Silent\" \"Beep\"";
    else if (myKey == "ringing.alert.volume")
        retval = "INTEGER 0-100";
    else if (myKey == "system.sound.level")
        retval = "INTEGER 0-3";
    else if (myKey == "clock.alarm.enabled")
        retval = "BOOLEAN";
    else if (myKey == "ringing.alert.type")
        retval = "STRING \"Ringing\" \"Silent\" \"Beep\"";
    else if (myKey == "ringing.alert.volume")
        retval = "INTEGER 0-100";

    if (!retval) {
        SYS_WARNING ("The stub does not know about this key. %s",
                     SYS_STR(myKey));
        retval = "";
    }

    return strdup (retval);
}
コード例 #2
0
QString
SoundSettings::saveFile (
        const QString &filePath)
{
    QFile         sourceFile (filePath);
    QString       baseDir;
    QString       fileName;
    QString       xmlFileName;
    QString       retval = filePath;
    QDir          baseDirectory;
    QString       targetFilePath;

    suggestedTargetFilePath (filePath, baseDir, fileName, xmlFileName);

    SYS_DEBUG ("*** baseDir  = %s", SYS_STR(baseDir));
    SYS_DEBUG ("*** fileName = %s", SYS_STR(fileName));
    baseDirectory = QDir (baseDir);
    if (!baseDirectory.exists()) {
        if (!QDir::root().mkpath(baseDir)) {
            SYS_WARNING ("ERROR: mkdir(%s) failed.", SYS_STR(baseDir));
            goto finalize;
        }
    }

    targetFilePath =
        baseDir + QDir::separator() + fileName;
    xmlFileName =
        baseDir + QDir::separator() + xmlFileName;

    if (QFile(targetFilePath).exists()) {
        SYS_DEBUG ("The file '%s' already exists.", SYS_STR(targetFilePath));
        retval = targetFilePath;
        goto finalize;
    }

    if (sourceFile.copy(targetFilePath)) {
        SYS_DEBUG ("File copy to %s success.", SYS_STR(targetFilePath));
        retval = targetFilePath;
    } else {
        SYS_WARNING ("ERROR: Unable to copy %s -> %s: %m",
                SYS_STR(filePath),
                SYS_STR(targetFilePath));
    }

finalize:
    if (retval != filePath) {
        TrackerConnection *tracker = TrackerConnection::instance();
        QString title;

        tracker->registerFileCopy (filePath, retval);
        title = tracker->niceNameFromFileName (filePath);
        saveXML (xmlFileName, filePath, retval, title);
    }

    return retval;
}
コード例 #3
0
QStringList
SoundSettings::customAlertToneDirs ()
{
    QDir                   directory (SoundSettings::OptDir);
    QStringList            dirNameList;
    QStringList            retval;

    if (!directory.exists(SoundSettings::OptDir))
        return retval;

    dirNameList = directory.entryList (QDir::Dirs | QDir::NoDotAndDotDot);
    SYS_WARNING ("*** dirNameList = %s", SYS_STR(dirNameList.join(";")));

    foreach (QString base, dirNameList) {
        QString path = 
            SoundSettings::OptDir +
            QDir::separator () + 
            base +
            DEFAULT_RINGTONE_PATH1;
        QDir    dir (path);

        if (dir.exists()) {
            SYS_DEBUG ("exists     : %s", SYS_STR(path));
            retval << path;
        } else {
            SYS_DEBUG ("not exists : %s", SYS_STR(path));
        }
    }
コード例 #4
0
ファイル: flash_main.c プロジェクト: NearZhxiAo/3730
void sig_handle_proc(int sig)
{
	SYS_WARNING("Flash Rcv Signo=%d\r\n",sig);
	IsFlashSysQuit = 1;
	flash_exit(&global_flash_private_handle);
	exit(0);
}
コード例 #5
0
void
AlertTonePreview::gstSignalHandler (
    GstBus              *bus,
    GstMessage          *msg,
    AlertTonePreview    *atp)
{
    Q_UNUSED (bus);

    if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR)
    {
        GError *err = NULL;
        char *debug = NULL;

        gst_message_parse_error (msg, &err, &debug);
        SYS_WARNING ("\nfrom '%s'\ntype '%s'\n'error '%s'\ndebug '%s'",
                     GST_MESSAGE_SRC_NAME (msg), GST_MESSAGE_TYPE_NAME (msg),
                     (err && err->message) ? err->message : "Unknown error",
                     debug ? debug : "empty");

        g_error_free(err);
        g_free(debug);
    }
    else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS)
        atp->rewind ();
}
コード例 #6
0
ファイル: test_sd.c プロジェクト: NearZhxiAo/3730
int main(int argc ,char **argv)
{
	FILE * fpin = NULL;	
	FILE * fpout = NULL;	
	int iRet = -1;	
	char ain[SD_WRITTEN_NUM] = "";

	memset(ain, 0x01, SD_WRITTEN_NUM);
	system("echo 'Hello' ");

	fpin = fopen("/mnt/mmc/sd_test","wb+");
	if(NULL == fpin)
	{
		SYS_ERROR("fpin fopen failed !!filename = %s\r\n fpin = 0x%x\r\n","/mnt/mmc/sd_test",fpin);
		return -1;
	}
	if((iRet = fwrite(ain, 1, SD_WRITTEN_NUM, fpin)) <0)	
	{
		SYS_ERROR("fpin fwrite failed !! iRet = 0x%x\r\n",iRet);
		return -1;
	}
	SYS_WARNING("fwrite %d b\r\n",iRet);
	fclose(fpin);
	return 0;
}
コード例 #7
0
/*!
 * Please note: In this function we return a value based on the role parameter
 * and we are not using the column number from the index. Well, it works...
 */
QVariant
ThemeListModel::data (
		const QModelIndex &index, 
		int                role) const
{    
    if (index.row() < 0 || index.row() >= m_ThemeDescList.size())
        return QVariant();

    ThemeDescriptor *desc = m_ThemeDescList[index.row()];
   
    switch (role) {
        case Qt::DisplayRole:
            return QVariant (desc->name());

        case ThemeListModel::SearchRole:
            return QVariant (desc->name());

        case ThemeListModel::CodeNameRole:
            return QVariant(desc->codeName());

        case ThemeListModel::NameRole:
            return QVariant(desc->name());
        
        case ThemeListModel::IconNameRole:
            return QVariant(desc->iconName());
            
        case ThemeListModel::ChangingNameRole:
            return QVariant (m_ChangingTheme);

        default:
            SYS_WARNING ("Unhandled role: %d", role);
            return QVariant();
    }
}
void
WarrantyWidget::initialize ()
{
    QSettings content (configFile, QSettings::IniFormat);

    m_warrantyTimer =
        content.value ("warrantytimer", true).toBool ();
    m_warrantyText =
        content.value ("warrantytext", "qtn_warr_terms").toString ();

    SYS_DEBUG ("show warranty timer = %s", SYS_BOOL (m_warrantyTimer));
    SYS_DEBUG ("warranty_text = %s", SYS_STR (m_warrantyText));

    if (! m_warrantyText.isEmpty ())
    {
        if (m_warrantyText.contains ("qtn_"))
            m_warrantyText = qtTrId (m_warrantyText.toAscii ().constData ());
        else
        {
            QFile warrantyFile (configPath + m_warrantyText);
            if (warrantyFile.open (QIODevice::ReadOnly | QIODevice::Text))
            {
                QTextStream inStream (&warrantyFile);
                m_warrantyText = inStream.readAll ();
            }
            else
            {
                SYS_WARNING ("Warranty text cannot be loaded!");
                m_warrantyText = "";
            }
        }
    }
}
コード例 #9
0
ファイル: flash_main.c プロジェクト: NearZhxiAo/3730
void flash_updatethread_func(void * arg)
{
	FLASH_PRIVATE_HANDLE * phandle = (FLASH_PRIVATE_HANDLE *)arg;
	FLASH_OPT_FLAG opt_flag = FLASH_OPT_START;
	while(0 == IsFlashSysQuit)
	{
		sleep(2);
		opt_flag = FLASH_OPT_START;
		get_saveparam_flag(phandle,&opt_flag);
		switch(opt_flag)
		{
			case FLASH_OPT_START:
			case FLASH_OPT_END:
				break;
			case FLASH_OPT_SAVE:
				SYS_WARNING("get_saveparam_flag rcv FLASH_OPT_SAVE opt!");
				flash_para_save(phandle);
				break;
			case FLASH_OPT_CLEAR:
				//flash_set_default();
				break;
			default:
				SYS_INFO("get_saveparam_flag rcv Nodefine opt!");
				break;
		}
	}
	pthread_exit(NULL);
}
void
BatteryBusinessLogic::setPSMValue (
        bool enabled)
{
    bool ret = false;

    #ifdef HAVE_QMSYSTEM
    ret = m_devicemode->setPSMState (
        enabled ?
        QmDeviceMode::PSMStateOn :
        QmDeviceMode::PSMStateOff);
    #else
    /*
     * FIXME: To implement the setting of the power save mode without the help
     * of the QmSystem library.
     */
    #endif

    if (ret) {
        // Change succeed, we don't need to wait for QmSystem reply, we can emit
        // the PSMValueChanged asap to update the UI.
        SYS_DEBUG ("Emitting PSMValueReceived(%s)", SYS_BOOL(enabled));
        emit PSMValueReceived (enabled);
    } else {
        SYS_WARNING ("Failed to set PSM mode to %s",
                enabled ? 
                "QmDeviceMode::PSMStateOn" : "QmDeviceMode::PSMStateOff");
    }
}
 int
 profile_get_value_as_int (const char *profile, const char *key)
 {
     SYS_WARNING ("");
     Q_UNUSED (profile);
     Q_UNUSED (key);
     return stub_volumelevel;
 }
 int
 profile_get_value_as_bool (const char *profile, const char *key)
 {
     SYS_WARNING ("");
     Q_UNUSED (profile);
     Q_UNUSED (key);
     return stub_vibration;
 }
コード例 #13
0
bool
SoundSettings::loadXML (
        const QString   &xmlFileName,
        QString         &origFileName,
        QString         &copyFileName,
        QString         &title)
{
    QFile            *file = 0;
    QXmlStreamReader *xml  = 0;
    bool              retval = false;
    QStringList       names;

    SYS_DEBUG ("*** xmlFileName = %s", SYS_STR(xmlFileName));
    file = new QFile(xmlFileName);

    if (!file || !file->open(QIODevice::ReadOnly | QIODevice::Text))
    {
        SYS_WARNING ("Can not open '%s' for reading: %m",
                SYS_STR(xmlFileName));
        goto finalize;
    }

    xml = new QXmlStreamReader(file);
    while(!xml->atEnd() && !xml->hasError()) {
        QString name(xml->name().toString());

        #if 0
        SYS_DEBUG ("*************************************");
        SYS_DEBUG ("*** name: %s", SYS_STR(name));
        SYS_DEBUG ("*** lineNumber : %d", xml->lineNumber());
        #endif

        if (xml->isStartElement()) {
            names << xml->name().toString();
        } else if (xml->isEndElement()) {
            names.removeLast();
        } else if (xml->isCharacters()) {
            QString path = names.join("/");

            if (path == "soundsettings-applet/orig-file")
                origFileName = xml->text().toString();
            else if (path == "soundsettings-applet/copy-file")
                copyFileName = xml->text().toString();
            else if (path == "soundsettings-applet/title")
                title = xml->text().toString();
        }

        xml->readNext();
    }

finalize:
    if (xml)
        delete xml;
    if (file)
        delete file;

    return retval;
}
コード例 #14
0
void
AlertTonePreview::rewind ()
{
    SYS_DEBUG ("");
    if (!gst_element_seek_simple (
           m_gstPipeline, GST_FORMAT_TIME,
           (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), 0l))
        SYS_WARNING ("seek failed");
}
    int
    profile_set_value_as_int (const char *profile, const char *key, int val)
    {
        SYS_WARNING ("");
        Q_UNUSED (profile);
        Q_UNUSED (key);
        stub_volumelevel = val;

        return 0;
    }
    int
    profile_set_value_as_bool (const char *profile, const char *key, int val)
    {
        SYS_WARNING ("");
        Q_UNUSED (profile);
        Q_UNUSED (key);
        stub_vibration = val;

        return 0;
    }
    int
    profile_set_profile (const char *profile)
    {
        SYS_WARNING ("");
        if (stub_active_profile != NULL)
            delete[] stub_active_profile;

        stub_active_profile = qstrdup (profile);

        return 0;
    }
コード例 #18
0
void 
GridImageWidget::createLayout()
{
    if (m_Layout) {
        SYS_WARNING ("Layout already created.");
        return;
    }

    m_Layout = new GridImageLayout(this);
    m_Layout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
    setLayout (m_Layout);
}
コード例 #19
0
void
AlertTonePreview::gstInit ()
{
    GError *err = NULL;
    GstBus *bus = NULL;
    SYS_DEBUG ("*** fname = %s", SYS_STR (m_Filename));
    SYS_DEBUG ("Starting the playback.");

    m_gstPipeline = gst_parse_launch (GstStartCommand, &err);
    if (err)
    {
        SYS_WARNING ("ERROR from gst_parse_launch: %s",
        err->message ? err->message : "Unknown error");
        g_error_free(err);
        goto finalize;
    }

    if (m_gstVolume)
    {
        // Unref the previous one if any
        gst_object_unref (m_gstVolume);
        m_gstVolume = NULL;
    }

    m_gstVolume = gst_bin_get_by_name (GST_BIN (m_gstPipeline), "alerttonepreviewvolume");
    m_gstFilesrc = gst_bin_get_by_name (GST_BIN (m_gstPipeline), "alerttonepreviewfilesrc");

    g_object_set (G_OBJECT (m_gstVolume),
                  "volume", profileToGstVolume(),
                   NULL);

    if (m_gstFilesrc)
    {
        g_object_set (G_OBJECT (m_gstFilesrc),
                      "location", m_Filename.toUtf8().constData(),
                      NULL);
        gst_object_unref (m_gstFilesrc);
        m_gstFilesrc = NULL;
    }

    bus = gst_element_get_bus (m_gstPipeline);
    gst_bus_add_signal_watch (bus);
    g_signal_connect (G_OBJECT (bus),
                      "message", (GCallback) gstSignalHandler, this);
    gst_object_unref (bus);

finalize:
    connect (&m_profileVolume, SIGNAL (changed ()),
             SLOT (profileVolumeChanged ()));
}
コード例 #20
0
void
SoundSettings::saveXML (
        const QString   &xmlFileName,
        const QString   &origFileName,
        const QString   &copyFileName,
        const QString   &title)
{
    QXmlStreamWriter *writer;
    QFile             file (xmlFileName);

    SYS_DEBUG ("-----------------------------------------------------");
    SYS_DEBUG ("*** xmlFileName = %s", SYS_STR(xmlFileName));

    if (!file.open(QIODevice::WriteOnly)) {
        SYS_WARNING ("Unable to open file for writing: %s",
                SYS_STR(xmlFileName));
        return;
    }

    /*
     *
     */
    writer = new QXmlStreamWriter();
    writer->setDevice (&file);
    writer->setAutoFormatting(true);
    writer->setCodec ("UTF-8");
    writer->writeStartDocument ();
    writer->writeStartElement ("soundsettings-applet");

    writer->writeStartElement("orig-file");
        writer->writeCharacters (origFileName);
    writer->writeEndElement ();

    writer->writeStartElement("copy-file");
        writer->writeCharacters (copyFileName);
    writer->writeEndElement ();

    writer->writeStartElement("title");
        writer->writeCharacters (title);
    writer->writeEndElement ();

    /*
     *
     */
    writer->writeEndElement();
    writer->writeEndDocument();

    delete writer;
    file.close ();
}
void
ProfileBackend::changeProfileValue (
    const char      *profile,
    const char      *key,
    const char      *value)
{
#ifdef HAVE_LIBPROFILE
    QString profileName = profile;

    if (m_profileVolumes.value (profileName, -1) < 0)
    {
        SYS_WARNING ("Invalid profile: %s, ignoring...", profile);
        return;
    }

    if (qstrcmp (keyVolume, key) == 0)
    {
        int volume = profile_parse_int (value);

        m_profileVolumes[profileName] = volume;

        emit volumeSettingChanged (profileName, volume);
    }
    else if (qstrcmp (keyVibration, key) == 0)
    {
        bool vibration = profile_parse_bool (value);

        m_profileVibrations[profileName] = vibration;

        emit vibrationSettingChanged (profileName, vibration);
    }
    else
    {
        SYS_WARNING ("Error, invalid key: %s", key);
    }
#endif
}
void
Ut_AlertToneTests::initTestCase()
{
    called_alertToneChanged = false;
    m_App = new MApplication(argc, argv);

    /*
     * XXX: FIXME: TODO: fix the test cases to not depend on libprofile!
     */
#ifdef HAVE_LIBPROFILE
    SYS_DEBUG ("*** Yes! we have libprofile!");
#else
    SYS_WARNING ("*** No! we don't have libprofile, some cases may fail...");
#endif
}
QStringList
BatteryBusinessLogic::PSMThresholdValues ()
{
    MGConfItem  possible_values (psm_values_key);
    QStringList retval;

    retval = possible_values.value ().toStringList ();
    if (retval.size() == 0) {
        SYS_WARNING ("The GConf key %s is not set. Falling back to default.",
                SYS_STR(psm_values_key));
        retval << "10" << "20" << "30" << "40" << "50";
    }

    return retval;
}
コード例 #24
0
void
ResetWidget::doTheWork ()
{
    switch (m_currentPlan)
    {
        case ResetSettings:
            m_ResetBusinessLogic->performRestoreSettings();
            break;
        case ClearData:
            m_ResetBusinessLogic->performClearData();
            break;
        default:
            SYS_WARNING ("Got access, but no plan ?!");
            break;
    }
    m_currentPlan = None;
}
コード例 #25
0
QModelIndex
ThemeListModel::indexOfCodeName(
        const QString &codeName) const 
{
    int i = 0;

    foreach (ThemeDescriptor *desc, m_ThemeDescList) {
        if (desc->codeName() == codeName) {
            return index (i, 0);
        }

        ++i;
    }

    SYS_WARNING("code name not found in list model: %s", SYS_STR(codeName));
    return QModelIndex();
}
コード例 #26
0
bool 
MTester::objectnameIs (
            QGraphicsWidget *widget,
            const QString   &name)
{
    bool retval = widget->objectName() == name;

    if (!retval) {
        QString realName = widget->objectName();
        SYS_WARNING ("Widget at %p should have the name %s, but it is %s.",
                widget, 
                SYS_STR(name),
                realName.isEmpty() ? "(empty)" : SYS_STR(realName));
    }

    return retval;
}
コード例 #27
0
DcpWidget *
AboutApplet::pageMain(
        int widgetId)
{
    SYS_DEBUG ("widgetId = %d", widgetId);
    switch (widgetId) {
        case 0:
            if (m_MainWidget == 0) 
                m_MainWidget = new AboutWidget (m_AboutBusinessLogic);
            return m_MainWidget;

        default:
            SYS_WARNING ("Unknown widgetId: %d", widgetId);
    }

    return 0;
}
void
BatteryBusinessLogic::setPSMThresholdValue (
        int percentage)
{
    #ifdef HAVE_QMSYSTEM
    bool ret;
    ret = m_devicemode->setPSMBatteryMode (percentage);

    if (!ret) {
        SYS_WARNING (" failed to set (precentage = %d)", percentage);
    }
    #else
    /*
     * To implement the code that sets the power save threshold without the help
     * of the QmSystem library.
     */
    #endif
}
コード例 #29
0
DcpStylableWidget *
AboutApplet::constructStylableWidget (int widgetId)
{
    SYS_DEBUG ("widgetId = %d", widgetId);

    switch (widgetId) {
        case 0:
            if (m_MainWidget.isNull ())
                m_MainWidget = new AboutWidget;
            return m_MainWidget;
            break;
        default:
            SYS_WARNING ("Unknown widgetId: %d", widgetId);
    }

    return 0;

}
コード例 #30
0
ファイル: flash_main.c プロジェクト: NearZhxiAo/3730
int main(int argc, char **argv)
{
	memset(&global_flash_private_handle, 0x00, sizeof(global_flash_private_handle));

	if ( flash_init(&global_flash_private_handle) != succeed_type_succeed)
	{
		SYS_ERROR("flash_init failed.\r\n");
		return 0;
	}

	
	//将flash数据拷贝到共享缓冲里
	if ( flash_para_load(&global_flash_private_handle) !=  succeed_type_succeed)
	{
		SYS_ERROR("flash_para_load failed.\r\n");
		return 0;
	}
	//创建flash管理线程 定时检测flash操作的更新状态
	if (pthread_create(&UpdateThread, NULL, flash_updatethread_func, (void *)&global_flash_private_handle))
	{
		SYS_ERROR("Failed to create flash_updatethread_func thread\n");
		return -1;
	}

	SYS_INFO("Enter flash_manager func.\r\n");
	while( 0 ==  IsFlashSysQuit)
	{
		if ( poll( &(global_flash_private_handle.polltimeout), global_flash_private_handle.active_fdcount , -1 ) > 0 )
		{
			SYS_WARNING("POLL event found.\r\n");
			if ( global_flash_private_handle.polltimeout[0].revents )
			{
				//do UNIX recv event.
				flash_unix(&global_flash_private_handle);
			}
			if ( global_flash_private_handle.polltimeout[1].revents )
			{
			}
			flash_poll_init(&global_flash_private_handle);
		}
	}
	flash_exit(&global_flash_private_handle);
	return 0;
}