-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework project structure in to common Maven structure. Combine Java e…
…xamples in to project.
- Loading branch information
Showing
198 changed files
with
3,015 additions
and
719 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.cowboycoders</groupId> | ||
<artifactId>jformica-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jformica-core</artifactId> | ||
<packaging>jar</packaging> | ||
<name>jformica-core</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.9.5</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.vidageek</groupId> | ||
<artifactId>mirror</artifactId> | ||
<version>1.5.1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
650 changes: 325 additions & 325 deletions
650
...g/cowboycoders/ant/defines/AntDefine.java → ...g/cowboycoders/ant/defines/AntDefine.java
Large diffs are not rendered by default.
Oops, something went wrong.
554 changes: 277 additions & 277 deletions
554
...org/cowboycoders/ant/defines/AntMesg.java → ...org/cowboycoders/ant/defines/AntMesg.java
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.cowboycoders</groupId> | ||
<artifactId>jformica-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jformica-java</artifactId> | ||
<packaging>jar</packaging> | ||
<name>jformica-java</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.cowboycoders</groupId> | ||
<artifactId>jformica-usb</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
jformica-java/src/main/java/org/cowboycoders/ant/examples/NetworkKeys.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.cowboycoders.ant.examples; | ||
|
||
import org.cowboycoders.ant.NetworkKey; | ||
|
||
public class NetworkKeys { | ||
|
||
public static final NetworkKey ANT_SPORT = new NetworkKey (0xB9,0xA5,0x21,0xFB,0xBD,0x72,0xC3,0x45); | ||
public static final NetworkKey ANT_PUBLIC = new NetworkKey (0,0,0,0,0,0,0,0); | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
jformica-java/src/main/java/org/cowboycoders/ant/examples/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.cowboycoders.ant.examples; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.cowboycoders.ant.Channel; | ||
import org.cowboycoders.ant.ChannelId; | ||
import org.cowboycoders.ant.events.MessageCondition; | ||
import org.cowboycoders.ant.events.MessageConditionFactory; | ||
import org.cowboycoders.ant.messages.commands.ChannelRequestMessage; | ||
import org.cowboycoders.ant.messages.commands.ChannelRequestMessage.Request; | ||
import org.cowboycoders.ant.messages.responses.ChannelIdResponse; | ||
|
||
/** | ||
* Contains some example utility functions | ||
* @author will | ||
* | ||
*/ | ||
public class Utils { | ||
|
||
public static void printChannelConfig(Channel channel) { | ||
|
||
// build request | ||
ChannelRequestMessage msg = new ChannelRequestMessage(channel.getNumber(),Request.CHANNEL_ID); | ||
|
||
// response should be an instance of ChannelIdResponse | ||
MessageCondition condition = MessageConditionFactory.newInstanceOfCondition(ChannelIdResponse.class); | ||
|
||
try { | ||
|
||
// send request (blocks until reply received or timeout expired) | ||
ChannelIdResponse response = (ChannelIdResponse) channel.sendAndWaitForMessage( | ||
msg, condition, 5L, TimeUnit.SECONDS, null); | ||
|
||
System.out.println(); | ||
System.out.println("Device configuration: "); | ||
System.out.println("deviceID: " + response.getDeviceNumber()); | ||
System.out.println("deviceType: " + response.getDeviceType()); | ||
System.out.println("transmissionType: " + response.getTransmissionType()); | ||
System.out.println("pairing flag set: " + response.isPairingFlagSet()); | ||
System.out.println(); | ||
|
||
} catch (Exception e) { | ||
// not critical, so just print error | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
/** | ||
* Requests a channels current channelId | ||
* @param channel | ||
* @return | ||
*/ | ||
public static ChannelId requestChannelId(Channel channel) { | ||
// build request | ||
ChannelRequestMessage msg = new ChannelRequestMessage(channel.getNumber(),Request.CHANNEL_ID); | ||
|
||
// response should be an instance of ChannelIdResponse | ||
MessageCondition condition = MessageConditionFactory.newInstanceOfCondition(ChannelIdResponse.class); | ||
|
||
try { | ||
|
||
// send request (blocks until reply received or timeout expired) | ||
ChannelIdResponse response = (ChannelIdResponse) channel.sendAndWaitForMessage( | ||
msg, condition, 5L, TimeUnit.SECONDS, null); | ||
|
||
return response.getChannelId(); | ||
|
||
} catch (Exception e) { | ||
// not critical, so just print error | ||
e.printStackTrace(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
||
} |
23 changes: 23 additions & 0 deletions
23
jformica-java/src/main/java/org/cowboycoders/ant/examples/api/Capabilities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.cowboycoders.ant.examples.api; | ||
|
||
import org.cowboycoders.ant.Node; | ||
import org.cowboycoders.ant.interfaces.AntTransceiver; | ||
import org.cowboycoders.ant.messages.responses.Capability; | ||
|
||
public class Capabilities { | ||
|
||
public static void main(String[] args) { | ||
AntTransceiver antchip = new AntTransceiver(0); | ||
Node node = new Node(antchip); | ||
|
||
node.start(); | ||
|
||
for (Capability c : node.getCapabiltites()) { | ||
System.out.println(c); | ||
} | ||
|
||
node.stop(); | ||
|
||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
jformica-java/src/main/java/org/cowboycoders/ant/examples/api/ChooseUsbDevice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.cowboycoders.ant.examples.api; | ||
|
||
import org.cowboycoders.ant.Node; | ||
import org.cowboycoders.ant.interfaces.AntDeviceId; | ||
import org.cowboycoders.ant.interfaces.AntTransceiver; | ||
import org.cowboycoders.ant.messages.responses.Capability; | ||
|
||
public class ChooseUsbDevice { | ||
|
||
public static void main(String [] args) { | ||
|
||
// Uncomment one of the following: | ||
|
||
// choose first ANTUSB_2 device | ||
AntTransceiver antchip = new AntTransceiver(AntDeviceId.ANTUSB_2,0); | ||
|
||
// choose first ANTUSB_M device | ||
//AntTransceiver antchip = new AntTransceiver(AntDeviceId.ANTUSB_M,0); | ||
|
||
// search for all known devices and select first device found | ||
//AntTransceiver antchip = new AntTransceiver(0); | ||
|
||
Node node = new Node(antchip); | ||
|
||
node.start(); | ||
|
||
for (Capability c : node.getCapabiltites()) { | ||
System.out.println(c); | ||
} | ||
|
||
node.stop(); | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.