registry: Speaker, StepSpeaker, EqualizerController, PlaybackController, PlaybackStateReporter, InputController, ChannelController
Seven descriptors written from their pages replace seven stubs. All are version 3; 1.5.2 announced Speaker, StepSpeaker, EqualizerController and PlaybackStateReporter as version 1, and all but ChannelController without a property. StepSpeaker has no properties object in discovery and PlaybackController one without fields, next to supportedOperations; a directive for an operation the device did not list is answered with INVALID_DIRECTIVE. The equalizer declares bands, modes or both under "configurations", a TV its inputs from the 61 names of the page. Not described: the lineup of ChannelController, whose discovery example the page folds away. The discovery examples of InputController spell one key "friendNames"; the fixtures have friendlyNames, as its table does. 62 examples of the six pages are saved as fixtures. 241 tests pass, 215 before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
c59cf3ff10
commit
d7dfc5b122
113 changed files with 3948 additions and 47 deletions
43
dist/esm/registry/interfaces/PlaybackController.js
vendored
Normal file
43
dist/esm/registry/interfaces/PlaybackController.js
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { s } from "../schema.js";
|
||||
import { defineInterface } from "../types.js";
|
||||
// In the order of the discovery example
|
||||
const OPERATIONS = ["Play", "Pause", "Stop", "Next", "Previous", "FastForward", "Rewind", "StartOver"];
|
||||
// Alexa sends the operations the capability lists
|
||||
const operation = (name) => ({
|
||||
name,
|
||||
payload: s.object({}),
|
||||
when: ({ options }) => (options.supportedOperations ?? OPERATIONS).includes(name),
|
||||
});
|
||||
/**
|
||||
* Play, pause and the other buttons of a player. The interface reports nothing: what plays is the playbackState of
|
||||
* Alexa.PlaybackStateReporter, which a Response to these directives has in its context. Errors of a video device go
|
||||
* under Alexa.Video, the others under Alexa.
|
||||
*/
|
||||
export const PlaybackController = defineInterface({
|
||||
namespace: "Alexa.PlaybackController",
|
||||
version: "3",
|
||||
doc: "https://developer.amazon.com/docs/alexaplus/device-apis/alexa-playbackcontroller.html",
|
||||
kind: "controller",
|
||||
tier: 2,
|
||||
instanced: false,
|
||||
properties: {},
|
||||
directives: {
|
||||
Play: operation("Play"),
|
||||
Pause: operation("Pause"),
|
||||
Stop: operation("Stop"),
|
||||
Next: operation("Next"),
|
||||
Previous: operation("Previous"),
|
||||
FastForward: operation("FastForward"),
|
||||
Rewind: operation("Rewind"),
|
||||
StartOver: operation("StartOver"),
|
||||
},
|
||||
options: s.object({
|
||||
/** Default: all eight. */
|
||||
supportedOperations: s.optional(s.array(s.enum(...OPERATIONS), { min: 1 })),
|
||||
}, { unknownKeys: "reject" }),
|
||||
// The example has a properties object without fields, which topLevel puts where properties: false left none
|
||||
discovery: ({ options: { supportedOperations = [...OPERATIONS] } }) => ({
|
||||
properties: false,
|
||||
topLevel: { properties: {}, supportedOperations },
|
||||
}),
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue