summaryrefslogtreecommitdiff
path: root/luals-stubs
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-08-29 15:20:22 +1000
committerailurux <ailuruxx@gmail.com>2024-08-29 15:20:22 +1000
commit96a224c0df4f647b3e5dbbcbbedad3a1d38470ba (patch)
tree8960865293dde6f9844b7b1a42d5775d5dceceb2 /luals-stubs
parent3421bd652c39b253872e43d3b6e43664bd0b66e2 (diff)
downloadtangara-fw-96a224c0df4f647b3e5dbbcbbedad3a1d38470ba.tar.gz
Lua API improvements and fixes
Co-authored-by: jacqueline <me@jacqueline.id.au>
Diffstat (limited to 'luals-stubs')
-rw-r--r--luals-stubs/backstack.lua4
-rw-r--r--luals-stubs/bluetooth.lua13
-rw-r--r--luals-stubs/playback.lua5
-rw-r--r--luals-stubs/queue.lua4
4 files changed, 22 insertions, 4 deletions
diff --git a/luals-stubs/backstack.lua b/luals-stubs/backstack.lua
index b39fcbf2..84a57e5c 100644
--- a/luals-stubs/backstack.lua
+++ b/luals-stubs/backstack.lua
@@ -17,4 +17,8 @@ function backstack.push(screen) end
--- there are no other screens in the stack.
function backstack.pop() end
+--- Sets a new root screen, replacing any existing screens
+--- @param screen screen The new root screen
+function backstack.reset(screen) end
+
return backstack
diff --git a/luals-stubs/bluetooth.lua b/luals-stubs/bluetooth.lua
index a2dd476d..d362974a 100644
--- a/luals-stubs/bluetooth.lua
+++ b/luals-stubs/bluetooth.lua
@@ -5,8 +5,17 @@
--- @class bluetooth
--- @field enabled Property Whether or not the Bluetooth stack is currently enabled. This property is writeable, and can be used to enable or disable Bluetooth.
--- @field connected Property Whether or not there is an active connection to another Bluetooth device.
---- @field paired_device Property The device that is currently paired. The bluetooth stack will automatically connected to this device if possible.
---- @field devices Property Devices nearby that have been discovered.
+--- @field connecting Property Whether or not we are currently connecting to the paired device.
+--- @field discovering Property Whether or not we are actively scanning for new devices.
+--- @field paired_device Property The device that is currently paired. The bluetooth stack will automatically connect to this device if possible.
+--- @field discovered_devices Property Devices nearby that have been discovered.
+--- @field known_devices Property Devices that have previously been paired.
local bluetooth = {}
+--- Enables Bluetooth, this is the same as bluetooth.enabled:set(true)
+function bluetooth.enable() end
+
+--- Disables Bluetooth, this is the same as bluetooth.enabled:set(false)
+function bluetooth.disable() end
+
return bluetooth
diff --git a/luals-stubs/playback.lua b/luals-stubs/playback.lua
index 85392e93..f905f384 100644
--- a/luals-stubs/playback.lua
+++ b/luals-stubs/playback.lua
@@ -8,4 +8,9 @@
--- @field position Property The current playback position within the current track, in seconds.
local playback = {}
+--- Returns whether or not this file can be played (i.e. is this an audio track)
+--- @param filepath string
+--- @return boolean
+function playback.is_playable(filepath) end
+
return playback
diff --git a/luals-stubs/queue.lua b/luals-stubs/queue.lua
index 895b4c78..97583587 100644
--- a/luals-stubs/queue.lua
+++ b/luals-stubs/queue.lua
@@ -13,10 +13,10 @@
--- @field random Property Determines whether, when progressing to the next track in the queue, the next track will be chosen randomly. The random selection algorithm used is a Miller Shuffle, which guarantees that no repeat selections will be made until every item in the queue has been played. Writeable.
local queue = {}
---- Adds the given track or database iterator to the end of the queue. Database
+--- Adds the given track, database iterator, or file to the end of the queue. Database
--- iterators passed to this method will be unnested and expanded into the track
--- ids they contain.
---- @param val TrackId|Iterator
+--- @param val TrackId|Iterator|string
function queue.add(val) end
--- Opens a playlist file from a filepath