Esempio n. 1
0
bool luna_service_initialize(const char *dbusAddress) {

  bool returnVal = FALSE;

  LSError lserror;
  LSErrorInit(&lserror);

  loop = g_main_loop_new(NULL, FALSE);
  if (loop==NULL)
    goto end;

  returnVal = LSRegisterPalmService(dbusAddress, &serviceHandle, &lserror);
  if (returnVal) {
    pub_serviceHandle = LSPalmServiceGetPublicConnection(serviceHandle);
    priv_serviceHandle = LSPalmServiceGetPrivateConnection(serviceHandle);
  } else
    goto end;

  returnVal =  register_methods(serviceHandle, lserror);
  if (returnVal) {
    LSGmainAttachPalmService(serviceHandle, loop, &lserror);
  }

 end:
  if (LSErrorIsSet(&lserror)) {
    LSErrorPrint(&lserror, stderr);
    LSErrorFree(&lserror);
  }

  return returnVal;
}
Esempio n. 2
0
/*************************************************
 Function:		JNI_OnLoad
 Descroption:	JNI Loader
 Input:
	1.vm
	2.reserved
 Output:
 Return:
 Other:
*************************************************/
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
	JNIEnv* temp = NULL;
    JNIEnv* env = NULL;
    jint result = -1;
	bool check = false;
    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK)
    {
        LOGE("ERROR: GetEnv failed/n");
        goto fail;
    }
    if (register_methods(env) != 0)
    {
        LOGE("ERROR: PlatformLibrary native registration failed/n");
        goto fail;
    }

	LOGD("Version[%s Build Time %s]",_JNI_BUILD_VERSION_,_JNI_BUILD_TIME_);
    result = JNI_VERSION_1_4;

	mCheck = CheckClassDex();
	#if CHECK_OPER
	if(false == check)
	{
		LOGD("È¥ËÀ°ÉÄã!");
		jclass clazz = temp->FindClass(USE_CLASS_PATH);
	}
	#endif
    fail:
    return result;
}
Esempio n. 3
0
 complex_item(const std::string& name, bool current, const std::string& url):
     m_name(name), m_current(current), m_url(url)
 {
   register_methods(this, std::map<std::string,mstch::node(complex_item::*)()>{
     {"name", &complex_item::name}, {"current", &complex_item::current},
     {"url", &complex_item::url},   {"link", &complex_item::link}
   });
 }
Esempio n. 4
0
 complex():
     m_header("Colors"),
     m_item(mstch::array{
       std::make_shared<complex_item>("red", true, "#Red"),
       std::make_shared<complex_item>("green", false, "#Green"),
       std::make_shared<complex_item>("blue", false, "#Blue")
     })
 {
   register_methods(this, std::map<std::string,mstch::node(complex::*)()>{
     {"header", &complex::header}, {"item", &complex::item},
     {"list", &complex::list}, {"empty", &complex::empty}
   });
 }
void EasyRPG::register_tilemap(mrb_state* M) {
	static method_info const methods[] = {
		{ "initialize", &initialize, MRB_ARGS_OPT(1) },
		property_methods(chipset),
		property_methods(map_data_down), property_methods(map_data_up),
		property_methods(passable_up), property_methods(passable_down),
		// property_methods(properties),
		property_methods(visible),
		property_methods(ox), property_methods(oy),
		property_methods(width), property_methods(height),
		property_methods(animation_speed), property_methods(animation_type),
		{ "substitudte_down", &substitudte_down, MRB_ARGS_REQ(2) },
		{ "substitudte_up", &substitudte_up, MRB_ARGS_REQ(2) },
		{ "update", &update, MRB_ARGS_NONE() },
		method_info_end };
	register_methods(M, define_class<Tilemap>(M, "Tilemap"), methods);
}
void EasyRPG::register_sprite(mrb_state* M) {
	static method_info const methods[] = {
		{ "initialize", &initialize, MRB_ARGS_OPT(1) },
		{ "viewport", &viewport, MRB_ARGS_NONE() },
		{ "flash", &flash, MRB_ARGS_REQ(2) },
		{ "update", &update, MRB_ARGS_NONE() },
		property_methods(bitmap), property_methods(src_rect),
		property_methods(visible), property_methods(mirror),
		property_methods(color), property_methods(tone),
		property_methods(x), property_methods(y), property_methods(z),
		property_methods(ox), property_methods(oy),
		property_methods(bush_depth), property_methods(blend_type),
		property_methods(opacity),
		property_methods(zoom_x), property_methods(zoom_y),
		property_methods(angle),
		method_info_end };
	register_methods(M, define_class<Sprite>(M, "Sprite"), methods);
}
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
    JNIEnv *env = NULL;
    jint result = -1;

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

    if (register_methods(env) < 0) {
        if (DEBUG) LOG_E(TAG, "ERROR: native registration failed\n");
        goto bail;
    }

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

    bail:
    return result;
}
Esempio n. 8
0
void LuaBeans::push( void* userdata )
{
  LUASTACK_SET(L);

  lua_newtable(L);

  lua_pushstring(L, "_USERDATA_REF_");

  luaCompat_pushTypeByName(L, module_name, udtag_name);
  luaCompat_newTypedObject(L, userdata);

  lua_settable(L, -3);

  if (this->mlist)
    register_methods(L, -1, this->mlist->table, this->mlist->n);

  luaCompat_pushTypeByName(L, module_name, tag_name);
  luaCompat_setType(L, -2);

  LUASTACK_CLEAN(L, 1);
}
	modRSEncode_Interface(xmlrpc_c::registryPtr& rpcRegistry):
		nasaCE::TrafficHandler_Interface<modRSEncode>(rpcRegistry, "modRSEncode") {
		ACE_TRACE("modRSEncode_Interface::modRSEncode_Interface");
		
		register_methods(rpcRegistry);
	}
