Skip to content

Commit

Permalink
Version 1.17 Update
Browse files Browse the repository at this point in the history
Stable & Working!
  • Loading branch information
Rusettsten committed Mar 8, 2022
1 parent d360706 commit 95173e3
Show file tree
Hide file tree
Showing 13 changed files with 356 additions and 114 deletions.
51 changes: 21 additions & 30 deletions photon/.classpath
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/com/illposed/osc/javaosc-core/0.6/javaosc-core-0.6.jar" sourcepath="M2_REPO/com/illposed/osc/javaosc-core/0.6/javaosc-core-0.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-ext/1.7.25/slf4j-ext-1.7.25.jar" sourcepath="M2_REPO/org/slf4j/slf4j-ext/1.7.25/slf4j-ext-1.7.25-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar" sourcepath="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0.jar" sourcepath="M2_REPO/org/apache/logging/log4j/log4j-core/2.15.0/log4j-core-2.15.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0.jar" sourcepath="M2_REPO/org/apache/logging/log4j/log4j-api/2.15.0/log4j-api-2.15.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.27/snakeyaml-1.27-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/30.0-jre/guava-30.0-jre.jar" sourcepath="M2_REPO/com/google/guava/guava/30.0-jre/guava-30.0-jre-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" sourcepath="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" sourcepath="M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar" sourcepath="M2_REPO/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar" sourcepath="M2_REPO/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar" sourcepath="M2_REPO/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-csv/1.9.0/commons-csv-1.9.0.jar" sourcepath="M2_REPO/org/apache/commons/commons-csv/1.9.0/commons-csv-1.9.0-sources.jar"/>
</classpath>
41 changes: 18 additions & 23 deletions photon/.project
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>photon</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>photon</name>
<comment>A plugin interface for Light Boards. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
9 changes: 7 additions & 2 deletions photon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.strikete</groupId>
<artifactId>photon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.17</version>
<name>Photon LX Console Plugin Manager</name>
<description>A plugin interface for Light Boards</description>
<dependencies>
Expand All @@ -24,14 +24,19 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
<version>31.0.1-jre</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
Expand Down
147 changes: 112 additions & 35 deletions photon/src/main/java/com/strikete/photon/Photon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.Subscribe;
import com.strikete.photon.events.CompleteDataModelEvent;
import com.strikete.photon.events.ObjectDataGatheredEvent;
import com.strikete.photon.events.UpdateOscObjectsEvent;
import com.strikete.photon.objects.BeamPalette;
import com.strikete.photon.objects.Channel;
import com.strikete.photon.objects.ColorPalette;
Expand Down Expand Up @@ -34,12 +41,13 @@ public class Photon {
* VARIABLES - PROGRAM SPECIFIC
*/
public static Logger log;
public static final String version = "SNAPSHOT 0.9.0";
public static final String version = "1.17";
public OscSender sender;
public OscInterpreter interpreter;
public PhotonDataUtilities dataUtility;
public OscSenderRoutines senderRoutines;

public AsyncEventBus photonEventBus;
public ExecutorService executor;

/*
* VARIABLES - EOS SPECIFIC
Expand Down Expand Up @@ -69,6 +77,9 @@ public class Photon {
public ArrayList<Sub> subs;

public int cuelistCount;
public boolean workingBool;
public boolean threadsAllowed;


/*
* METHODS - GETTERS
Expand All @@ -77,6 +88,24 @@ public String getEosVersion() {
return eosVersion;
}

/*
* METHODS - USER
*/

public void stopUpdating() {
workingBool = false;
}
public boolean isUpdating() {
return workingBool;
}
public void closeAllThreads() {
executor.shutdownNow();
threadsAllowed = false;
}
public void allowThreads() {
threadsAllowed = true;
}


/*
* METHODS - SETTERS
Expand All @@ -100,44 +129,87 @@ private static void printWelcomeMessage() { //Only to be called after the logger
* METHODS - CORE FUNCTIONS
*/

@Subscribe
public void updateOscObjectsViaEvent(UpdateOscObjectsEvent e) {
updateOscObjects();
}

public void updateOscObjects() {
log.debug("PHOTON: Updating OSC Objects.");
workingBool = true;

senderRoutines.getPatchCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getCuelistCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getGroupCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getMacroCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getSubCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getPresetCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getIntensityPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getFocusPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getColorPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getBeamPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getCurveCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getEffectCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getSnapshotCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getPixelmapCount();
waitForPause(1000000000L); //Wait 1 second after last message
senderRoutines.getMagicSheetCount();
waitForPause(1000000000L); //Wait 1 second after last message
while(workingBool) {
senderRoutines.getPatchCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Channels",channels.size()));

senderRoutines.getCuelistCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Cuelists",cuelists.size()));

senderRoutines.getGroupCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Groups",groups.size()));

senderRoutines.getMacroCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Macros",macros.size()));

senderRoutines.getSubCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Subs",subs.size()));

senderRoutines.getPresetCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Presets",presets.size()));

senderRoutines.getIntensityPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Intensity Palettes",intensityPalettes.size()));

senderRoutines.getFocusPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Focus Palettes",focusPalettes.size()));

senderRoutines.getColorPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Color Palettes",colorPalettes.size()));

senderRoutines.getBeamPaletteCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Beam Palettes",beamPalettes.size()));

senderRoutines.getCurveCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Curves",curves.size()));

senderRoutines.getEffectCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Effects",effects.size()));

senderRoutines.getSnapshotCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Snapshots",effects.size()));

senderRoutines.getPixelmapCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Pixelmaps",effects.size()));

senderRoutines.getMagicSheetCount();
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new ObjectDataGatheredEvent("Magic Sheets",magicSheets.size()));

log.debug("PHOTON: Updating Cue Objects.");
for(int x = 0; x < cuelists.size(); x++) {
senderRoutines.getCueCount(cuelists.get(x).getCuelistNumber());
log.debug("PHOTON: Updating Cue Objects.");
for(int x = 0; x < cuelists.size(); x++) {
senderRoutines.getCueCount(cuelists.get(x).getCuelistNumber());
}
waitForPause(1000000000L); //Wait 1 second after last message
photonEventBus.post(new CompleteDataModelEvent());
workingBool = false;
break;
}
workingBool = false;

}

public void waitForPause(long pauseTimeNano) { //Wait a set amount of time after receiving the last OSC message.
Expand Down Expand Up @@ -205,6 +277,11 @@ public Photon() {
BasicConfigurator.configure();
initializeVariables();
this.dataUtility = new PhotonDataUtilities(this);
this.executor = Executors.newFixedThreadPool(40);
this.threadsAllowed = true;

this.photonEventBus = new AsyncEventBus(executor);
photonEventBus.register(this);

printWelcomeMessage();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.strikete.photon.events;

public class CompleteDataModelEvent extends GenericUpdateEvent {

/*
* CONSTRUCTOR
*/
public CompleteDataModelEvent() {
super();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.strikete.photon.events;

public class CountResponseEvent extends GenericUpdateEvent {

/*
* VARIABLES
*/
private String type;
private int count;

/*
* METHODS
*/
public String getType() {
return type;
}
public int getCount() {
return count;
}

/*
* CONSTRUCTOR
*/
public CountResponseEvent(String type, int count) {
super();
this.type = type;
this.count = count;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.strikete.photon.events;

public class GenericUpdateEvent {

/*
* VARIABLE
*/
long timestamp;

/*
* METHODS
*/
public long getTimestamp() {
return timestamp;
}

/*
* CONSTRUCTOR
*/
public GenericUpdateEvent() {
this.timestamp = System.nanoTime();
}
}
Loading

0 comments on commit 95173e3

Please sign in to comment.