# Barry::Controller Class Reference

`#include <controller.h>`

Collaboration diagram for Barry::Controller:

[legend]

List of all members.

## Detailed Description

The main interface class.

This class coordinates the communication to a single handheld. This class also owns the only Usb::Device object the handheld. All other classes reference this one for the low level device object. This class owns the only SocketZero object as well, which is the object that any SocketRoutingQueue is plugged into if constructed that way.

To use this class, use the following steps:

- Probe the USB bus for matching devices with the Probe class
- Create an optional SocketRoutingQueue object and create a read thread for it, or use its default read thread.
- Pass one of the probe results into the Controller constructor to connect to the USB device. Pass the routing queue to the Controller constructor here too, if needed.
- Create the Mode object of your choice. See m_desktop.h and m_serial.h for these mode classes. You pass your controller object into these mode constructors to create the mode.

Definition at line 71 of file controller.h.

## Public Types

enum | ModeType
| Handheld mode type. More...

## Public Member Functions

| Controller (const ProbeResult &device, int default_timeout=USBWRAP_DEFAULT_TIMEOUT)
| Constructor for the Controller class.
| Controller (const ProbeResult &device, SocketRoutingQueue &queue, int default_timeout=USBWRAP_DEFAULT_TIMEOUT)
| Constructor for the Controller class.

## Friends

class | Barry::Mode::Mode
class | Barry::Mode::JavaLoader
class | Barry::Mode::JVMDebug
class | Barry::Mode::RawChannel

## Member Enumeration Documentation

enum Barry::Controller::ModeType

Handheld mode type.

Definition at line 82 of file controller.h.

## Constructor & Destructor Documentation

Barry::Controller::Controller | ( | const ProbeResult & | device,
|  | int | default_timeout = `USBWRAP_DEFAULT_TIMEOUT` |
| ) |  |  | `[explicit]`

Constructor for the Controller class.

Requires a valid ProbeResult object to find the USB device to talk to.

Parameters:

  `[in]` | device | One of the ProbeResult objects from the Probe class.
  `[in]` | default_timeout | Override Usb::Device's default timeout

Definition at line 47 of file controller.cc.

Barry::Controller::Controller | ( | const ProbeResult & | device,
|  | SocketRoutingQueue & | queue,
|  | int | default_timeout = `USBWRAP_DEFAULT_TIMEOUT` |
| ) |  |  |

Constructor for the Controller class.

Requires a valid ProbeResult object to find the USB device to talk to.

Parameters:

  `[in]` | device | One of the ProbeResult objects from the Probe class.
  `[in]` | queue | Plugin router object for reading data from sockets.
  `[in]` | default_timeout | Override Usb::Device's default timeout

Definition at line 72 of file controller.cc.

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

- controller.h
- controller.cc