# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALTabletService API

NAOqi Core - Overview | API

Namespace : AL

## Method list

Has the following methods:

class `ALTabletService`

Web view

- `ALTabletService::cleanWebview`
- `ALTabletService::executeJS`
- `ALTabletService::getOnTouchScaleFactor`
- `ALTabletService::hideWebview`
- `ALTabletService::loadApplication`
- `ALTabletService::loadUrl`
- `ALTabletService::reloadPage`
- `ALTabletService::setOnTouchWebviewScaleFactor`
- `ALTabletService::showWebview`

Video Player

- `ALTabletService::getVideoLength`
- `ALTabletService::getVideoPosition`
- `ALTabletService::pauseVideo`
- `ALTabletService::playVideo`
- `ALTabletService::resumeVideo`
- `ALTabletService::stopVideo`

Image

- `ALTabletService::hideImage`
- `ALTabletService::pauseGif`
- `ALTabletService::preLoadImage`
- `ALTabletService::resumeGif`
- `ALTabletService::setBackgroundColor`
- `ALTabletService::showImage`
- `ALTabletService::showImageNoCache`

Dialog

- `ALTabletService::hideDialog`
- `ALTabletService::showAlertView`
- `ALTabletService::showInputDialog`
- `ALTabletService::showInputTextDialog`

Wifi

- `ALTabletService::configureWifi`
- `ALTabletService::connectWifi`
- `ALTabletService::disableWifi`
- `ALTabletService::disconnectWifi`
- `ALTabletService::enableWifi`
- `ALTabletService::forgetWifi`
- `ALTabletService::getWifiStatus`

System

- `ALTabletService::getBrightness`
- `ALTabletService::getAvailableKeyboards`
- `ALTabletService::getWifiMacAddress`
- `ALTabletService::goToSleep`
- `ALTabletService::hide`
- `ALTabletService::resetTablet`
- `ALTabletService::robotIp`
- `ALTabletService::setBrightness`
- `ALTabletService::setKeyboard`
- `ALTabletService::setVolume`
- `ALTabletService::turnScreenOn`
- `ALTabletService::version`
- `ALTabletService::wakeUp`

Deprecated

- `ALTabletService::getLastVideoErrorLog`
- `ALTabletService::getCurrentLifeActivity`
- `ALTabletService::postEventToApplication`
- `ALTabletService::resetToDefaultValue`
- `ALTabletService::setTabletLanguage`

## Signal list

Tactile screen

- `ALTabletService::onTouchDown`
- `ALTabletService::onTouchDownRatio`
- `ALTabletService::onTouchMove`
- `ALTabletService::onTouchUp`

Web view

- `ALTabletService::onConsoleMessage`
- `ALTabletService::onJSEvent`
- `ALTabletService::onPageFinished`
- `ALTabletService::onPageStarted`

Video Player

- `ALTabletService::videoFinished`
- `ALTabletService::videoStarted`

Other

- `ALTabletService::onImageLoaded`
- `ALTabletService::onInputText`
- `ALTabletService::onLoadPageError`
- `ALTabletService::onWifiStatusChange`

## Event list

- `ALTabletService/error()`
- `ALTabletService/message()`
- `ALTabletService/onInputText()`

## Methods

Web view

void `ALTabletService::``cleanWebview`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Clean the web browser.

