Skip to content

Commit 7826f25

Browse files
committed
flash_lights added
1 parent bb22750 commit 7826f25

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

resources-fre/strings/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<string id="menu_label_reset">Remise à zéro</string>
1616
<string id="menu_label_honk">Klaxon</string>
1717
<string id="menu_label_toggle">Temp. °C/°F</string>
18+
<string id="menu_label_flash_lights">Flash Lights</string>
19+
1820
<!-- Template: <string id="menu_label_%snake_case%">%Title Case%</string>-->
1921

2022
<!-- Second view -->
@@ -37,6 +39,8 @@
3739
<string id="label_unlock_doors">Déver. portes</string>
3840
<string id="label_unlocked">Ouverte</string>
3941
<string id="label_waking_vehicle">Réveil du vehicule...</string>
42+
<string id="label_flash_lights">Flash Lights</string>
43+
4044
<!-- Template: <string id="label_%snake_case%">%Title Case%</string> -->
4145

4246
</strings>

resources/layouts/menu.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<menu-item id="toggle_units" label="@Strings.menu_label_toggle" />
55
<menu-item id="select_car" label="@Strings.menu_label_select_car" />
66
<!-- Template: <menu-item id="%snake_case%" label="@Strings.menu_label_%snake_case%" /> -->
7+
<menu-item id="flash_lights" label="@Strings.menu_label_flash_lights" />
78

89
</menu>

resources/strings/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<string id="menu_label_honk">Honk</string>
2020
<string id="menu_label_toggle">Toggle C vs. F</string>
2121
<string id="menu_label_select_car">Select Vehicle...</string>
22+
<string id="menu_label_flash_lights">Flash Lights</string>
23+
2224
<!-- Template: <string id="menu_label_%snake_case%">%Title Case%</string> -->
2325

2426
<string id="setting_token_label">API Token</string>
@@ -44,6 +46,8 @@
4446
<string id="label_unlock_doors">Unlock Doors</string>
4547
<string id="label_unlocked">Unlocked</string>
4648
<string id="label_waking_vehicle">Waking vehicle...</string>
49+
<string id="label_flash_lights">Flash Lights</string>
50+
4751
<!-- Template: <string id="label_%snake_case%">%Title Case%</string> -->
4852

4953
</strings>

source/OptionMenu.mc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ class OptionMenuDelegate extends Ui.MenuInputDelegate {
2727
} else {
2828
Application.getApp().setProperty("imperial", true);
2929
}
30+
} else if (item == :flash_lights) {
31+
_controller._flash_lights = true;
32+
_controller.stateMachine();
33+
3034
/* Template:
31-
} else if (item == :"%snake_case%) {
32-
_controller._"%snake_case% = true;
35+
} else if (item == :%snake_case%) {
36+
_controller._%snake_case% = true;
3337
_controller.stateMachine();
3438
*/
3539
}

source/SecondDelegate.mc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SecondDelegate extends Ui.BehaviorDelegate {
2626
var _lock;
2727
var _settings;
2828
// Template: // var _%lower_case% dnl
29+
var _flash_lights;
2930

3031
var _data;
3132

@@ -60,6 +61,7 @@ class SecondDelegate extends Ui.BehaviorDelegate {
6061
_unlock = false;
6162
_lock = false;
6263
// Template: // _%snake_case% = false
64+
_flash_lights = false;
6365

6466

6567
if(_dummy_mode) {
@@ -168,6 +170,12 @@ class SecondDelegate extends Ui.BehaviorDelegate {
168170
_tesla.%camelCase%(_vehicle_id, method(:genericHandler));
169171
} */
170172

173+
if (_flash_lights) {
174+
_flash_lights = false;
175+
_handler.invoke(Ui.loadResource(Rez.Strings.label_flash_lights));
176+
_tesla.%camelCase%(_vehicle_id, method(:genericHandler));
177+
}
178+
171179
if (_unlock) {
172180
_unlock = false;
173181
_handler.invoke(Ui.loadResource(Rez.Strings.label_unlock_doors));

source/Tesla.mc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ class Tesla {
123123
// _notify.invoke(responseCode, data);
124124
//}
125125

126+
function flashLights(vehicle, notify) {
127+
var url = "https://owner-api.teslamotors.com/api/1/vehicles/" + vehicle.toString() + "/command/flash_lights";
128+
System.println(url);
129+
genericPost(url, notify);
130+
}
131+
126132
/* Template:
127133
function %camelCase%(vehicle, notify) {
128134
var url = "https://owner-api.teslamotors.com/api/1/vehicles/" + vehicle.toString() + "/command/%snake_case%";

0 commit comments

Comments
 (0)