You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-22Lines changed: 42 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,38 @@ This is a Java version of [mjg59](https://github.com/mjg59)'s [python-broadlink]
5
5
6
6
## Adding this API
7
7
8
-
1. (Eclipse) Clone the project via ```git clone https://github.com/mob41/broadlink-java-api.git``` or via the [download ZIP](https://github.com/mob41/broadlink-java-api/archive/master.zip) and extract the ZIP to a folder.
8
+
This API is distributed via **Maven Central**. You can import via adding this as dependency in Maven ```pom.xml``` or clone/download this as ZIP and import in IDE.
9
+
10
+
1.**Via Maven Central**: (Release Builds) Add the following to your ```pom.xml``` under ```<dependencies>```
11
+
12
+
```xml
13
+
<dependency>
14
+
<groupId>com.github.mob41.blapi</groupId>
15
+
<artifactId>broadlink-java-api</artifactId>
16
+
<version>1.0.1</version>
17
+
</dependency>
18
+
```
19
+
20
+
2. **Via OSSRH Snapshots**: (Development Builds) To access snapshots/development builds e.g. ```1.0.1-SNAPSHOT```, you have to add the OSSRH snapshot repository
3. **Via Cloning**: (Eclipse) Clone the project via ```git clone https://github.com/mob41/broadlink-java-api.git``` or via the [download ZIP](https://github.com/mob41/broadlink-java-api/archive/master.zip) and extract the ZIP to a folder.
9
40
10
41
And add the project into your Eclipse IDE by right clicking the ```Package Explorer```, and,
@@ -18,21 +49,9 @@ This is a Java version of [mjg59](https://github.com/mjg59)'s [python-broadlink]
18
49
<dependency>
19
50
<groupId>com.github.mob41.blapi</groupId>
20
51
<artifactId>broadlink-java-api</artifactId>
21
-
<version>0.0.1-SNAPSHOT</version>
52
+
<version>1.0.1</version>
22
53
</dependency>
23
54
```
24
-
25
-
26
-
2. Maven dependency: Add the following to your ```pom.xml``` under ```<dependencies>```
27
-
28
-
```xml
29
-
<dependency>
30
-
<groupId>com.github.mob41.blapi</groupId>
31
-
<artifactId>broadlink-java-api</artifactId>
32
-
<version>0.0.3-SNAPSHOT</version>
33
-
</dependency>
34
-
```
35
-
36
55
37
56
## Tutorial
38
57
@@ -44,11 +63,13 @@ This is a Java version of [mjg59](https://github.com/mjg59)'s [python-broadlink]
44
63
import com.github.mob41.blapi.mac.Mac; //Necessary if using <code>2.ii</code>
45
64
```
46
65
47
-
2. Creating a Broadlink device to connect
48
-
49
-
i. You can discover it.
66
+
2. Creating/Discovering ```BLDevice``` instances by two methods:
50
67
51
68
```java
69
+
//
70
+
// === Method 1. By Discovering Devices In Local Network ===
71
+
//
72
+
52
73
BLDevice[] devs = BLDevice.discoverDevices(); //Default with 10000 ms (10 sec) timeout, search for multiple devices
53
74
54
75
//BLDevice[] devs = BLDevice.discoverDevices(0); //No timeout will block the thread and search for one device only
@@ -64,17 +85,16 @@ This is a Java version of [mjg59](https://github.com/mjg59)'s [python-broadlink]
64
85
}
65
86
66
87
//BLDevice dev = devs[0]
67
-
```
68
-
69
-
ii. Create a <code>RM2Device</code> or another <code>BLDevice</code> child according to your device type
70
88
71
-
```java
89
+
//
90
+
// === Method 2. Create a "RM2Device" or another "BLDevice" child according to your device type ===
91
+
//
92
+
72
93
BLDevice dev = new RM2Device("192.168.1.123", new Mac("01:12:23:34:43:320"));
73
94
//~do stuff
74
95
//dev.auth();
75
96
```
76
97
77
-
78
98
3. Before any commands like ```getTemp()``` and ```enterLearning()```, ```BLDevice.auth()``` must be ran to connect and authenticate with the Broadlink device.
0 commit comments