void `ALTabletService::``executeJS`(const std::string& script)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Execute javascript on the web browser.

  Parameters: | script – Script to execute

  `altabletservice_executejs.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use executeJS Method"""

      import qi
      import argparse
      import sys
      import time

      def main(session):
          """
          This example uses the executeJS method.
          To Test ALTabletService, you need to run the script ON the robot.
          """
          # Get the service ALTabletService.
          tabletService = session.service("ALTabletService")

          try:
              # Display a local web page located in boot-config/html folder
              # The ip of the robot from the tablet is 198.18.0.1
              tabletService.showWebview("http://198.18.0.1/apps/boot-config/preloading_dialog.html")

              time.sleep(3)

              # Javascript script for displaying a prompt
              # ALTabletBinding is a javascript binding inject in the web page displayed on the tablet
              script = """
                  var name = prompt("Please enter your name", "Harry Pepper");
                  ALTabletBinding.raiseEvent(name)
              """

              # Don't forget to disconnect the signal at the end
              signalID = 0

              # function called when the signal onJSEvent is triggered
              # by the javascript function ALTabletBinding.raiseEvent(name)
              def callback(event):
                  print "your name is:", event
                  promise.setValue(True)

              promise = qi.Promise()

              # attach the callback function to onJSEvent signal
              signalID = tabletService.onJSEvent.connect(callback)

              # inject and execute the javascript in the current web page displayed
              tabletService.executeJS(script)

              try:
                  promise.future().hasValue(30000)
              except RuntimeError:
                  raise RuntimeError('Timeout: no signal triggered')

          except Exception, e:
              print "Error was:", e

          # Hide the web view
          tabletService.hideWebview()
          # disconnect the signal
          tabletService.onJSEvent.disconnect(signalID)

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

float `ALTabletService::``getOnTouchScaleFactor`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Get the touch scale factor of current view displayed. Default is 1.0 for all views except for the browser view which is 1.34 .

  Returns: | the scale factor.

bool `ALTabletService::``hideWebview`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

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

  Returns: | True if successful, false otherwise.

bool `ALTabletService::``loadApplication`(const std::string& name)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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.

  `altabletservice_loadapplication.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use loadApplication Method"""

      import qi
      import argparse
      import sys
      import time

      def main(session):
          """
          This example uses the loadApplication method.
          To Test ALTabletService, you need to run the script ON the robot.
          """
          # Get the service ALTabletService.

          try:
              tabletService = session.service("ALTabletService")

              # Display the index.html page of a behavior name j-tablet-browser
              # The index.html must be in a folder html in the behavior folder
              tabletService.loadApplication("j-tablet-browser")
              tabletService.showWebview()

              time.sleep(3)

              # Hide the web view
              tabletService.hideWebview()
          except Exception, e:
              print "Error was: ", e

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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.

void `ALTabletService::``reloadPage`(bool bypassCache)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Reload the current displayed web page.

  Parameters: | bypassCache – set to true in order to reload the current page by bypassing the local web cache.

void `ALTabletService::``setOnTouchWebviewScaleFactor`(float scaleFactor)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Set the touch scale factor of the webview. Default is 1.34 so the touch viewport is 1707 × 1067. If set to 1, the touch view port will be 1280x800.

  Parameters: | scaleFactor – scale factor to set.

bool `ALTabletService::``showWebview`()

  There are two overloads of this function:

  - ALTabletService::showWebview
  - ALTabletService::showWebview with the url

  > Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  > Display the webview on the tablet.

  > Warning

  > Tablet screen density may vary without notice. This has an impact on browser display resolution.

  > Make sure your application remains compatible: create and use responsive content!

  > For further details, see: Browser display resolution troubleshooting.

  > return: | True if successful, false otherwise.

bool `ALTabletService::``showWebview`(const std::string& url)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Display the webview on the tablet and load the url.

  Warning

  Tablet screen density may vary without notice. This has an impact on browser display resolution.

  Make sure your application remains compatible: create and use responsive content!

  For further details, see: Browser display resolution troubleshooting.

  param url: | Url of the page to display.
  return: | True if succeed to load the url, false if the url is not found or unreachable.

  `altabletservice_showwebview.py`

    #! /usr/bin/env python
    # -*- encoding: UTF-8 -*-

    """Example: Use showWebview Method"""

    import qi
    import argparse
    import sys
    import time

    def main(session):
        """
        This example uses the showWebview method.
        To Test ALTabletService, you need to run the script ON the robot.
        """
        # Get the service ALTabletService.

        try:
            tabletService = session.service("ALTabletService")

            # Ensure that the tablet wifi is enable
            tabletService.enableWifi()

            # Display a web page on the tablet
            tabletService.showWebview("http://www.google.com")

            time.sleep(3)

            # Display a local web page located in boot-config/html folder
            # The ip of the robot from the tablet is 198.18.0.1
            tabletService.showWebview("http://198.18.0.1/apps/boot-config/preloading_dialog.html")

            time.sleep(3)

            # Hide the web view
            tabletService.hideWebview()
        except Exception, e:
            print "Error was: ", e

    if __name__ == "__main__":
        parser = argparse.ArgumentParser()
        parser.add_argument("--ip", type=str, default="127.0.0.1",
                            help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
        parser.add_argument("--port", type=int, default=9559,
                            help="Naoqi port number")

        args = parser.parse_args()
        session = qi.Session()
        try:
            session.connect("tcp://" + args.ip + ":" + str(args.port))
        except RuntimeError:
            print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                   "Please check your script arguments. Run with -h option for help.")
            sys.exit(1)
        main(session)

Video Player

int `ALTabletService::``getVideoLength`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Get video length in milliseconds.

  Returns: | -1 on error.

int `ALTabletService::``getVideoPosition`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Open a video player on tablet and play video from given url. Recommend format is mp4 container, video codec H.264, audio codec AAC For further details see: pepper-tablet.

  Can be stopped by `ALTabletService::stopVideo`.

  Parameters: | url – URL of the video to play.
  Returns: | True if video is playing, false otherwise.

  `altabletservice_playvideo.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use playVideo Method"""

      import qi
      import argparse
      import sys
      import time

      def main(session):
          """
          This example uses the playVideo method.
          To Test ALTabletService, you need to run the script ON the robot.
          """
          # Get the service ALTabletService.

          try:
              tabletService = session.service("ALTabletService")

              # Ensure that the tablet wifi is enable
              tabletService.enableWifi()

              # Play a video from the web and display the player
              # If you want to play a local video, the ip of the robot from the tablet is 198.18.0.1
              # Put the video in the HTML folder of your behavior
              # "http://198.18.0.1/apps/my_behavior/my_video.mp4"
              tabletService.playVideo("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")

              time.sleep(3)

              # Display the time elapse / the total time of the video
              print tabletService.getVideoPosition(), " / ", tabletService.getVideoLength()

              # Pause the video
              tabletService.pauseVideo()

              time.sleep(3)

              # resume the video
              tabletService.resumeVideo()

              time.sleep(3)

              # stop the video and hide the player
              tabletService.stopVideo()
          except Exception, e:
              print "Error was: ", e

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTabletService::``resumeVideo`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Resume the video paused by `ALTabletService::pauseVideo`.

  Returns: | True if video is playing, false otherwise.

bool `ALTabletService::``stopVideo`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Close the video player.

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

Image

void `ALTabletService::``hideImage`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Hide image currently displayed.

void `ALTabletService::``pauseGif`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Pause current gif displayed.

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Resume current gif displayed.

  Returns: | True if gif is playing, false otherwise.

void `ALTabletService::``setBackgroundColor`(const std::string& color)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Set image background color.

  Parameters: | color – hexadecimal color code, from “#000000” to “#FFFFFF”.

bool `ALTabletService::``showImage`(const std::string& url)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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.

  `altabletservice_showimage.py`

    #! /usr/bin/env python
    # -*- encoding: UTF-8 -*-

    """Example: Use showImage Method"""

    import qi
    import argparse
    import sys
    import time

    def main(session):
        """
        This example uses the showImage method.
        To Test ALTabletService, you need to run the script ON the robot.
        """
        # Get the service ALTabletService.

        try:
            tabletService = session.service("ALTabletService")

            # Display a local image located in img folder in the root of the web server
            # The ip of the robot from the tablet is 198.18.0.1
            tabletService.showImage("http://198.18.0.1/img/help_charger.png")

            time.sleep(3)

            # Hide the web view
            tabletService.hideImage()
        except Exception, e:
            print "Error was: ", e

    if __name__ == "__main__":
        parser = argparse.ArgumentParser()
        parser.add_argument("--ip", type=str, default="127.0.0.1",
                            help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
        parser.add_argument("--port", type=int, default=9559,
                            help="Naoqi port number")

        args = parser.parse_args()
        session = qi.Session()
        try:
            session.connect("tcp://" + args.ip + ":" + str(args.port))
        except RuntimeError:
            print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                   "Please check your script arguments. Run with -h option for help.")
            sys.exit(1)
        main(session)

bool `ALTabletService::``showImageNoCache`(const std::string& url)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Show an image, without using the cache. Download the image before displaying it.

  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::``hideDialog`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Hide the dialog view.

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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)

  There are two overloads of this function:

  - ALTabletService::showInputDialog
  - ALTabletService::showInputDialog with a pre-filled value and a limit of characters

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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::``showInputDialog`(const std::string& type, const std::string& title, const std::string& ok, const std::string& cancel)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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. value – pre-filled text of the input field. limit – Limit of characters that can be input.

void `ALTabletService::``showInputTextDialog`(const std::string& title, const std::string& ok, const std::string& cancel)

  There are two overloads of this function:

  - ALTabletService::showInputTextDialog
  - ALTabletService::showInputTextDialog with a pre-filled value and a limit of characters

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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.

void `ALTabletService::``showInputTextDialog`(const std::string& title, const std::string& ok, const std::string& cancel, const std::string& value, const int& limit)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Show a native input text dialog with a pre-filled input.

  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. value – pre-filled text of the input field. limit – Limit of characters that can be input.

Wifi

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Configure the WiFi.

  Parameters: | security – among (wep, wpa, open) ssid – network name key – encryption key (for wep or wpa only).
  Returns: | true if this configuration is valid

bool `ALTabletService::``connectWifi`(const std::string& ssid)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Connect to a known wifi.

  Parameters: | ssid – network name
  Returns: | True if connection was established successfully, False otherwise.

void `ALTabletService::``disableWifi`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Disable the wifi.

bool `ALTabletService::``disconnectWifi`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Disconnect current connected wifi.

  Returns: | true if it succeed to disconnect, false otherwise

void `ALTabletService::``enableWifi`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Enable the wifi.

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  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`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Check WiFi status on the tablet.

  Returns: | IDLE, SCANNING, DISCONNECTED, or CONNECTED.

