ALTabletService API

NAOqi Core - Overview | API


Namespace : AL

Methods

Web view

void ALTabletService::cleanWebview()

Clean the web browser.

bool ALTabletService::hideWebview()

Hide the webview on the tablet, the idle screen appears instead.

Returns:True if successful, false otherwise.
bool ALTabletService::loadApplication(const std::string& name)

Start new application on tablet.

Parameters:
  • name – Name of application. It must have a index.html to load.
Returns:

True if successful, false if the application is not found or unreachable.

bool ALTabletService::loadUrl(const std::string& url)

Load an URL in the browser of the tablet. Warning: you need to call ALTabletService::showWebview() to display the browser.

Parameters:
  • url – Url of the page to display.
Returns:

True if successful, false if the URL is not found or unreachable.

bool ALTabletService::showWebview()

Display the webview on the tablet.

Returns:True if successful, false otherwise.

Video Player

int ALTabletService::getVideoLength()

Get video length in milliseconds.

Returns:-1 on error.
int ALTabletService::getVideoPosition()

Get the time elapsed since the beginning of the video in milliseconds.

Returns:-1 if no video is played, a positive number otherwise.
bool ALTabletService::pauseVideo()

Pause the video playing but do not close the video player. Can be resumed by ALTabletService::resumeVideo().

Returns:True if video is playing, false otherwise.
bool ALTabletService::playVideo(const std::string& url)

Open a video player on tablet and play video from given url. Supported formats is: mp4 or mov. Can be stopped by ALTabletService::stopVideo().

Parameters:
  • url – URL of the video to play.
Returns:

True if video is playing, false otherwise.

void ALTabletService::resumeVideo()

Resume the video paused by ALTabletService::pauseVideo().

Returns:True if video is playing, false otherwise.
bool ALTabletService::stopVideo()

Close the video player.

Returns:True if video player is open, false otherwise.

Image

void ALTabletService::hideImage()

Hide image currently displayed.

void ALTabletService::pauseGif()

Pause current gif displayed.

bool ALTabletService::preLoadImage(const std::string& url)

Pre-load an image. Use the same URL for showImage.

Parameters:
  • url – URL of the image to pre-load.
Returns:

True if pre-load succeed, false if it cannot ping the URL or if it is not a image.

void ALTabletService::resumeGif()

Resume current gif displayed.

Returns:True if gif is playing, false otherwise.
void ALTabletService::setBackgroundColor(const std::string& color)

Set image background color.

Parameters:
  • color – hexadecimal color code, from “#000000” to “#FFFFFF”.
bool ALTabletService::showImage(const std::string& url)

Show an image, using the cache. Download the image before displaying it, unless the picture is already in the cache, because it has been preloaded or already displayed.

Parameters:
  • url – url of the image to display.
Returns:

true if show succeed, false if it can’t ping the URL or if it’s not a image.

Dialog

void ALTabletService::showAlertView(const float& radius, const std::string& color, const int& delay)

Show an alert view.

Parameters:
  • radius – radius of the 3 displayed points
  • color – hexadecimal color code, from “#000000” to “#FFFFFF”.
  • delay – refresh time.
void ALTabletService::showInputDialog(const std::string& type, const std::string& title, const std::string& ok, const std::string& cancel)

Show a native input text dialog.

Parameters:
  • type – Type among: “text”, “password”, “email”, “url”, “number”.
  • title – Title of the box (could be just a title or a question).
  • ok – text of the OK button.
  • cancel – text of the Cancel button.
void ALTabletService::showInputTextDialog(const std::string& title, const std::string& ok, const std::string& cancel)

Show a native input text dialog.

Parameters:
  • title – Title of the box (could be just a title or a question).
  • ok – text of the OK button.
  • cancel – text of the Cancel button.

Wifi

bool ALTabletService::configureWifi(const std::string& security, const std::string& ssid, const std::string& key)

Configure the WiFi.

Parameters:
  • security – among (wep, wpa, open)
  • ssid – network name
  • key – encryption key (for wep or wpa only).
void ALTabletService::disableWifi()

Disable the wifi.

