1 #ifndef DEVICECONFIGURATOR_H_
2 #define DEVICECONFIGURATOR_H_
4 #include "DeviceDataStorage.h"
6 //! DeviceControl class. Configures the device behavior.
8 * DeviceControl class. DeviceControl class. Configures the device behavior. Updates the device system
9 * files, activates/deactivates the application initialization script, uses the gconftool to configure
10 * some parameters of the device and uses the devstopper binary to restart the device to activate
11 * the changes. The changes it makes affect to the hardware keys, the screen dimming enabling/disabling
12 * and the automated turning on/off the device. These are all supported features of the "kiosk mode".
14 class DeviceConfigurator : public QObject
21 * Constructor to initialize an AlarmSender instance
22 * \param aDataStorage Pointer to the DataStorage class instance.
24 DeviceConfigurator( DeviceDataStorage *aDataStorage );
26 virtual ~DeviceConfigurator();
27 //! Toggles the screen switching on/off and dimming options of the device.
29 * Toggles the screen switching on/off and dimming options of the device. Asks DeviceDataStorage to
30 * read/store the screen related original parameters. Uses systemIO( ... ) method to execute
31 * gconftool system commands to change the configurations.
32 * \param aEnable Indicates if the screen switchin off and dimming are wanted to be enabled.
33 * \return True if configuring of screen options succeeds; otherwise, false.
35 bool toggleScreenSwitchOff( bool aEnable );
36 //! Toggles the enabling of the "home"-hardware key of the device.
38 * Toggles the enabling of the "home"-hardware key of the device. Asks DeviceDataStorage to
39 * read/store the hardware key related original parameters. Uses the DeviceDataStorage to manipulate
40 * the device system file /etc/mce/mce.ini to enable/disable the hw key.
41 * \param aEnable Indicates if the "home"-hardware key is wanted to be enabled.
42 * \return True if configuring of the hw-key succeeds; otherwise, false.
44 bool toggleHWKeys( bool aEnable );
45 //! Toggles the activation of the application initialization script.
47 * Toggles the activation of the application initialization script. Uses the systemIO( ... ) method
48 * to execute the script that uses update-rc.d system command to install/remove the init script
49 * qtmeetings-launcher.
50 * \param aEnable Indicates if the script is wanted to be activated/deactivated
51 * \return True if activating/deactivating of the script succeeds; otherwise, false.
53 bool toggleInitScript( bool aEnable );
54 //! Restarts the device.
56 * Restarts the device by using the systemIO( ... ) method to execute devstopper executable.
57 * \return True if resrating of the device succeeds; otherwise, false.
60 //! Resolves the currently used account of the device.
62 * Resolves the currently used account of the device by using the systemIO( ... ) method to execute
63 * whoami system command.
64 * \return True if resolving the account succeeds; otherwise, false.
66 static bool whoAmI( QByteArray &aName );
67 //! Consists and executes a system command and stores the received output.
69 * Consists and executes a system command and stores the received output.
70 * \param aCommand The whole system command or just the "binary"-part of the command
71 * \param aArgs The possible arguments for the "binary"
72 * \param aResult The place to put the output of the command
73 * \return True if executing the system command succeeds; otherwise, false.
75 static bool systemIO( const QString &aCommand, const QStringList &aArgs, QByteArray &aResult );
78 //! Signal. Emitted if error occured during configuring the device.
80 * Signal. Emitted if error occured during configuring the device.
81 * \param aErrorCode The error code.
83 void configuringError( DeviceManager::ErrorCode aErrorCode );
86 DeviceDataStorage *iDataStorage;
89 #endif /*DEVICECONFIGURATOR_H_*/