Esempio n. 1
0
GLuint Application::loadShader(const char* filename, GLenum type)
{
  GLuint shader = glCreateShader(type);
  string src;
  ifstream ifs(filename, std::ios::in);
  if(ifs.is_open())
  {
    string line = "";
	  while(getline(ifs, line))
	  {
	    src += "\n" + line;
	  }
	  ifs.close();
  }

  const char * srcPtr = src.c_str();
  glShaderSource(shader, 1, &srcPtr, NULL);
  glCompileShader(shader);

  GLint result = GL_FALSE;
  int info_log_length = -1;
  glGetShaderiv(shader, GL_COMPILE_STATUS, &result);
  glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_log_length);
  if(info_log_length > 0)
  {
    std::vector<char> errorMsg(info_log_length + 1);
    glGetShaderInfoLog(shader, info_log_length, NULL, &errorMsg[0]);
    printf("%s\n", &errorMsg[0]);
  }
  return shader;
}
Esempio n. 2
0
void cmdGameCreate(PkgInfo& inputPkg, PkgInfo& outputPkg) {
    CHashGameData inputGameData;
    memcpy(&inputGameData, inputPkg.data, sizeof (inputGameData));
    //
    CHashGameData gameData;
    gameData.id = inputGameData.id;
    gameData.playA = inputGameData.id;
    gameData.playACode = 0;
    gameData.playAScore = 0;
    gameData.playB = 0;
    gameData.playBCode = 0;
    gameData.playBScore = 0;
    gameData.result = 0;
    
    printf("gameData.id:%ld\n",gameData.id);
    CHashGameData *gameDataMem = hashGame->GetObjByKey(gameData.id);
    char msg[50];
    if(gameDataMem == NULL){
        hashGame->InsertObj(gameData);
        sprintf(msg, "%ld: game create success\n", gameData.id);        
    }else{
        sprintf(msg, "%ld: game already created\n", gameData.id);        
    }
    errorMsg(outputPkg, msg);
    printf("[ok]cmdGameCreate\n");
}
Esempio n. 3
0
QString DRAE::getErrorMsg()
{
   QString errorMsg(
                "<html>"
                "<head>"
                "<title>Error</title>"
                "<style type=\"text/css\">"
                "body {"
                "font-family: \"Arial Unicode MS\",\"TITUS Cyberbit Basic\",\"Lucida Sans Unicode\";"
                "font-size: 13pt;"
                "text-align: left;"
                "}"
                "h1 {"
                "font-size: 13pt;"
                "color: #9C0204;"
                "margin-top: 20px;"
                "}"
                "</style>"
                "</head>"
                "<body>"
                "<h1>Error: No se ha podido cargar la p&aacute;gina</h1>"
                "Por favor, comprueba que tu ordenador est&eacute; conectado a Internet."
                "<br>"
                "En caso afirmativo, int&eacute;ntalo de nuevo."
                "</body>"
                "</html>"
                );
   
   return errorMsg;
}
Esempio n. 4
0
/*
 *------------------------------------------------------------
 *------------------------------------------------------------
 */