void ALTabletService::enableWifi()

Enable the wifi.

bool ALTabletService::forgetWifi(const std::string& ssid)

Forget a wifi network.

Parameters:
  • ssid – ssid of the network to forget.
Returns:

true if it find the network and succeed to forget it.

std::string ALTabletService::getWifiStatus()

Check WiFi status on the tablet.

Returns:IDLE, SCANNING, DISCONNECTED, or CONNECTED.

System

float ALTabletService::getBrightness()

Get the tablet brightness.

Returns:a float between 0 and 1.
std::string ALTabletService::getCurrentLifeActivity()

Get the name of the current life activity running.

Returns:the name of the current life activity running or “” if there isn’t.
void ALTabletService::hide()

Hide view currently displayed (video, image, web, alert ...).

void ALTabletService::resetToDefaultValue()

reset view to default values.

std::string ALTabletService::robotIp()
Returns:Current robot IP.
bool ALTabletService::setBrightness(float newBrightness)

Set tablet brightness.

Parameters:
  • newBrightness – New brightness value. Must be between 0 (exclusive) and 1.
Returns:

True if successful, false otherwise.

bool ALTabletService::setTabletLanguage(const std::string& language)

Set the tablet language.

Parameters:
  • language – language - like fr, en, ja.
bool ALTabletService::setVolume(const int& volume)

Configure the media volume of the tablet.

Parameters:
  • volume – a positive integer between 0 and 15.
Returns:

true if it’s work false otherwise, if the volume isn’t in the proper range.

std::string ALTabletService::version()

Return the tablet browser version.

Deprecated

void ALTabletService::postEventToApplication()

Deprecated since version 2.0.2: Deprecated and removed. Do not use anymore.

Forward given signal to current web application.

std::string ALTabletService::getLastVideoErrorLog()

Deprecated since version 2.0.1: use ALTabletService/error() instead.

Signals

Tactile screen

ALTabletService::onTouchDown(const float& x, const float& y)
Triggered :

When someone When someone touches the tablet screen.

Parameters:
  • x – Abscissa of touched point.
  • y – Ordinate of touched point.
ALTabletService::onTouchMove(const float& x, const float& y)
Triggered :

When someone moves its finger on the tablet screen.

Parameters:
  • x – Abscissa of touched point.
  • y – Ordinate of touched point.
ALTabletService::onTouchUp(const float& x, const float& y)
Triggered :

When someone removes its finger from the tablet screen.

Parameters:
  • x – Abscissa of touched point.
  • y – Ordinate of touched point.
ALTabletService::onTouch(const float& x, const float& y)

Deprecated since version 2.0.2: use more specific events instead.

Parameters:
  • x – Abscissa of touched point.
  • y – Ordinate of touched point.

Other

ALTabletService::onConsoleMessage(const std::string& message)
Purpose :

View JavaScript console message written by web applications loaded on tablet.

Tip: in command line, use: qicli watch ALTabletService.onConsoleMessage.

Parameters:
  • message – Content of message.
Triggered :

By web applications.

ALTabletService::onImageLoaded()
Triggered :When an image is pre-loaded.
ALTabletService::onInputText(const int& validation, const std::string& input)
Triggered :

When ALTabletService::showInputDialog() or ALTabletService::showInputTextDialog() returns a text.

Parameters:
  • validation – Button clicked by the user: 1 means ‘OK’, 0 means ‘Cancel’.
  • input – input entered by user.
ALTabletService::onPageFinished()
Triggered :When page upload is finished.
ALTabletService::onPageStarted()
Triggered :When page upload is started.
ALTabletService::videoFinished()
Purpose :Warn NAOqi modules that displayed video is finished.
Triggered :When video started by ALTabletService::playVideo() is finished.
ALTabletService::videoStarted()
Purpose :Warn NAOqi modules that displayed video is started.
Triggered :When video started by ALTabletService::playVideo() is started.

Events

Event: "ALTabletService/error"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when an error occurs.

Event: "ALTabletService/message"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when message occurs.

Event: "ALTabletService/onInputText"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when text input occurs.