class NotificationLEDApp extends AppServer {
protected async onSession(session: AppSession, sessionId: string, userId: string): Promise<void> {
if (!session.capabilities?.hasLight) {
session.layouts.showTextWall("No LED support - notifications via display only");
return;
}
// Listen for events and provide LED feedback
session.events.onTranscription(async (data) => {
if (data.isFinal) {
await this.handleNotification(session, data.text);
}
});
}
private async handleNotification(session: AppSession, text: string): Promise<void> {
if (text.toLowerCase().includes('urgent')) {
await session.led.blink('red', 200, 200, 5);
} else if (text.toLowerCase().includes('success')) {
await session.led.blink('green', 500, 500, 2);
} else {
await session.led.blink('blue', 300, 300, 1);
}
}
}