-rw-r--r-- | libopie/odevice.cpp | 34 | ||||
-rw-r--r-- | libopie/odevice.h | 21 |
2 files changed, 31 insertions, 24 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 4c49c4f..8f4e296 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -363,96 +363,98 @@ bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) | |||
363 | bool ODevice::hasLightSensor ( ) const | 363 | bool ODevice::hasLightSensor ( ) const |
364 | { | 364 | { |
365 | return false; | 365 | return false; |
366 | } | 366 | } |
367 | 367 | ||
368 | int ODevice::readLightSensor ( ) | 368 | int ODevice::readLightSensor ( ) |
369 | { | 369 | { |
370 | return -1; | 370 | return -1; |
371 | } | 371 | } |
372 | 372 | ||
373 | int ODevice::lightSensorResolution ( ) const | 373 | int ODevice::lightSensorResolution ( ) const |
374 | { | 374 | { |
375 | return 0; | 375 | return 0; |
376 | } | 376 | } |
377 | 377 | ||
378 | //QValueList <int> ODevice::keyList ( ) const | 378 | //QValueList <int> ODevice::keyList ( ) const |
379 | //{ | 379 | //{ |
380 | //return QValueList <int> ( ); | 380 | //return QValueList <int> ( ); |
381 | //} | 381 | //} |
382 | 382 | ||
383 | 383 | ||
384 | 384 | ||
385 | /************************************************** | 385 | /************************************************** |
386 | * | 386 | * |
387 | * iPAQ | 387 | * iPAQ |
388 | * | 388 | * |
389 | **************************************************/ | 389 | **************************************************/ |
390 | 390 | ||
391 | void iPAQ::init ( ) | 391 | void iPAQ::init ( ) |
392 | { | 392 | { |
393 | d-> m_vendorstr = "HP"; | 393 | d-> m_vendorstr = "HP"; |
394 | d-> m_vendor = Vendor_HP; | 394 | d-> m_vendor = Vendor_HP; |
395 | 395 | ||
396 | QFile f ( "/proc/hal/model" ); | 396 | QFile f ( "/proc/hal/model" ); |
397 | 397 | ||
398 | if ( f. open ( IO_ReadOnly )) { | 398 | if ( f. open ( IO_ReadOnly )) { |
399 | QTextStream ts ( &f ); | 399 | QTextStream ts ( &f ); |
400 | 400 | ||
401 | d-> m_modelstr = "H" + ts. readLine ( ); | 401 | d-> m_modelstr = "H" + ts. readLine ( ); |
402 | 402 | ||
403 | if ( d-> m_modelstr == "H3100" ) | 403 | if ( d-> m_modelstr == "H3100" ) |
404 | d-> m_model = Model_iPAQ_H31xx; | 404 | d-> m_model = Model_iPAQ_H31xx; |
405 | else if ( d-> m_modelstr == "H3600" ) | 405 | else if ( d-> m_modelstr == "H3600" ) |
406 | d-> m_model = Model_iPAQ_H36xx; | 406 | d-> m_model = Model_iPAQ_H36xx; |
407 | else if ( d-> m_modelstr == "H3700" ) | 407 | else if ( d-> m_modelstr == "H3700" ) |
408 | d-> m_model = Model_iPAQ_H37xx; | 408 | d-> m_model = Model_iPAQ_H37xx; |
409 | else if ( d-> m_modelstr == "H3800" ) | 409 | else if ( d-> m_modelstr == "H3800" ) |
410 | d-> m_model = Model_iPAQ_H38xx; | 410 | d-> m_model = Model_iPAQ_H38xx; |
411 | else if ( d-> m_modelstr == "H3900" ) | ||
412 | d-> m_model = Model_iPAQ_H39xx; | ||
411 | else | 413 | else |
412 | d-> m_model = Model_Unknown; | 414 | d-> m_model = Model_Unknown; |
413 | 415 | ||
414 | f. close ( ); | 416 | f. close ( ); |
415 | } | 417 | } |
416 | 418 | ||
417 | f. setName ( "/etc/familiar-version" ); | 419 | f. setName ( "/etc/familiar-version" ); |
418 | if ( f. open ( IO_ReadOnly )) { | 420 | if ( f. open ( IO_ReadOnly )) { |
419 | d-> m_systemstr = "Familiar"; | 421 | d-> m_systemstr = "Familiar"; |
420 | d-> m_system = System_Familiar; | 422 | d-> m_system = System_Familiar; |
421 | 423 | ||
422 | QTextStream ts ( &f ); | 424 | QTextStream ts ( &f ); |
423 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); | 425 | d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); |
424 | 426 | ||
425 | f. close ( ); | 427 | f. close ( ); |
426 | } | 428 | } |
427 | 429 | ||
428 | m_leds [0] = m_leds [1] = Led_Off; | 430 | m_leds [0] = m_leds [1] = Led_Off; |
429 | 431 | ||
430 | m_power_timer = 0; | 432 | m_power_timer = 0; |
431 | 433 | ||
432 | if ( d-> m_qwsserver ) | 434 | if ( d-> m_qwsserver ) |
433 | QWSServer::setKeyboardFilter ( this ); | 435 | QWSServer::setKeyboardFilter ( this ); |
434 | } | 436 | } |
435 | 437 | ||
436 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... | 438 | //#include <linux/h3600_ts.h> // including kernel headers is evil ... |
437 | 439 | ||
438 | typedef struct { | 440 | typedef struct { |
439 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ | 441 | unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ |
440 | unsigned char TotalTime; /* Units of 5 seconds */ | 442 | unsigned char TotalTime; /* Units of 5 seconds */ |
441 | unsigned char OnTime; /* units of 100m/s */ | 443 | unsigned char OnTime; /* units of 100m/s */ |
442 | unsigned char OffTime; /* units of 100m/s */ | 444 | unsigned char OffTime; /* units of 100m/s */ |
443 | } LED_IN; | 445 | } LED_IN; |
444 | 446 | ||
445 | typedef struct { | 447 | typedef struct { |
446 | unsigned char mode; | 448 | unsigned char mode; |
447 | unsigned char pwr; | 449 | unsigned char pwr; |
448 | unsigned char brightness; | 450 | unsigned char brightness; |
449 | } FLITE_IN; | 451 | } FLITE_IN; |
450 | 452 | ||
451 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) | 453 | #define LED_ON OD_IOW( 'f', 5, LED_IN ) |
452 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) | 454 | #define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) |
453 | 455 | ||
454 | 456 | ||
455 | 457 | ||
456 | QValueList <OLed> iPAQ::ledList ( ) const | 458 | QValueList <OLed> iPAQ::ledList ( ) const |
457 | { | 459 | { |
458 | QValueList <OLed> vl; | 460 | QValueList <OLed> vl; |
@@ -610,121 +612,129 @@ void iPAQ::alarmSound ( ) | |||
610 | volalarm |= ( volalarm << 8 ); | 612 | volalarm |= ( volalarm << 8 ); |
611 | 613 | ||
612 | if (( volalarm & 0xff ) > ( vol & 0xff )) { | 614 | if (( volalarm & 0xff ) > ( vol & 0xff )) { |
613 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) | 615 | if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) |
614 | vol_reset = true; | 616 | vol_reset = true; |
615 | } | 617 | } |
616 | } | 618 | } |
617 | } | 619 | } |
618 | 620 | ||
619 | snd. play ( ); | 621 | snd. play ( ); |
620 | while ( !snd. isFinished ( )) | 622 | while ( !snd. isFinished ( )) |
621 | qApp-> processEvents ( ); | 623 | qApp-> processEvents ( ); |
622 | 624 | ||
623 | if ( fd >= 0 ) { | 625 | if ( fd >= 0 ) { |
624 | if ( vol_reset ) | 626 | if ( vol_reset ) |
625 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); | 627 | ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); |
626 | ::close ( fd ); | 628 | ::close ( fd ); |
627 | } | 629 | } |
628 | #endif | 630 | #endif |
629 | #endif | 631 | #endif |
630 | } | 632 | } |
631 | 633 | ||
632 | 634 | ||
633 | bool iPAQ::setSoftSuspend ( bool soft ) | 635 | bool iPAQ::setSoftSuspend ( bool soft ) |
634 | { | 636 | { |
635 | bool res = false; | 637 | bool res = false; |
636 | int fd; | 638 | int fd; |
637 | 639 | ||
638 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { | 640 | if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { |
639 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) | 641 | if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) |
640 | res = true; | 642 | res = true; |
641 | else | 643 | else |
642 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); | 644 | ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); |
643 | 645 | ||
644 | ::close ( fd ); | 646 | ::close ( fd ); |
645 | } | 647 | } |
646 | else | 648 | else |
647 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); | 649 | ::perror ( "/proc/sys/ts/suspend_button_mode" ); |
648 | 650 | ||
649 | return res; | 651 | return res; |
650 | } | 652 | } |
651 | 653 | ||
652 | 654 | ||
653 | bool iPAQ::setDisplayBrightness ( int bright ) | 655 | bool iPAQ::setDisplayBrightness ( int bright ) |
654 | { | 656 | { |
655 | bool res = false; | 657 | bool res = false; |
656 | int fd; | 658 | int fd; |
657 | 659 | ||
658 | if ( bright > 255 ) | 660 | int maxbright = displayBrightnessResolution ( ); |
659 | bright = 255; | 661 | |
662 | if ( bright > maxbright ) | ||
663 | bright = maxbright; | ||
660 | if ( bright < 0 ) | 664 | if ( bright < 0 ) |
661 | bright = 0; | 665 | bright = 0; |
662 | 666 | ||
663 | // 128 is the maximum if you want a decent lifetime for the LCD | ||
664 | |||
665 | if ( bright > 1 ) | ||
666 | bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic | ||
667 | //bright = ( bright + 1 ) / 2; | ||
668 | |||
669 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { | 667 | if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { |
670 | FLITE_IN bl; | 668 | FLITE_IN bl; |
671 | bl. mode = 1; | 669 | bl. mode = 1; |
672 | bl. pwr = bright ? 1 : 0; | 670 | bl. pwr = bright ? 1 : 0; |
673 | bl. brightness = bright; | 671 | bl. brightness = bright; |
674 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); | 672 | res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); |
675 | ::close ( fd ); | 673 | ::close ( fd ); |
676 | } | 674 | } |
677 | return res; | 675 | return res; |
678 | } | 676 | } |
679 | 677 | ||
680 | int iPAQ::displayBrightnessResolution ( ) const | 678 | int iPAQ::displayBrightnessResolution ( ) const |
681 | { | 679 | { |
682 | return 256; // really 128, but logarithmic control is smoother this way | 680 | switch ( model ( )) { |
681 | case Model_iPAQ_H31xx: | ||
682 | case Model_iPAQ_H36xx: | ||
683 | case Model_iPAQ_H37xx: | ||
684 | return 128; // really 256, but >128 could damage the LCD | ||
685 | |||
686 | case Model_iPAQ_H38xx: | ||
687 | case Model_iPAQ_H39xx: | ||
688 | return 64; | ||
689 | |||
690 | default: | ||
691 | return 2; | ||
692 | } | ||
683 | } | 693 | } |
684 | 694 | ||
685 | 695 | ||
686 | bool iPAQ::hasLightSensor ( ) const | 696 | bool iPAQ::hasLightSensor ( ) const |
687 | { | 697 | { |
688 | return true; | 698 | return true; |
689 | } | 699 | } |
690 | 700 | ||
691 | int iPAQ::readLightSensor ( ) | 701 | int iPAQ::readLightSensor ( ) |
692 | { | 702 | { |
693 | int fd; | 703 | int fd; |
694 | int val = -1; | 704 | int val = -1; |
695 | 705 | ||
696 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { | 706 | if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { |
697 | char buffer [8]; | 707 | char buffer [8]; |
698 | 708 | ||
699 | if ( ::read ( fd, buffer, 5 ) == 5 ) { | 709 | if ( ::read ( fd, buffer, 5 ) == 5 ) { |
700 | char *endptr; | 710 | char *endptr; |
701 | 711 | ||
702 | buffer [4] = 0; | 712 | buffer [4] = 0; |
703 | val = ::strtol ( buffer + 2, &endptr, 16 ); | 713 | val = ::strtol ( buffer + 2, &endptr, 16 ); |
704 | 714 | ||
705 | if ( *endptr != 0 ) | 715 | if ( *endptr != 0 ) |
706 | val = -1; | 716 | val = -1; |
707 | } | 717 | } |
708 | ::close ( fd ); | 718 | ::close ( fd ); |
709 | } | 719 | } |
710 | 720 | ||
711 | return val; | 721 | return val; |
712 | } | 722 | } |
713 | 723 | ||
714 | int iPAQ::lightSensorResolution ( ) const | 724 | int iPAQ::lightSensorResolution ( ) const |
715 | { | 725 | { |
716 | return 256; | 726 | return 256; |
717 | } | 727 | } |
718 | 728 | ||
719 | /************************************************** | 729 | /************************************************** |
720 | * | 730 | * |
721 | * Zaurus | 731 | * Zaurus |
722 | * | 732 | * |
723 | **************************************************/ | 733 | **************************************************/ |
724 | 734 | ||
725 | 735 | ||
726 | 736 | ||
727 | void Zaurus::init ( ) | 737 | void Zaurus::init ( ) |
728 | { | 738 | { |
729 | d-> m_modelstr = "Zaurus SL5000"; | 739 | d-> m_modelstr = "Zaurus SL5000"; |
730 | d-> m_model = Model_Zaurus_SL5000; | 740 | d-> m_model = Model_Zaurus_SL5000; |
@@ -912,55 +922,49 @@ bool Zaurus::setSoftSuspend ( bool soft ) | |||
912 | if ( soft ) | 922 | if ( soft ) |
913 | sources &= ~APM_EVT_POWER_BUTTON; | 923 | sources &= ~APM_EVT_POWER_BUTTON; |
914 | else | 924 | else |
915 | sources |= APM_EVT_POWER_BUTTON; | 925 | sources |= APM_EVT_POWER_BUTTON; |
916 | 926 | ||
917 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources | 927 | if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources |
918 | res = true; | 928 | res = true; |
919 | else | 929 | else |
920 | perror ( "APM_IOCGEVTSRC" ); | 930 | perror ( "APM_IOCGEVTSRC" ); |
921 | } | 931 | } |
922 | else | 932 | else |
923 | perror ( "APM_IOCGEVTSRC" ); | 933 | perror ( "APM_IOCGEVTSRC" ); |
924 | 934 | ||
925 | ::close ( fd ); | 935 | ::close ( fd ); |
926 | } | 936 | } |
927 | else | 937 | else |
928 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); | 938 | perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); |
929 | 939 | ||
930 | return res; | 940 | return res; |
931 | } | 941 | } |
932 | 942 | ||
933 | 943 | ||
934 | bool Zaurus::setDisplayBrightness ( int bright ) | 944 | bool Zaurus::setDisplayBrightness ( int bright ) |
935 | { | 945 | { |
936 | bool res = false; | 946 | bool res = false; |
937 | int fd; | 947 | int fd; |
938 | 948 | ||
939 | if ( bright > 255 ) | 949 | if ( bright > 255 ) |
940 | bright = 255; | 950 | bright = 255; |
941 | if ( bright < 0 ) | 951 | if ( bright < 0 ) |
942 | bright = 0; | 952 | bright = 0; |
943 | 953 | ||
944 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { | 954 | if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { |
945 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus | 955 | int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus |
946 | if ( bright && !bl ) | 956 | if ( bright && !bl ) |
947 | bl = 1; | 957 | bl = 1; |
948 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); | 958 | res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); |
949 | ::close ( fd ); | 959 | ::close ( fd ); |
950 | } | 960 | } |
951 | return res; | 961 | return res; |
952 | } | 962 | } |
953 | 963 | ||
954 | 964 | ||
955 | int Zaurus::displayBrightnessResolution ( ) const | 965 | int Zaurus::displayBrightnessResolution ( ) const |
956 | { | 966 | { |
957 | return 5; | 967 | return 5; |
958 | } | 968 | } |
959 | 969 | ||
960 | //QValueList <int> Zaurus::keyList ( ) const | ||
961 | //{ | ||
962 | //QValueList <int> vl; | ||
963 | //vl << HardKey_Datebook << HardKey_Contacts << HardKey_Mail << HardKey_Menu << HardKey_Home << HardKey_Suspend << HardKey_Backlight; | ||
964 | //return vl; | ||
965 | //} | ||
966 | 970 | ||
diff --git a/libopie/odevice.h b/libopie/odevice.h index e07b91c..e50009c 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -1,146 +1,149 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* This file is part of the OPIE libraries |
2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) | 2 | Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _LIBOPIE_ODEVICE_H_ | 20 | #ifndef _LIBOPIE_ODEVICE_H_ |
21 | #define _LIBOPIE_ODEVICE_H_ | 21 | #define _LIBOPIE_ODEVICE_H_ |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qnamespace.h> | 24 | #include <qnamespace.h> |
25 | 25 | ||
26 | class ODeviceData; | 26 | class ODeviceData; |
27 | 27 | ||
28 | namespace Opie { | 28 | namespace Opie { |
29 | 29 | ||
30 | enum OModel { | 30 | enum OModel { |
31 | Model_Unknown, | 31 | Model_Unknown, |
32 | |||
33 | Model_Series_Mask = 0xff000000, | ||
32 | 34 | ||
33 | Model_iPAQ = ( 1 << 16 ), | 35 | Model_iPAQ = ( 1 << 24 ), |
34 | 36 | ||
35 | Model_iPAQ_H31xx = ( Model_iPAQ | 1 ), | 37 | Model_iPAQ_All = ( Model_iPAQ | 0xffffff ), |
36 | Model_iPAQ_H36xx = ( Model_iPAQ | 2 ), | 38 | Model_iPAQ_H31xx = ( Model_iPAQ | 0x000001 ), |
37 | Model_iPAQ_H37xx = ( Model_iPAQ | 3 ), | 39 | Model_iPAQ_H36xx = ( Model_iPAQ | 0x000002 ), |
38 | Model_iPAQ_H38xx = ( Model_iPAQ | 4 ), | 40 | Model_iPAQ_H37xx = ( Model_iPAQ | 0x000004 ), |
41 | Model_iPAQ_H38xx = ( Model_iPAQ | 0x000008 ), | ||
42 | Model_iPAQ_H39xx = ( Model_iPAQ | 0x000010 ), | ||
39 | 43 | ||
40 | Model_Zaurus = ( 2 << 16 ), | 44 | Model_Zaurus = ( 2 << 24 ), |
41 | 45 | ||
42 | Model_Zaurus_SL5000 = ( Model_Zaurus | 1 ), | 46 | Model_Zaurus_SL5000 = ( Model_Zaurus | 0x000001 ), |
43 | }; | 47 | }; |
44 | 48 | ||
45 | enum OVendor { | 49 | enum OVendor { |
46 | Vendor_Unknown, | 50 | Vendor_Unknown, |
47 | 51 | ||
48 | Vendor_HP, | 52 | Vendor_HP, |
49 | Vendor_Sharp | 53 | Vendor_Sharp |
50 | }; | 54 | }; |
51 | 55 | ||
52 | enum OSystem { | 56 | enum OSystem { |
53 | System_Unknown, | 57 | System_Unknown, |
54 | 58 | ||
55 | System_Familiar, | 59 | System_Familiar, |
56 | System_Zaurus, | 60 | System_Zaurus, |
57 | System_OpenZaurus | 61 | System_OpenZaurus |
58 | }; | 62 | }; |
59 | 63 | ||
60 | enum OLedState { | 64 | enum OLedState { |
61 | Led_Off, | 65 | Led_Off, |
62 | Led_On, | 66 | Led_On, |
63 | Led_BlinkSlow, | 67 | Led_BlinkSlow, |
64 | Led_BlinkFast | 68 | Led_BlinkFast |
65 | }; | 69 | }; |
66 | 70 | ||
67 | enum OLed { | 71 | enum OLed { |
68 | Led_Mail, | 72 | Led_Mail, |
69 | Led_Power, | 73 | Led_Power, |
70 | Led_BlueTooth | 74 | Led_BlueTooth |
71 | }; | 75 | }; |
72 | 76 | ||
73 | enum OHardKey { | 77 | enum OHardKey { |
74 | HardKey_Datebook = Qt::Key_F9, | 78 | HardKey_Datebook = Qt::Key_F9, |
75 | HardKey_Contacts = Qt::Key_F10, | 79 | HardKey_Contacts = Qt::Key_F10, |
76 | HardKey_Menu = Qt::Key_F11, | 80 | HardKey_Menu = Qt::Key_F11, |
77 | HardKey_Home = Qt::Key_F12, | 81 | HardKey_Home = Qt::Key_F12, |
78 | HardKey_Mail = Qt::Key_F14, | 82 | HardKey_Mail = Qt::Key_F14, |
79 | HardKey_Record = Qt::Key_F24, | 83 | HardKey_Record = Qt::Key_F24, |
80 | HardKey_Suspend = Qt::Key_F34, | 84 | HardKey_Suspend = Qt::Key_F34, |
81 | HardKey_Backlight = Qt::Key_F35, | 85 | HardKey_Backlight = Qt::Key_F35, |
82 | }; | 86 | }; |
83 | 87 | ||
84 | 88 | ||
85 | class ODevice | 89 | class ODevice |
86 | { | 90 | { |
87 | private: | 91 | private: |
88 | ODevice ( const ODevice & ); | 92 | ODevice ( const ODevice & ); |
89 | 93 | ||
90 | protected: | 94 | protected: |
91 | ODevice ( ); | 95 | ODevice ( ); |
92 | virtual void init ( ); | 96 | virtual void init ( ); |
93 | 97 | ||
94 | ODeviceData *d; | 98 | ODeviceData *d; |
95 | 99 | ||
96 | public: | 100 | public: |
97 | virtual ~ODevice ( ); | 101 | virtual ~ODevice ( ); |
98 | 102 | ||
99 | static ODevice *inst ( ); | 103 | static ODevice *inst ( ); |
100 | 104 | ||
101 | 105 | ||
102 | 106 | ||
103 | // information | 107 | // information |
104 | 108 | ||
105 | QString modelString ( ) const; | 109 | QString modelString ( ) const; |
106 | OModel model ( ) const; | 110 | OModel model ( ) const; |
111 | inline OModel series ( ) const { return (OModel) ( model ( ) & Model_Series_Mask ); } | ||
107 | 112 | ||
108 | QString vendorString ( ) const; | 113 | QString vendorString ( ) const; |
109 | OVendor vendor ( ) const; | 114 | OVendor vendor ( ) const; |
110 | 115 | ||
111 | QString systemString ( ) const; | 116 | QString systemString ( ) const; |
112 | OSystem system ( ) const; | 117 | OSystem system ( ) const; |
113 | 118 | ||
114 | QString systemVersionString ( ) const; | 119 | QString systemVersionString ( ) const; |
115 | 120 | ||
116 | // system | 121 | // system |
117 | 122 | ||
118 | virtual bool setSoftSuspend ( bool on ); | 123 | virtual bool setSoftSuspend ( bool on ); |
119 | virtual bool suspend ( ); | 124 | virtual bool suspend ( ); |
120 | 125 | ||
121 | virtual bool setDisplayStatus ( bool on ); | 126 | virtual bool setDisplayStatus ( bool on ); |
122 | virtual bool setDisplayBrightness ( int brightness ); | 127 | virtual bool setDisplayBrightness ( int brightness ); |
123 | virtual int displayBrightnessResolution ( ) const; | 128 | virtual int displayBrightnessResolution ( ) const; |
124 | 129 | ||
125 | // input / output | 130 | // input / output |
126 | 131 | ||
127 | virtual void alarmSound ( ); | 132 | virtual void alarmSound ( ); |
128 | virtual void keySound ( ); | 133 | virtual void keySound ( ); |
129 | virtual void touchSound ( ); | 134 | virtual void touchSound ( ); |
130 | 135 | ||
131 | virtual QValueList <OLed> ledList ( ) const; | 136 | virtual QValueList <OLed> ledList ( ) const; |
132 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; | 137 | virtual QValueList <OLedState> ledStateList ( OLed led ) const; |
133 | virtual OLedState ledState ( OLed led ) const; | 138 | virtual OLedState ledState ( OLed led ) const; |
134 | virtual bool setLedState ( OLed led, OLedState st ); | 139 | virtual bool setLedState ( OLed led, OLedState st ); |
135 | 140 | ||
136 | virtual bool hasLightSensor ( ) const; | 141 | virtual bool hasLightSensor ( ) const; |
137 | virtual int readLightSensor ( ); | 142 | virtual int readLightSensor ( ); |
138 | virtual int lightSensorResolution ( ) const; | 143 | virtual int lightSensorResolution ( ) const; |
139 | |||
140 | //virtual QValueList <int> keyList ( ) const; | ||
141 | }; | 144 | }; |
142 | 145 | ||
143 | } | 146 | } |
144 | 147 | ||
145 | #endif | 148 | #endif |
146 | 149 | ||