System

float `ALTabletService::``getBrightness`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Get the tablet brightness.

  Returns: | a float between 0 and 1.

std::vector<std::string> `ALTabletService::``getAvailableKeyboards`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Get the list of available keyboards installed on the tablet.

  Returns: | a list of keyboard IDs

std::string `ALTabletService::``getWifiMacAddress`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Get the wifi mac address

  Returns: | the wifi mac address

void `ALTabletService::``goToSleep`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Put the tablet in sleep mode (standby mode).

void `ALTabletService::``hide`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

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

void `ALTabletService::``resetTablet`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Reset the tablet as if no one used it before, i.e. clean the stack of activities, the web browser content, and the web browser cache.

std::string `ALTabletService::``robotIp`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Returns: | Current robot IP.

bool `ALTabletService::``setBrightness`(float newBrightness)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Set tablet brightness.

  Parameters: | newBrightness – New brightness value. Must be between 0 (exclusive) and 1.
  Returns: | True if successful, false otherwise.

bool `ALTabletService::``setKeyboard`(const std::string& keyboardID)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Set the tablet keyboard.

  Parameters: | keyboardID – ID of the keyboard to use. Get the list from `ALTabletService::getAvailableKeyboards`
  Returns: | True if the change succeed, false otherwise.

bool `ALTabletService::``setTabletLanguage`(const std::string& locale)

  Deprecated since version 2.7: Does nothing.

  The tablet’s language is now handled in Android’s settings screen. There is no API to change it.

