Coder Social home page Coder Social logo

jwlanapi's Introduction

JWlanAPI

JWlanApi is a JNA wrapper for Micosoft Windows Native Wifi API. The goal of this project is to provide an easy and reliable Wi-Fi connection manager for Windows based on Java (voiding using netsh or similar approaches).

The base code is taken from AllSeen/Alljoyn proyect, and more specifically based on the code commited by at4wireless.

Current Status

Current code is a bit buggy, some method are not working and also more code is needed to handles some data and serialize them properly.

TO BE DONE:

  • Make connect method work
  • Make connectedSsid method work (current conected signal SSID)
  • ScanResult signal level, frequency and capabilities values are not correctly handled.
  • Serialize ScanResult capabilities (currently a string with int values, ned to use DOT11_AUTH_ALGORITHM and DOT11_CIPHER_ALGORITHM enums)
  • Change all method to asynchronous result handling with custom listeners.

Example Code

Using this library is quite easy, here you have a simple code snippet.

import net.java.dev.wlanapi.ScanResult;
import net.java.dev.wlanapi.WifiManager;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
* Created by i.perezdealbeniz on 29/12/2016.
*/
public class SimpleTest {

   public static void main(String[] args) throws InterruptedException {
       System.out.println("Java wlanapi.dll Wrapper Test:\n");
       System.out.println("******************************\n");
       WifiManager wlan_manager = new WifiManager();

       System.out.printf("Wifi Enabled: %s\n\n",wlan_manager.isWifiEnabled());

       System.out.println("Detected Wifi Networks:\n");
       List<ScanResult> scan_results = wlan_manager.waitForScanResults(5,
               TimeUnit.SECONDS);
       for(int i=0; i < scan_results.size(); i++){
           System.out.println("\t SSID : "+scan_results.get(i).SSID);
           System.out.println("\t\t BSSID : "+scan_results.get(i).BSSID);
           System.out.println("\t\t Frequency (MHz): "+
                   Integer.toString(scan_results.get(i).frequency));
           System.out.println("\t\t Signal Level (db) : "+
                   Integer.toString(scan_results.get(i).level));
           System.out.println("\t\t Capabilities : "+
                   scan_results.get(i).capabilities);
           System.out.println();
       }

       System.out.println("Configured Wifi Networks:");
       List<String> configured_networks = wlan_manager.getConfiguredNetworks();
       for(int i=0; i < scan_results.size(); i++){
           System.out.println("\t"+ Integer.toString(i)+"\t"+scan_results.get(i));
       }
   }

}

jwlanapi's People

Contributors

ikeralbeniz avatar marssmart avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.