예제 #1
0
///////////////////////////////////////////////////////////////////////////////
/// @fn PyHelloWorldAPI::PyHelloWorldAPI(const PyHelloWorldPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
PyHelloWorldAPI::PyHelloWorldAPI(const PyHelloWorldPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    Py_Initialize();

    globals = PyDict_New ();
    PyDict_SetItemString (globals, "__builtins__", PyEval_GetBuiltins ());

    registerMethod("echo",      make_method(this, &PyHelloWorldAPI::echo));
    registerMethod("testEvent", make_method(this, &PyHelloWorldAPI::testEvent));

    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &PyHelloWorldAPI::get_testString,
                        &PyHelloWorldAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &PyHelloWorldAPI::get_version));
    
    
    registerEvent("onfired");    

    registerMethod("hello_py", make_method(this, &PyHelloWorldAPI::hello_py));

    registerMethod("getHelloPyExtension", make_method(this, &PyHelloWorldAPI::hello_py_extension));

//    registerMethod("eval", make_method(this, &PyHelloWorldAPI::eval));
}
예제 #2
0
파일: jUARTAPI.cpp 프로젝트: arbruijn/jUART
////////////////////////////////////////////////////////////////////////////
/// @fn jUARTAPI::jUARTAPI(const jUARTPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.
///         You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
////////////////////////////////////////////////////////////////////////////
jUARTAPI::jUARTAPI(const jUARTPtr& plugin, const FB::BrowserHostPtr& host) :
m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &jUARTAPI::echo));
    registerMethod("testEvent", make_method(this, &jUARTAPI::testEvent));

    registerProperty("Serial",  make_property(this, &jUARTAPI::get_Serial));

    // Read-write property
    registerProperty("testString",
        make_property(this,
        &jUARTAPI::get_testString,
        &jUARTAPI::set_testString));

    // Read-only property
    registerProperty("version",
        make_property(this,
        &jUARTAPI::get_version));

    std::string domain = m_host->getDOMWindow()->getNode("location")->getProperty<std::string>("host");
    size_t colon = domain.find(':');
    if (colon != std::string::npos)
            domain = domain.substr(0, colon);
    int secZone = domain.compare("localhost") == 0 ? FB::SecurityScope_Local : FB::SecurityScope_Public;
    m_Serial = boost::make_shared<SerialAPI>(m_host, secZone);
}
encrev2_pluginAPI::encrev2_pluginAPI(FB::BrowserHostPtr host, encrev2_plugin &plugin)
  : m_host(host), m_plugin(plugin)
{
  // Callable
  registerMethod("testEvent", make_method(this, &encrev2_pluginAPI::testEvent));
  registerMethod("stream",    make_method(this, &encrev2_pluginAPI::stream));
  registerMethod("play",      make_method(this, &encrev2_pluginAPI::play));
  registerMethod("stop",      make_method(this, &encrev2_pluginAPI::stop));
  registerMethod("setOptions",make_method(this, &encrev2_pluginAPI::setOptions));
  
  // Read-only property
  registerProperty("version",
                   make_property(this,
                                 &encrev2_pluginAPI::get_version));

  // Read-Write property
  registerProperty("hostname", make_property(this,
  			  &encrev2_pluginAPI::get_hostname,
			  &encrev2_pluginAPI::set_hostname));
  registerProperty("port", make_property(this,
  			  &encrev2_pluginAPI::get_port,
			  &encrev2_pluginAPI::set_port));

  // Event
  registerEvent("onfired");
}
예제 #4
0
///////////////////////////////////////////////////////////////////////////////
/// @fn DNSSDPluginAPI::DNSSDPluginAPI(const DNSSDPluginPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
DNSSDPluginAPI::DNSSDPluginAPI(const DNSSDPluginPtr& plugin,
			       const FB::BrowserHostPtr& host)
  : m_plugin(plugin), m_host(host)
{
  bool safe = true;
  std::string msg = "DNSSDPlugin: ";
  std::string location = m_host->getDOMWindow()->getLocation();
  msg.append("running from ");
  msg.append(location);
#ifndef DEBUG
  safe = (location == MOZILLA_CHROME_URI
	  || location.find("chrome-extension://") == 0);
#endif
  msg.append(safe ? " presumed safe" : " presumed unsafe");
  FBLOG_INFO("DNSSDPluginAPI()", msg);
  if (!safe) return;

  registerMethod("plugin_version",
		 make_method(this, &DNSSDPluginAPI::plugin_version));
  registerMethod("daemon_version",
		 make_method(this, &DNSSDPluginAPI::daemon_version));
  registerMethod("browse_domains",
		 make_method(this, &DNSSDPluginAPI::enum_browse));
  registerMethod("browse", make_method(this, &DNSSDPluginAPI::browse));
  registerMethod("resolve", make_method(this, &DNSSDPluginAPI::resolve));
}
void FriendAPI::initProxy() {
	registerProperty("address", make_property(this, &FriendAPI::getAddress, &FriendAPI::setAddress));
	registerProperty("incSubscribePolicy", make_property(this, &FriendAPI::getIncSubscribePolicy, &FriendAPI::setIncSubscribePolicy));
	registerProperty("name", make_property(this, &FriendAPI::getName, &FriendAPI::setName));
	registerProperty("presenceModel", make_property(this, &FriendAPI::getPresenceModel));
	registerProperty("refKey", make_property(this, &FriendAPI::getRefKey, &FriendAPI::setRefKey));
	registerProperty("subscribesEnabled", make_property(this, &FriendAPI::subscribesEnabled, &FriendAPI::enableSubscribes));

	registerMethod("done", make_method(this, &FriendAPI::done));
	registerMethod("edit", make_method(this, &FriendAPI::edit));
	registerMethod("inList", make_method(this, &FriendAPI::inList));
}
예제 #6
0
PluginAPI::PluginAPI(const BitcoinTrezorPluginPtr &plugin,
                     const FB::BrowserHostPtr &host) :
    _plugin(plugin),
    _host(host)
{
    registerAttribute("version", FBSTRING_PLUGIN_VERSION, true);
    
    registerMethod("call", make_method(this, &PluginAPI::call));
    registerMethod("close", make_method(this, &PluginAPI::close));
    registerMethod("devices", make_method(this, &PluginAPI::devices));
    registerMethod("configure", make_method(this, &PluginAPI::configure));
    registerMethod("deriveChildNode", make_method(this, &PluginAPI::derive_child_node));
}
예제 #7
0
SerialAPI::SerialAPI(const FB::BrowserHostPtr& host) : m_host(host),io(), serial(io)
{
    registerMethod("open",  make_method(this, &SerialAPI::open));
    registerMethod("set_option",  make_method(this, &SerialAPI::set_option));
    registerMethod("send",  make_method(this, &SerialAPI::send));
    registerMethod("sendmulti",  make_method(this, &SerialAPI::sendmulti));
    registerMethod("sendtest",  make_method(this, &SerialAPI::sendtest));
    registerMethod("is_open",  make_method(this, &SerialAPI::is_open));
    registerMethod("recv_callback",  make_method(this, &SerialAPI::recv_callback));
    registerMethod("err_callback",  make_method(this, &SerialAPI::err_callback));
    registerMethod("close",  make_method(this, &SerialAPI::close));
	registerMethod("getports",  make_method(this, &SerialAPI::getports));
}
예제 #8
0
///////////////////////////////////////////////////////////////////////////////
/// @fn osgWebAPI::osgWebAPI(const osgWebPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
osgWebAPI::osgWebAPI(const osgWebPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &osgWebAPI::echo));
    registerMethod("testEvent", make_method(this, &osgWebAPI::testEvent));

    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &osgWebAPI::get_testString,
                        &osgWebAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &osgWebAPI::get_version));
}
예제 #9
0
void VideoAPI::initProxy() {
	mId = getFactory()->getWhiteBoard()->addValue(VideoAPIWeakPtr(boost::static_pointer_cast<VideoAPI>(this->shared_from_this())));
	
	// Methods
	registerProperty("magic", make_property(this, &VideoAPI::getMagic, &VideoAPI::setMagic));
	registerProperty("window", make_property(this, &VideoAPI::getWindow));
	registerMethod("setBackgroundColor", make_method(this, &VideoAPI::setBackgroundColor));
}
예제 #10
0
void KeyRange::initializeMethods()
	{	
	registerProperty("left", make_property(this, &KeyRange::getLeft));
	registerProperty("right", make_property(this, &KeyRange::getRight));
	registerProperty("flags", make_property(this, &KeyRange::getFlags));

	registerProperty("SINGLE", make_property(this, &KeyRange::getSingle));
	registerProperty("LEFT_OPEN", make_property(this, &KeyRange::GetLeftOpen));
	registerProperty("RIGHT_OPEN", make_property(this, &KeyRange::GetRightOpen));
	registerProperty("LEFT_BOUND", make_property(this, &KeyRange::GetLeftBound));
	registerProperty("RIGHT_BOUND", make_property(this, &KeyRange::GetRightBound));

	registerMethod("only", make_method(this, &KeyRange::only));
	registerMethod("leftBound", make_method(this, static_cast<FB::JSOutObject (KeyRange::*)(FB::variant, const FB::CatchAll &)>(&KeyRange::leftBound))); 
	registerMethod("rightBound", make_method(this, static_cast<FB::JSOutObject (KeyRange::*)(FB::variant, const FB::CatchAll &)>(&KeyRange::rightBound)));
	registerMethod("bound", make_method(this, static_cast<FB::JSOutObject (KeyRange::*)(FB::variant, FB::variant, const FB::CatchAll &)>(&KeyRange::bound)));
	}
