如何使用SPAN(智能手机Ad-hoc网络)框架建立Mesh网络?

3

我正在开发一款基于安卓系统的应用程序,它将在紧急或灾难情况下帮助用户安全疏散。为此,我需要在特定区域的用户之间建立一个网状网络。我必须采用自组网模式来实现这一目标。

3个回答

0
您可能正在寻找的协议不方便地标记为“adhoc”,它被称为“Wifi P2P”:
文档:developer.android.com/guide/topics/connectivity/wifip2p.html
WifiP2pManager mManager;
Channel mChannel;
BroadcastReceiver mReceiver;
...
@Override
protected void onCreate(Bundle savedInstanceState){
    ...
    mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
    mChannel = mManager.initialize(this, getMainLooper(), null);
    mReceiver = new WiFiDirectBroadcastReceiver(mManager, mChannel, this);
    ...
}

//obtain a peer from the WifiP2pDeviceList
WifiP2pDevice device;
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = device.deviceAddress;
mManager.connect(mChannel, config, new ActionListener() {

    @Override
    public void onSuccess() {
        //success logic
    }

    @Override
    public void onFailure(int reason) {
        //failure logic
    }
});

希望这能有所帮助


实际上,需要对设备进行root才能启用adhoc模式。而我不想更改Wi-Fi芯片组的源代码。我只是想知道,您是否可以通过SPAN框架帮助我启用adhoc模式。 - Ahmed Qayyum
是的,不幸的是,SPAN只是一个概念,在谷歌上没有任何文档,除非你能在某个地方找到链接。 - Aaron Gillion
Wi-Fi P2P(现在称为Wi-Fi Direct)不支持自组网(多跳路由)。 - Bora M. Alper

0

0

我在谷歌商店上发现了一个类似的想法,名为Beamify。也许你可以联系他们获取一些灵感。


仅提供链接的答案通常不被鼓励。您能否总结链接的内容以及它如何适用于问题? - ymbirtt

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接