コード例 #1
0
bool HalDevice::QueryCapability( const char* capability )
{
	/*	build request
	*/	
	DBus::CallMessage msg
	(
		HAL_PATH,
		_udi.c_str(),
		HALDEV_IFACE,
		"QueryCapability"
	);

//	DBus::MessageIter iter = msg.w_iter();
//	iter.append_string(capability);
 	msg.append(DBUS_TYPE_STRING, &capability, DBUS_TYPE_INVALID);

	/*	invoke remote method
	*/
	try
	
	{ 	
		DBus::Message reply = conn().send_blocking(msg, 2000);

	
		DBus::MessageIter ri = reply.r_iter();
		return ri.get_bool();
 	}
 	catch( std::exception& e )
 	{
	
 		hal_dbg("%s",e.what());
	
 		return false;
	}	
}
コード例 #2
0
bool HalDevice::PropertyExists( const char* property )
{
	/*	build request
	*/	
	DBus::CallMessage msg
	(
		HAL_PATH,
		_udi.c_str(),
		HALDEV_IFACE,
		"PropertyExists"
	);

	DBus::MessageIter iter = msg.w_iter();
	iter.append_string(property);

	/*	invoke remote method
	*/
	DBus::Message reply = conn().send_blocking(msg, 1000);

	DBus::MessageIter ri = reply.r_iter();
	return ri.get_bool();
}