예제 #11
0
BlabbleCall::BlabbleCall(const BlabbleAccountPtr& parent_account)
	: call_id_(-1), ringing_(false)
{
	if (parent_account) 
	{
		acct_id_ = parent_account->id();
		audio_manager_ = parent_account->GetManager()->audio_manager();
		parent_ = BlabbleAccountWeakPtr(parent_account);
	}
	else 
	{
		acct_id_ = -1;
	}
	
	id_ = BlabbleCall::GetNextId();
	BLABBLE_LOG_DEBUG("New call created. Global id: " << id_);

	registerMethod("answer", make_method(this, &BlabbleCall::Answer));
	registerMethod("hangup", make_method(this, &BlabbleCall::LocalEnd));
	registerMethod("hold", make_method(this, &BlabbleCall::Hold));
	registerMethod("unhold", make_method(this, &BlabbleCall::Unhold));
	registerMethod("sendDTMF", make_method(this, &BlabbleCall::SendDTMF));
	registerMethod("transferReplace", make_method(this, &BlabbleCall::TransferReplace));
	registerMethod("transfer", make_method(this, &BlabbleCall::Transfer));

	registerProperty("callerId", make_property(this, &BlabbleCall::caller_id));
	registerProperty("isActive", make_property(this, &BlabbleCall::is_active));
	registerProperty("status", make_property(this, &BlabbleCall::status));

	registerProperty("onCallConnected", make_write_only_property(this, &BlabbleCall::set_on_call_connected));
	registerProperty("onCallEnd", make_write_only_property(this, &BlabbleCall::set_on_call_end));
}
예제 #12
0
InlineInstallerAPI::InlineInstallerAPI(FB::BrowserHostWrapper *host) : m_host(host)
{
    registerMethod("echo",      make_method(this, &InlineInstallerAPI::echo));
    registerMethod("testEvent", make_method(this, &InlineInstallerAPI::testEvent));

    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &InlineInstallerAPI::get_testString,
                        &InlineInstallerAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &InlineInstallerAPI::get_version));
    
    
    registerEvent("onfired");    
}
void AddressAPI::initProxy() {
	registerMethod("asString", make_method(this, &AddressAPI::asString));
	registerMethod("asStringUriOnly", make_method(this, &AddressAPI::asStringUriOnly));
	registerMethod("clean", make_method(this, &AddressAPI::clean));
	registerMethod("clone", make_method(this, &AddressAPI::clone));
	if (isConst()) {
		registerProperty("displayName", make_property(this, &AddressAPI::getDisplayName));
		registerProperty("domain", make_property(this, &AddressAPI::getDomain));
		registerProperty("port", make_property(this, &AddressAPI::getPort));
		registerProperty("transport", make_property(this, &AddressAPI::getTransport));
		registerProperty("username", make_property(this, &AddressAPI::getUsername));
	} else {
		registerProperty("displayName", make_property(this, &AddressAPI::getDisplayName, &AddressAPI::setDisplayName));
		registerProperty("domain", make_property(this, &AddressAPI::getDomain, &AddressAPI::setDomain));
		registerProperty("port", make_property(this, &AddressAPI::getPort, &AddressAPI::setPort));
		registerProperty("transport", make_property(this, &AddressAPI::getTransport, &AddressAPI::setTransport));
		registerProperty("username", make_property(this, &AddressAPI::getUsername, &AddressAPI::setUsername));
	}
	registerProperty("scheme", make_property(this, &AddressAPI::getScheme));
}
예제 #14
0
파일: jUARTAPI.cpp 프로젝트: CMONO/jUART
////////////////////////////////////////////////////////////////////////////
/// @fn jUARTAPI::jUARTAPI(const jUARTPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.
///         You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
////////////////////////////////////////////////////////////////////////////
jUARTAPI::jUARTAPI(const jUARTPtr& plugin, const FB::BrowserHostPtr& host) :
m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &jUARTAPI::echo));
    registerMethod("testEvent", make_method(this, &jUARTAPI::testEvent));

    registerProperty("Serial",  make_property(this, &jUARTAPI::get_Serial));

    // Read-write property
    registerProperty("testString",
        make_property(this,
        &jUARTAPI::get_testString,
        &jUARTAPI::set_testString));

    // Read-only property
    registerProperty("version",
        make_property(this,
        &jUARTAPI::get_version));

    m_Serial = boost::make_shared<SerialAPI>(m_host);
}
예제 #15
0
///////////////////////////////////////////////////////////////////////////////
/// @fn WebrtcPluginAPI::WebrtcPluginAPI(const WebrtcPluginPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
WebrtcPluginAPI::WebrtcPluginAPI(const WebrtcPluginPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &WebrtcPluginAPI::echo));
    registerMethod("testEvent", make_method(this, &WebrtcPluginAPI::testEvent));
    registerMethod("Signin", make_method(this, &WebrtcPluginAPI::Signin));
    registerMethod("Signout", make_method(this, &WebrtcPluginAPI::Signout));
    registerMethod("Call", make_method(this, &WebrtcPluginAPI::Call));
    registerMethod("Hangup", make_method(this, &WebrtcPluginAPI::Hangup));
    
    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &WebrtcPluginAPI::get_testString,
                        &WebrtcPluginAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &WebrtcPluginAPI::get_version));
    
    m_testString = "Hello World";
    
    m_pMsgQ = new (GoCast::ThreadSafeMessageQueue)();
    m_pEvtQ = new (GoCast::ThreadSafeMessageQueue)();
    m_pMainThread = new PluginMainThread(m_pMsgQ, m_pEvtQ);
    m_pNotificationsThread = new PluginNotificationsThread(this, m_pEvtQ);
    m_pMainThread->startThread();
    m_pNotificationsThread->startThread();
}
예제 #16
0
void UdpServer::initialize()
{
    log_options();

    listening = false;

    if(using_ipv6 && *using_ipv6)
        socket->open(udp::v6());
    else
    	socket->open(udp::v4());

    if(!socket->is_open())
    {
    	string message("UDP server failed to initialize, could not open socket");
    	Logger::error(message, port, host);
    	fire_error(message);
    }

	// synchronize the buffer size of the socket with this class's buffer size
	boost::asio::socket_base::receive_buffer_size buf_size_option(BUFFER_SIZE);
	socket->set_option(buf_size_option);

    if(do_not_route)
    {
        boost::asio::socket_base::do_not_route option(*do_not_route);
		socket->set_option(option);
    }

    if(reuse_address)
    {
        boost::asio::socket_base::reuse_address option(*reuse_address);
        socket->set_option(option);
    }

	if(multicast)
	{
        /* force this to be set */
        boost::asio::socket_base::reuse_address option(true);
        socket->set_option(option);
    }

    if(multicast_ttl)
    {
        boost::asio::ip::multicast::hops option(*multicast_ttl);
        socket->set_option(option);
    }

	// register these methods so they can be invoked from the Javascript
	registerMethod("listen", make_method(this, &UdpServer::start_listening));
}
예제 #17
0
void IndexSync::initializeMethods()
	{
	registerMethod("get", make_method(this, &IndexSync::get));
	registerMethod("getObject", make_method(this, &IndexSync::getObject));
	registerMethod("put", make_method(this, &IndexSync::put));
	registerMethod("remove", make_method(this, &IndexSync::remove));
	registerMethod("openCursor", make_method(this, static_cast<FB::JSOutObject (IndexSync::*)(const FB::CatchAll &)>(&IndexSync::openCursor))); 
	registerMethod("openObjectCursor", make_method(this, static_cast<FB::JSOutObject (IndexSync::*)(const FB::CatchAll &)>(&IndexSync::openObjectCursor))); 
	}
