Esempio n. 1
0
XMLRPC2DIServer::XMLRPC2DIServer(unsigned int port, 
				 bool di_export, 
				 string direct_export) 
  : port(port),
    // register method 'calls'
    calls_method(&s),
    // register method 'get_loglevel'
    setloglevel_method(&s),
    // register method 'set_loglevel'
    getloglevel_method(&s)
{	
  DBG("XMLRPC Server: enabled builtin method 'calls'\n");
  DBG("XMLRPC Server: enabled builtin method 'get_loglevel'\n");
  DBG("XMLRPC Server: enabled builtin method 'set_loglevel'\n");

  // export all methods via 'di' function? 
  if (di_export) {
    // register method 'di'
    di_method = new XMLRPC2DIServerDIMethod(&s);
  }
  
  vector<string> export_ifaces = explode(direct_export, ";");
  for(vector<string>::iterator it=export_ifaces.begin(); 
      it != export_ifaces.end(); it++) {
    registerMethods(*it);
  }

  DBG("Initialized XMLRPC2DIServer with: \n");
  DBG("                          port = %u\n", port);
}
Esempio n. 2
0
word loader(CrocThread* t)
{
	registerGlobals(t, _globalFuncs);

	croc_class_new(t, "Timer", 0);
		croc_pushBool(t, false); croc_class_addField(t, -2, "_running");
		croc_pushInt(t, 0);      croc_class_addField(t, -2, "_start");
		croc_pushInt(t, 0);      croc_class_addField(t, -2, "_total");
		registerMethods(t, _Timer_methods);
	croc_newGlobal(t, "Timer");

	return 0;
}
Esempio n. 3
0
jint JNI_OnLoad(JavaVM* vm, void* reserved) {//JNI main
	JNIEnv* env = NULL;
	jint ret = JNI_ERR;
	if(vm->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK) {
		LOGE("GetEnv failed!");
		return ret;
	}
	assert(env != NULL);
	if(registerMethods(env) != JNI_OK) {
		LOGE("can not load methods!");
		return ret;
	}
	ret = JNI_VERSION_1_4;
	LOGI("Loaded!");
	return ret;
}
Esempio n. 4
0
/*
 * Load the functions.
 */
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
    JNIEnv* env = NULL;

    if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK) {
        ALOGE("ERROR Message: GetEnv failed\n");
        return -1;
    }

    if (!registerMethods(env, "com/qti/fcctest/FccTestActivity",
            wifiFtmMethods,
            sizeof(wifiFtmMethods) / sizeof(wifiFtmMethods[0]))) {
        ALOGE("ERROR Message: libwifi_ftmd registration failed\n");
        return -1;
    }

    return JNI_VERSION_1_6;
}
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
    JNIEnv* env = NULL;
    jint result = -1;

    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
        LOGE("ERROR: GetEnv failed\n");
	goto bail;
    }
    assert(env != NULL);

    registerMethods(env);

    /* success -- return valid version number */
    result = JNI_VERSION_1_4;

bail:
    return result;
}
Esempio n. 6
0
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
    JNIEnv* env = NULL;
    jint result = -1;
 
    if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
        goto bail;
    }
    assert(env != NULL);
 
    registerMethods(env);

    /* 此处可预先获取Java层对象的信息 */
    get_inner_class_info(env);
 
    result = JNI_VERSION_1_4;
 
bail:
    return result;
}
Esempio n. 7
0
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	JNIEnv* env = NULL;
	jint result = -1;
	if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) == JNI_OK) {
		assert(env != NULL);

		jclass clazz = env->FindClass("android/os/Build$VERSION");
		jfieldID feild = env->GetStaticFieldID(clazz, "SDK_INT", "I");
		version = env->GetStaticIntField(clazz, feild);

		if (registerMethods(env) != 0) {
			LOGI("ERROR: PlatformLibrary native registration failed\n");
			goto fail;
		}
	}
	/* success -- return valid version number */
	result = JNI_VERSION_1_6;
	fail: return result;
}
/*
 *
 *   * This is called by the VM when the shared library is first loaded.
 */ 
