Skip to content

Commit

Permalink
Builder pattern updates, javadocs, new package name, updated README, …
Browse files Browse the repository at this point in the history
…and travis config

close #16
close #20
close #21
close #22
close #23
close #24
  • Loading branch information
isuPatches committed Oct 23, 2016
1 parent 3512ea1 commit bdb6ea7
Show file tree
Hide file tree
Showing 52 changed files with 8,087 additions and 1,042 deletions.
54 changes: 34 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,35 @@ WiseFy now supports the builder pattern so cool functionality can be added later
To grab a default instance:

```java
WiseFy mWiseFy = new WiseFy.getSmarts().initiateHamsters();
WiseFy mWiseFy = new WiseFy.generator().withContext(getActivity()).getSmarts();
```

To grab an instance with logging enabled:

```java
WiseFy mWiseFy = new WiseFy.getSmarts().withLogging(true).initiateHamsters();
WiseFy mWiseFy = new WiseFy.generator().withContext(getActivity()).logging(true).getSmarts();
```

**IMPORTANT!** Please make sure you call withContext for WiseFy to work properly

## Commands

To add an open network:

```java
int addedSuccessfully = mWiseFy.addOpenNetwork(getActivity(), "Open Network");
int addedSuccessfully = mWiseFy.addOpenNetwork("Open Network");
```

To add a WEP network:

```java
int addedSuccessfully = mWiseFy.addWEPNetwork(getActivity(), "WEP Network", "123456");
int addedSuccessfully = mWiseFy.addWEPNetwork("WEP Network", "123456");
```

To add a WPA2 network:

```java
int addedSuccessfully = mWiseFy.addWPA2Network(getActivity(), "WPA2 Network", "12345678");
int addedSuccessfully = mWiseFy.addWPA2Network("WPA2 Network", "12345678");
```

To calculate number of bars given a networks signal strength and total number of bars:
Expand All @@ -55,74 +56,74 @@ int result = mWiseFy.compareSignalLevel(-35, -70);
To connect to a network given an SSID:

```java
boolean connectedSuccessfully = mWiseFy.connectToNetwork(getActivity(), "SSID To Reconnect To", 3000);
boolean connectedSuccessfully = mWiseFy.connectToNetwork("SSID To Reconnect To", 3000);
```

To disable wifi:

```java
boolean disabledWifiSuccessfully = mWiseFy.disableWifi(getActivity());
boolean disabledWifiSuccessfully = mWiseFy.disableWifi();
```

To disconnect from current network:

```java
boolean disconnectedSuccessfully = mWiseFy.disconnectFromCurrentNetwork(getActivity());
boolean disconnectedSuccessfully = mWiseFy.disconnectFromCurrentNetwork();
```

To enable wifi:

```java
boolean wifiEnabled = mWiseFy.enableWiFi(getActivity());
boolean wifiEnabled = mWiseFy.enableWiFi();
```

To get current network:

```java
WifiInfo currentNetwork = mWiseFy.getCurrentNetwork(getActivity());
WifiInfo currentNetwork = mWiseFy.getCurrentNetwork();
```

To get nearby access points:<br/><br/>
<strong>Setting filterDuplicates to true will not return SSIDs with a weaker signal strength (will always take the highest)</strong>

```java
List<ScanResult> nearbyAccessPoints = mWiseFy.getNearbyAccessPoints(getActivity(), true);
List<ScanResult> nearbyAccessPoints = mWiseFy.getNearbyAccessPoints(true);
```

To get the networks whose configuration is already stored:

```java
List<WifiConfiguration> savedNetworks = mWiseFy.getSavedNetworks(getActivity());
List<WifiConfiguration> savedNetworks = mWiseFy.getSavedNetworks();
```

To check and see if the device is connected to a mobile network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToMobileNetwork(getActivity());
boolean isConnected = mWiseFy.isDeviceConnectedToMobileNetwork();
```

To check and see if the device is connected to a mobile or wifi network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToMobileOrWifiNetwork(getActivity());
boolean isConnected = mWiseFy.isDeviceConnectedToMobileOrWifiNetwork();
```

To check and see if the device is connected to a given SSID:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToSSID(getActivity(), "SSID");
boolean isConnected = mWiseFy.isDeviceConnectedToSSID("SSID");
```

To check and see if the device is connected to a wifi network:

```java
boolean isConnected = mWiseFy.isDeviceConnectedToWifiNetwork(getActivity(), "SSID");
boolean isConnected = mWiseFy.isDeviceConnectedToWifiNetwork("SSID");
```

To check and see if a given SSID is in the devices set of configured networks:

```java
boolean isConfigured = mWiseFy.isNetworkInConfigurationList(getActivity(), "SSID");
boolean isConfigured = mWiseFy.isNetworkInConfigurationList("SSID");
```

To check and see if a network is secure (WEP/PSK/EAP capabilities):
Expand All @@ -134,17 +135,30 @@ boolean isSecure = mWiseFy.isNetworkSecure(scanResult);
To check and see if Wifi is enabled on a device:

```java
boolean wifiEnabled = mWiseFy.isWifiEnabled(getActivity());
boolean wifiEnabled = mWiseFy.isWifiEnabled();
```

To remove a configured network:

```java
boolean removedSuccessfully = mWiseFy.removeNetwork(getActivity(), "SSID To Remove");
boolean removedSuccessfully = mWiseFy.removeNetwork("SSID To Remove");
```

To search for an SSID given a search string:

```java
String ssid = mWiseFy.searchForSSID(getActivity(), "SSID To Search For", 3000);
String ssid = mWiseFy.searchForSSID("SSID To Search For", 3000);
```

## License ##
Copyright 2016

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
5 changes: 5 additions & 0 deletions app/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: android
android:
components:
- build-tools-24.0.3
- android-24
65 changes: 62 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'jacoco'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: "com.github.dcendents.android-maven"

group = 'com.isupatches'
version = '1.0.4'

def coverageSourceDirs = [
'../app/src/main/java'
Expand Down Expand Up @@ -59,8 +63,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 4
versionName "1.0.3"
versionCode 5
versionName version
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

Expand Down Expand Up @@ -89,4 +93,59 @@ dependencies {
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'

testCompile 'junit:junit:4.12'
}
}

install {
repositories.mavenInstaller {
pom {
project {
artifactId 'wisefy'
packaging 'aar'

name 'WiseFy'
url 'https://github.com/isuPatches/WiseFy'

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'isuPatches'
name 'Sarah Klinefelter'
email '[email protected]'
}
}
scm {
connection 'https://github.com/isuPatches/WiseFy.git'
developerConnection 'https://github.com/isuPatches/WiseFy.git'
url 'https://github.com/isuPatches/WiseFy'
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
destinationDir = file("../javadoc/")
failOnError false
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

-verbose

-keep class com.metova.** { *; }
-keep class com.isupatches.** { *; }
Loading

0 comments on commit bdb6ea7

Please sign in to comment.