예제 #18
0
파일: Event.cpp 프로젝트: chenbk85/sockit
Event::Event()
{
	// Expose these methods to the Javascript
	registerMethod("send", make_method(this, &Event::send));
	registerMethod("sendBytes", make_method(this, &Event::send_bytes));
	registerMethod("read", make_method(this, &Event::read));
	registerMethod("readBytes", make_method(this, &Event::read_bytes));
	registerMethod("getHost", make_method(this, &Event::get_host));
	registerMethod("getPort", make_method(this, &Event::get_port));
}
예제 #19
0
btlauncherAPI::btlauncherAPI(const btlauncherPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &btlauncherAPI::echo));
    registerMethod("testEvent", make_method(this, &btlauncherAPI::testEvent));
	registerMethod("getInstallPath", make_method(this, &btlauncherAPI::getInstallPath));
	registerMethod("getInstallVersion", make_method(this, &btlauncherAPI::getInstallVersion));
	registerMethod("isRunning", make_method(this, &btlauncherAPI::isRunning));
	registerMethod("stopRunning", make_method(this, &btlauncherAPI::stopRunning));
	registerMethod("runProgram", make_method(this, &btlauncherAPI::runProgram));
	registerMethod("downloadProgram", make_method(this, &btlauncherAPI::downloadProgram));
	registerMethod("checkForUpdate", make_method(this, &btlauncherAPI::checkForUpdate));
    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &btlauncherAPI::get_testString,
                        &btlauncherAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &btlauncherAPI::get_version));
}
예제 #20
0
///////////////////////////////////////////////////////////////////////////////
/// @fn hapticAPI::hapticAPI(const hapticPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
hapticAPI::hapticAPI(const hapticPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &hapticAPI::echo));
    registerMethod("testEvent", make_method(this, &hapticAPI::testEvent));

	//Register JHaptic library properties
	registerProperty("numDevice",		make_property(this, &hapticAPI::getNumDevice));
	registerProperty("initialized",		make_property(this, &hapticAPI::getStatus));
	registerProperty("deviceType",		make_property(this, &hapticAPI::getDeviceType));
	registerProperty("maxForce",		make_property(this, &hapticAPI::getMaxForce));
	registerProperty("workspaceSize",	make_property(this, &hapticAPI::getWorkspaceSize));
	registerProperty("position",		make_property(this, &hapticAPI::getPosition));
	registerProperty("pixel",			make_property(this, &hapticAPI::getPixelWidth));


	//Register JHaptic library methods
	registerMethod("startDevice",	make_method(this, &hapticAPI::startDevice));
	registerMethod("stopDevice",	make_method(this, &hapticAPI::stopDevice));
	registerMethod("sendForce",		make_method(this, &hapticAPI::sendForce));
	registerMethod("setContext",	make_method(this, &hapticAPI::setContext));




    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &hapticAPI::get_testString,
                        &hapticAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &hapticAPI::get_version));

	//State variables initialization
	initialized			 =	false;
	deviceID			 =  getNumDevice()-1;
	InitializedString	 =	"Initialized";
	NotInitializedString =	"Not initialized";
	ConnectionString	 =	"Connection opened";
	DisconnectionString	 =	"Connection closed";

	setPixelWidth();
}
예제 #21
0
int service(int argc, char *argv[]){
    //init list_methods
    method_data list_methods[50];
    int list_methods_len = 0; 
    
    //set mailbox
    char mailbox[50];
    strcpy(mailbox,argv[1]);

    //create the list of methods 
    int i;
    for(i = 2;i<argc;i = i+3){
	make_method(&list_methods[list_methods_len++],argv[i],argv[i+1],argv[i+2]);
    }
   
    m_task_t received_task = NULL;
    MSG_error_t res = MSG_OK;
    msg_comm_t msg_recv = NULL;
    //receive request
    while(1){
	msg_recv = MSG_task_irecv(&(received_task),mailbox);
	res = MSG_comm_wait(msg_recv,-1);
	if(res == MSG_OK){
	    char task_name[100];
	    strcpy(task_name,MSG_task_get_name(received_task));
	    task_data *received_task_data = (task_data *) received_task->data;
	    //received_task_data->starttime = MSG_get_clock();
	    //double endtime = MSG_get_clock();
	    //write_log(received_task_data->starttime,endtime,"waiting time");
	    //received_task_data->starttime = endtime;
	    XBT_INFO("received task %lf",received_task_data->id);
	    run_task(task_name,list_methods_len,list_methods,received_task);
	}
	MSG_task_destroy(received_task);
	received_task = NULL;
    }
}
예제 #22
0
FBTestPluginAPI::FBTestPluginAPI(boost::shared_ptr<FBTestPlugin> plugin, FB::BrowserHostPtr host) : m_host(host), m_pluginWeak(plugin)
{    
    registerMethod("add",  make_method(this, &FBTestPluginAPI::add));
    registerMethod(L"echo",  make_method(this, &FBTestPluginAPI::echo));
    registerMethod(L"eval",  make_method(this, &FBTestPluginAPI::eval));
    registerMethod(L"asString",  make_method(this, &FBTestPluginAPI::asString));
    registerMethod(L"asBool",  make_method(this, &FBTestPluginAPI::asBool));
    registerMethod(L"asInt",  make_method(this, &FBTestPluginAPI::asInt));
    registerMethod("asDouble",  make_method(this, &FBTestPluginAPI::asDouble));
    registerMethod("listArray",  make_method(this, &FBTestPluginAPI::listArray));
    registerMethod("reverseArray",  make_method(this, &FBTestPluginAPI::reverseArray));
    registerMethod("getUserData",  make_method(this, &FBTestPluginAPI::getUserData));
    registerMethod("getUserArray",  make_method(this, &FBTestPluginAPI::getUserArray));
    registerMethod("getObjectKeys",  make_method(this, &FBTestPluginAPI::getObjectKeys));
    registerMethod("getObjectValues",  make_method(this, &FBTestPluginAPI::getObjectValues));
    registerMethod("testEvent",  make_method(this, &FBTestPluginAPI::testEvent));
    registerMethod("testStreams",  make_method(this, &FBTestPluginAPI::testStreams));
    registerMethod("getTagAttribute", make_method(this, &FBTestPluginAPI::getTagAttribute));
    registerMethod("getPageLocation", make_method(this, &FBTestPluginAPI::getPageLocation));
    registerMethod("createThreadRunner", make_method(this, &FBTestPluginAPI::createThreadRunner));
    registerMethod("optionalTest", make_method(this, &FBTestPluginAPI::optionalTest));
    registerMethod("getURL", make_method(this, &FBTestPluginAPI::getURL));
     
    registerMethod(L"скажи",  make_method(this, &FBTestPluginAPI::say));
    
    registerMethod("addWithSimpleMath", make_method(this, &FBTestPluginAPI::addWithSimpleMath));
    registerMethod("createSimpleMath", make_method(this, &FBTestPluginAPI::createSimpleMath));

    registerMethod("countArrayLength",  make_method(this, &FBTestPluginAPI::countArrayLength));
    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &FBTestPluginAPI::get_testString,
                        &FBTestPluginAPI::set_testString));

    registerProperty("simpleMath",
                     make_property(this,
                        &FBTestPluginAPI::get_simpleMath));
    // Read-only property
    registerProperty("someInt",
                     make_property(this,
                        &FBTestPluginAPI::get_someInt));
    registerProperty("pluginPath",
                     make_property(this, &FBTestPluginAPI::get_pluginPath));

    registerEvent("onfired");

    m_simpleMath = boost::make_shared<SimpleMathAPI>(m_host);
}
예제 #23
0
IndexedDatabase::IndexedDatabase(FB::BrowserHostPtr host)
    : host(host)
{
    registerMethod("open", make_method(this, &IndexedDatabase::open));
}
예제 #24
0
///////////////////////////////////////////////////////////////////////////////
/// @fn ambientAPI::ambientAPI(const ambientPtr& plugin, const FB::BrowserHostPtr host)
///
/// @brief  Constructor for your JSAPI object.  You should register your methods, properties, and events
///         that should be accessible to Javascript from here.
///
/// @see FB::JSAPIAuto::registerMethod
/// @see FB::JSAPIAuto::registerProperty
/// @see FB::JSAPIAuto::registerEvent
///////////////////////////////////////////////////////////////////////////////
ambientAPI::ambientAPI(const ambientPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
    registerMethod("echo",      make_method(this, &ambientAPI::echo));
    registerMethod("testEvent", make_method(this, &ambientAPI::testEvent));

    // Read-write property
    registerProperty("testString",
                     make_property(this,
                        &ambientAPI::get_testString,
                        &ambientAPI::set_testString));

    // Read-only property
    registerProperty("version",
                     make_property(this,
                        &ambientAPI::get_version));

	registerMethod("setCalculationRate", make_method(this, &ambientAPI::setCalculationRate));
	registerMethod("threadedCalculation", make_method(this, &ambientAPI::threadedCalculation));
	registerMethod("threadedCalculationFullscreen", make_method(this, &ambientAPI::threadedCalculationFullscreen));
	registerMethod("initialize", make_method(this, &ambientAPI::initialize));
	registerMethod("calcFrame", make_method(this, &ambientAPI::calcFrame));
	registerMethod("getErrorMessage",make_method(this, &ambientAPI::getErrorMessage));
	registerMethod("loadSEM",make_method(this, &ambientAPI::loadSEM));
	registerMethod("playEffectAtTimeAbs", make_method(this, &ambientAPI::playEffectAtTimeAbs));
	registerMethod("playEffectAtTimeRel", make_method(this, &ambientAPI::playEffectAtTimeRel));
	registerMethod("grabFrame",make_method(this,&ambientAPI::grabFrame));

	// EPOC JS method
#ifdef USE_EPOC
	registerMethod("queryEPOC", make_method(this,&ambientAPI::queryEPOC));
#endif	

	

}
void FileManagerAPI::initProxy() {
	registerMethod("copy", make_method(this, &FileManagerAPI::copy));
	registerMethod("exists", make_method(this, &FileManagerAPI::exists));
	registerMethod("mkdir", make_method(this, &FileManagerAPI::mkdir));
	registerMethod("remove", make_method(this, &FileManagerAPI::remove));
}