Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

odevice_yopy.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C)2002-2005 The Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #include "odevice_yopy.h"
00032 
00033 /* QT */
00034 #include <qapplication.h>
00035 #include <qfile.h>
00036 #include <qtextstream.h>
00037 #include <qwindowsystem_qws.h>
00038 
00039 /* OPIE */
00040 #include <qpe/config.h>
00041 #include <qpe/sound.h>
00042 #include <qpe/qcopenvelope_qws.h>
00043 
00044 #include <opie2/oresource.h>
00045 
00046 /* STD */
00047 #include <fcntl.h>
00048 #include <math.h>
00049 #include <stdlib.h>
00050 #include <signal.h>
00051 #include <sys/ioctl.h>
00052 #include <sys/time.h>
00053 #include <unistd.h>
00054 #ifndef QT_NO_SOUND
00055 #include <linux/soundcard.h>
00056 #endif
00057 
00058 using namespace Opie::Core;
00059 using namespace Opie::Core::Internal;
00060 
00061 struct yopy_button yopy_buttons [] = {
00062     { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ),
00063         "devicebuttons/yopy_action",
00064         "datebook", "nextView()",
00065         "today", "raise()" },
00066     { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ),
00067         "devicebuttons/yopy_ok",
00068         "addressbook", "raise()",
00069         "addressbook", "beamBusinessCard()" },
00070     { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ),
00071         "devicebuttons/yopy_end",
00072         "QPE/Launcher", "home()",
00073         "buttonsettings", "raise()" },
00074 };
00075 
00076 void Yopy::init(const QString&)
00077 {
00078     d->m_vendorstr = "G.Mate";
00079     d->m_vendor = Vendor_GMate;
00080     d->m_modelstr = "Yopy3700";
00081     d->m_model = Model_Yopy_3700;
00082     d->m_rotation = Rot0;
00083     d->m_systemstr = "Linupy";
00084     d->m_system = System_Linupy;
00085     // Distribution detection code now in the base class
00086 }
00087 
00088 
00089 void Yopy::initButtons()
00090 {
00091     if ( d->m_buttons )
00092         return ;
00093 
00094     d->m_buttons = new QValueList <ODeviceButton>;
00095 
00096     for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ )
00097     {
00098 
00099         yopy_button *ib = yopy_buttons + i;
00100 
00101         ODeviceButton b;
00102 
00103         b. setKeycode ( ib->code );
00104         b. setUserText ( QObject::tr ( "Button", ib->utext ) );
00105         b. setPixmap ( OResource::loadPixmap ( ib->pix ) );
00106         b. setFactoryPresetPressedAction
00107         ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) );
00108         b. setFactoryPresetHeldAction
00109         ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) );
00110 
00111         d->m_buttons->append ( b );
00112     }
00113     reloadButtonMapping();
00114 }
00115 
00116 
00117 bool Yopy::suspend()
00118 {
00119     /* Opie for Yopy does not implement its own power management at the
00120         moment.  The public version runs parallel to X, and relies on the
00121         existing power management features. */
00122     return false;
00123 }
00124 
00125 
00126 bool Yopy::setDisplayBrightness( int bright )
00127 {
00128     /* The code here works, but is disabled as the current version runs
00129         parallel to X, and relies on the existing backlight demon. */
00130 #if 0
00131     if ( QFile::exists( "/proc/sys/pm/light" ) )
00132     {
00133         int fd = ::open( "/proc/sys/pm/light", O_WRONLY );
00134         if ( fd >= 0 )
00135         {
00136             if ( bright )
00137                 ::write( fd, "1\n", 2 );
00138             else
00139                 ::write( fd, "0\n", 2 );
00140             ::close( fd );
00141             return true;
00142         }
00143     }
00144 #else
00145     Q_UNUSED( bright )
00146 #endif
00147     return false;
00148 }
00149 
00150 
00151 int Yopy::displayBrightnessResolution() const
00152 {
00153     return 2;
00154 }
00155 

Generated on Sat Nov 5 16:16:06 2005 for OPIE by  doxygen 1.4.2