Skip to content
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
7 changes: 7 additions & 0 deletions resources-fre/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<string id="menu_label_reset">Remise à zéro</string>
<string id="menu_label_honk">Klaxon</string>
<string id="menu_label_toggle">Temp. °C/°F</string>
<string id="menu_label_flash_lights">Flash Lights</string>

<!-- Template: <string id="menu_label_%snake_case%">%Title Case%</string>-->

<!-- Second view -->
<string id="label_cabin">Temp: </string>
Expand All @@ -36,4 +39,8 @@
<string id="label_unlock_doors">Déver. portes</string>
<string id="label_unlocked">Ouverte</string>
<string id="label_waking_vehicle">Réveil du vehicule...</string>
<string id="label_flash_lights">Flash Lights</string>

<!-- Template: <string id="label_%snake_case%">%Title Case%</string> -->

</strings>
3 changes: 3 additions & 0 deletions resources/layouts/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<menu-item id="reset" label="@Strings.menu_label_reset" />
<menu-item id="toggle_units" label="@Strings.menu_label_toggle" />
<menu-item id="select_car" label="@Strings.menu_label_select_car" />
<!-- Template: <menu-item id="%snake_case%" label="@Strings.menu_label_%snake_case%" /> -->
<menu-item id="flash_lights" label="@Strings.menu_label_flash_lights" />

</menu>
7 changes: 7 additions & 0 deletions resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<string id="menu_label_honk">Honk</string>
<string id="menu_label_toggle">Toggle C vs. F</string>
<string id="menu_label_select_car">Select Vehicle...</string>
<string id="menu_label_flash_lights">Flash Lights</string>

<!-- Template: <string id="menu_label_%snake_case%">%Title Case%</string> -->

<string id="setting_token_label">API Token</string>
<string id="setting_token_prompt">Enter your Tesla Account token</string>
Expand All @@ -43,4 +46,8 @@
<string id="label_unlock_doors">Unlock Doors</string>
<string id="label_unlocked">Unlocked</string>
<string id="label_waking_vehicle">Waking vehicle...</string>
<string id="label_flash_lights">Flash Lights</string>

<!-- Template: <string id="label_%snake_case%">%Title Case%</string> -->

</strings>
9 changes: 9 additions & 0 deletions source/OptionMenu.mc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class OptionMenuDelegate extends Ui.MenuInputDelegate {
} else {
Application.getApp().setProperty("imperial", true);
}
} else if (item == :flash_lights) {
_controller._flash_lights = true;
_controller.stateMachine();

/* Template:
} else if (item == :%snake_case%) {
_controller._%snake_case% = true;
_controller.stateMachine();
*/
}
}

Expand Down
18 changes: 18 additions & 0 deletions source/SecondDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class SecondDelegate extends Ui.BehaviorDelegate {
var _unlock;
var _lock;
var _settings;
// Template: // var _%lower_case%
var _flash_lights;

var _data;

Expand Down Expand Up @@ -58,6 +60,9 @@ class SecondDelegate extends Ui.BehaviorDelegate {
_open_frunk = false;
_unlock = false;
_lock = false;
// Template: // _%snake_case% = false
_flash_lights = false;


if(_dummy_mode) {
_data._vehicle = {
Expand Down Expand Up @@ -158,6 +163,19 @@ class SecondDelegate extends Ui.BehaviorDelegate {
_tesla.honkHorn(_vehicle_id, method(:genericHandler));
}

/* Template:
if (_%snake_case%) {
_%snake_case% = false;
_handler.invoke(Ui.loadResource(Rez.Strings.label_%snake_case%));
_tesla.%camelCase%(_vehicle_id, method(:genericHandler));
} */

if (_flash_lights) {
_flash_lights = false;
_handler.invoke(Ui.loadResource(Rez.Strings.label_flash_lights));
_tesla.%camelCase%(_vehicle_id, method(:genericHandler));
}

if (_unlock) {
_unlock = false;
_handler.invoke(Ui.loadResource(Rez.Strings.label_unlock_doors));
Expand Down
14 changes: 14 additions & 0 deletions source/Tesla.mc
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,18 @@ class Tesla {
// }
// _notify.invoke(responseCode, data);
//}

function flashLights(vehicle, notify) {
var url = "https://owner-api.teslamotors.com/api/1/vehicles/" + vehicle.toString() + "/command/flash_lights";
System.println(url);
genericPost(url, notify);
}

/* Template:
function %camelCase%(vehicle, notify) {
var url = "https://owner-api.teslamotors.com/api/1/vehicles/" + vehicle.toString() + "/command/%snake_case%";
System.println(url);
genericPost(url, notify);
}
*/
}