Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JTradfri</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
4 changes: 2 additions & 2 deletions JTradfri/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
9 changes: 2 additions & 7 deletions JTradfri/.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JTradfri</name>
<comment>Project JTradfri created by Buildship.</comment>
<comment></comment>
<projects>
</projects>
<buildSpec>
Expand All @@ -10,14 +10,9 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#org.springsource.ide.eclipse.gradle.core.preferences.GradleImportPreferences
#Mon Dec 10 17:49:19 GMT 2018
addResourceFilters=true
afterTasks=afterEclipseImport;
beforeTasks=cleanEclipse;eclipse;
enableAfterTasks=true
enableBeforeTasks=true
enableDependendencyManagement=true
projects=;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences
#Mon Dec 10 17:49:42 GMT 2018
build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=;
org.springsource.ide.eclipse.gradle.linkedresources=
org.springsource.ide.eclipse.gradle.rootprojectloc=
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences
#Mon Dec 10 17:49:36 GMT 2018
addResourceFilters=true
afterTasks=afterEclipseImport;
beforeTasks=cleanEclipse;eclipse;
enableAfterTasks=true
enableBeforeTasks=true
useHierarchicalNames=false
14 changes: 10 additions & 4 deletions JTradfri/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#Fri Jul 28 22:22:55 CEST 2017
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.0.2))
override.workspace.settings=true
gradle.user.home=
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
build.scans.enabled=false
override.workspace.settings=true
show.console.view=false
show.executions.view=false
13 changes: 13 additions & 0 deletions JTradfri/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
#Mon Dec 10 17:49:36 GMT 2018
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
Empty file modified JTradfri/gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import org.eclipse.californium.core.CoapHandler;
import org.eclipse.californium.core.CoapResponse;
import org.eclipse.californium.core.coap.CoAP.ResponseCode;
import org.json.JSONArray;
import org.json.JSONObject;

import org.eclipse.californium.core.coap.CoAP.ResponseCode;
import net.kappelt.JTradfri.GWConnection;

/**
Expand Down Expand Up @@ -60,6 +60,9 @@ public class TradfriDevice{
//true if it is a bulb or a light panel
private Boolean isLightingDevice = false;

//true if it is a socket outlet
private Boolean isOutlet = false;

private boolean isSubscribed = false; //set once the method subsribe() is called

private String manufacturer;
Expand Down Expand Up @@ -183,6 +186,17 @@ private Boolean newInfoAvailable(String jsonInfo) {
this.color = json.getJSONArray("3311").getJSONObject(0).getString("5706");
this.isLightingDevice = true;
}
//onoff
if(json.has("3312") && json.getJSONArray("3312").length() > 0 && json.getJSONArray("3312").getJSONObject(0).has("5850")) {
this.onoff = json.getJSONArray("3312").getJSONObject(0).getInt("5850");
this.isOutlet = true;
}

//dimvalue
if(json.has("3312") && json.getJSONArray("3312").length() > 0 && json.getJSONArray("3312").getJSONObject(0).has("5851")) {
this.dimvalue = json.getJSONArray("3312").getJSONObject(0).getInt("5851");
this.isOutlet = true;
}

//name
if(json.has("9001")) {
Expand Down Expand Up @@ -267,6 +281,9 @@ public void onError() {
public Boolean isLightingDevice() {
return isLightingDevice;
}
public Boolean isOutlet() {
return isOutlet;
}

public int getDeviceID() {
return deviceID;
Expand Down
1 change: 1 addition & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Eclipse-Workspace
17 changes: 17 additions & 0 deletions bin/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JTradfri</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13 changes: 13 additions & 0 deletions bin/JTradfri-builds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
New versions of JTradfri are published in the ./bin Folder, without a version number in their name. Upgrading shall be easier now, because you don't need to check for the new Version-Number and Build-Date.


This folder is just kept as an archive for previous versions.





Neue Versionen von JTradfri werden im ./bin-Ordner veröffentlicht, ohne eine Versionsnummer in deren Namen. Updates sollten daher einfacher sein, da beim Download nicht mehr die Versionsnummer und das Builddatum ermittelt werden muss.


Dieser Ordner bleibt als Archiv für vorherige Versionen bestehen.
12 changes: 12 additions & 0 deletions bin/JTradfri/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="/home/swilson/JTradfri_unpack/org/json"/>
<classpathentry exported="true" kind="lib" path="/home/swilson/JTradfri_unpack/io"/>
<classpathentry exported="true" kind="lib" path="/home/swilson/JTradfri_unpack/org/eclipse/californium/core"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
3 changes: 3 additions & 0 deletions bin/JTradfri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.gradle/
/build/
/bin/
23 changes: 23 additions & 0 deletions bin/JTradfri/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JTradfri</name>
<comment>Project JTradfri created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
7 changes: 7 additions & 0 deletions bin/JTradfri/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Fri Jul 28 22:22:55 CEST 2017
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.0.2))
override.workspace.settings=true
gradle.user.home=
connection.project.dir=
offline.mode=false
build.scans.enabled=false
84 changes: 84 additions & 0 deletions bin/JTradfri/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/4.0.2/userguide/java_library_plugin.html
*/

plugins {
id 'com.github.johnrengelman.shadow' version '2.0.1'
id 'java'
}

// Apply the java plugin to add support for Java
apply plugin: 'java'
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'

apply plugin: 'application'
apply plugin: 'eclipse'

apply plugin: 'maven'

def getDate() {
new Date().format('ddMMyyyy')
}

version='0.0.6-snapshot'
mainClassName='net.kappelt.JTradfri.JTradfri'


// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:21.0'

// Use JUnit test framework
testImplementation 'junit:junit:4.12'

// https://mvnrepository.com/artifact/com.beust/jcommander
compile group: 'com.beust', name: 'jcommander', version: '1.7'
compile "com.beust:jcommander:1.71"

runtime group: 'com.beust', name: 'jcommander', version: '1.7'


// https://mvnrepository.com/artifact/org.eclipse.californium/californium-core
compile group: 'org.eclipse.californium', name: 'californium-core', version: '2.0.0-M5'
// https://mvnrepository.com/artifact/org.eclipse.californium/scandium
compile group: 'org.eclipse.californium', name: 'scandium', version: '2.0.0-M5'
// https://mvnrepository.com/artifact/org.eclipse.californium/element-connector
compile group: 'org.eclipse.californium', name: 'element-connector', version: '2.0.0-M5'

// https://mvnrepository.com/artifact/org.json/json
compile group: 'org.json', name: 'json', version: '20170516'
}


sourceSets {
main {
resources {
srcDirs = ["src/main/resources"]
}
java {
srcDirs = ["src/main/java"]
}
}
}

shadowJar {
version = "${getDate()}-${version}"
from('src/main/resources') {
into('certs')
}
}
Binary file added bin/JTradfri/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions bin/JTradfri/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Fri Jul 28 22:22:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip
Loading