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;
	}	
}
Example #2
0
DBus::Variant contentAccessModuleServer::createVariantUint16(uint16_t value)
{
    DBus::Variant var;
    DBus::MessageIter iter = var.writer();
    iter.append_uint16(value);
    return var;
}
Example #3
0
DBus::Variant contentAccessModuleServer::createVariantString(std::string str)
{
    DBus::Variant var;
    DBus::MessageIter iter = var.writer();
    iter.append_string(str.c_str());
    return var;
}
void UDisksDeviceProxy::PropertyModifiedCb(const DBus::SignalMessage &sig)
{
	typedef DBus::Struct< std::string, bool, bool > HalProperty;

	DBus::MessageIter it = sig.reader();
	int32_t number;

	it >> number;

	DBus::MessageIter arr = it.recurse();

	for (int i = 0; i < number; ++i, ++arr)
	{
		HalProperty hp;

		arr >> hp;

		std::cout << "modified property " << hp._1 << " in " << path() << std::endl;
	}
}
const char* HalDevice::GetPropertyString( const char* property )
{
	/*	build request
	*/	
	DBus::CallMessage msg
	(
		HAL_PATH,
		_udi.c_str(),
		HALDEV_IFACE,
		"GetPropertyString"
	);

 	msg.append(DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID);

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

	DBus::MessageIter ri = reply.r_iter();
	return ri.get_string();
}
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();
}
void SdpBrowser::on_read_response( u16 status, const Sdp::RecordList& data )
{
	DBus::MessageIter rw = _reply->w_iter();

	rw.append_uint16(status);

	DBus::MessageIter sa = rw.new_array(DBUS_TYPE_STRING);

	Sdp::RecordList::const_iterator rit = data.begin();
	while( rit != data.end() )
	{
		sa.append_string( _records[rit->handle()]->oname().c_str() );

		++rit;
	}

	rw.close_container(sa);
	_reply->append(DBUS_TYPE_INVALID);

	_bus.send(*_reply);
	delete _reply;
	_reply = NULL;
}