void saveObjFile( const char *file )
{
	FILE *fp;
	int i, j, len;
	char objFileName[128];
	char fileName[128];

	len = strlen( file );
	strncpy( fileName, file, len );
	strcat( fileName,".obj" ); //provisório, tem que remover o .session
	if( (fp = fopen(fileName, "w")) == NULL )
		errorMsg("Could not open input obj file to write!");

	printf("==========================\n");
	printf("Saving obj file into file %s\n\n", fileName);

	len = strlen( sessionFileName );
	strncpy( objFileName, sessionFileName, len - 8 );
	objFileName[len-8]='\0';

	fprintf(fp, "# Object saved from the 'MClone' program\n");
	fprintf(fp, "# Marcelo Walter ([email protected])\n");
	fprintf(fp, "# The original object file is %s\n\n", objFileName );

	fprintf(fp, "# Vertices info\n");
	for(i = 0; i < NumberVertices; i++){
		/* MARCELO */
		fprintf(fp, "v %3.6f %3.6f %3.6f\n",
				vert[i].pos.x, vert[i].pos.y, vert[i].pos.z);
		/*vertDisplay[i].x, vertDisplay[i].y, vertDisplay[i].z );*/
	}

	fprintf(fp, "# Normals info\n");
	for(i = 0; i < NumberNormals; i++){
		fprintf(fp, "vn %3.6f %3.6f %3.6f\n",
				vertn[i].x, vertn[i].y, vertn[i].z);
	}
	fprintf(fp, "\n");
	fprintf(fp, "# Faces info\n");
	if ( NumberNormals > 0 ){
		for(i = 0; i < NumberFaces; i++){
			fprintf(fp, "f ");
			for(j = 0; j < faces[i].nverts; j++){
				fprintf(fp, "%d//%d ", faces[i].v[j]+1, faces[i].vn[j]+1 );
			}
			fprintf(fp, "\n");
		}
	}
	else{
		for(i = 0; i < NumberFaces; i++){
			fprintf(fp, "f ");
			for(j = 0; j < faces[i].nverts; j++){
				fprintf(fp, "%d ", faces[i].v[j]+1 );
			}
			fprintf(fp, "\n");
		}
	}

	fclose( fp );
}
Esempio n. 5
0
void Acceptor::onAccept(IOLoop* loop, int events)
{
    int sockFd = accept4(m_sockFd, NULL, NULL, SOCK_NONBLOCK | SOCK_CLOEXEC);
    if(sockFd < 0)
    {
        int err = errno;
        if(err == EMFILE || err == ENFILE)
        {
            LOG_ERROR("accept error %s", errorMsg(err));
            close(m_dummyFd);
            sockFd = accept(m_sockFd, NULL, NULL);
            close(sockFd);

            m_dummyFd = createDummyFd();
        }
        return;
    }
    else
    {
        LOG_INFO("onAccept %d", sockFd);

        SockUtil::setNoDelay(sockFd, true);

        m_callback(loop, sockFd);
    }
}
Esempio n. 6
0
/** 135 7630 9308 - 0793 8035336 
 * 查询用户
 * @param inputPkg
 * @param outputPkg
 */
