split lua stubs into one set for ldoc, and one set for lua-ls

custom
jacqueline 1 year ago
parent aa1dd3d522
commit e12a68a74d
  1. 3
      .luarc.json
  2. 2
      config.ld
  3. 0
      ldoc-stubs/alerts.lua
  4. 0
      ldoc-stubs/backstack.lua
  5. 9
      ldoc-stubs/bluetooth.lua
  6. 0
      ldoc-stubs/database.lua
  7. 19
      ldoc-stubs/playback.lua
  8. 18
      ldoc-stubs/power.lua
  9. 22
      ldoc-stubs/queue.lua
  10. 12
      ldoc-stubs/types.lua
  11. 14
      ldoc-stubs/volume.lua
  12. 11
      luals-stubs/alerts.lua
  13. 11
      luals-stubs/backstack.lua
  14. 8
      luals-stubs/bluetooth.lua
  15. 33
      luals-stubs/database.lua
  16. 10
      luals-stubs/playback.lua
  17. 10
      luals-stubs/power.lua
  18. 11
      luals-stubs/queue.lua
  19. 13
      luals-stubs/types.lua
  20. 8
      luals-stubs/volume.lua
  21. 15
      src/lua/stubs/playback.lua
  22. 18
      src/lua/stubs/power.lua
  23. 22
      src/lua/stubs/queue.lua
  24. 14
      src/lua/stubs/volume.lua

@ -1,6 +1,7 @@
{ {
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"workspace.library": ["lib/luavgl/src", "src/lua/stubs"], "workspace.library": ["lib/luavgl/src", "luals-stubs"],
"workspace.ignoreDir": ["ldoc-stubs"],
"runtime.version": "Lua 5.4", "runtime.version": "Lua 5.4",
} }

@ -1,3 +1,3 @@
file = {'src/lua/stubs'} file = {'ldoc-stubs'}
project = "Tangara" project = "Tangara"
description = "Lua modules provided by Tangara's firmware" description = "Lua modules provided by Tangara's firmware"

@ -1,14 +1,13 @@
--- Properties and functions for handling Bluetooth connectivity --- Properties and functions for handling Bluetooth connectivity
-- @module bluetooth -- @module bluetooth
local bluetooth = {} local bluetooth = {}
--- Whether or not the Bluetooth stack is currently enabled. This property is writeable, and can be used to enable or disable Bluetooth. --- Whether or not the Bluetooth stack is currently enabled. This property is writeable, and can be used to enable or disable Bluetooth.
-- @treturn types.Property a boolean property -- @see types.Property
function bluetooth.enabled() end bluetooth.enabled = types.Property
--- Whether or not there is an active connection to another Bluetooth device. --- Whether or not there is an active connection to another Bluetooth device.
-- @treturn types.Property a boolean property -- @see types.Property
function bluetooth.connected() end bluetooth.connected = types.Property
return bluetooth return bluetooth

@ -0,0 +1,19 @@
--- Properties for interacting with the audio playback system
-- @module playback
local playback = {}
--- Whether or not any audio is *allowed* to be played. If there is a current track, then this is essentially an indicator of whether playback is paused or unpaused.
-- @see types.Property
playback.playing = types.Property
--- Rich information about the currently playing track.
-- @see types.Property
-- @see types.Track
playback.track = types.Property
--- The current playback position within the current track, in seconds.
-- @see types.Property
playback.position = types.Property
return playback

@ -0,0 +1,18 @@
--- Properties and functions that deal with the device's battery and power state
-- @module power
local power = {}
--- The battery's current charge as a percentage
-- @see types.Property
power.battery_pct = types.Property
--- The battery's current voltage, in millivolts.
-- @see types.Property
power.battery_millivolts = types.Property
--- Whether or not the device is currently receiving external power
-- @see types.Property
power.plugged_in = types.Property
return power

@ -0,0 +1,22 @@
--- Properties and functions for inspecting and manipulating the track playback queue
-- @module queue
local queue = {}
--- The index in the queue of the currently playing track. This may be zero if the queue is empty.
-- @see types.Property
queue.position = types.Property
--- The total number of tracks in the queue, including tracks which have already been played.
-- @see types.Property
queue.size = types.Property
--- Determines whether or not the queue will be restarted after the final track is played.
-- @see types.Property
queue.replay = types.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.
-- @see types.Property
queue.random = types.Property
return queue

@ -1,10 +1,11 @@
--- Userdata-based types used throughout the rest of the API. These types are --- Userdata-based types used throughout the rest of the API. These types are
--- not generally constructable within Lua code. --- not generally constructable within Lua code.
-- @module types -- @module types
local types = {}
--- A value sourced from the C++ firmware. --- A observable value, owned by the C++ firmware.
-- @type Property -- @type Property
local Property = {} types.Property = {}
--- Gets the current value --- Gets the current value
-- @return The property's current value. -- @return The property's current value.
@ -24,4 +25,11 @@ function Property:set(val) end
-- @return fn, for more ergonmic use with anonymous closures. -- @return fn, for more ergonmic use with anonymous closures.
function Property:bind(fn) end function Property:bind(fn) end
--- Table containing information about a track. Most fields are optional.
-- @type Track
types.Track = {}
--- The title of the track, or the filename if no title is available.
types.Track.title = ""
return Property return Property

