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

# ALModule API

NAOqi Core - Overview | API

Namespace : AL

    #include <alcommon/almodule.h>

## Bound Method list

Task Management

- `ALModule::isRunning`
- `ALModule::wait`
- `ALModule::stop`
- `ALModule::exit`

Introspection

- `ALModule::getBrokerName`
- `ALModule::getMethodList`
- `ALModule::getMethodHelp`
- `ALModule::getModuleHelp`
- `ALModule::getUsage`
- `ALModule::ping`
- `ALModule::version`

## Event list

- `ClientConnected()`
- `ClientDisconnected()`

## Bound Methods - Task Management

bool `ALModule::``isRunning`(const int& id)

  Determines if the method created with a ‘post’ is still running.

  Parameters: | id – The ID of the method that was returned by ‘post’
  Returns: | true if the method is still running, false otherwise

bool `ALModule::``wait`(const int& id, const int& timeout)

  Waits until the end of a long running method using the ID that was returned from a method started with ‘post’

  Parameters: | id – The ID of the method that was returned by ‘post’ timeout – The wait timeout period in ms. If 0 wait indefinitely.
  Returns: | true if the timeout period expired, false otherwise

qi::FutureSync<void> `ALModule::``wait`(const int& id)

  Waits until the end of a long running method using the ID that was returned from a method started with ‘post’

  Parameters: | id – The ID of the method that was returned by ‘post’
  Returns: | a cancelable future that will call stop(id) upon cancel

void `ALModule::``stop`(const int& id)

  Stops a module’s method using the ID given returned by a ‘post’ call. Module authors are encouraged to implement this if they have long running methods that they wish to allow users to interrupt.

  Parameters: | id – The ID of the method that was returned by ‘post’

void `ALModule::``exit`()

  Unregisters the module from the parent broker. Once this is called the method of your module will no longer be available. Module authors who override this method are expected to perform a clean shutdown.

  Warning

  It is not advised to call exit on Core modules such as ALMemory or ALMotion while other module or code are accessing them.

## Bound Methods - Introspection

std::string `ALModule::``getBrokerName`()

  Gets the name of the parent broker

  Returns: | The name of the parent broker

std::vector<std::string> `ALModule::``getMethodList`()

  Retrieves the module’s method list

  Returns: | A vector of method names

AL::ALValue `ALModule::``getMethodHelp`(const std::string& methodName)

  Retrieves a method’s description

  Parameters: | methodName – The name of the method
  Returns: | A structure containing the method’s description

      [
        std::string methodName,
        [ parameter, ...],
        std::string returnName,
        std::string returnDescription
      ]

      Where parameter is

      [
        std::string parameterName,
        std::string parameterDescription
      ]

AL::ALValue `ALModule::``getModuleHelp`()

  Retrieves a structure containing the module’s description:

  Returns: | A structure describing the module

      [
        std::string moduleDescription,
        [ moduleExample, ...]
      ]

      Where moduleExample is

      [
        std::string language,
        std::string example
      ]

std::string `ALModule::``getUsage`(const std::string& methodName)

  Gets the method usage string. This summarizes how to use the method.

  Parameters: | methodName – The name of the method
  Returns: | A string that summarizes the usage of the method

bool `ALModule::``ping`()

  Just a ping to test connectivity. Always returns true

  Returns: | returns true

std::string `ALModule::``version`()

  Returns the version of the module

  Returns: | The version as a string

## Events

Event: `"ClientConnected"`
callback(std::string eventName, const std::string &brokerName, std::string subscriberIdentifier)

  The broker brokerName is connected.

Event: `"ClientDisconnected"`
callback(std::string eventName, const std::string &brokerName, std::string subscriberIdentifier)

  The broker brokerName has been disconnect.

Glossary Site map Index Support Contact Legal Notices