Skip to content

Platform Abstraction

Robin Wohlers-Reichel edited this page Nov 2, 2018 · 5 revisions

Platform Abstraction

Take Photo

Signature

irs.photo(callback: fn(image))

Parameters

  • callback -> called with either base64EncodedImage or Null as parameter

Listen For Phrase

Signature

irs.listen(triggers: [string], timeout: int, callback: fn(int))

Parameters

  • triggers: an array of words which the system should listen for
  • timeout: the maximum time to wait in milliseconds
  • callback: See below

Callback value

  • 0 to n: listen triggered on the nth word in the 'triggers' array
  • -1: timeout was reached before a trigger word was detected
  • -2: unable to access the microphone
  • -3: unknown error

Say

Signature

irs.say(phrase: string)

Parameters

phrase: The phrase to say

Identify

Signature

irs.identify() -> int

Return value

  • 0 if there is no platform abstraction available
  • 1 if the platform is the robot
  • 2 if the platform is chrome