Hi,
I've successfully created a manet with some G1s and I want to give
some advices to those who are interested in building up an ad-hoc
wireless connection between two or more G1s.
First of all I downloaded Android from the source (http://
source.android.com/download) and I followed the instructions, adding
G1 support as showed in this link:
http://source.android.com/documentation/building-for-dream.
Hence I've patched the code thanks to Drew Jacob's patches which can
be found here:
https://review.source.android.com/#change,9714
https://review.source.android.com/#change,9718
I recommend to apply the patches by hand, because they are old and
repo leads to some compilation errors.
After that I created the build by running "make".
If you encounter errors read the troubleshooting sections of the pages
listed above. If the compilation process starts complaining about
socket.c you have to comment those lines which are not well digested.
Hence I flashed the device with the fresh build, following this guide:
http://andblogs.net/fastboot/
At this point I created the sdk by running "make sdk". Make sure to
use jdk1.5 instead of jdk1.6
for example:
$ java-config -L
The following VMs are available for generation-2:
1) Sun JDK 1.5.0.18 [sun-jdk-1.5]
*) Sun JDK 1.6.0.13 [sun-jdk-1.6]
$ sudo java-config -S 1
Password:
Now using sun-jdk-1.5 as your generation-2 system JVM
To set the JVM as user run:
$ java-config --set-user-vm sun-jdk-1.5
Now using sun-jdk-1.5 as your user JVM
Once I had the build on the phone and the sdk I wrote a simple
application to set up the ad-hoc connection. Here some useful code to
bring up the manet with a basic configuration:
public class Gossip extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WifiManager mainWifi = (WifiManager)getSystemService
(Context.WIFI_SERVICE);
WifiConfiguration configuration = new WifiConfiguration();
List<WifiConfiguration> remembered =
mainWifi.getConfiguredNetworks();
mainWifi.disconnect();
int i=0;
while (i<(remembered.size())){
mainWifi.removeNetwork(remembered.get(i).networkId);
i++;
}
configuration.SSID="\"YOURSSID\"";
configuration.networkId = 1;
configuration.status=WifiConfiguration.Status.ENABLED;
BitSet setOfBits = new BitSet();
setOfBits.set(0);
configuration.allowedKeyManagement=setOfBits;
configuration.priority=100;
configuration.isAdhoc=true;
configuration.frequency=WifiConfiguration.ChannelFrequency.CHANNEL_11;
int id = mainWifi.addNetwork(configuration);
mainWifi.enableNetwork(id, true);
mainWifi.reconnect();
}
}
That's all folks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---