00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "odevice_yopy.h"
00032
00033
00034 #include <qapplication.h>
00035 #include <qfile.h>
00036 #include <qtextstream.h>
00037 #include <qwindowsystem_qws.h>
00038
00039
00040 #include <qpe/config.h>
00041 #include <qpe/sound.h>
00042 #include <qpe/qcopenvelope_qws.h>
00043
00044 #include <opie2/oresource.h>
00045
00046
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
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
00120
00121
00122 return false;
00123 }
00124
00125
00126 bool Yopy::setDisplayBrightness( int bright )
00127 {
00128
00129
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