Esempio n. 10
0
int main() {
	RegisterExecutablePlatform(ExePlatformWebInterface);
	Log.LoadLogSettingsDefaults();
	
	set_exception_handler();
	register_methods();
	Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect
	Log.Out(Logs::General, Logs::WebInterface_Server, "Starting EQEmu Web Server.");
	
	if (signal(SIGINT, CatchSignal) == SIG_ERR)	{
		Log.Out(Logs::General, Logs::Error, "Could not set signal handler");
		return 1;
	}
	
	if (signal(SIGTERM, CatchSignal) == SIG_ERR)	{
		Log.Out(Logs::General, Logs::Error, "Could not set signal handler");
		return 1;
	}

	Timer writable_socket_timer;
	config = EQEmuConfig::get();
	lws_context_creation_info info;
	memset(&info, 0, sizeof info);
	info.port = config->WebInterfacePort;
	info.protocols = protocols;
	info.extensions = nullptr;
	info.gid = -1;
	info.uid = -1;

	context = libwebsocket_create_context(&info);
	if (context == NULL) {
		Log.Out(Logs::General, Logs::Error, "Could not create websocket handler.");
		return 1;
	}

	db = new SharedDatabase();
	Log.Out(Logs::General, Logs::WebInterface_Server, "Connecting to database...");
	if(!db->Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
		config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
		Log.Out(Logs::General, Logs::WebInterface_Server, "Unable to connect to the database, cannot continue without a database connection");
		return 1;
	}
	db->LoadLogSettings(Log.log_settings);
	worldserver = new WorldServer(config->SharedKey);
	worldserver->Connect();
	writable_socket_timer.Start(10);

	while(run) { 
		Timer::SetCurrentTime(); 
		
		if (InterserverTimer.Check()) {
			if (worldserver->TryReconnect() && (!worldserver->Connected()))
				worldserver->AsyncConnect();
		}
		worldserver->Process(); 

		timeout_manager.CheckTimeouts();

		if (writable_socket_timer.Check(true)) {
			libwebsocket_callback_on_writable_all_protocol(&protocols[1]);
		}

		libwebsocket_service(context, 5);
		Sleep(1);
	}

	safe_delete(worldserver);
	safe_delete(db);
	libwebsocket_context_destroy(context);

	return 0;
}
	modTM_VC_Gen_Packet_Interface(xmlrpc_c::registryPtr& rpcRegistry):
		nasaCE::TrafficHandler_Interface<modTM_VC_Gen_Packet>(rpcRegistry, "modTM_VC_Gen_Packet") {
		ACE_TRACE("modTM_VC_Gen_Packet_Interface::modTM_VC_Gen_Packet_Interface");

		register_methods(rpcRegistry);
	}
	modPseudoRandomize_Interface(xmlrpc_c::registryPtr& rpcRegistry):
		nasaCE::TrafficHandler_Interface<modPseudoRandomize>(rpcRegistry, "modPseudoRandomize") {
		ACE_TRACE("modPseudoRandomize_Interface::modPseudoRandomize_Interface");

		register_methods(rpcRegistry);
	}
devTcp4Client_Interface::devTcp4Client_Interface(xmlrpc_c::registryPtr& rpcRegistry):
	Device_Interface_Templ<devTcp4Client>("devTcp4Client_Interface") {
	ACE_TRACE("devTcp4Client_Interface::devTcp4Client_Interface");

	register_methods(rpcRegistry);
}