Beispiel #1
0
void Log::print(const xmlrpc_c::paramList & params)
{
	for(unsigned i=0; i < params.size(); i++) {
		std::clog<<"param["<<i<<"]\n";
		printValues(params.getStruct(i));
	}
}
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();
}
Beispiel #3
0
    void
    execute(const xmlrpc_c::paramList & paramList, xmlrpc_c::value* retvalP) {
        // Get the requested mode
        bool const hvRequested(paramList.getBoolean(0));
        paramList.verifyEnd(1);

        TheTransmitControl->setHvRequested(hvRequested);
        *retvalP = xmlrpc_c::value_nil();
    }
Beispiel #4
0
void RemoteKinematics::LookAtMethod::execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const resultP) {
    paramList.verifyEnd(4);
    double x = paramList.getDouble(0);
    double y = paramList.getDouble(1);
    double z = paramList.getDouble(2);
    bool top_camera = paramList.getBoolean(3);
    this->m_kinematics->lookAt(x, y, z, top_camera);
    *resultP = value_nil();
}
Beispiel #5
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
 execute(xmlrpc_c::paramList const& paramList,
         value *             const  retvalP) {
     
     paramList.getNil(0);
     
     paramList.verifyEnd(1);
     
     *retvalP = value_i8(7ll);
 }
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();
}
 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);
 }
Beispiel #10
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();
    }
	virtual void get_rate_limit(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* retvalP) {
		ACE_TRACE("modEmulateRate_Interface::get_rate");
		int rate = 0;

		if (paramList.size() > 2 ) {
			rate = find_handler(paramList)->getRateLimitAtTime(paramList.getDouble(2));
		}
		else {
			rate = find_handler(paramList)->getRateLimit();
		}

		*retvalP = xmlrpc_c::value_double(rate);
	}
		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");
			}
		}
Beispiel #13
0
  void
  execute(xmlrpc_c::paramList const& paramList,
          xmlrpc_c::value *   const  retvalP) {
    const params_t params = paramList.getStruct(0);
    breakOutParams(params);
#if PT_UG
    Mmsapt* pdsa = reinterpret_cast<Mmsapt*>(PhraseDictionary::GetColl()[0]);
    pdsa->add(source_,target_,alignment_);
#else
    const PhraseDictionary* pdf = PhraseDictionary::GetColl()[0];
    PhraseDictionaryDynSuffixArray* 
      pdsa = (PhraseDictionaryDynSuffixArray*) pdf;
    cerr << "Inserting into address " << pdsa << endl;
    pdsa->insertSnt(source_, target_, alignment_);
#endif
    if(add2ORLM_) {
      //updateORLM();
    }
    XVERBOSE(1,"Done inserting\n");
    //PhraseDictionary* pdsa = (PhraseDictionary*) pdf->GetDictionary(*dummy);
    map<string, xmlrpc_c::value> retData;
    //*retvalP = xmlrpc_c::value_struct(retData);
#ifndef PT_UG
    pdf = 0;
#endif
    pdsa = 0;
    *retvalP = xmlrpc_c::value_string("Phrase table updated");
  }
    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);
    }
Beispiel #15
0
void RegisterDeviceHandler::execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value * const retvalP){
	std::string device(paramList.getString(0));

	LOG_INFO("Register device: " << device);

	*retvalP = xmlrpc_c::value_int(1337);
}
  void 
  CloseSession::
  execute(xmlrpc_c::paramList const& paramList,
	  xmlrpc_c::value *   const  retvalP)
  {
    typedef std::map<std::string, xmlrpc_c::value> params_t;
    paramList.verifyEnd(1); // ??? UG
    params_t const& params = paramList.getStruct(0);
    params_t::const_iterator si = params.find("session-id");
    if (si != params.end())
      {
	uint64_t session_id = xmlrpc_c::value_int(si->second);
	m_server.delete_session(session_id);
	*retvalP = xmlrpc_c::value_string("Session closed");
      }
  }
Beispiel #17
0
 void
 execute(xmlrpc_c::paramList const& paramList,
         value *             const  retvalP) {
     
     paramList.verifyEnd(1);
     
     *retvalP = paramList[0];
 }
	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();
	}
Beispiel #19
0
/** Execute method.
 * @param params parameters
 * @param result result value
 */
