Skip to content

Commit

Permalink
Added newly discovered option codes and other minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpasqua committed Oct 17, 2013
1 parent fd021bf commit 04dc0b5
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 73 deletions.
3 changes: 1 addition & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
Expand Down
110 changes: 53 additions & 57 deletions nbproject/build-impl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ is divided into following sections:
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<property name="platform.java" value="${java.home}/bin/java"/>
<available file="${manifest.file}" property="manifest.available"/>
<condition property="splashscreen.available">
<and>
Expand All @@ -71,10 +72,11 @@ is divided into following sections:
</not>
</and>
</condition>
<condition property="manifest.available+main.class">
<condition property="profile.available">
<and>
<isset property="manifest.available"/>
<isset property="main.class.available"/>
<isset property="javac.profile"/>
<length length="0" string="${javac.profile}" when="greater"/>
<matches pattern="1\.[89](\..*)?" string="${javac.source}"/>
</and>
</condition>
<condition property="do.archive">
Expand All @@ -91,12 +93,6 @@ is divided into following sections:
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="do.mkdist"/>
</and>
</condition>
<condition property="do.archive+manifest.available">
<and>
<isset property="manifest.available"/>
Expand All @@ -115,24 +111,12 @@ is divided into following sections:
<istrue value="${do.archive}"/>
</and>
</condition>
<condition property="do.archive+manifest.available+main.class">
<condition property="do.archive+profile.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="profile.available"/>
<istrue value="${do.archive}"/>
</and>
</condition>
<condition property="manifest.available-mkdist.available">
<or>
<istrue value="${manifest.available}"/>
<isset property="do.mkdist"/>
</or>
</condition>
<condition property="manifest.available+main.class-mkdist.available">
<or>
<istrue value="${manifest.available+main.class}"/>
<isset property="do.mkdist"/>
</or>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
Expand Down Expand Up @@ -186,7 +170,15 @@ is divided into following sections:
</condition>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<length length="0" string="${endorsed.classpath}" when="greater"/>
<and>
<isset property="endorsed.classpath"/>
<not>
<equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
<isset property="profile.available"/>
</condition>
<condition else="false" property="jdkBug6558476">
<and>
Expand Down Expand Up @@ -275,6 +267,7 @@ is divided into following sections:
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.profile.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<compilerarg value="-processorpath"/>
<compilerarg path="@{processorpath}:${empty.dir}"/>
Expand Down Expand Up @@ -314,6 +307,7 @@ is divided into following sections:
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.profile.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<customize/>
</javac>
Expand Down Expand Up @@ -446,7 +440,7 @@ is divided into following sections:
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="TeslaClient" testname="TestNG tests" workingDir="${work.dir}">
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="TeslaClient" testname="TestNG tests" workingDir="${work.dir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
Expand Down Expand Up @@ -837,8 +831,8 @@ is divided into following sections:
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
<customize/>
Expand All @@ -850,7 +844,7 @@ is divided into following sections:
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
<j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
</jar>
</presetdef>
</target>
Expand Down Expand Up @@ -966,65 +960,67 @@ is divided into following sections:
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo level="info">To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
<target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
<tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
<touch file="${tmp.manifest.file}" verbose="false"/>
</target>
<target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
<target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
<tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
<copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
</target>
<target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
<manifest file="${tmp.manifest.file}" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</target>
<target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
<manifest file="${tmp.manifest.file}" mode="update">
<attribute name="Profile" value="${javac.profile}"/>
</manifest>
</target>
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
<basename file="${application.splash}" property="splashscreen.basename"/>
<mkdir dir="${build.classes.dir}/META-INF"/>
<copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
<manifest file="${tmp.manifest.file}" mode="update">
<attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
</manifest>
</target>
<target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
<target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs">
<j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
<echo level="info">To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo level="info">java -jar "${dist.jar.resolved}"</echo>
</target>
<target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
<j2seproject1:jar manifest="${tmp.manifest.file}"/>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
<isset property="main.class.available"/>
</condition>
<condition else="debug" property="jar.usage.level" value="info">
<isset property="main.class.available"/>
</condition>
<echo level="${jar.usage.level}" message="${jar.usage.message}"/>
</target>
<target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
<delete>
<fileset file="${tmp.manifest.file}"/>
</delete>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
<target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
<target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
Expand Down
8 changes: 4 additions & 4 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=abdf726c
build.xml.script.CRC32=1f77a374
build.xml.stylesheet.CRC32=28e38971@1.56.1.46
build.xml.script.CRC32=9c2ee652
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=abdf726c
nbproject/build-impl.xml.script.CRC32=94967532
nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46
nbproject/build-impl.xml.script.CRC32=bf1d8e73
nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46
6 changes: 3 additions & 3 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ file.reference.resty-0.3.2.jar=../../ThirdParty/resty/resty-0.3.2.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.commons-codec-1.8.jar}:\
${file.reference.commons-lang3-3.1.jar}:\
${file.reference.commons-logging-1.1.3.jar}:\
${file.reference.geocoder-java-0.15.jar}:\
${file.reference.commons-logging-api-1.1.3.jar}:\
${file.reference.commons-lang3-3.1.jar}:\
${file.reference.geocoder-java-0.15.jar}:\
${file.reference.gson-2.2.4.jar}:\
${file.reference.commons-codec-1.8.jar}:\
${file.reference.resty-0.3.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
Expand Down
17 changes: 14 additions & 3 deletions src/org/noroomattheinn/tesla/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ public SeatType seatType() {
public boolean hasSatRadio() { return hasOption("X013"); }
public boolean hasPerfExterior() { return hasOption("X019"); }
public boolean hasPerfPowertrain() { return hasOption("X024"); }

// Speculative at this point
public boolean hasParkingSensors() { return hasOption("PK"); }
public boolean hasLightingPackage() { return hasOption("LP"); }
public boolean hasSecurityPackage() { return hasOption("SP"); }
public boolean hasColdWeather() { return hasOption("CW"); }

//
// Override Methods
Expand Down Expand Up @@ -184,6 +188,12 @@ public String toString() {
" Parcel Shelf: %b\n" +
" Paint Armor: %b\n" +
" Third Row Seating: %b\n" +
" ]\n" +
" Newer Options: [\n" +
" Parking Sensors: %b\n" +
" Lighting Package: %b\n" +
" Security Package: %b\n" +
" Cold Weather Package: %b\n" +
" ]\n",
region(), trimLevel(), driveSide(),
isPerformance(), isPerfPlus(),
Expand All @@ -194,8 +204,9 @@ public String toString() {
hasHomeLink(), hasNavSystem(),
hasAudioUpgrade(), hasSatRadio(),
hasSupercharger(), hasTwinCharger(), hasHPWC(),
hasParcelShelf(), hasPaintArmor(), hasThirdRow()
);
hasParcelShelf(), hasPaintArmor(), hasThirdRow(),
hasParkingSensors(), hasLightingPackage(), hasSecurityPackage(),
hasColdWeather());
}

//
Expand Down
17 changes: 13 additions & 4 deletions src/org/noroomattheinn/tesla/Tesla.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public class Tesla {
}

// Instance Variables
private RestyWrapper api;
private List<Vehicle> vehicles;
private final RestyWrapper api;
private final List<Vehicle> vehicles;
private String username = null;


Expand Down Expand Up @@ -142,7 +142,16 @@ private boolean login(String username, String password) {
"user_session[email]=" + RestyWrapper.enc(username) +
"&user_session[password]=" + RestyWrapper.enc(password));
text = api.text(endpoint("login"), fc);
return (text.status(200) || text.status(302));
int status = text.http().getResponseCode();
if (!text.status(200) && !text.status(302))
return false;

String responseBody = text.toString();
if (responseBody.contains("You do not have access")) {
logger.log(Level.INFO, "Login Failure:\n{0}", responseBody);
return false;
}
return true;
} catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
return false;
Expand Down Expand Up @@ -201,7 +210,7 @@ boolean fetchVehiclesInto(List<Vehicle> list) {
list.add(vehicle);
}
} catch (IOException | JSONException ex) {
logger.log(Level.INFO, null, ex);
logger.log(Level.INFO, "Problem fetching vehicle list", ex);
return false;
}
return true;
Expand Down
4 changes: 4 additions & 0 deletions src/org/noroomattheinn/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public static void sleep(long timeInMillis) {
}
}

public static void yieldFor(long timeInMillis) {
try { Thread.sleep(timeInMillis); } catch (InterruptedException ex) { }
}

public static int compareVersions(String versionA, String versionB) {
String[] partsOfA = versionA.split("\\.");
String[] partsOfB = versionB.split("\\.");
Expand Down

0 comments on commit 04dc0b5

Please sign in to comment.