bool `ALTabletService::``setVolume`(const int& volume)

  Deprecated since version 2.7.1: Does nothing.

  Configure the media volume of the tablet.

  Parameters: | volume – a positive integer between 0 and 15.
  Returns: | always false.

void `ALTabletService::``turnScreenOn`(const bool& isOn)

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Turn on/off the tablet screen.

  Parameters: | isOn – true to turn on the screen, false to turn it off.

std::string `ALTabletService::``version`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Returns: | the tablet browser version.

void `ALTabletService::``wakeUp`()

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Wake the tablet (from standby mode).

## Signals

Tactile screen

qi::Signal<float, float> `ALTabletService::``onTouchDown`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when someone touches the tablet screen. Does not work when a video or an image activity is running on the tablet.

  - float x: Abscissa of touched point.
  - float y: Ordinate of touched point.

  `altabletservice_ontouchdown.py`

    #! /usr/bin/env python
    # -*- encoding: UTF-8 -*-

    """Example: Use onTouchDown Method"""

    import qi
    import argparse
    import sys

    def main(app):
        """
        This example uses the onTouchDown method.
        To Test ALTabletService, you need to run the script ON the robot.
        """
        # Get the service ALTabletService.

        try:
            session = app.session
            tabletService = session.service("ALTabletService")

            # Don't forget to disconnect the signal at the end
            signalID = 0

            # function called when the signal onTouchDown is triggered
            def callback(x, y):
                print "coordinate are x: ", x, " y: ", y
                if x > 640:
                    # disconnect the signal
                    tabletService.onTouchDown.disconnect(signalID)
                    app.stop()

            # attach the callback function to onJSEvent signal
            signalID = tabletService.onTouchDown.connect(callback)
            app.run()
        except Exception, e:
            print "Error was: ", e

    if __name__ == "__main__":
        parser = argparse.ArgumentParser()
        parser.add_argument("--ip", type=str, default="127.0.0.1",
                            help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
        parser.add_argument("--port", type=int, default=9559,
                            help="Naoqi port number")

        args = parser.parse_args()
        try:
            connection_url = "tcp://" + args.ip + ":" + str(args.port)
            app = qi.Application(["TabletModule", "--qi-url=" + connection_url])
            app.start()
        except RuntimeError:
            print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                   "Please check your script arguments. Run with -h option for help.")
            sys.exit(1)
        main(app)