void
XmlRpcLogMethods::log_log::execute(xmlrpc_c::paramList const& params,
					xmlrpc_c::value *   const  result)
{
  std::string component = params.getString(0);
  std::string message   = params.getString(1);
  __logger->log(__log_level, component.c_str(), "%s", message.c_str());
  *result = xmlrpc_c::value_nil();
}
/*
void devTcp4Client_Interface::client_remove(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {

	ACE_TRACE("devTcp4Client_Interface::remove");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	devices::instance()->remove(devname);

	CEcfg::instance()->get("Devices").remove(devname);

	*retvalP = xmlrpc_c::value_nil();
}
*/
void devTcp4Client_Interface::client_is_connected(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devTcp4Client_Interface::is_connected");

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

	bool isConnected = tcp4_dev->isConnected();
	*retvalP = xmlrpc_c::value_boolean(isConnected);
}
Beispiel #21
0
void ElementMethodCl::execute(xmlrpc_c::paramList const& paramList,xmlrpc_c::value *   const  retvalP) 
{
        
        
        if (paramList.size() == 0)
        {
            /* return list of element */
            *retvalP = xmlrpc_c::value_string("empty");
        }
}
void devUdp4_Interface::dev_udp_bind(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devUdp4_Interface::get_port");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	devUdp4* udp4_dev = dynamic_cast<devUdp4*>(devices::instance()->device(devname));

	udp4_dev->bindSocket();
	*retvalP = xmlrpc_c::value_nil();
}
void devTcp4Client_Interface::client_open_connection(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devTcp4Client_Interface::openConnection");

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

	tcp4_dev->openConnection();
	*retvalP = xmlrpc_c::value_nil();
}
void devTcp4Client_Interface::client_get_address(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devTcp4Client_Interface::get_address");

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

	std::string address = tcp4_dev->getAddress();
	*retvalP = xmlrpc_c::value_string(address);
}
/*
void devUdp4_Interface::dev_udp_remove(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {

	ACE_TRACE("devUdp4_Interface::remove");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	devices::instance()->remove(devname);

	CEcfg::instance()->get("Devices").remove(devname);

	*retvalP = xmlrpc_c::value_nil();
}
*/
void devUdp4_Interface::dev_udp_set_address(xmlrpc_c::paramList const& paramList,
	xmlrpc_c::value* retvalP) {
	ACE_TRACE("devUdp4_Interface::set_address");

	std::string devname = static_cast<std::string>(paramList.getString(0));
	std::string address = static_cast<std::string>(paramList.getString(1));
	devUdp4* udp4_dev = dynamic_cast<devUdp4*>(devices::instance()->device(devname));

	udp4_dev->setAddress(address);
	*retvalP = xmlrpc_c::value_nil();
}
Beispiel #26
0
/** 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();
}
Beispiel #27
0
xmlrpc_c::paramList  myXmlRpc::_add(xmlrpc_c::paramList dataServ,vector<string> v1)
{
    vector<xmlrpc_c::value> arrayData;
    typedef::vector <string>::const_iterator iV ;

    for (iV i =v1.begin(); i != v1.end(); i++) {
        arrayData.push_back(xmlrpc_c::value_string(*i));
    }

    //xmlrpc_c::value_array array1(v1);

    dataServ.add(xmlrpc_c::value_array(arrayData));
    return dataServ;
}
	void set_fill_pattern(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* retvalP) {
		ACE_TRACE("modTM_VC_Gen_Packet_Interface::set_fill_pattern");
		const std::vector<xmlrpc_c::value> xml_rpc_pattern = paramList.getArray(2);

		std::vector<uint8_t> fillPattern;

		for (unsigned i = 0; i < xml_rpc_pattern.size(); i++ ) {
			fillPattern[i] = xmlrpc_c::value_int(xml_rpc_pattern[i]);
		}

		find_handler(paramList)->setFillPattern(fillPattern);

		*retvalP = xmlrpc_c::value_nil();
	}
		void execute(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const retvalP)
		{
			xmlrpc_c::value_array
			/*std::vector<xmlrpc_c::value>*/ symbols = paramList.getArray(0);
			std::vector<xmlrpc_c::value> csymbols = symbols.vectorValueValue();

			vector<string> ss;
			for(unsigned int i=0; i<csymbols.size(); i++)
				ss.push_back(xmlrpc_c::value_string(csymbols[i]).cvalue());

			subscribed_symbols = ss;

			*retvalP = xmlrpc_c::value_boolean(true);
		}
    void
    execute(xmlrpc_c::paramList        const& paramList,
            const xmlrpc_c::callInfo * const  callInfoPtr,
            xmlrpc_c::value *          const  retvalP) {

        const xmlrpc_c::callInfo_serverAbyss * const callInfoP(
            dynamic_cast<const xmlrpc_c::callInfo_serverAbyss *>(callInfoPtr));
        
        paramList.verifyEnd(0);

        // Because this gets called via a xmlrpc_c::serverAbyss:
        assert(callInfoP != NULL);

        *retvalP = xmlrpc_c::value_string(rpcIpAddrMsg(*callInfoP));
    }