jint JNI_OnLoad(JavaVM* vm, void* reserved)  //实现函数registerMethods向当前Java环境中注册接口
{
	JNIEnv* env = NULL;
	jint result = -1;
	LOGI("JNI_OnLoad");

	if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
		LOGE("ERROR: GetEnv failed\n");
		goto fail;
	}

	assert(env != NULL);
	if (registerMethods(env) != 0) {
		LOGE("ERROR: PlatformLibrary native registration failed\n");
		goto fail;
	}
	/* success -- return valid version number */	
	result = JNI_VERSION_1_4;

fail:
	return result;
} 
void MainWindow::loadAllObjectRecords()
{
    DataLoader* dl = ct->loader;

    QMessageBox msgBox;
    int amountOfObjectRecords = dl->getAmountOfObjectRecords(objectsData[choosenObjectId].first);
    msgBox.setInformativeText(QString::fromUtf8("Czy chcesz załadować ") + QString::number(amountOfObjectRecords) + QString::fromUtf8(" rekordów?"));
    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
    msgBox.setDefaultButton(QMessageBox::Yes);
    msgBox.setIcon(QMessageBox::Question);
    msgBox.setWindowTitle(QString::fromUtf8("Pobieranie danych"));

    // workaround for not working setMinimumWidth:
    QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    if(msgBox.exec()==QMessageBox::Yes)
    {
        ct->loader->objectId = objectsData[choosenObjectId].first;
        QProgressDialog progress(QString::fromUtf8("Pobieranie rekordów dla wybranego obiektu..."), "Anuluj", 0, amountOfObjectRecords, this);
        progress.setWindowModality(Qt::WindowModal);
        dl->progessBar = &progress;
        progress.show();
        progress.setValue(0);
        dl->initDataRecordTable();
        dl->loadAllRecords();

        if(progress.wasCanceled())
            return;

        progress.setLabelText(QString::fromUtf8("Pobieranie danych anomalii dla wybranego obiektu..."));
        progress.setCancelButtonText("Anuluj");
        progress.setMinimum(0);
        progress.setValue(0);

        dl->loadMeasurementInfo();
        dl->setAlarmFlagToRecords();
        ct->dataset->setMinMaxFromDataset();

        if(!progress.wasCanceled())
        {
            this->statusOfObjectDataLoad = true;
            ui->livelogTab->setEnabled(true);
            ui->changeRefreshTimeBtn->setEnabled(false);
            ui->refreshIntervalSpin->setEnabled(false);
            ui->filterValuesLivelogBtn->setEnabled(false);
            ui->startLivelogBtn->setEnabled(true);
            ui->stopLivelogBtn->setEnabled(false);
            ui->linearScaleLivelogRadioButton->setEnabled(false);
            ui->logScaleLivelogRadioButton->setEnabled(false);

            ui->anomalyDetectionTab->setEnabled(true);
            ui->leftBtn->setEnabled(false);
            ui->rightBtn->setEnabled(false);
            ui->linearScaleRadioButton->setEnabled(false);
            ui->logScaleRadioButton->setEnabled(false);

            ui->dataOverviewTab->setEnabled(true);
            ui->refreshDatabaseTable->setEnabled(true);
            ui->datasetTableView->setEnabled(true);

            ui->reportsTab->setEnabled(true);
            ui->subscriptionTab->setEnabled(true);

            ui->reportDataRangeFrom->setMaximum(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-2);
            ui->reportDataRangeTo->setMaximum(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-1);
            ui->reportDataRangeTo->setValue(this->ct->dataset->datasetControler->dataset->dataTable->getLength()-1);

            ct->dataRecordSize = ct->dataset->datasetControler->dataset->dataTable->dataNames.size();

            ui->webView->initFilter(ct->dataRecordSize);

            registerMethods();

            QMessageBox msgBoxOK;
            msgBoxOK.setInformativeText(QString::fromUtf8("Dane zostały pobrane."));
            msgBoxOK.setStandardButtons(QMessageBox::Ok);
            msgBoxOK.setDefaultButton(QMessageBox::Ok);
            msgBoxOK.setIcon(QMessageBox::Information);
            msgBoxOK.setWindowTitle(QString::fromUtf8("Pobrano"));

            // workaround for not working setMinimumWidth:
            QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
            QGridLayout* layout = (QGridLayout*)msgBoxOK.layout();
            layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

            msgBoxOK.exec();
        }
    }
}
Esempio n. 10
0
word loader(CrocThread* t)
{
	loadPCRESharedLib(t);

	// Check that we have an appropriate libpcre, first..
	{
		auto vers = atoda(pcre_version());
		vers = vers.slice(0, strLocateChar(vers, ' '));
		auto dotPos = strLocateChar(vers, '.');

		auto major = strtol(cast(const char*)vers.ptr, nullptr, 10);
		auto minor = strtol(cast(const char*)vers.ptr + dotPos + 1, nullptr, 10);

		if(major < 7 || (major == 7 && minor < 4))
		{
			croc_eh_throwStd(t, "RuntimeError", "Your PCRE library is only version %.*s. You need 7.4 or higher.",
				cast(int)vers.length, vers.ptr);
		}

		int haveUtf8;
		pcre_config(PCRE_CONFIG_UTF8, &haveUtf8);

		if(!haveUtf8)
			croc_eh_throwStd(t, "RuntimeError", "Your PCRE library was not built with UTF-8 support.");
	}

	croc_class_new(t, "Regex", 0);
		croc_pushNull(t);   croc_class_addHField(t, -2, _Ptrs);      // memblock
		croc_pushNull(t);   croc_class_addHField(t, -2, _Names);     // table
		croc_pushNull(t);   croc_class_addHField(t, -2, _GroupIdx);  // memblock
		croc_pushNull(t);   croc_class_addHField(t, -2, _Subject);   // string
		croc_pushInt(t, 0); croc_class_addHField(t, -2, _NumGroups); // int
		croc_pushInt(t, 0); croc_class_addHField(t, -2, _NextStart); // int

		registerMethods(t, Regex_methodFuncs);
		registerMethodUV(t, Regex_opApplyFunc);

		croc_field(t, -1, "match");
		croc_class_addMethod(t, -2, "opIndex");
	croc_newGlobal(t, "Regex");

#ifdef CROC_BUILTIN_DOCS
	CrocDoc doc;
	croc_ex_doc_init(t, &doc, __FILE__);
	croc_dup(t, 0);
	croc_ex_doc_push(&doc, moduleDocs);
		croc_field(t, -1, "Regex");
			croc_ex_doc_push(&doc, RegexDocs);
			docFields(&doc, Regex_methodFuncs);
			docFieldUV(&doc, Regex_opApplyFunc);

			docField(&doc, {Regex_opIndex_info, nullptr});
			croc_ex_doc_pop(&doc, -1);
		croc_popTop(t);
	croc_ex_doc_pop(&doc, -1);
	croc_ex_doc_finish(&doc);
	croc_popTop(t);
#endif

	return 0;
}
Esempio n. 11
0
JNIRect::JNIRect( jobject instance )
{
	_instance = createJNIReference( instance );
	registerMethods();
}
Esempio n. 12
0
JNIRect::JNIRect( const JNIRect& copy )
{
	_instance = createJNIReference( copy._instance );
	registerMethods();
}
Esempio n. 13
0
JNIRect::JNIRect( int left, int top, int width, int height )
{
	_instance = JNIRect::getConstructor()->createInstance( NULL, left, top, width, height );//JNIObject::createJNIInstance( JNIRect::getConstructor(), left, top, width, height );
	registerMethods();
}
Esempio n. 14
0
void Server::start(BaseLib::Rpc::PServerInfo& serverInfo)
{
	if(_server->getMethods()->size() == 0) registerMethods();
	_server->start(serverInfo);
}