qi::Signal<float, float, std::string> `ALTabletService::``onTouchDownRatio`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when someone touches the tablet screen.

  - float x: Abscissa ratio of touched point between 0 and 1.0 .
  - float y: Ordinate ratio of touched point between 0 and 1.0 .
  - std::string viewTouched: Name of the view touched among AlertActivity, BootActivity, GifActivity, ImageActivity, OpenGLActivity, BrowserActivity or VideoActivity .

qi::Signal<float, float> `ALTabletService::``onTouchMove`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when someone moves its finger on the tablet screen.

  - float x: Abscissa of touched point.
  - float y: Ordinate of touched point.

qi::Signal<float, float> `ALTabletService::``onTouchUp`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when someone removes its finger from the tablet screen.

  - float x: Abscissa of touched point.
  - float y: Ordinate of touched point.

Web view

qi::Signal<std::string> `ALTabletService::``onJSEvent`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent by web applications. Get the event raised by Javascript method raiseEvent or closeWindow

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

  - std::string eventName: Name of the event.

qi::Signal<std::string> `ALTabletService::``onConsoleMessage`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

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

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

  - std::string message: Content of message.

qi::Signal<void> `ALTabletService::``onPageFinished`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when page upload is finished.

qi::Signal<void> `ALTabletService::``onPageStarted`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when page upload is started.

Video Player

qi::Signal<void> `ALTabletService::``videoFinished`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when video started by `ALTabletService::playVideo` is finished. Warn NAOqi modules that displayed video is finished.

qi::Signal<void> `ALTabletService::``videoStarted`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when video started by `ALTabletService::playVideo` is started. Warn NAOqi modules that displayed video is started.

Other

qi::Signal<void> `ALTabletService::``onImageLoaded`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when an image is pre-loaded.

qi::Signal<int, std::string> `ALTabletService::``onInputText`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when `ALTabletService::showInputDialog`
    or `ALTabletService::showInputTextDialog` returns a text.
  - int validation: Button clicked by the user: 1 means ‘OK’, 0 means ‘Cancel’.
  - std::string input: input entered by user.

qi::Signal<int, std::string, std::string> `ALTabletService::``onLoadPageError`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when a web page failed to load.

  - int errorCode: the error id.
  - std::string description: A string describing the error.
  - std::string failingUrl: The url that failed to load.

qi::Signal<std::string> `ALTabletService::``onWifiStatusChange`

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Sent when the tablet WiFi status changes.

  - std::string status: WiFi status among IDLE, SCANNING, DISCONNECTED, CONNECTED

## Events

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Raised when an error occurs.

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Raised when message occurs.

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

  Deprecated since version 2.7.1: Use the Pepper SDK for Android instead.

  Raised when text input occurs.

Glossary Site map Index Support Contact Legal Notices