First Commit
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
6
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
4
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
||||
20
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
25
.idea/jarRepositories.xml
generated
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/misc.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Jason Tu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# GlassFrame
|
||||
Base application for Google Glass apps (SDK version 19)
|
||||
|
||||
SDK Version 19 (Android KitKat (4.4))
|
||||
targetSdkVersion = 29
|
||||
|
||||
master branch has Java version, kotlin branch has Kotlin version
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
28
app/build.gradle
Normal file
@ -0,0 +1,28 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
|
||||
buildToolsVersion "29.0.2"
|
||||
defaultConfig {
|
||||
applicationId "haus.nightmare.GlassTesla"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'org.jetbrains:annotations-java5:15.0'
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.4'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation 'org.conscrypt:conscrypt-android:2.2.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,13 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
||||
33
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="haus.nightmare.GlassTesla">
|
||||
|
||||
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
tools:ignore="GoogleAppIndexingWarning">
|
||||
<activity
|
||||
android:name="haus.nightmare.GlassTesla.MainActivity"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/title_activity_main">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.glass.VoiceTrigger"
|
||||
android:resource="@xml/voice_trigger" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
47
app/src/main/java/haus/nightmare/GlassTesla/ChargeState.java
Normal file
@ -0,0 +1,47 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class ChargeState {
|
||||
public boolean battery_heater_on;
|
||||
public int battery_level;
|
||||
public double battery_range;
|
||||
public int charge_current_request;
|
||||
public int charge_current_request_max;
|
||||
public boolean charge_enable_request;
|
||||
public double charge_energy_added;
|
||||
public int charge_limit_soc;
|
||||
public int charge_limit_soc_max;
|
||||
public int charge_limit_soc_min;
|
||||
public int charge_limit_soc_std;
|
||||
public double charge_miles_added_ideal;
|
||||
public double charge_miles_added_rated;
|
||||
public Object charge_port_cold_weather_mode;
|
||||
public boolean charge_port_door_open;
|
||||
public String charge_port_latch;
|
||||
public double charge_rate;
|
||||
public boolean charge_to_max_range;
|
||||
public int charger_actual_current;
|
||||
public int charger_phases;
|
||||
public int charger_pilot_current;
|
||||
public int charger_power;
|
||||
public int charger_voltage;
|
||||
public String charging_state;
|
||||
public String conn_charge_cable;
|
||||
public double est_battery_range;
|
||||
public String fast_charger_brand;
|
||||
public boolean fast_charger_present;
|
||||
public String fast_charger_type;
|
||||
public double ideal_battery_range;
|
||||
public boolean managed_charging_active;
|
||||
public Object managed_charging_start_time;
|
||||
public boolean managed_charging_user_canceled;
|
||||
public int max_range_charge_counter;
|
||||
public int minutes_to_full_charge;
|
||||
public boolean not_enough_power_to_heat;
|
||||
public boolean scheduled_charging_pending;
|
||||
public Object scheduled_charging_start_time;
|
||||
public double time_to_full_charge;
|
||||
public long timestamp;
|
||||
public boolean trip_charging;
|
||||
public int usable_battery_level;
|
||||
public Object user_charge_enable_request;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class ClimateState {
|
||||
public boolean battery_heater;
|
||||
public boolean battery_heater_no_power;
|
||||
public String climate_keeper_mode;
|
||||
public int defrost_mode;
|
||||
public double driver_temp_setting;
|
||||
public int fan_status;
|
||||
public double inside_temp;
|
||||
public boolean is_auto_conditioning_on;
|
||||
public boolean is_climate_on;
|
||||
public boolean is_front_defroster_on;
|
||||
public boolean is_preconditioning;
|
||||
public boolean is_rear_defroster_on;
|
||||
public int left_temp_direction;
|
||||
public double max_avail_temp;
|
||||
public double min_avail_temp;
|
||||
public double outside_temp;
|
||||
public double passenger_temp_setting;
|
||||
public boolean remote_heater_control_enabled;
|
||||
public int right_temp_direction;
|
||||
public int seat_heater_left;
|
||||
public int seat_heater_right;
|
||||
public boolean side_mirror_heaters;
|
||||
public long timestamp;
|
||||
public boolean wiper_blade_heater;
|
||||
}
|
||||
20
app/src/main/java/haus/nightmare/GlassTesla/DriveState.java
Normal file
@ -0,0 +1,20 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
// import com.fasterxml.jackson.databind.ObjectMapper; // version 2.11.1
|
||||
// import com.fasterxml.jackson.annotation.JsonProperty; // version 2.11.1
|
||||
/* ObjectMapper om = new ObjectMapper();
|
||||
Root root = om.readValue(myJsonString, Root.class); */
|
||||
public class DriveState {
|
||||
public int gps_as_of;
|
||||
public int heading;
|
||||
public double latitude;
|
||||
public double longitude;
|
||||
public double native_latitude;
|
||||
public int native_location_supported;
|
||||
public double native_longitude;
|
||||
public String native_type;
|
||||
public int power;
|
||||
public Object shift_state;
|
||||
public Object speed;
|
||||
public long timestamp;
|
||||
}
|
||||
11
app/src/main/java/haus/nightmare/GlassTesla/GuiSettings.java
Normal file
@ -0,0 +1,11 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class GuiSettings {
|
||||
public boolean gui_24_hour_time;
|
||||
public String gui_charge_rate_units;
|
||||
public String gui_distance_units;
|
||||
public String gui_range_display;
|
||||
public String gui_temperature_units;
|
||||
public boolean show_range_units;
|
||||
public long timestamp;
|
||||
}
|
||||
190
app/src/main/java/haus/nightmare/GlassTesla/MainActivity.java
Normal file
@ -0,0 +1,190 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
import com.google.android.glass.media.Sounds;
|
||||
import com.google.android.glass.widget.CardBuilder;
|
||||
import com.google.android.glass.widget.CardScrollAdapter;
|
||||
import com.google.android.glass.widget.CardScrollView;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.StrictMode;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import org.conscrypt.Conscrypt;
|
||||
|
||||
import java.net.URL;
|
||||
import java.security.Security;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private CardScrollView cardScroller;
|
||||
|
||||
private View view;
|
||||
private TeslaResponse vehicleData;
|
||||
private SharedPreferences prefs;
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
StrictMode.setThreadPolicy(policy);
|
||||
prefs = getPreferences(MODE_PRIVATE);
|
||||
view = buildStatusView();
|
||||
view.setKeepScreenOn(true);
|
||||
cardScroller = new CardScrollView(this);
|
||||
cardScroller.setAdapter(new CardScrollAdapter() {
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPosition(Object item) {
|
||||
if (view.equals(item)) {
|
||||
return 0;
|
||||
}
|
||||
return AdapterView.INVALID_POSITION;
|
||||
}
|
||||
});
|
||||
|
||||
cardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
am.playSoundEffect(Sounds.TAP);
|
||||
|
||||
}
|
||||
});
|
||||
setContentView(cardScroller);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
cardScroller.activate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
cardScroller.deactivate();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
private View buildStatusView() {
|
||||
if (vehicleData == null) {
|
||||
try {
|
||||
getVehicleData();
|
||||
} catch(Exception e) {
|
||||
Log.v("Tesla API Setup", "Unable to get Tesla data", e);
|
||||
this.finishAffinity();
|
||||
System.exit(0); // Shouldn't be reached, but just in case let's kill it dead
|
||||
}
|
||||
}
|
||||
|
||||
CardBuilder card = new CardBuilder(this, CardBuilder.Layout.TEXT);
|
||||
String chargeDuration = "";
|
||||
int totalSecs = (int) (vehicleData.charge_state.time_to_full_charge * 3600);
|
||||
int hours = totalSecs / 3600;
|
||||
int minutes = (totalSecs % 3600) / 60;
|
||||
if (hours > 0) {
|
||||
chargeDuration += hours + "h";
|
||||
}
|
||||
if (minutes > 0) {
|
||||
chargeDuration += minutes + "m";
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.HOUR_OF_DAY, hours);
|
||||
cal.add(Calendar.MINUTE, minutes);
|
||||
card.setText(
|
||||
String.format(getString(R.string.StatusFormat),
|
||||
vehicleData.charge_state.battery_level,
|
||||
(int) vehicleData.charge_state.battery_range,
|
||||
vehicleData.vehicle_state.sentry_mode ? "Enabled" : "Disabled",
|
||||
vehicleData.charge_state.charging_state,
|
||||
vehicleData.charge_state.charger_power,
|
||||
chargeDuration,
|
||||
new SimpleDateFormat("hh:mm").format(cal.getTime())
|
||||
)
|
||||
);
|
||||
card.setFootnote(String.format("%s last updated: %s",
|
||||
vehicleData.display_name,
|
||||
new SimpleDateFormat("hh:mm").format(vehicleData.charge_state.timestamp)
|
||||
));
|
||||
|
||||
return card.getView();
|
||||
}
|
||||
|
||||
// /api/1/vehicles/{id}/vehicle_data
|
||||
public void getVehicleData() {
|
||||
String vehicleId = prefs.getString("vehicle_id", "");
|
||||
String json = getResponseFromJsonURL("https://owner-api.teslamotors.com/api/1/vehicles/" + vehicleId +"/vehicle_data");
|
||||
Gson gson = new Gson();
|
||||
ResponseRoot root = gson.fromJson(json, ResponseRoot.class);
|
||||
vehicleData = root.response;
|
||||
}
|
||||
public String getResponseFromJsonURL(String url) {
|
||||
String token = prefs.getString("bearer_token", "");
|
||||
|
||||
String jsonResponse = null;
|
||||
if (url.length() > 0) {
|
||||
try {
|
||||
Security.insertProviderAt(Conscrypt.newProvider(), 1);
|
||||
|
||||
|
||||
|
||||
/************** For getting response from HTTP URL start ***************/
|
||||
URL object = new URL(url);
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder()
|
||||
.url(object)
|
||||
.addHeader("Authorization", "Bearer " + token)
|
||||
.addHeader("User-Agent", "Tesla-GLASS")
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int responseCode = response.code();
|
||||
|
||||
if (responseCode == 200) {
|
||||
return response.body().string();
|
||||
|
||||
}
|
||||
} catch (SSLException e) {
|
||||
Log.e("DataSSL", "SSL Exception getting json:", e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class MediaState {
|
||||
public boolean remote_control_enabled;
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class ResponseRoot {
|
||||
public TeslaResponse response;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class SoftwareUpdate {
|
||||
public int download_perc;
|
||||
public int expected_duration_sec;
|
||||
public int install_perc;
|
||||
public String status;
|
||||
public String version;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class SpeedLimitMode {
|
||||
public boolean active;
|
||||
public double current_limit_mph;
|
||||
public int max_limit_mph;
|
||||
public int min_limit_mph;
|
||||
public boolean pin_code_set;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class TeslaResponse{
|
||||
public long id;
|
||||
public long user_id;
|
||||
public long vehicle_id;
|
||||
public String vin;
|
||||
public String display_name;
|
||||
public String option_codes;
|
||||
public Object color;
|
||||
public String access_type;
|
||||
public ArrayList<String> tokens;
|
||||
public String state;
|
||||
public boolean in_service;
|
||||
public String id_s;
|
||||
public boolean calendar_enabled;
|
||||
public int api_version;
|
||||
public Object backseat_token;
|
||||
public Object backseat_token_updated_at;
|
||||
public DriveState drive_state;
|
||||
public ClimateState climate_state;
|
||||
public ChargeState charge_state;
|
||||
public GuiSettings gui_settings;
|
||||
public VehicleState vehicle_state;
|
||||
public VehicleConfig vehicle_config;
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class VehicleConfig {
|
||||
public boolean can_accept_navigation_requests;
|
||||
public boolean can_actuate_trunks;
|
||||
public String car_special_type;
|
||||
public String car_type;
|
||||
public String charge_port_type;
|
||||
public boolean default_charge_to_max;
|
||||
public boolean ece_restrictions;
|
||||
public boolean eu_vehicle;
|
||||
public String exterior_color;
|
||||
public boolean has_air_suspension;
|
||||
public boolean has_ludicrous_mode;
|
||||
public boolean motorized_charge_port;
|
||||
public boolean plg;
|
||||
public int rear_seat_heaters;
|
||||
public int rear_seat_type;
|
||||
public boolean rhd;
|
||||
public String roof_color;
|
||||
public int seat_type;
|
||||
public String spoiler_type;
|
||||
public int sun_roof_installed;
|
||||
public String third_row_seats;
|
||||
public long timestamp;
|
||||
public String trim_badging;
|
||||
public boolean use_range_badging;
|
||||
public String wheel_type;
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package haus.nightmare.GlassTesla;
|
||||
|
||||
public class VehicleState {
|
||||
public int api_version;
|
||||
public String autopark_state_v2;
|
||||
public String autopark_style;
|
||||
public boolean calendar_supported;
|
||||
public String car_version;
|
||||
public int center_display_state;
|
||||
public int df;
|
||||
public int dr;
|
||||
public int fd_window;
|
||||
public int fp_window;
|
||||
public int ft;
|
||||
public int homelink_device_count;
|
||||
public boolean homelink_nearby;
|
||||
public boolean is_user_present;
|
||||
public String last_autopark_error;
|
||||
public boolean locked;
|
||||
public MediaState media_state;
|
||||
public boolean notifications_supported;
|
||||
public double odometer;
|
||||
public boolean parsed_calendar_supported;
|
||||
public int pf;
|
||||
public int pr;
|
||||
public int rd_window;
|
||||
public boolean remote_start;
|
||||
public boolean remote_start_enabled;
|
||||
public boolean remote_start_supported;
|
||||
public int rp_window;
|
||||
public int rt;
|
||||
public boolean sentry_mode;
|
||||
public boolean sentry_mode_available;
|
||||
public boolean smart_summon_available;
|
||||
public SoftwareUpdate software_update;
|
||||
public SpeedLimitMode speed_limit_mode;
|
||||
public boolean summon_standby_mode_enabled;
|
||||
public int sun_roof_percent_open;
|
||||
public String sun_roof_state;
|
||||
public long timestamp;
|
||||
public boolean valet_mode;
|
||||
public boolean valet_pin_needed;
|
||||
public Object vehicle_name;
|
||||
}
|
||||
BIN
app/src/main/res/drawable-hdpi/ic_glass_logo.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_stop.png
Normal file
|
After Width: | Height: | Size: 633 B |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
7
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">GlassTesla</string>
|
||||
<string name="title_activity_main">Glass Tesla</string>
|
||||
<string name="hello_world">Hello, world!</string>
|
||||
<string name="voice_trigger">glass tesla</string>
|
||||
<string name="StatusFormat">Battery: %d%% (%d mi)\nSentry Mode: %s \n%s: %dkW \nTime to Full: %s (%s)</string>
|
||||
</resources>
|
||||
5
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="android:Theme.Holo.Light"></style>
|
||||
</resources>
|
||||
2
app/src/main/res/xml/voice_trigger.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<!-- For more information about voice trigger, check out: https://developers.google.com/glass/develop/gdk/starting-glassware -->
|
||||
<trigger keyword="@string/voice_trigger" />
|
||||
28
build.gradle
Normal file
@ -0,0 +1,28 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.4.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
20
gradle.properties
Normal file
@ -0,0 +1,20 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Mon Aug 19 22:28:14 EDT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
||||
172
gradlew
vendored
Executable file
@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
gradlew.bat
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app'
|
||||