【发布时间】:2016-12-15 13:32:26
【问题描述】:
我使用 alljoyn 进行 wifi 共享。我希望设备列表连接到基于频道的 wifi 网络。
我关注了一个演示,但它没有调用实现的方法announced
AboutListener 是 alljoyn 的一部分。
import org.alljoyn.bus.AboutListener;
public class OnboardingApplication extends Application implements AboutListener {
@Override
public void announced(String busName, int version, short port, AboutObjectDescription[] objectDescriptions, Map<String, Variant> aboutMap) {
Map<String, Object> newMap = new HashMap<String, Object>();
try {
newMap = TransportUtil.fromVariantMap(aboutMap);
String deviceId = (newMap.get(AboutKeys.ABOUT_APP_ID).toString());
String deviceFriendlyName = (String) newMap.get(AboutKeys.ABOUT_DEVICE_NAME);
m_logger.debug(TAG, "onAnnouncement received: with parameters: busName:" + busName + ", port:" + port + ", deviceid" + deviceId + ", deviceName:" + deviceFriendlyName);
addDevice(deviceId, busName, port, deviceFriendlyName, objectDescriptions, newMap);
} catch (BusException e) {
e.printStackTrace();
}
}
}
【问题讨论】:
-
你把aboutListener注册到busAttachment了吗?
-
是的,我已经注册了
-
@AmitPrajapati 为什么不勾选我的答案?
标签: java android networking wifi alljoyn