Skip to content

Commit

Permalink
Merge remote branch 'upstreamrepo/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
pataxis committed Oct 12, 2023
2 parents 3eb63ad + 085df65 commit b43d01d
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions docs/develop/VAPIX-access-for-ACAP-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,24 @@ An ACAP application can acquire VAPIX service account credentials through a D-Bu
GDBusConnection *connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
```

2. Create a proxy object for your D-Bus interface:

This proxy allows users to interact with your D-Bus service or interface.

```c
GDBusProxy *proxy = g_dbus_proxy_new_sync(connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"com.axis.HTTPConf1",
"/com/axis/HttpConf1/Auth",
"com.axis.HTTPConf1.Auth1",
NULL,
&error);
```

3. Invoke the D-Bus method using the proxy:
2. Invoke the D-Bus method using the D-Bus connection:

The user can effectively call the method that returns the credentials by doing this.

```c
GVariant *username = g_variant_new("(s)", "testuser");

GVariant *result = g_dbus_proxy_call_sync(proxy,
"com.axis.HTTPConf1.Auth1.GetVapixServiceAccountCredentials",
username,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
GVariant *result = g_dbus_connection_call_sync (connection,
"com.axis.HTTPConf1",
"/com/axis/HttpConf1/Auth",
"com.axis.HTTPConf1.Auth1",
"GetVapixServiceAccountCredentials",
username,
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
```

When the `GetVapixServiceAccountCredentials` method is invoked, it generates credentials with the specified username and a random password, which is returned to the ACAP as a string.
Expand Down

0 comments on commit b43d01d

Please sign in to comment.