OryksaTvFakeBackend class

SIMULATED backend, for tests and demos only. It never calls ORYKSA, never counts interactions and its texts are samples: nothing shown with it proves the real server.

Drive the phone from your test or demo with phoneConnects, phoneSays, phoneLeaves and expire.

Implemented types

Constructors

OryksaTvFakeBackend({String platform = 'android_tv', Uint8List? voice(String text, String locale)?, String chatReply(String message)?, Duration delay = Duration.zero, OryksaTvConfig? fixedConfig})
Creates the simulated backend.

Properties

aiCalls ↔ int
Calls to ai.
getter/setter pair
delay → Duration
Simulated time of each answer.
final
fixedConfig → OryksaTvConfig?
Fixed configuration (null: the sample one for the asked locale).
final
hashCode → int
The hash code for this object.
no setterinherited
platform → String
The value sent as platform (for example fire_tv).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sentMessages → List<String>
Messages sent with chat.
final
speakCalls ↔ int
Calls to speak (each one is charged on the real server).
getter/setter pair
speakRequests → List<({String? cachedRev, String text, bool voice})>
What each speak asked: the text, whether a voice was wanted, and the voice revision of a line the device already had.
final
unpaired → List<String>
Pairings ended with unpair.
final
voice → Uint8List? Function(String text, String locale)?
MP3 for a text, or null.
final

Methods

ai({String? instructions, String? input, Map<String, dynamic>? schema}) → Future<OryksaAiResult>
An AI task of your app (client.ai), counted as ORYKSA interactions.
override
chat(String message, {required String locale, OryksaAppContext? appContext, bool voice = false}) → Future<OryksaReply>
Sends a message to the AI and waits for the reply (the assistant panel).
override
config(String locale) → Future<OryksaTvConfig>
The TV configuration for locale (texts, presenter, rules). The server picks the supported locale and says which in OryksaTvConfig.locale.
override
expire() → void
The code expired.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pair(String locale) → Future<OryksaPairing>
Starts pairing a phone: the QR and the code to show.
override
phoneConnects() → void
The phone opened the page.
phoneEvents(String pairId, {int after = 0, Duration wait = const Duration(seconds: 25)}) → Future<OryksaPhoneEventsPage>
Waits up to wait for phone events newer than after (long-poll).
override
phoneLeaves() → void
The phone closed the page.
phoneSays(String text) → void
The person said text on the phone (a listening then a text event).
speak(String text, {required String locale, bool whisper = false, bool voice = true, String? cachedRev}) → Future<OryksaTvSpeech?>
The presenter's line text in locale, charged each time by the ORYKSA interaction cost table (OryksaTvSpeech.interactionsSpent; a line not counted is not shown). voice false: subtitles only, no voice wanted. cachedRev: the device already has this line with that voice revision, so the server may only count it and send no voice. The bytes may be empty (subtitles only). Null when the server gave nothing for it. Throws on other errors.
override
toString() → String
A string representation of this object.
inherited
unpair(String pairId) → Future<void>
Ends the pairing.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

pairIdOf(int n) → String
The pair id of the n-th simulated pairing (1-based): tvp_ and 12 hex, as the server.
resolveLocale(String requested) → String
The locale the real server would choose for requested (the same rule as the approved voice table: the 8 locales, the rest English of the USA).
sampleTextsFor(String locale) → Map<String, String>
The sample texts for a supported locale (resolveLocale): pt-BR, pt-PT, otherwise English.

Constants

codes → const List<String>
Codes of the simulated pairings, in order (the real alphabet: no I, O, 0 or 1).
sampleTexts → const Map<String, Map<String, String>>
Sample texts (English, and Portuguese of Brazil and of Portugal, never mixed): the real ones come from the server. Other languages use English, the only fallback language.