Invoking method is an array argument #206
-
Hi all, How can I invoke the
The XML method definition is: [...]
<method name="CreateNetwork">
<arg name="app" type="o" direction="in"/>
<arg name="uuid" type="ay" direction="in"/>
</method>
[...] And the generated code is: void CreateNetwork(const sdbus::ObjectPath& app, const std::vector<uint8_t>& uuid)
{
proxy_.callMethod("CreateNetwork").onInterface(INTERFACE_NAME).withArguments(app, uuid);
} I'm invoking it as: static std::string serviceName = "com.example.BLEMesh";
static std::string objectPath = "/com/example/blemesh";
// Create connection
auto connection = sdbus::createSystemBusConnection(serviceName);
// Create proxy w/ connection
auto networkProxy = new org::bluez::mesh::Network(*connection, "org.bluez.mesh", "org.bluez.mesh.Network1");
// Enter the event loop
connection->enterEventLoopAsync();
// Sleep to let things spin up (?)
sleep(1);
// Generate GUID, get ObjectPath obj
std::vector<uint8_t> uuid = generateUUID();
sdbus::ObjectPath objectPathObj(objectPath);
// Invoke method
networkProxy->CreateNetwork(objectPathObj, uuid); I wrote a C program using the Any help is appreciated! Thanks, JD Scott |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @shiirish, here are a few notes on usage:
|
Beta Was this translation helpful? Give feedback.
Hi @shiirish, here are a few notes on usage:
org::bluez::mesh::Network
proxy class takes three parameters: anIConnection
reference, a D-Bus service name, and a D-Bus object path. You are passing it a D-Bus interface for the third parameter.