Simple wrapper of the Android WiFi services

Refer to the official Android documentation for the details on these services.

Introduced classes

extern class NativeListOfScanResult

android :: NativeListOfScanResult

Java list of NativeScanResult
extern class NativeScanResult

android :: NativeScanResult

Wraps Java class: android.net.wifi.ScanResult
extern class NativeWifiManager

android :: NativeWifiManager

Wraps Java class: android.net.wifi.WifiManager

Redefined classes

redef extern class NativeContext

android :: wifi $ NativeContext

An Android activity context

All class definitions

redef extern class NativeContext

android :: wifi $ NativeContext

An Android activity context
extern class NativeListOfScanResult

android $ NativeListOfScanResult

Java list of NativeScanResult
extern class NativeScanResult

android $ NativeScanResult

Wraps Java class: android.net.wifi.ScanResult
extern class NativeWifiManager

android $ NativeWifiManager

Wraps Java class: android.net.wifi.WifiManager
package_diagram android::wifi wifi android::nit_activity nit_activity android::wifi->android::nit_activity android::log log android::nit_activity->android::log android::key_event key_event android::nit_activity->android::key_event android\>bundle\> bundle android::nit_activity->android\>bundle\> android::dalvik dalvik android::nit_activity->android::dalvik ...android::log ... ...android::log->android::log ...android::key_event ... ...android::key_event->android::key_event ...android\>bundle\> ... ...android\>bundle\>->android\>bundle\> ...android::dalvik ... ...android::dalvik->android::dalvik a_star-m a_star-m a_star-m->android::wifi

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module activities

android :: activities

Android Activities wrapper
module app

app :: app

app.nit is a framework to create cross-platform applications
module app_base

app :: app_base

Base of the app.nit framework, defines App
module array

core :: array

This module introduces the standard array structure.
module assets

app :: assets

Portable services to load resources from the assets folder
module aware

android :: aware

Android compatibility module
module bitset

core :: bitset

Services to handle BitSet
module bundle

android :: bundle

A mapping class of String to various value types used by the
module bytes

core :: bytes

Services for byte streams and arrays
module caching

serialization :: caching

Services for caching serialization engines
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module collections

java :: collections

Basic Java collections
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module dalvik

android :: dalvik

Java related services specific to Android and its Dalvik VM
module engine_tools

serialization :: engine_tools

Advanced services for serialization engines
module environ

core :: environ

Access to the environment variables of the process
module error

json :: error

Intro JsonParseError which is exposed by all JSON reading APIs
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module ffi_support

java :: ffi_support

Core supporting services for the FFI with Java
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module inspect

serialization :: inspect

Refine Serializable::inspect to show more useful information
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module java

java :: java

Supporting services for the FFI with Java and to access Java libraries
module json

json :: json

Read and write JSON formatted text using the standard serialization services
module jvm

jvm :: jvm

Java Virtual Machine invocation API and others services from the JNI C API
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module log

android :: log

Advanced Android logging services
module math

core :: math

Mathematical operations
module meta

meta :: meta

Simple user-defined meta-level to manipulate types of instances as object.
module native

core :: native

Native structures for text and bytes
module numeric

core :: numeric

Advanced services for Numeric types
module parser_base

parser_base :: parser_base

Simple base for hand-made parsers of all kinds
module platform

android :: platform

Triggers compilation for the android platform
module poset

poset :: poset

Pre order sets and partial order set (ie hierarchies)
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module safe

serialization :: safe

Services for safer deserialization engines
module serialization

serialization :: serialization

General serialization services
module serialization_core

serialization :: serialization_core

Abstract services to serialize Nit objects to different formats
module serialization_read

json :: serialization_read

Services to read JSON: deserialize_json and JsonDeserializer
module serialization_write

json :: serialization_write

Services to write Nit objects to JSON strings: serialize_to_json and JsonSerializer
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module static

json :: static

Static interface to read Nit objects from JSON strings
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O

Parents

module nit_activity

android :: nit_activity

Core implementation of app.nit on Android using a custom Java entry point

Children

module a_star-m

a_star-m

