SaX::SaXManipulateDevices Class Reference

SaX2 - Device manipulator class. More...

#include <device.h>

Inheritance diagram for SaX::SaXManipulateDevices:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int addDesktopDevice (void)
int addInputDevice (const char *)
int removeDesktopDevice (int)
int removeInputDevice (int)
 SaXManipulateDevices (SaXImport *, SaXImport *, SaXImport *)
 SaXManipulateDevices (SaXImport *, SaXImport *)

Detailed Description

SaX2 - Device manipulator class.

The device manipulator is either used to create a new desktop- or a new input-Device. A new input-Device needs to be transformed into a standard Keyboard,Mouse,Tablet or Touchscreen device before it can be handled by the appropriate manipulator for the device. A new desktop-Device instead can be handled by the DesktopManipulator directly after the device has been created. To create a new input device the device manipulator requires two imports:

whereas the constructor to create a new desktop device requires three imports:

The following example will show how to use the device manipulator for adding a new Tablet to the configuration:

 #include <sax/sax.h>

 int main (void) {
     SaXException().setDebug (true);
     QDict<SaXImport> section;
     int importID[] = {
         SAX_POINTERS,
         SAX_LAYOUT
     };
     printf ("Importing data...\n");
     SaXConfig* config = new SaXConfig;
     for (int id=0; id < 2; id++) {
         SaXImport* import = new SaXImport ( importID[id] );
         import->setSource ( SAX_SYSTEM_CONFIG );
         import->doImport();
         config->addImport (import);
         section.insert (
             import->getSectionName(),import
         );
     }
     printf ("Adding new pointer device... ");
     SaXManipulateDevices dev (
         section["Pointers"],section["Layout"]
     );
     int tabletID = dev.addInputDevice (SAX_INPUT_TABLET);
     printf ("ID: %d [SAX_INPUT_TABLET] added\n",tabletID);
 
     printf ("Setting up tablet data... ");
     SaXManipulateTablets pointer (
         section["Pointers"],section["Layout"]
     );
     if (pointer.selectPointer (tabletID)) {
         QList<QString> tabletList = pointer.getTabletList();
         QString* myTablet = tabletList.at (3);
         pointer.setTablet( *myTablet );
         printf ("[%s]\n",myTablet->ascii());
     }
     printf ("writing configuration\n");
     config->setMode (SAX_MERGE);
     if ( ! config->createConfiguration() ) {
         printf ("%s\n",config->errorString().ascii());
         printf ("%s\n",config->getParseErrorValue().ascii());
         return 1;
     }
     return (0);
 }

Definition at line 138 of file device.h.


Constructor & Destructor Documentation

SaX::SaXManipulateDevices::SaXManipulateDevices SaXImport desktop,
SaXImport card,
SaXImport layout
 

an object of this type is used to create or remove new desktops for further configuration. A desktop is defined by the Monitor,Modes,Screen and ServerLayout sections. Adding a new desktop will add a new Monitor,Modes and Screen section. The section gets activated by chaning the global ServerLayout section. Removing a desktop will do the same vice versa

Definition at line 27 of file device.cpp.

References SaX::SaXException::errorString(), SaX::SaXException::excDesktopImportBindFailed(), SaX::SaXException::excNullPointerArgument(), and SaX::SaXImport::getSectionID().

Here is the call graph for this function:

SaX::SaXManipulateDevices::SaXManipulateDevices SaXImport input,
SaXImport layout
 

an object of this type is used to create or remove new input devices. An input device is a mouse,tablet,touchscreen or keyboard. An input device is defined by its InputDevice section and is activated within the global ServerLayout section. Adding an input device requires setting the InputFashion which is the type of the device.

Definition at line 71 of file device.cpp.

References SaX::SaXException::errorString(), SaX::SaXException::excLayoutImportBindFailed(), SaX::SaXException::excNullPointerArgument(), and SaX::SaXImport::getSectionID().

Here is the call graph for this function:


Member Function Documentation

int SaX::SaXManipulateDevices::addDesktopDevice void   )  [virtual]
 

add a new desktop at the end of the current desktop list. The new desktop ID is returned

Implements SaX::SaXManipulateDevicesIF.

Definition at line 112 of file device.cpp.

References SaX::SaXStorage::addID(), and SaX::SaXStorage::getCount().

Here is the call graph for this function:

int SaX::SaXManipulateDevices::addInputDevice const char *  fashion  )  [virtual]
 

add a new input device at the end of the current input device list. The new input device ID is returned. pointer input devices are following the odd order (1,3,5,7...) whereas keyboard input devices use the even order (0,2,4,6...)

Implements SaX::SaXManipulateDevicesIF.

Definition at line 160 of file device.cpp.

References SaX::SaXException::errorString(), SaX::SaXException::excWrongInputFashion(), SaX::SaXStorage::getCount(), and SaX::SaXStorage::getTablePointer().

Referenced by SaX::SaXManipulateVNC::addVNCKeyboard(), and SaX::SaXManipulateVNC::addVNCMouse().

Here is the call graph for this function:

int SaX::SaXManipulateDevices::removeDesktopDevice int  id  )  [virtual]
 

remove the desktop of the given id (id) and return the previous desktop id. The current desktop is set to this previous desktop id. If the desktop does not exist or the desktop id is the core (0) desktop the method will return (-1)

Implements SaX::SaXManipulateDevicesIF.

Definition at line 240 of file device.cpp.

References SaX::SaXStorage::delID(), SaX::SaXException::errorString(), and SaX::SaXException::excInvalidArgument().

Here is the call graph for this function:

int SaX::SaXManipulateDevices::removeInputDevice int  id  )  [virtual]
 

remove the input device of the given id (id) and return the previous input device id. The current input device id is set to this previous input device id. If the input device does not exist or the input device id is the core (0|1) mouse or keyboard the method will return (-1)

Implements SaX::SaXManipulateDevicesIF.

Definition at line 284 of file device.cpp.

References SaX::SaXStorage::delID(), SaX::SaXException::errorString(), and SaX::SaXException::excInvalidArgument().

Referenced by SaX::SaXManipulateTablets::removePen(), SaX::SaXManipulateVNC::removeVNCKeyboard(), and SaX::SaXManipulateVNC::removeVNCMouse().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Jun 19 12:42:58 2006 for libsax by  doxygen 1.4.6