Aria: ArCameraCollection Class Reference

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArCameraCollection Class Reference

`#include <ArCameraCollection.h>`

List of all members.

## Detailed Description

Maintains information about all of the robot's cameras.

ArCameraCollection is a repository for information about each of the cameras that are installed on the robot. It enables clients to adjust to robots with varying camera configurations.

Three main types of information are maintained for each camera:

- Overview Information: This includes the name and type of the camera, along with text strings suitable for display. Note that each camera must be assigned a unique name. Furthermore, the overview information must be added to the collection before any of the other types of information are added.

- Command Information: Each camera may respond to any number of generic commands (such as pan/tilt/zoom, or get camera picture). The command information defines which commands are supported for each camera, and also defines a unique "camera command name" for each generic command. (The "camera command name", for example, may be used as a network packet name. It must be unique across all of the robot's cameras.) Commands which are commonly supported are defined in ArCameraCommands, but additional ones may be added.

- Parameter Information: Parameters, or settings, may be defined for each camera. A framework has been built into the collection to allow clients to view/edit the parameters. Changes are relayed to the originator (source) of the parameter, which is responsible for actually adjusting the camera hardware.

Callbacks may be installed on the collection to be notified whenever the collection is modified. This notification only occurs when cameras, commands, or parameters are added or removed. (The editing of parameters is merely passed to the parameter source.)

ArCameraCollection is thread-safe.

## Public Member Functions
virtual bool | addCamera (const char *cameraName, const char *cameraType, const char *displayName, const char *displayType)
| Adds a new camera to the collection.
virtual bool | addCameraCommand (const char *cameraName, const char *command, const char *cameraCommandName, int requestInterval=-1)
| Adds the specified command to the camera.
virtual bool | addModifiedCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
| Adds a callback to be invoked when the camera collection has been modified.
virtual bool | addParameter (const char *cameraName, ArCameraParameterSource *source, const ArConfigArg &param)
| Adds the specified parameter to the camera.
| ArCameraCollection ()
| Constructor.
virtual void | endUpdate ()
| Ends an update to the collection.
virtual bool | exists (const char *cameraName, const char *command)
| Returns whether the specified command is defined for a particular camera.
virtual bool | exists (const char *cameraName)
| Returns whether the specified camera is contained in the collection.
virtual void | getCameraCommands (const char *cameraName, std::list< std::string > &outList)
| Returns the generic commands that are supported by the specified camera.
virtual void | getCameraNames (std::list< std::string > &outList)
| Returns the names of the cameras that are in the collection.
virtual const char * | getCameraType (const char *cameraName)
| Returns the type of the specified camera.
virtual const char * | getCommandName (const char *cameraName, const char *command)
| Returns the specific camera command (/ network packet) name for the generic command.
virtual const char * | getDisplayName (const char *cameraName)
| Returns the display name of the specified camera.
virtual const char * | getDisplayType (const char *cameraName)
| Returns the display type of the specified camera.
virtual bool | getParameter (const char *cameraName, const char *parameterName, ArConfigArg &paramOut)
| Returns the specified camera parameter.
virtual void | getParameterNames (const char *cameraName, std::list< std::string > &outList)
| Returns the names of the parameters for the specified camera.
virtual int | getRequestInterval (const char *cameraName, const char *command)
| Returns the default request interval for the specified camera command.
int | lock ()
| Lock the collection.
virtual bool | parameterExists (const char *cameraName, const char *paramName)
| Returns whether the specified parameter has been defined for a particular camera.
virtual bool | removeCamera (const char *cameraName)
| Removes the specified camera from the collection.
virtual bool | removeCameraCommand (const char *cameraName, const char *command)
| Removes the specified command from the camera.
virtual bool | removeModifiedCB (ArFunctor *functor)
| Removes a callback from the modified notification list.
virtual bool | removeParameter (const char *cameraName, const char *paramName)
| Removes the specified parameter from the camera.
virtual bool | setParameter (const char *cameraName, const ArConfigArg &param)
| Updates the specified camera parameter.
virtual void | startUpdate ()
| Starts an update to the collection.
int | tryLock ()
| Try to lock the collection without blocking.
int | unlock ()
| Unlock the collection.
virtual | ~ArCameraCollection ()
| Destructor.
## Protected Member Functions
CameraInfo * | findCameraInfo (const char *cameraName)
| Returns a pointer to the CameraInfo for the specified camera.
CommandInfo * | findCommandInfo (const char *cameraName, const char *commandName)
| Returns a pointer to the CommandInfo for the specified generic command.
ParamInfo * | findParamInfo (const char *cameraName, const char *paramName)
| Returns a pointer to the ParamInfo for the specified parameter.
void | notifyModifiedListeners ()
| Invokes each of the callbacks when the collection has been modified.
void | setModified ()
| Sets an indication that the collection has been modified.
## Protected Attributes
std::map< std::string, CameraInfo * > | myCameraToInfoMap
| Map of camera names to the associated camera information.
bool | myIsModified
| Whether the collection has been modified (since the last notification).
bool | myIsUpdatesEnabled
| Whether updates are currently enabled.
std::list< ArFunctor * > | myModifiedCBList
| List of callbacks to be notified when the collection is modified.
ArMutex | myMutex
| Mutex for multi-threaded access.
## Classes
struct | CameraInfo
| Information regarding a single camera. More...
struct | CommandInfo
| Information regarding a particular camera command. More...
struct | ParamInfo
| Information regarding a particular camera parameter. More...

## Member Function Documentation

virtual bool ArCameraCollection::addCamera | ( | const char * | cameraName,
|  | const char * | cameraType,
|  | const char * | displayName,
|  | const char * | displayType |
| ) |  |  | `[virtual]`

Adds a new camera to the collection.

Parameters:

  | cameraName | the char * name of the camera; must be unique and non-NULL
  | cameraType | the char * type of the camera (e.g. VCC4 or Omni)
  | displayName | the char * string to be displayed for the camera name; if NULL, then the cameraName is used instead
  | displayType | the char * string to be displayed for the camera type; if NULL, then the cameraType is used instead

Returns:
  bool true if the camera was successfully added; false, otherwise.

virtual bool ArCameraCollection::addCameraCommand | ( | const char * | cameraName,
|  | const char * | command,
|  | const char * | cameraCommandName,
|  | int | requestInterval = `-1` |
| ) |  |  | `[virtual]`

Adds the specified command to the camera.

Parameters:

  | cameraName | the char * name of the camera to which the command is to be added. The camera must have already been installed in the collection via the addCamera() method.
  | command | the char * identifier of the command that is being added. Common commands (currently recognized by MobileEyes) are defined in ArCameraCommands.
  | cameraCommandName | the corresponding char * command (i.e. network packet) name that is actually handled by the camera. The cameraCommandName must be non-NULL and unique across all robot cameras.
  | requestInterval | the int number of milliseconds between client requests for repeating commands; if -1, then the command is not repeating.

Returns:
  bool true if the command was successfully added; false if an error occurred.

virtual bool ArCameraCollection::addModifiedCB | ( | ArFunctor * | functor,
|  | ArListPos::Pos | position = `ArListPos::LAST` |
| ) |  |  | `[virtual]`

Adds a callback to be invoked when the camera collection has been modified.

Parameters:

  | functor | the ArFunctor * to be invoked when the collection has been modified; must be non-NULL
  | position | the ArListPos::Pos at which to put the callback (beginning or end)

Returns:
  bool true if the callback was succesfully added; false, otherwise.

virtual bool ArCameraCollection::addParameter | ( | const char * | cameraName,
|  | ArCameraParameterSource * | source,
|  | const ArConfigArg & | param |
| ) |  |  | `[virtual]`

Adds the specified parameter to the camera.

Parameters:

  | cameraName | the char * name of the camera to which the parameter is to be added. The camera must have already been installed in the collection via the addCamera() method.
  | source | the ArCameraParameterSource * that is to be notified when the parameter value is changed; if NULL, then no notification
  | param | the ArConfigArg parameter to be added; the parameter name must be unique for this camera. (Parameter names may be reused across different cameras though.)

Returns:
  bool true if the parameter was successfully added to the camera; false if an error occurred

virtual void ArCameraCollection::endUpdate | ( |  | ) | `[virtual]`

Ends an update to the collection.

A call to startUpdate() must eventually be followed by a call to endUpdate().

virtual void ArCameraCollection::getCameraCommands | ( | const char * | cameraName,
|  | std::list< std::string > & | outList |
| ) |  |  | `[virtual]`

Returns the generic commands that are supported by the specified camera.

Parameters:

  | cameraName | the unique char * name of the camera
  | outList | the std::list<std::string> into which the commands are output; any previous contents of the outList are cleared.

virtual void ArCameraCollection::getCameraNames | ( | std::list< std::string > & | outList | ) | `[virtual]`

Returns the names of the cameras that are in the collection.

Parameters:

  | outList | the std::list<std::string> into which the names are output; any previous contents of the outList are cleared.

virtual const char* ArCameraCollection::getCameraType | ( | const char * | cameraName | ) | `[virtual]`

Returns the type of the specified camera.

Parameters:

  | cameraName | the unique char * name of the camera

Returns:
  char * the type of the specified camera; NULL if the camera was not found in the collection

virtual const char* ArCameraCollection::getCommandName | ( | const char * | cameraName,
|  | const char * | command |
| ) |  |  | `[virtual]`

Returns the specific camera command (/ network packet) name for the generic command.

Parameters:

  | cameraName | the unique char * name of the camera
  | command | the char * name of the generic command to be retrieved

Returns:
  char * the unique command (or network packet) name for the generic command on the specified camera; NULL, if the camera does not support the generic command

virtual const char* ArCameraCollection::getDisplayName | ( | const char * | cameraName | ) | `[virtual]`

Returns the display name of the specified camera.

Parameters:

  | cameraName | the unique char * name of the camera

Returns:
  char * the string to be displayed as the name of the specified camera; NULL if the camera was not found in the collection

virtual const char* ArCameraCollection::getDisplayType | ( | const char * | cameraName | ) | `[virtual]`

Returns the display type of the specified camera.

Parameters:

  | cameraName | the unique char * name of the camera

Returns:
  char * the string to be displayed as the type of the specified camera; NULL if the camera was not found in the collection

virtual bool ArCameraCollection::getParameter | ( | const char * | cameraName,
|  | const char * | parameterName,
|  | ArConfigArg & | paramOut |
| ) |  |  | `[virtual]`

Returns the specified camera parameter.

Parameters:

  | cameraName | the unique char * name of the camera
  | parameterName | the unique char * name of the parameter to be retrieved
  | paramOut | the ArConfigArg into which the parameter is copied

Returns:
  bool true if the parameter was successfully found; false, otherwise.

virtual void ArCameraCollection::getParameterNames | ( | const char * | cameraName,
|  | std::list< std::string > & | outList |
| ) |  |  | `[virtual]`

Returns the names of the parameters for the specified camera.

Parameters:

  | cameraName | the unique char * name of the camera
  | outList | the std::list<std::string> into which the parameter names are output; any previous contents of the outList are cleared.

virtual int ArCameraCollection::getRequestInterval | ( | const char * | cameraName,
|  | const char * | command |
| ) |  |  | `[virtual]`

Returns the default request interval for the specified camera command.

Parameters:

  | cameraName | the unique char * name of the camera
  | command | the char * name of the generic command

Returns:
  int the default number of milliseconds between command requests; if -1, then the command is not for refreshing data

virtual bool ArCameraCollection::removeCamera | ( | const char * | cameraName | ) | `[virtual]`

Removes the specified camera from the collection.

Parameters:

  | cameraName | the char * name of the camera to be removed

Returns:
  bool true if the camera was successfully removed; false, otherwise.

virtual bool ArCameraCollection::removeCameraCommand | ( | const char * | cameraName,
|  | const char * | command |
| ) |  |  | `[virtual]`

Removes the specified command from the camera.

Parameters:

  | cameraName | the char * name of the camera from which the command is to be removed.
  | command | the char * identifier of the command that is being removed.

Returns:
  bool true if the command was successfully removed; false if an error occurred.

virtual bool ArCameraCollection::removeModifiedCB | ( | ArFunctor * | functor | ) | `[virtual]`

Removes a callback from the modified notification list.

Parameters:

  | functor | the ArFunctor * to be removed from the notification list

Returns:
  bool true if the callback was succesfully removed; false, otherwise.

virtual bool ArCameraCollection::removeParameter | ( | const char * | cameraName,
|  | const char * | paramName |
| ) |  |  | `[virtual]`

Removes the specified parameter from the camera.

Parameters:

  | cameraName | the char * name of the camera from which the parameter is to be removed.
  | paramName | the char * name of the parameter to be removed

Returns:
  bool true if the parameter was successfully removed from the camera; false if an error occurred

virtual bool ArCameraCollection::setParameter | ( | const char * | cameraName,
|  | const ArConfigArg & | param |
| ) |  |  | `[virtual]`

Updates the specified camera parameter.

Parameters:

  | cameraName | the unique char * name of the camera
  | param | the ArConfigArg to be set; the parameter must have been previously added to the camera with the addParameter() method

Returns:
  bool true if the parameter was found and set; false, otherwise.

virtual void ArCameraCollection::startUpdate | ( |  | ) | `[virtual]`

Starts an update to the collection.

This method may be used when multiple changes are being made to the collection. While an update is in progress, the modified callbacks will not be invoked. The endUpdate() method should be called after all of the changes are complete (and then the modified callbacks will be invoked).

The documentation for this class was generated from the following file:

- ArCameraCollection.h