在 alljoyn 中公开暴露的 Signal

Publicly exposed Signal in alljoyn

我正在尝试创建一个应用程序 将通过所有总线公布信号。您不需要连接到总线中的特定对象的想法。 我看到接口可以自省,但我发现这个接口在总线上注册时自动添加到总线对象。 所以问题是如何让信号在总线上可见。

接口:

@BusInterface(name = Door.DOOR_INTF_NAME, announced = "true")
public interface Door {

    String DOOR_INTF_NAME = "com.example.Door";
    String PERSON_PASSED_THROUGH = "PersonPassedThrough";

    @BusSignal(name = PERSON_PASSED_THROUGH, sessionless = true)
    void personPassedThrough(String person) throws BusException;
}

发布:

private void doRegisterBusObject(Object obj) {
    LocatableBusObject object = (LocatableBusObject) obj;
    String location = object.getBusObjectLocation();
    if (!location.startsWith("/")) {
        location = "/" + location;
    }
    // Register the object on the local bus
    Status status = bus.registerBusObject(object, location);
    if (Status.OK != status) {
        return;
    }
    // Have About send a signal a new door is available.
    aboutObj.announce(CONTACT_PORT, aboutData);
}

物体可见,信号不可见

基本上,接口 org.allseen.Introspectable 是由路由器添加的,只有在我们宣布对 @BusInterface 的描述时才会添加。

到那时,我们不会有这个界面。