Updates
This commit is contained in:
@@ -10,11 +10,14 @@ export async function serveOnSessionBus(daemon) {
|
||||
Arm() { daemon.arm(); }
|
||||
Sleep() { daemon.sleep(); }
|
||||
Shutdown() { daemon.close(); }
|
||||
PushToTalk(pressed) { daemon.emit('PushToTalk', Boolean(pressed)); }
|
||||
Say(text) { return daemon.say?.(text); }
|
||||
Ask(text) { return daemon.ask(text); }
|
||||
Cancel() { daemon.cancel(); }
|
||||
SetMode(mode) { daemon.mode = mode; daemon.emit('ModeChanged', mode); }
|
||||
GetState() { return daemon.state; }
|
||||
EnrollWake(phrase) { daemon.emit('EnrollWake', String(phrase)); }
|
||||
IngestPath(filePath) { daemon.emit('IngestPath', String(filePath)); }
|
||||
ComputerGrant(persist) { daemon.computerGrant(persist); }
|
||||
ComputerRevoke() { daemon.computerRevoke(); }
|
||||
ComputerStatus() { return JSON.stringify(daemon.computer.status()); }
|
||||
@@ -22,16 +25,28 @@ export async function serveOnSessionBus(daemon) {
|
||||
Reply(text) { this.emit('Reply', String(text)); }
|
||||
Token(text) { this.emit('Token', String(text)); }
|
||||
Error(code, message) { this.emit('Error', String(code), String(message)); }
|
||||
WakeHeard(phrase) { this.emit('WakeHeard', String(phrase)); }
|
||||
PartialTranscript(text) { this.emit('PartialTranscript', String(text)); }
|
||||
FinalTranscript(text) { this.emit('FinalTranscript', String(text)); }
|
||||
SpeakingLevel(rms) { this.emit('SpeakingLevel', Number(rms)); }
|
||||
ListeningLevel(rms) { this.emit('ListeningLevel', Number(rms)); }
|
||||
ChipOffered(id, label, payload) { this.emit('ChipOffered', String(id), String(label), String(payload)); }
|
||||
JobProgress(id, pct, label) { this.emit('JobProgress', String(id), Number(pct), String(label)); }
|
||||
ComputerStep(json) { this.emit('ComputerStep', String(json)); }
|
||||
ComputerHighlight(json) { this.emit('ComputerHighlight', String(json)); }
|
||||
}
|
||||
Interface.configureMembers(Session, {
|
||||
Arm: { inSignature: '', outSignature: '', method: 'Arm' },
|
||||
Sleep: { inSignature: '', outSignature: '', method: 'Sleep' },
|
||||
Shutdown: { inSignature: '', outSignature: '', method: 'Shutdown' },
|
||||
PushToTalk: { inSignature: 'b', outSignature: '', method: 'PushToTalk' },
|
||||
Say: { inSignature: 's', outSignature: '', method: 'Say' },
|
||||
Ask: { inSignature: 's', outSignature: '', method: 'Ask' },
|
||||
Cancel: { inSignature: '', outSignature: '', method: 'Cancel' },
|
||||
SetMode: { inSignature: 's', outSignature: '', method: 'SetMode' },
|
||||
GetState: { inSignature: '', outSignature: 's', method: 'GetState' },
|
||||
EnrollWake: { inSignature: 's', outSignature: '', method: 'EnrollWake' },
|
||||
IngestPath: { inSignature: 's', outSignature: '', method: 'IngestPath' },
|
||||
ComputerGrant: { inSignature: 'b', outSignature: '', method: 'ComputerGrant' },
|
||||
ComputerRevoke: { inSignature: '', outSignature: '', method: 'ComputerRevoke' },
|
||||
ComputerStatus: { inSignature: '', outSignature: 's', method: 'ComputerStatus' },
|
||||
@@ -39,6 +54,15 @@ export async function serveOnSessionBus(daemon) {
|
||||
Reply: { signature: 's', signal: true },
|
||||
Token: { signature: 's', signal: true },
|
||||
Error: { signature: 'ss', signal: true },
|
||||
WakeHeard: { signature: 's', signal: true },
|
||||
PartialTranscript: { signature: 's', signal: true },
|
||||
FinalTranscript: { signature: 's', signal: true },
|
||||
SpeakingLevel: { signature: 'd', signal: true },
|
||||
ListeningLevel: { signature: 'd', signal: true },
|
||||
ChipOffered: { signature: 'sss', signal: true },
|
||||
JobProgress: { signature: 'sds', signal: true },
|
||||
ComputerStep: { signature: 's', signal: true },
|
||||
ComputerHighlight: { signature: 's', signal: true },
|
||||
});
|
||||
const bus = dbus.sessionBus();
|
||||
await bus.requestName(BUS_NAME);
|
||||
@@ -48,6 +72,9 @@ export async function serveOnSessionBus(daemon) {
|
||||
daemon.on('Reply', (reply) => iface.Reply(reply));
|
||||
daemon.on('Token', (token) => iface.Token(token));
|
||||
daemon.on('Error', (code, message) => iface.Error(code, message));
|
||||
for (const signal of ['WakeHeard', 'PartialTranscript', 'FinalTranscript', 'SpeakingLevel', 'ListeningLevel', 'ChipOffered', 'JobProgress', 'ComputerStep', 'ComputerHighlight']) {
|
||||
daemon.on(signal, (...args) => iface[signal](...args));
|
||||
}
|
||||
return bus;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user