用于激活无线连接的文档ActivateConnection
说您可以提供"/"
第二个和第三个参数来让 dbus 为您选择合理的默认值。
由于 Java 中函数的绑定是 type DBusInterface
,你是怎么做的?你几乎不会写(DBusInterface)"/"
,是吗?
如果有人能回答以上问题,我将不胜感激。对于在该领域有更多时间或知识的人来说,我要解决的真正ActivateConnection
问题是我的呼叫崩溃了。这是我导致崩溃的代码。它引用了这个接口。
var nmIface = (NetworkManagerIface) instance.getRemoteObject(NetworkManagerIface._NM_IFACE, NetworkManagerIface._NM_PATH, NetworkManagerIface.class);
System.out.println("Connect:" + connMatch.getObjectPath());
System.out.println("Adaptor:" + adaptor.getObjectPath());
System.out.println("AccessP:" + accessMatch.getObjectPath());
for (DBusPath devName : nmIface.GetDevices()) {
System.out.println(" Device:" + devName.getPath());
}
nmIface.ActivateConnection(connMatch, adaptor, accessMatch);
并产生此输出(由 SO 插入颜色):
Connect:/org/freedesktop/NetworkManager/Settings/4
Adaptor:/org/freedesktop/NetworkManager/Devices/3
AccessP:/org/freedesktop/NetworkManager/AccessPoint/248
Device:/org/freedesktop/NetworkManager/Devices/1
Device:/org/freedesktop/NetworkManager/Devices/2
Device:/org/freedesktop/NetworkManager/Devices/3
Exception in thread "JavaFX Application Thread" org.freedesktop.dbus.exceptions.DBusExecutionException: Failed to construct D-Bus type: Not an object exported or imported by this connection at org.freedesktop.dbus.RemoteInvocationHandler.executeRemoteMethod(RemoteInvocationHandler.java:102)
at org.freedesktop.dbus.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:228)
at com.sun.proxy.$Proxy23.ActivateConnection(Unknown Source)
at com.mycompany.Wifi.activateConnection(Wifi.java:322)
如果有人可以就这可能有什么问题提供任何指示,我将更加感激。