Skip to content

Commit 355fa3e

Browse files
Merge pull request #42 from stealthcopter/feature/develop
Feature/develop
2 parents d3d8f3b + 90d766b commit 355fa3e

File tree

16 files changed

+95
-22
lines changed

16 files changed

+95
-22
lines changed

.circleci/key.p12.enc

0 Bytes
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/captures
1111
TODO
1212
key.p12
13+
/keystore

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ android {
3232
applicationId "com.stealthcotper.networktools"
3333
minSdkVersion minSdkVer
3434
targetSdkVersion targetSdkVer
35-
versionCode versionName
36-
versionName versionCode
35+
versionName appVersionName
36+
versionCode appVersionCode
3737
archivesBaseName = "AndroidNetworkTools"
3838
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3939
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ subprojects {
3030
ext.targetSdkVer = 27
3131
ext.supportLibVer = "27.1.1"
3232

33-
ext.versionName = "0.4.0"
34-
ext.versionCode = 14
33+
ext.appVersionName = "0.4.0"
34+
ext.appVersionCode = 14
3535
}

library/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,20 @@ dependencies {
88
testImplementation 'org.mockito:mockito-core:2.10.0'
99
}
1010

11+
task sourcesJar(type: Jar, dependsOn: classes) {
12+
classifier = 'sources'
13+
from sourceSets.main.allSource
14+
}
15+
16+
task javadocJar(type: Jar) {
17+
classifier = 'javadoc'
18+
from javadoc
19+
}
20+
21+
artifacts {
22+
archives sourcesJar
23+
archives javadocJar
24+
}
25+
1126
sourceCompatibility = "1.7"
1227
targetCompatibility = "1.7"

library/src/main/java/com/stealthcopter/networktools/ARPInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
/**
1010
* Created by mat on 09/12/15.
11-
* <p/>
11+
*
1212
* Looks at the file at /proc/net/arp to fromIPAddress ip/mac addresses from the cache
1313
* We assume that the file has this structure:
14-
* <p/>
14+
*
1515
* IP address HW type Flags HW address Mask Device
1616
* 192.168.18.11 0x1 0x2 00:04:20:06:55:1a * eth0
1717
* 192.168.18.36 0x1 0x2 00:22:43:ab:2a:5b * eth0

library/src/main/java/com/stealthcopter/networktools/Ping.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public void cancel() {
154154
* request
155155
*
156156
* @return - ping result
157+
* @throws UnknownHostException - if the host cannot be resolved
157158
*/
158159
public PingResult doPing() throws UnknownHostException {
159160
cancelled = false;

library/src/main/java/com/stealthcopter/networktools/PortScan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public interface PortListener {
5454
* @param address - Address to be pinged
5555
* @return this object to allow chaining
5656
* @throws UnknownHostException - if no IP address for the
57-
* <code>host</code> could be found, or if a scope_id was specified
57+
* {@code host} could be found, or if a scope_id was specified
5858
* for a global IPv6 address.
5959
*/
6060
public static PortScan onAddress(String address) throws UnknownHostException {

library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public interface OnSubnetDeviceFound {
3434

3535
/**
3636
* Find devices on the subnet working from the local device ip address
37+
*
38+
* @return - this for chaining
3739
*/
3840
public static SubnetDevices fromLocalAddress() {
3941
InetAddress ipv4 = IPTools.getLocalIPv4Address();
@@ -47,6 +49,8 @@ public static SubnetDevices fromLocalAddress() {
4749

4850
/**
4951
* @param inetAddress - an ip address in the subnet
52+
*
53+
* @return - this for chaining
5054
*/
5155
public static SubnetDevices fromIPAddress(InetAddress inetAddress) {
5256
return fromIPAddress(inetAddress.getHostAddress());
@@ -55,6 +59,8 @@ public static SubnetDevices fromIPAddress(InetAddress inetAddress) {
5559
/**
5660
* @param ipAddress - the ipAddress string of any device in the subnet i.e. "192.168.0.1"
5761
* the final part will be ignored
62+
*
63+
* @return - this for chaining
5864
*/
5965
public static SubnetDevices fromIPAddress(final String ipAddress) {
6066

@@ -84,6 +90,8 @@ public static SubnetDevices fromIPAddress(final String ipAddress) {
8490

8591
/**
8692
* @param ipAddresses - the ipAddresses of devices to be checked
93+
*
94+
* @return - this for chaining
8795
*/
8896
public static SubnetDevices fromIPList(final List<String> ipAddresses) {
8997

@@ -100,8 +108,10 @@ public static SubnetDevices fromIPList(final List<String> ipAddresses) {
100108
/**
101109
* @param noThreads set the number of threads to work with, note we default to a large number
102110
* as these requests are network heavy not cpu heavy.
103-
* @return self
104-
* @throws IllegalAccessException
111+
*
112+
* @throws IllegalArgumentException - if invalid number of threads requested
113+
*
114+
* @return - this for chaining
105115
*/
106116
public SubnetDevices setNoThreads(int noThreads) throws IllegalArgumentException {
107117
if (noThreads < 1) throw new IllegalArgumentException("Cannot have less than 1 thread");
@@ -112,9 +122,13 @@ public SubnetDevices setNoThreads(int noThreads) throws IllegalArgumentException
112122
/**
113123
* Sets the timeout for each address we try to ping
114124
*
125+
* @param timeOutMillis - timeout in milliseconds for each ping
126+
*
115127
* @return this object to allow chaining
128+
*
129+
* @throws IllegalArgumentException - if timeout is less than zero
116130
*/
117-
public SubnetDevices setTimeOutMillis(int timeOutMillis) {
131+
public SubnetDevices setTimeOutMillis(int timeOutMillis) throws IllegalArgumentException {
118132
if (timeOutMillis < 0) throw new IllegalArgumentException("Timeout cannot be less than 0");
119133
this.timeOutMillis = timeOutMillis;
120134
return this;

library/src/main/java/com/stealthcopter/networktools/WakeOnLan.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public void wake() throws IOException {
141141
/**
142142
* Asynchronous call of the wake method. This will be performed on the background thread
143143
* and optionally fire a listener when complete, or when an error occurs
144+
*
145+
* @param wakeOnLanListener - listener to call on result
144146
*/
145147
public void wake(final WakeOnLanListener wakeOnLanListener) {
146148

@@ -165,6 +167,9 @@ public void run() {
165167
*
166168
* @param ipStr - IP String to send to
167169
* @param macStr - MAC address to wake up
170+
*
171+
* @throws IllegalArgumentException - invalid ip or mac
172+
* @throws IOException - error sending packet
168173
*/
169174
public static void sendWakeOnLan(String ipStr, String macStr) throws IllegalArgumentException, IOException {
170175
sendWakeOnLan(ipStr, macStr, DEFAULT_PORT, DEFAULT_TIMEOUT_MILLIS, DEFAULT_NO_PACKETS);
@@ -178,6 +183,9 @@ public static void sendWakeOnLan(String ipStr, String macStr) throws IllegalArgu
178183
* @param port - port to send packet to
179184
* @param timeoutMillis - timeout (millis)
180185
* @param packets - number of packets to send
186+
*
187+
* @throws IllegalArgumentException - invalid ip or mac
188+
* @throws IOException - error sending packet
181189
*/
182190
public static void sendWakeOnLan(final String ipStr, final String macStr, final int port, final int timeoutMillis, final int packets) throws IllegalArgumentException, IOException {
183191
if (ipStr == null) throw new IllegalArgumentException("Address cannot be null");
@@ -193,6 +201,9 @@ public static void sendWakeOnLan(final String ipStr, final String macStr, final
193201
* @param port - port to send packet to
194202
* @param timeoutMillis - timeout (millis)
195203
* @param packets - number of packets to send
204+
*
205+
* @throws IllegalArgumentException - invalid ip or mac
206+
* @throws IOException - error sending packet
196207
*/
197208
public static void sendWakeOnLan(final InetAddress address, final String macStr, final int port, final int timeoutMillis, final int packets) throws IllegalArgumentException, IOException {
198209
if (address == null) throw new IllegalArgumentException("Address cannot be null");

0 commit comments

Comments
 (0)