예제 #1
0
 void
 execute(xmlrpc_c::paramList const& paramList,
         value *             const  retvalP) {
     
     int const addend(paramList.getInt(0));
     int const adder(paramList.getInt(1));
     
     paramList.verifyEnd(2);
     
     *retvalP = value_int(addend + adder);
 }
    void
    execute(xmlrpc_c::paramList const& paramList,
            xmlrpc_c::value *   const  retvalP) {

        int const addend(paramList.getInt(0));
        int const adder(paramList.getInt(1));

        paramList.verifyEnd(2);

        *retvalP = xmlrpc_c::value_int(addend + adder);

        // Sometimes, make it look hard (so client can see what it's like
        // to do an RPC that takes a while).
        if (adder == 1)
            SLEEP(2);
    }
void devTcp4Client_Interface::client_create(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {

	ACE_TRACE("devTcp4Client_Interface::create");

	std::string devname = static_cast<std::string>(paramList.getString(0));

	if (devices::instance()->exists(devname)) {
		throw Exception("Device with that name already exists.");
	}

	std::string address = IPv4Addr::IPv4_Any;
	int port = 0;

	devTcp4Client* tcp4_dev = new devTcp4Client(devname, this);
	devices::instance()->add(tcp4_dev);

	if (paramList.size() > 1) {
		address = static_cast<std::string>(paramList.getString(2));
		tcp4_dev->setAddress(address);
	}
	if (paramList.size() > 2) {
		port = static_cast<int>(paramList.getInt(3));
		tcp4_dev->setPort(port);
		if (port > 0) tcp4_dev->openConnection();
	}

	*retvalP = xmlrpc_c::value_nil();
}
예제 #4
0
    void
    execute(const xmlrpc_c::paramList & paramList, xmlrpc_c::value* retvalP) {
        // Get the requested mode
        int const state(paramList.getInt(0));
        paramList.verifyEnd(1);

        ILOG << "Received 'setApsValveControl(" << state << ")' command";
        TheApsControl->setValveControl(static_cast<ApsControl::ValveControlState>(state));
        *retvalP = xmlrpc_c::value_nil();
    }
void devTcp4Client_Interface::client_set_ms_between_attempts(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devTcp4Client_Interface::client_set_ms_between_attempts");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	int ms = static_cast<int>(paramList.getInt(1));
	devTcp4Client* tcp4_dev = dynamic_cast<devTcp4Client*>(devices::instance()->device(devname));

	tcp4_dev->setMsBetweenAttempts(ms);
	*retvalP = xmlrpc_c::value_nil();
}
void devTcp4Client_Interface::client_set_port(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devTcp4Client_Interface::set_port");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	int port = static_cast<int>(paramList.getInt(1));
	devTcp4Client* tcp4_dev = dynamic_cast<devTcp4Client*>(devices::instance()->device(devname));

	tcp4_dev->setPort(port);
	*retvalP = xmlrpc_c::value_nil();
}
예제 #7
0
    void
    execute(const xmlrpc_c::paramList & paramList, xmlrpc_c::value* retvalP) {
        paramList.verifyEnd(1);
        // Get the requested mode
        const int iMode(paramList.getInt(0));
        HcrPmc730::HmcOperationMode hmcMode =
                static_cast<HcrPmc730::HmcOperationMode>(iMode);

        ILOG << "Received 'setRequestedHmcMode(" << iMode << ")' command";
        TheTransmitControl->setRequestedHmcMode(hmcMode);
        *retvalP = xmlrpc_c::value_nil();
    }
예제 #8
0
파일: log.cpp 프로젝트: tempbottle/fawkes
/** Execute method.
 * @param params parameters
 * @param result result value
 */
void
XmlRpcLogMethods::log_set_size::execute(xmlrpc_c::paramList const& params,
					xmlrpc_c::value *   const  result)
{
  int new_size = params.getInt(0);
  if (new_size <= 0) {
    throw xmlrpc_c::fault("Illegal size value, must be integer > 0",
			  xmlrpc_c::fault::CODE_UNSPECIFIED);
  }
  __cache_logger->set_size(new_size);
  *result = xmlrpc_c::value_nil();
}
예제 #9
0
		void execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const retvalP)
		{
			chair = paramList.getInt(0);
			symbol_name = paramList.getString(1);

			SetEvent(symbol_need);
			DWORD wait_result;
			wait_result = WaitForSingleObject(symbol_ready, INFINITE);
			if(WAIT_OBJECT_0 == wait_result)
			{
				*retvalP = xmlrpc_c::value_double(symbol_value);
			} else {
				msg(L"Something went wrong.", L"openholdem-xmlrpc-dll");
			}
		}
	virtual void set_rate_limit(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* retvalP) {
		ACE_TRACE("modEmulateRate_Interface::set_rate");
		int rate = 0, startTime = -1.0;

		if ( paramList[2].type() != xmlrpc_c::value::TYPE_ARRAY ) {
			rate = paramList.getInt(2);
		}
		else {
			const std::vector<xmlrpc_c::value> arrayData = paramList.getArray(2);
			startTime = xmlrpc_c::value_double(arrayData[0]);
			rate = xmlrpc_c::value_double(arrayData[1]);
		}

		find_handler(paramList)->setRateLimit(rate, startTime);

		*retvalP = xmlrpc_c::value_nil();
	}