# Simple wrapper of the Android WiFi services
#
# Refer to the official Android documentation for the details on these services.
module wifi is android_manifest """
	<uses-permission android:name="android.hardware.WIFI" />
	<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
"""

import android::nit_activity

redef class NativeContext
	# Handle to the WiFi system service
	fun wifi_manager: NativeWifiManager in "Java" `{
		return (android.net.wifi.WifiManager)
			self.getSystemService(android.content.Context.WIFI_SERVICE);
	`}
end

# Wraps Java class: `android.net.wifi.WifiManager`
extern class NativeWifiManager in "Java" `{ android.net.wifi.WifiManager `}
	super JavaObject

	# Wraps: `removeNetwork`
	fun remove_network(arg0: Int): Bool in "Java" `{
		return self.removeNetwork((int)arg0);
	`}

	# Wraps: `enableNetwork`
	fun enable_network(arg0: Int, arg1: Bool): Bool in "Java" `{
		return self.enableNetwork((int)arg0, arg1);
	`}

	# Wraps: `disableNetwork`
	fun disable_network(arg0: Int): Bool in "Java" `{
		return self.disableNetwork((int)arg0);
	`}

	# Wraps: `disconnect`
	fun disconnect: Bool in "Java" `{
		return self.disconnect();
	`}

	# Wraps: `reconnect`
	fun reconnect: Bool in "Java" `{
		return self.reconnect();
	`}

	# Wraps: `reassociate`
	fun reassociate: Bool in "Java" `{
		return self.reassociate();
	`}

	# Wraps: `pingSupplicant`
	fun ping_supplicant: Bool in "Java" `{
		return self.pingSupplicant();
	`}

	# Wraps: `startScan`
	fun start_scan: Bool in "Java" `{
		return self.startScan();
	`}

	# Wraps: `getScanResults`
	fun get_scan_results: NativeListOfScanResult in "Java" `{
		return self.getScanResults();
	`}

	# Wraps: `saveConfiguration`
	fun save_configuration: Bool in "Java" `{
		return self.saveConfiguration();
	`}

	# Wraps: `setWifiEnabled`
	fun set_wifi_enabled(arg0: Bool): Bool in "Java" `{
		return self.setWifiEnabled(arg0);
	`}

	# Wraps: `getWifiState`
	fun get_wifi_state: Int in "Java" `{
		return self.getWifiState();
	`}

	# Wraps: `isWifiEnabled`
	fun is_wifi_enabled: Bool in "Java" `{
		return self.isWifiEnabled();
	`}

	# Wraps: `calculateSignalLevel`
	fun calculate_signal_level(arg0: Int, arg1: Int): Int in "Java" `{
		return self.calculateSignalLevel((int)arg0, (int)arg1);
	`}

	# Wraps: `compareSignalLevel`
	fun compare_signal_level(arg0: Int, arg1: Int): Int in "Java" `{
		return self.compareSignalLevel((int)arg0, (int)arg1);
	`}
end

# Wraps Java class: `android.net.wifi.ScanResult`
extern class NativeScanResult in "Java" `{ android.net.wifi.ScanResult `}
	super JavaObject

	# Wraps: `describeContents`
	fun describe_contents: Int in "Java" `{
		return self.describeContents();
	`}

	# Wraps: `BSSID`
	fun bssid: JavaString in "Java" `{
		return self.BSSID;
	`}

	# Wraps: `SSID`
	fun ssid: JavaString in "Java" `{
		return self.SSID;
	`}

	# Wraps: `capabilities`
	fun capabilities: JavaString in "Java" `{
		return self.capabilities;
	`}

	# Wraps: `frequency`
	fun frequency: Int in "Java" `{
		return self.frequency;
	`}

	# Wraps: `level`
	fun level: Int in "Java" `{
		return self.level;
	`}
end

# Java list of `NativeScanResult`
extern class NativeListOfScanResult in "Java" `{ java.util.List<android.net.wifi.ScanResult> `}

	# Number of elements in this list
	fun length: Int in "Java" `{ return self.size();`}

	# Element at `index`
	fun [](index: Int): NativeScanResult in "Java" `{
		return self.get((int)index);
	`}
end
lib/android/wifi.nit:15,1--158,3