summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
Unidiff
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp108
1 files changed, 102 insertions, 6 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 9b2a954..8f954b1 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -53,7 +53,7 @@ using namespace Opie;
53 53
54class ODeviceData { 54class ODeviceData {
55public: 55public:
56 bool m_qwsserver; 56 bool m_qwsserver : 1;
57 57
58 QString m_vendorstr; 58 QString m_vendorstr;
59 OVendor m_vendor; 59 OVendor m_vendor;
@@ -270,6 +270,9 @@ void ODevice::init ( )
270{ 270{
271} 271}
272 272
273/**
274 * This method initialises the button mapping
275 */
273void ODevice::initButtons ( ) 276void ODevice::initButtons ( )
274{ 277{
275 if ( d-> m_buttons ) 278 if ( d-> m_buttons )
@@ -313,7 +316,17 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ )
313 316
314#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 317#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
315 318
316 319/**
320 * This method will try to suspend the device
321 * It only works if the user is the QWS Server and the apm application
322 * is installed.
323 * It tries to suspend and then waits some time cause some distributions
324 * do have asynchronus apm implementations.
325 * This method will either fail and return false or it'll suspend the
326 * device and return once the device got woken up
327 *
328 * @return if the device got suspended
329 */
317bool ODevice::suspend ( ) 330bool ODevice::suspend ( )
318{ 331{
319 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend 332 if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend
@@ -354,7 +367,9 @@ bool ODevice::suspend ( )
354#define VESA_HSYNC_SUSPEND 2 367#define VESA_HSYNC_SUSPEND 2
355#define VESA_POWERDOWN 3 368#define VESA_POWERDOWN 3
356 369
357 370/**
371 * This sets the display on or off
372 */
358bool ODevice::setDisplayStatus ( bool on ) 373bool ODevice::setDisplayStatus ( bool on )
359{ 374{
360 if ( d-> m_model == Model_Unknown ) 375 if ( d-> m_model == Model_Unknown )
@@ -370,8 +385,13 @@ bool ODevice::setDisplayStatus ( bool on )
370 return res; 385 return res;
371} 386}
372 387
373bool ODevice::setDisplayBrightness ( int ) 388/**
389 * This sets the display brightness
390 * @return success or failure
391 */
392bool ODevice::setDisplayBrightness ( int p)
374{ 393{
394 Q_UNUSED( p )
375 return false; 395 return false;
376} 396}
377 397
@@ -380,46 +400,76 @@ int ODevice::displayBrightnessResolution ( ) const
380 return 16; 400 return 16;
381} 401}
382 402
403/**
404 * This returns the vendor as string
405 * @return Vendor as QString
406 */
383QString ODevice::vendorString ( ) const 407QString ODevice::vendorString ( ) const
384{ 408{
385 return d-> m_vendorstr; 409 return d-> m_vendorstr;
386} 410}
387 411
412/**
413 * This returns the vendor as one of the values of OVendor
414 * @return OVendor
415 */
388OVendor ODevice::vendor ( ) const 416OVendor ODevice::vendor ( ) const
389{ 417{
390 return d-> m_vendor; 418 return d-> m_vendor;
391} 419}
392 420
421/**
422 * This returns the model as a string
423 * @return A string representing the model
424 */
393QString ODevice::modelString ( ) const 425QString ODevice::modelString ( ) const
394{ 426{
395 return d-> m_modelstr; 427 return d-> m_modelstr;
396} 428}
397 429
430/**
431 * This does return the OModel used
432 */
398OModel ODevice::model ( ) const 433OModel ODevice::model ( ) const
399{ 434{
400 return d-> m_model; 435 return d-> m_model;
401} 436}
402 437
438/**
439 * This does return the systen name
440 */
403QString ODevice::systemString ( ) const 441QString ODevice::systemString ( ) const
404{ 442{
405 return d-> m_systemstr; 443 return d-> m_systemstr;
406} 444}
407 445
446/**
447 * Return System as OSystem value
448 */
408OSystem ODevice::system ( ) const 449OSystem ODevice::system ( ) const
409{ 450{
410 return d-> m_system; 451 return d-> m_system;
411} 452}
412 453
454/**
455 * @return the version string of the base system
456 */
413QString ODevice::systemVersionString ( ) const 457QString ODevice::systemVersionString ( ) const
414{ 458{
415 return d-> m_sysverstr; 459 return d-> m_sysverstr;
416} 460}
417 461
462/**
463 * @return the current Transformation
464 */
418Transformation ODevice::rotation ( ) const 465Transformation ODevice::rotation ( ) const
419{ 466{
420 return d-> m_rotation; 467 return d-> m_rotation;
421} 468}
422 469
470/**
471 * This plays an alarmSound
472 */
423void ODevice::alarmSound ( ) 473void ODevice::alarmSound ( )
424{ 474{
425#ifndef QT_NO_SOUND 475#ifndef QT_NO_SOUND
@@ -430,6 +480,9 @@ void ODevice::alarmSound ( )
430#endif 480#endif
431} 481}
432 482
483/**
484 * This plays a key sound
485 */
433void ODevice::keySound ( ) 486void ODevice::keySound ( )
434{ 487{
435#ifndef QT_NO_SOUND 488#ifndef QT_NO_SOUND
@@ -440,6 +493,9 @@ void ODevice::keySound ( )
440#endif 493#endif
441} 494}
442 495
496/**
497 * This plays a touch sound
498 */
443void ODevice::touchSound ( ) 499void ODevice::touchSound ( )
444{ 500{
445 501
@@ -451,42 +507,72 @@ void ODevice::touchSound ( )
451#endif 507#endif
452} 508}
453 509
454 510/**
511 * This method will return a list of leds
512 * available on this device
513 * @return a list of LEDs.
514 */
455QValueList <OLed> ODevice::ledList ( ) const 515QValueList <OLed> ODevice::ledList ( ) const
456{ 516{
457 return QValueList <OLed> ( ); 517 return QValueList <OLed> ( );
458} 518}
459 519
520/**
521 * This does return the state of the LEDs
522 */
460QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 523QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
461{ 524{
462 return QValueList <OLedState> ( ); 525 return QValueList <OLedState> ( );
463} 526}
464 527
528/**
529 * @return the state for a given OLed
530 */
465OLedState ODevice::ledState ( OLed /*which*/ ) const 531OLedState ODevice::ledState ( OLed /*which*/ ) const
466{ 532{
467 return Led_Off; 533 return Led_Off;
468} 534}
469 535
470bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) 536/**
537 * Set the state for a LED
538 * @param which Which OLed to use
539 * @param st The state to set
540 * @return success or failure
541 */
542bool ODevice::setLedState ( OLed which, OLedState st )
471{ 543{
544 Q_UNUSED( which )
545 Q_UNUSED( st )
472 return false; 546 return false;
473} 547}
474 548
549/**
550 * @return if the device has a light sensor
551 */
475bool ODevice::hasLightSensor ( ) const 552bool ODevice::hasLightSensor ( ) const
476{ 553{
477 return false; 554 return false;
478} 555}
479 556
557/**
558 * @return a value from the light senso
559 */
480int ODevice::readLightSensor ( ) 560int ODevice::readLightSensor ( )
481{ 561{
482 return -1; 562 return -1;
483} 563}
484 564
565/**
566 * @return the light sensor resolution whatever that is ;)
567 */
485int ODevice::lightSensorResolution ( ) const 568int ODevice::lightSensorResolution ( ) const
486{ 569{
487 return 0; 570 return 0;
488} 571}
489 572
573/**
574 * @return a list of hardware buttons
575 */
490const QValueList <ODeviceButton> &ODevice::buttons ( ) 576const QValueList <ODeviceButton> &ODevice::buttons ( )
491{ 577{
492 initButtons ( ); 578 initButtons ( );
@@ -494,11 +580,21 @@ const QValueList <ODeviceButton> &ODevice::buttons ( )
494 return *d-> m_buttons; 580 return *d-> m_buttons;
495} 581}
496 582
583/**
584 * @return The amount of time that would count as a hold
585 */
497uint ODevice::buttonHoldTime ( ) const 586uint ODevice::buttonHoldTime ( ) const
498{ 587{
499 return d-> m_holdtime; 588 return d-> m_holdtime;
500} 589}
501 590
591/**
592 * This method return a ODeviceButton for a key code
593 * or 0 if no special hardware button is available for the device
594 *
595 * @return The devicebutton or 0l
596 * @see ODeviceButton
597 */
502const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 598const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
503{ 599{
504 initButtons ( ); 600 initButtons ( );