void cmdUserQuery(PkgInfo& inputPkg, PkgInfo& outputPkg) {
    CHashUserData userData;
    memcpy(&userData, inputPkg.data, sizeof (userData));
    //
    printf("pkg.id:%d-%ld\n",inputPkg.id,userData.id);
    
    CHashUserData *userDataMem = hashUser->GetObjByKey(userData.id);
    if(userDataMem->id) {
        printf("user:%ld|%d|%s\n", userDataMem->id, userDataMem->gameMessageStatus, userDataMem->gameMessage);
    }
//    
    if(userDataMem == NULL){
        char msg[50];
        sprintf(msg,"can not find user:%ld\n",userData.id);
        printf("->1\n");
        errorMsg(outputPkg,msg);
    }else{
        printf("->2\n");
        outputPkg.id = inputPkg.id;
        printf("gameMessageStatus:%d\n",userDataMem->gameMessageStatus);
        //printf(" ->%ld: join in the game:%ld.\n",gameData.playB,gameData.playA);
                    
        memcpy(&outputPkg.data, (char *) userDataMem, sizeof (outputPkg.data));
    }
    printf("[ok]cmdUserQuery\n");
}
Esempio n. 7
0
void send_packets(packet temp_packet)
{
    usleep(100);
    int n;
    n = sendto(sockfd,&temp_packet,PACKET_SIZE, 0,(struct sockaddr *) &serv_addr,sizeof(serv_addr));
    if (n < 0)  errorMsg("sendto");
}
Esempio n. 8
0
//=============================================================================
// METHOD: SPELLserverCif::notifyError
//=============================================================================
void SPELLserverCif::notifyError( const std::string& error, const std::string& reason, bool fatal )
{
    DEBUG("[CIF] Error notification: " + error + " (" + reason + ")");

    SPELLipcMessage errorMsg( MessageId::MSG_ID_ERROR);
    errorMsg.setType(MSG_TYPE_ERROR);
    errorMsg.set( MessageField::FIELD_PROC_ID, getProcId() );
    errorMsg.set( MessageField::FIELD_DATA_TYPE, MessageValue::DATA_TYPE_STATUS );
    errorMsg.set( MessageField::FIELD_EXEC_STATUS, StatusToString(STATUS_ERROR) );
    errorMsg.set( MessageField::FIELD_ERROR, error );
    errorMsg.set( MessageField::FIELD_REASON, reason );
    if (fatal)
    {
        errorMsg.set( MessageField::FIELD_FATAL, PythonConstants::True );
    }
    else
    {
        errorMsg.set( MessageField::FIELD_FATAL, PythonConstants::False );
    }

    completeMessage( &errorMsg );

    m_asRun->writeErrorInfo( error, reason );

    sendGUIMessage(&errorMsg);
}
Esempio n. 9
0
int TagScanner::scan(QString filepath, QList<Tag> *taglist)
{
    if(!m_ctagsExist)
        return 0;

    QString etagsCmd;
    etagsCmd = ETAGS_ARGS;
    etagsCmd += " ";
    etagsCmd += filepath;
    QString name = ETAGS_CMD;
    QStringList argList;
    argList = etagsCmd.split(' ',  QString::SkipEmptyParts);

    QByteArray stdoutContent;
    QByteArray stderrContent;
    int rc = execProgram(ETAGS_CMD, argList,
                            &stdoutContent,
                            &stderrContent);

    parseOutput(stdoutContent, taglist);

    // Display stderr
    QString all = stderrContent;
    if(!all.isEmpty())
    {
        QStringList outputList = all.split('\n', QString::SkipEmptyParts);
        for(int r = 0;r < outputList.size();r++)
        {
            errorMsg("%s", stringToCStr(outputList[r]));
        } 
    }

    return rc;
}
Esempio n. 10
0
int read_smtp_multi_lines(void)
{
    int
        rc,
        lcnt = 0;
    if (smtp_sep == A_DASH)
    {
        for (;;)
        {
            rc=read_smtp_line();
            if (rc < 0)
                break;
            lcnt++;
            if (lcnt >= 100)
            {
                errorMsg("Too many lines from server\n");
                rc=(-1);
                goto ExitProcessing;
            }
            if (smtp_sep != A_DASH)
                break;
        }
    }
    smtp_sep = A_SPACE;
    return(0);
ExitProcessing:
    return(1);
}
Esempio n. 11
0
File: tts.c Progetto: wdebeaum/cabot
void
tts_send(char *txt, KQMLPerformative *perf)
{
    int theErr = noErr;

    /* Notify that we started speaking */
    DEBUG0("notifying started speaking");
    sendStartedSpeaking();
    DEBUG0("done");
    /* wait until speech-in got the message
       note: it's impractical to do this sync-ing via messages, so we'll just
       wait a reasonable amount of time, say 20ms */
    usleep(20000);
    /* Send the text */
    DEBUG1("saying \"%s\"", txt);
    theErr = SpeakText(channel, txt, strlen(txt) );
    if (theErr != noErr) {
	errorMsg("SpeakText failed", theErr);
    }
    /* Wait for speech to finish */
    DEBUG0("waiting");
    if (sem_wait(sem) < 0) {
	SYSERR0("sem_wait failed");
    }
    /* Notify that we stopped speaking */
    DEBUG0("notifying stopped speaking");
    sendStoppedSpeaking();
    DEBUG0("done");
    /* Send reply */
    DEBUG0("replying");
    sendDoneReply(perf);
    DEBUG0("done");
}
Esempio n. 12
0
void MysqlTask::run()
{
  TRACE;
  LOG( Logger::FINEST, std::string("I'm a task, provessing message: \"").
                        append(m_message).append("\"").c_str() );

  MYSQL_RES *res_set(0);
  MysqlClient *c = m_connectionPool->acquire();
  if ( !c->querty(m_message.c_str(), m_message.length(), &res_set) ) {

    std::string errorMsg("Could not execute query.");
    LOG ( Logger::ERR, errorMsg.c_str() );
     m_connection->send(errorMsg.c_str(), errorMsg.length() );
  } else {

    std::list<std::string> results;
    MysqlClient::queryResultToStringList(res_set, results);

    std::string joinedLines;
    std::list<std::string>::const_iterator it;
    for(it = results.begin(); it != results.end(); ++it)
      joinedLines.append(*it).append(";");

    m_connection->send(joinedLines.c_str(), joinedLines.length() );
  }
  m_connectionPool->release(c);
}
Esempio n. 13
0
/* connect to SMTP server and returns the socket fd */
static SOCKET smtpConnect(char *smtp_server,int port)
{
    SOCKET
        sfd;

    if (g_use_protocol == MSOCK_USE_IPV4)
    {
        showVerbose("Forcing to use IPv4 address of SMTP server\n");
    }
    else if (g_use_protocol == MSOCK_USE_IPV6)
    {
        showVerbose("Forcing to use IPv6 address of SMTP server\n");
    }
    else
    {
        showVerbose("Will detect IPv4 or IPv6 automatically\n");
    }
    
    sfd=clientSocket(g_use_protocol, smtp_server,port, g_connect_timeout);
    if (sfd == INVALID_SOCKET)
    {
        errorMsg("Could not connect to SMTP server \"%s\" at port %d",
                smtp_server,port);
        return (INVALID_SOCKET);
    }

    /* set the socket to msock lib's static place, not thread safe*/
    msock_set_socket(sfd);

    return (sfd);
}
Esempio n. 14
0
void MagRead::captureStart() {
	magDec = new MagDecode( this );
	connect( magDec, SIGNAL( cardRead( MagCard ) ), this, SLOT( cardRead( MagCard ) ) );
	connect( magDec, SIGNAL( errorMsg( QString ) ), this, SLOT( notice( QString ) ) );

	magDec->setThreshold( settings->value( "silenceThreshold" ).toInt() );
	magDec->setTimeOut( settings->value( "timeOut" ).toInt() );

	if( settings->value( "normAuto" ) == false )
		magDec->setNorm( settings->value( "norm" ).toInt() );
	
	magDec->setAlgorithm( settings->value( "algorithm" ).toString() );

	audioInput = 0;

	QList<QAudioDeviceInfo> inputDevices = QAudioDeviceInfo::availableDevices( QAudio::AudioInput );
	for( int i = 0; i < inputDevices.size(); i++ ) {
		if( inputDevices.at( i ).deviceName() == settings->value( "audioDevice" ) ) {
			audioInput = new QAudioInput( inputDevices.at( i ), audioFormat, this );
		}
	}

	if( audioInput == 0 )
		audioInput = new QAudioInput( audioFormat, this );


	magDec->start();
	audioInput->start( magDec );
}
Result NetControlThread::defineNetwork()
{
    Result result;
    QString path = task.args.path;
    QByteArray xmlData;
    if ( task.srcConnPtr==nullptr ) {
        result.result = false;
        result.err = "Connection pointer is NULL.";
        return result;
    };
    QFile f;
    f.setFileName(path);
    if ( !f.open(QIODevice::ReadOnly) ) {
        QString msg = QString("File \"%1\"\nnot opened.").arg(path);
        emit errorMsg( msg, number );
        result.err = msg;
        return result;
    };
    xmlData = f.readAll();
    f.close();
    virNetworkPtr network = virNetworkDefineXML(
                *task.srcConnPtr, xmlData.data());
    if ( network==nullptr ) {
        result.err = sendConnErrors();
        return result;
    };
    result.name = QString().fromUtf8( virNetworkGetName(network) );
    result.result = true;
    result.msg.append(QString("'<b>%1</b>' Network from\n\"%2\"\nis defined.")
                      .arg(result.name).arg(path));
    virNetworkFree(network);
    return result;
}
void Shader::checkShaderError()
{
	GLint Result = GL_FALSE;
	int infoLogLen;

	glGetShaderiv(_vertexShaderID, GL_COMPILE_STATUS, &Result);
	glGetShaderiv(_vertexShaderID, GL_INFO_LOG_LENGTH, &infoLogLen);
	std::vector<char> vertexShaderErrorMessage(infoLogLen);
	glGetShaderInfoLog(_vertexShaderID, infoLogLen, NULL, &vertexShaderErrorMessage[0]);

	std::string errorMsg(vertexShaderErrorMessage.begin(), vertexShaderErrorMessage.end());
#ifdef _DEBUG
	std::cout << errorMsg << std::endl;
#endif
	glGetShaderiv(_fragmentShaderID, GL_COMPILE_STATUS, &Result);
	glGetShaderiv(_fragmentShaderID, GL_INFO_LOG_LENGTH, &infoLogLen);
	std::vector<char> fragmentShaderErrorMessage(infoLogLen);
	glGetShaderInfoLog(_fragmentShaderID, infoLogLen, NULL, &fragmentShaderErrorMessage[0]);

	errorMsg.clear();

	errorMsg = std::string(fragmentShaderErrorMessage.begin(), fragmentShaderErrorMessage.end());
#ifdef _DEBUG
	std::cout << errorMsg << std::endl;
#endif
}
Result StoragePoolControlThread::defineStoragePool()
{
    Result result;
    QString path = task.args.path;
    QByteArray xmlData;
    QFile f;
    f.setFileName(path);
    if ( !f.open(QIODevice::ReadOnly) ) {
        QString msg = QString("File \"%1\"\nnot opened.").arg(path);
        emit errorMsg( msg, number );
        result.result = false;
        result.err = msg;
        return result;
    };
    xmlData = f.readAll();
    f.close();
    // flags: extra flags; not used yet, so callers should always pass 0
    unsigned int flags = 0;
    virStoragePoolPtr storagePool = virStoragePoolDefineXML(
                *task.srcConnPtr, xmlData.data(), flags);
    if ( storagePool==NULL ) {
        result.err = sendConnErrors();
        result.result = false;
        return result;
    };
    result.name = QString().fromUtf8( virStoragePoolGetName(storagePool) );
    result.msg.append(
                QString("'<b>%1</b>' StoragePool from\n\"%2\"\nis Defined.")
                .arg(result.name).arg(path));
    virStoragePoolFree(storagePool);
    result.result = true;
    return result;
}
Esempio n. 18
0
/**
 * 查询赛局
 * @param inputPkg
 * @param outputPkg
 */