@ -0,0 +1,14 @@
--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
-- @module volume
local volume = {}
--- The current volume as a percentage of the current volume limit.
-- @see types.Property
volume.current_pct = types.Property
--- The current volume in terms of decibels relative to line level.
-- @see types.Property
volume.current_db = types.Property
return volume

@ -0,0 +1,11 @@
--- @meta
--- @class alerts
local alerts = {}
--- @param constructor function
function alerts.show(constructor) end
function alerts.hide() end
return alerts

@ -0,0 +1,11 @@
--- @meta
--- @class backstack
local backstack = {}
--- @param constructor function
function backstack.push(constructor) end
function backstack.pop() end
return backstack

@ -0,0 +1,8 @@
--- @meta
--- @class bluetooth
--- @field enabled Property
--- @field connected Property
local bluetooth = {}
return bluetooth

@ -0,0 +1,33 @@
--- @meta
--- @class database
local database = {}
--- @return Index[]
function database.indexes() end
--- @class Iterator
local Iterator = {}
--- @class TrackId
local TrackId = {}
--- @class Record
local Record = {}
--- @return string
function Record:title() end
--- @return TrackId|Iterator(Record)
function Record:contents() end
--- @class Index
local Index = {}
--- @return string
function Index:name() end
--- @return Iterator(Record)
function Index:iter() end
return database

@ -0,0 +1,10 @@
--- @meta
--- Properties for interacting with the audio playback system
--- @class playback
--- @field playing Property Whether or not audio is allowed to be played. if there is a current track, then this indicated whether playback is paused or unpaused. If there is no current track, this determines what will happen when the first track is added to the queue.
--- @field track Property The currently playing track.
--- @field position Property The current playback position within the current track, in seconds.
local playback = {}
return playback

@ -0,0 +1,10 @@
--- @meta
--- Properties and functions that deal with the device's battery and power state.
--- @class power
--- @field battery_pct Property The battery's current charge, as a percentage of the maximum charge.
--- @field battery_millivolts Property The battery's current voltage, in millivolts.
--- @field plugged_in Property Whether or not the device is currently receiving external power.
local power = {}
return power

@ -0,0 +1,11 @@
--- @meta
--- Properties and functions for inspecting and manipulating the track playback queue
--- @class queue
--- @field position Property The index in the queue of the currently playing track. This may be zero if the queue is empty. Writeable.
--- @field size Property The total number of tracks in the queue, including tracks which have already been played.
--- @field replay Property Whether or not the queue will be restarted after the final track is played. Writeable.
--- @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 = {}
return queue

@ -0,0 +1,13 @@
--- @meta
---@class Property
local property = {}
function property:get() end
function property:set(val) end
--- @param fn function
function property:bind(fn) end
return property

@ -0,0 +1,8 @@
--- @meta
--- @class volume
--- @field current_pct Property
--- @field current_db Property
local volume = {}
return volume

@ -1,15 +0,0 @@
--- Properties for interacting with the audio playback system
-- @module playback
local playback = {}
--- Whether or not any audio is *allowed* to be played. If there is a current track, then this is essentially an indicator of whether playback is paused or unpaused.
--- This value isn't meaningful if there is no current track.
-- @treturn types.Property a boolean property
function playback.playing() end
function playback:track() end
function playback:position() end
return playback

@ -1,18 +0,0 @@
--- Properties and functions that deal with the device's battery and power state
-- @module power
local power = {}
--- battery_pct returns the battery's current charge as a percentage
-- @treturn types.Property an integer property, from 0 to 100
function power.battery_pct() end
--- battery_millivolts returns the battery's current voltage in millivolts
-- @treturn types.Property an integer property, typically from about 3000 to about 4200.
function power.battery_millivolts() end
--- plugged_in returns whether or not the device is currently receiving external power
-- @treturn types.Property a boolean property
function power.plugged_in() end
return power

@ -1,22 +0,0 @@
--- Properties and functions for inspecting and manipulating the track playback queue
-- @module queue
local queue = {}
--- queue.position returns the index in the queue of the currently playing track. This may be zero if the queue is empty.
-- @treturn types.Property a positive integer property, which is a 1-based index
function queue.position() end
--- queue.size returns the total number of tracks in the queue, including tracks which have already been played.
-- @treturn types.Property a positive integer property
function queue.size() end
--- queue.replay determines whether or not the queue will be restarted after the final track is played.
-- @treturn types.Property a writeable boolean property
function queue.replay() end
--- queue.random 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.
-- @treturn types.Property a writeable boolean property
function queue.random() end
return queue

@ -1,14 +0,0 @@
--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
-- @module volume
local volume = {}
--- Returns the current volume as a percentage of the current volume limit.
-- @treturn types.Property an integer property
function volume.current_pct() end
--- Returns the current volume in terms of dB from line level.
-- @treturn types.Property an integer property
function volume.current_db() end
return volume
Loading…
Cancel
Save