lejos.hardware.Wifi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.hardware;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class Wifi {
public static LocalWifiDevice getLocalDevice(String ifName) {
return new LocalWifiDevice(ifName);
}
public static String[] getIfNames() throws IOException {
ArrayList results = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader("/proc/net/wireless"));
String s;
br.readLine();
br.readLine();
int n=0;
while ((s = br.readLine()) != null) {
String [] ss = s.split(":");
String ifn = ss[0].trim();
System.out.println("Interface " + n++ + " is " + ifn);
results.add(ifn);
}
br.close();
return results.toArray(new String[results.size()]);
}
}