void cmdGameQuery(PkgInfo& inputPkg, PkgInfo& outputPkg) {
    CHashGameData gameData;
    memcpy(&gameData, inputPkg.data, sizeof (gameData));
    //
    
    CHashGameData *gameDataMem = hashGame->GetObjByKey(gameData.id);
    //gameData.id = gameDataMem->id;
    gameData.playA = gameDataMem->playA;
    gameData.playACode = gameDataMem->playACode;
    gameData.playB = gameDataMem->playB;
    gameData.playBCode = gameDataMem->playBCode;
    printf("creater:%ld|%ld|%d,joiner:%ld|%ld|%d\n",gameDataMem->playA,gameDataMem->playACode,gameDataMem->playAScore,gameDataMem->playB,gameDataMem->playBCode,gameDataMem->playBScore);
     
    //printf("mem.id:%ld\n",gameDataMem->id);
    if(gameDataMem == NULL){
        char msg[50];
        sprintf(msg,"can not find game:%ld\n",gameData.id);
        errorMsg(outputPkg,msg);
    }else{
        outputPkg.id = inputPkg.id;
        printf(" ->%ld: join in the game:%ld.\n",gameData.playB,gameData.playA);
                    
        memcpy(&outputPkg.data, (char *) &gameData, sizeof (outputPkg.data));
    }
    printf("[ok]cmdGameQuery\n");
}
void CreateScreenDlg::accept()
{
	const QString screenName = GetScreenName();
	QString errorMsg("");
	if (!screenName.isNull() && !screenName.isEmpty())
	{
		if(!HierarchyTreeController::Instance()->GetActivePlatform()->IsAggregatorOrScreenNamePresent(screenName))
		{
			QDialog::accept();
		}
		else
		{
			errorMsg = "Please fill screen name field with unique value.\r\nThe same name with any of aggregators is forbidden.";
		}
	}
	else
	{
		errorMsg = ("Please fill screen name field with value. It can't be empty.");
	}
	if(!errorMsg.isEmpty())
	{
		QMessageBox msgBox;
		msgBox.setText(errorMsg);
		msgBox.exec();
	}
}
Esempio n. 20
0
    void PreparedStatement::prepare(const std::string& sql)
    {
        locker l(d->mutex);
        if (d->prepared) {
            throw SQLiteException(-1, "Statement is already prepared");
        }

        if (d->db == nullptr) {
            throw SQLiteException(-1, "PreparedStatement::prepare : Database pointer is null");
        }
        int result = sqlite3_prepare_v2(d->db->getSqltite3db(), sql.c_str(), sql.size() + 1, &d->stmt, nullptr);
        if (result != SQLITE_OK) {
            throw SQLiteException(result, errorMsg());
        }
        // The statement is ready
        d->prepared = true;
        // Count columns
        int count = sqlite3_column_count(d->stmt);

        // Add column index and name to d->_columnsNames
        d->columnsNames->clear();
        for (int i = 0; i < count; i++) {
            std::string name(sqlite3_column_name(d->stmt, i));
            d->columnsNames->emplace(name, i);
        }

    }
