Skip to content

Commit

Permalink
Removed unused android files, optimized code and fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
stealthcopter committed Jun 21, 2018
1 parent 355fa3e commit ad6d793
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 29 deletions.
5 changes: 0 additions & 5 deletions library/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private MACTools() {
* Validates a provided MAC address
*
* @param macAddress - the MAC address to check
* @return - true if it is valid MAC address in IEEE802 format (either hyphen or colon seperated)
* @return - true if it is valid MAC address in IEEE802 format (either hyphen or colon separated)
* eg: "01:23:45:67:89:AB" or "01-23-45-67-89-AB"
*/
public static boolean isValidMACAddress(final String macAddress) {
Expand All @@ -28,7 +28,7 @@ public static boolean isValidMACAddress(final String macAddress) {
/**
* Convert a MAC string to bytes
*
* @param macStr - MAC string in IEEE802 format (either hyphen or colon seperated)
* @param macStr - MAC string in IEEE802 format (either hyphen or colon separated)
* eg: "01:23:45:67:89:AB" or "01-23-45-67-89-AB"
* @return - MAC formatted in bytes
* @throws IllegalArgumentException - if mac address is invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,21 @@ public static PingResult ping(InetAddress host, PingOptions pingOptions) throws
proc.waitFor();
int exit = proc.exitValue();
String pingError;
if (exit == 0) {
InputStreamReader reader = new InputStreamReader(proc.getInputStream());
BufferedReader buffer = new BufferedReader(reader);
String line;
while ((line = buffer.readLine()) != null) {
echo.append(line).append("\n");
}
return getPingStats(pingResult, echo.toString());
} else if (exit == 1) {
pingError = "failed, exit = 1";
} else {
pingError = "error, exit = 2";
switch (exit) {
case 0:
InputStreamReader reader = new InputStreamReader(proc.getInputStream());
BufferedReader buffer = new BufferedReader(reader);
String line;
while ((line = buffer.readLine()) != null) {
echo.append(line).append("\n");
}
return getPingStats(pingResult, echo.toString());
case 1:
pingError = "failed, exit = 1";
break;
default:
pingError = "error, exit = 2";
break;
}
pingResult.error = pingError;
return pingResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;

/**
* Created by mat on 09/12/15.
Expand Down Expand Up @@ -47,7 +46,7 @@ public static PingResult doPing(InetAddress ia, PingOptions pingOptions) {
* @param pingOptions - ping command options
* @return - the ping results
* @throws IOException - IO error running ping command
* @throws InterruptedException - thread interupt
* @throws InterruptedException - thread interrupt
*/
public static PingResult doNativePing(InetAddress ia, PingOptions pingOptions) throws IOException, InterruptedException {
return PingNative.ping(ia, pingOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import java.net.InetAddress;

public class Device {
public String ip = "";
public String hostname = "";
public String mac = "";


public String ip;
public String hostname;
public String mac;
public float time = 0;

public Device(InetAddress ip) {
Expand Down
3 changes: 0 additions & 3 deletions library/src/main/res/values/strings.xml

This file was deleted.

0 comments on commit ad6d793

Please sign in to comment.