Esempio n. 21
0
QString clsRS232::sendCommand(QString strCommand, bool hasReturn)
{
    if(!serial.isOpen())
        serial.open(QIODevice::ReadWrite);
    strCommand +="\n\r\n";
    serial.write(strCommand.toStdString().c_str());
    TestResult.setEmptyString();

    if(hasReturn)
    {
        isTimeOut =false;
        timer.start();
        while(!TestResult.hasFilled && !isTimeOut)
        {
            qApp->processEvents();
        }
        if(!isTimeOut)
        {
            timer.stop();
            return TestResult.strRes;
        }
        else
        {
            emit errorMsg(tr("Send command to 4300 with Rs232 time out"));
            return "";
        }
    }
    else
        return  "";

}
Esempio n. 22
0
void CUcontent_Adjustments::saveAdjustmentValue(unsigned int index)
{
	QWidget *cellWidget = NULL;
	QDoubleSpinBox *spinbox = NULL;
	QComboBox *combobox = NULL;
	double newvalue_scaledDouble = 0;
	QString newvalue_scaledStr = "";
	unsigned int newvalue_raw = 0;
	unsigned int controlValue_raw = 0;
	bool ok = false;

	if (!_SSMPdev) return;
	// Show wait-message:
	FSSM_WaitMsgBox waitmsgbox(this, tr("Saving adjustment value to Electronic Control Unit... Please wait !"));
	waitmsgbox.show();
	// Get selected Value from table:
	cellWidget = adjustments_tableWidget->cellWidget (index, 2);
	if (_newValueSelWidgetType.at(index))	// Combobox
	{
		combobox = dynamic_cast<QComboBox*>(cellWidget);
		newvalue_scaledStr = combobox->currentText();
	}
	else	// Spinbox
	{
		spinbox = dynamic_cast<ModQDoubleSpinBox*>(cellWidget);
		newvalue_scaledDouble = spinbox->value();
		newvalue_scaledStr = QString::number(newvalue_scaledDouble, 'f', _supportedAdjustments.at(index).precision);
	}
	// Convert scaled value string to raw value:
	if (!libFSSM::scaled2raw(newvalue_scaledStr, _supportedAdjustments.at(index).formula, &newvalue_raw))
	{
		calculationError(tr("The new adjustment value couldn't be scaled."));
		return;
	}
	// Save new ajustment value to control unit:
	ok = _SSMPdev->setAdjustmentValue(index, newvalue_raw);
	// To be sure: read and verify value again
	if (ok)
		ok = _SSMPdev->getAdjustmentValue(index, &controlValue_raw);
	if (!ok)
	{
		communicationError(tr("No or invalid answer from Control Unit."));
		return;
	}
	// Scale and display the current value:
	ok = libFSSM::raw2scaled(controlValue_raw, _supportedAdjustments.at(index).formula, _supportedAdjustments.at(index).precision, &newvalue_scaledStr);
	if (ok)
		displayCurrentValue(index, newvalue_scaledStr, _supportedAdjustments.at(index).unit);
	else
		displayCurrentValue(index, QString::number(controlValue_raw, 10), tr("[RAW]"));
	// Close wait-messagebox
	waitmsgbox.hide();
	// Check if the CU accepted the new value:
	if (controlValue_raw != newvalue_raw)
		errorMsg(tr("Error"), tr("Error:\nThe Control Unit didn't accept the new value !"));
	// Check for calculation error:
	if (!ok)
		calculationError(tr("The current value couldn't be scaled."));
}
void StoragePoolControlThread::sendGlobalErrors()
{
    virtErrors = virGetLastError();
    if ( virtErrors!=NULL && virtErrors->code>0 )
        emit errorMsg( QString("VirtError(%1) : %2").arg(virtErrors->code)
                       .arg(QString().fromUtf8(virtErrors->message)) );
    virResetLastError();
}
Esempio n. 24
0
// pcompany should be "" except when checking for errors in configCC
CreditCardProcessor * CreditCardProcessor::getProcessor(const QString pcompany)
{
  if (DEBUG)
    qDebug("CCP:getProcessor(%s)", pcompany.toAscii().data());

  if (pcompany == "Authorize.Net")
    return new AuthorizeDotNetProcessor();

  else if (pcompany == "Verisign")
    return new VerisignProcessor();

  else if (pcompany == "YourPay")
    return new YourPayProcessor();

  else if (! pcompany.isEmpty())
  {
    _errorMsg = errorMsg(-14).arg(pcompany);
    return 0;
  }

  CreditCardProcessor *processor = 0;

  if (_metrics->value("CCCompany") == "Authorize.Net")
    processor = new AuthorizeDotNetProcessor();

  else if (_metrics->value("CCCompany") == "Verisign")
    processor = new VerisignProcessor();

  else if ((_metrics->value("CCCompany") == "YourPay"))
    processor = new YourPayProcessor();

  else
    _errorMsg = errorMsg(-14).arg(_metrics->value("CCServer"));

  // reset to 0 if the config is bad and we're not configuring the system
  if (processor && processor->testConfiguration() != 0 && pcompany.isEmpty())
  {
    delete processor;
    processor = 0;
  }

  if (processor)
    processor->reset();

  return processor;
}
Esempio n. 25
0
//++ ------------------------------------------------------------------------------------
// Details:	Retrieve if possible the OS last error description.
// Type:	Method.
// Args:	None.
// Return:	CMIUtilString - Error description.
// Throws:	None.
//--
CMIUtilString CMIUtilSystemOsx::GetOSLastError( void ) const
{
	CMIUtilString errorMsg( "Error fn not implemented" );
	
	// ToDo: Implement LINUX version
		
	return errorMsg;
}
Esempio n. 26
0
void send_file_info_tcp(){
    int sockfd_t, n_t, portno_t = 51615;
    sockfd_t = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd_t < 0)
        errorMsg("ERROR opening socket");
    struct sockaddr_in serv_addr_t;
    bzero((char *) &serv_addr_t, sizeof(serv_addr_t));
    serv_addr_t.sin_family = AF_INET;
    bcopy((char *)server_t->h_addr,(char *)&serv_addr_t.sin_addr.s_addr,server_t->h_length);
    serv_addr_t.sin_port = htons(portno_t);
    if (connect(sockfd_t,(struct sockaddr *) &serv_addr_t,sizeof(serv_addr_t)) < 0)
        errorMsg("ERROR connecting");
    n_t = write(sockfd_t,(void *)&filesize,sizeof(filesize));
    if (n_t < 0)
         errorMsg("ERROR writing to socket");
    close(sockfd_t);
}
Esempio n. 27
0
void CWizApiBase::onXmlRpcError(const QString& strMethodName, WizXmlRpcError err, int errorCode, const QString& errorMessage)
{
    Q_UNUSED(err);
    Q_UNUSED(errorCode);

    QString errorMsg(QString("Error: [%1]: %2").arg(strMethodName).arg(errorMessage));
    Q_EMIT processErrorLog(errorMsg);
}
Esempio n. 28
0
/*
** include the content of the file as body of the message
** No encoding will be done.
*/
int include_msg_body(void)
{
    Sll
        *l,
        *msg_body_attachment_head;

    FILE
        *fp = NULL;

    Attachment
        *a;

    msg_body_attachment_head = get_msg_body_attachment_list();
    if (msg_body_attachment_head == NULL)
    {
        return(-1);
    }

    l = msg_body_attachment_head;
    a = (Attachment *) l->data;

    (void) snprintf(buf,bufsz,"Mime-version: 1.0\r\n");
    write_to_socket(buf);

    if (strcmp(a->charset,"none") != 0)
    {
        (void) snprintf(buf,bufsz,"Content-Type: %s; charset=%s\r\n\r\n",
                a->mime_type,
                a->charset);
    }
    else
    {
        (void) snprintf(buf,bufsz,"Content-Type: %s\r\n\r\n",a->mime_type);
    }
    write_to_socket(buf);

    fp=fopen(a->file_path,"r");
    if (fp == (FILE *) NULL)
    {
        errorMsg("Could not open message body file: %s",a->file_path);
        return (-1);
    } 

    while (fgets(buf,bufsz,fp))
    {
        write_to_socket(buf);
        if (g_show_attachment_in_log)
        {
            showVerbose("[C] %s",buf); 
        }
    }
    (void) fclose(fp);

    (void) snprintf(buf,bufsz,"\r\n\r\n");
    msock_puts(buf);
    showVerbose(buf);
    return(0);
}
Esempio n. 29
0
    void VideoWriter_ufmf::checkImageFormat(StampedImage stampedImg)
    {
        if (stampedImg.image.channels() != 1)
        {
            unsigned int errorId = ERROR_VIDEO_WRITER_INITIALIZE;
            std::string errorMsg("video writer ufmf setup failed:\n\n"); 
            errorMsg += "images must be single channel";
            throw RuntimeError(errorId,errorMsg);
        }

        if (stampedImg.image.depth() != CV_8U)
        {
            unsigned int errorId = ERROR_VIDEO_WRITER_INITIALIZE;
            std::string errorMsg("video writer ufmf setup failed:\n\n"); 
            errorMsg += "image depth must be CV_8U";
            throw RuntimeError(errorId,errorMsg);
        }
    }
Esempio n. 30
0
string ERYDBErrorInfo::logError(const logging::LOG_TYPE logLevel,
                  const logging::LoggingID logid,
                  const unsigned eid,
                  const logging::Message::Args& args)
{
	Logger logger(logid.fSubsysID);
	Message message(errorMsg(eid, args));
	return logger.logMessage(logLevel, message, logid);
}