epoc-keypress-anim.hpp

Go to the documentation of this file.
00001 // This is a variant implementation of the "keypress" sensor,
00002 // utilizing the Jaiku "keyevents" component. Unfortunately the Jaiku
00003 // codebase does not actually appear to have any code that uses the
00004 // component, but hopefully we manage it without an example, and
00005 // hopefully it actually does work.
00006 
00007 #ifndef __epoc_keypress_anim_hpp__
00008 #define __epoc_keypress_anim_hpp__
00009 
00010 #include "application_config.h"
00011 
00012 #if __KEYPRESS_ENABLED__ && __HAVE_ANIM__
00013 
00014 #include "ld_log_db.h"
00015 #include "utils_cl2.h"
00016 
00017 #include "keyevents/client.h" // third-party library
00018 
00019 #include <apgwgnam.h>
00020 #include <coedef.h>
00021 #include <e32base.h>
00022 #include <e32property.h>
00023 #include <w32std.h> // link against: ws32.lib
00024 
00025 #include <glib.h>
00026 
00027 // The implementation bears some similarity to that of the appfocus
00028 // sensor, since we must deal with window groups and the like.
00029 NONSHARABLE_CLASS(CSensor_keypress) : public CActive
00030 {
00031  public:
00032   static CSensor_keypress* NewL(LogDb* aLogDb);
00033 
00034   virtual ~CSensor_keypress();
00035 
00036   gboolean StartL(GError** error);
00037 
00038   void Stop();
00039 
00040  private:
00041   CSensor_keypress(LogDb* aLogDb);
00042 
00043   void ConstructL();
00044 
00045  private:
00046 
00047   // Makes next capture request.
00048   void MakeRequest();
00049 
00050   virtual void RunL();
00051 
00052   virtual void DoCancel();
00053 
00054   gboolean LogAndClear(GError** error);
00055 
00056  private:
00057 
00058   LogDb* iLogDb; // not owned
00059 
00060   RWsSession* iSession;
00061   RWindowGroup* iWinGroup;
00062   CApaWindowGroupName* iWinGroupName;
00063 
00064   DEF_SESSION(RProperty, iProperty);
00065 
00066   CKeyEventsClient* iKeyEventsClient;
00067 
00068   TInt32 iCaptureHandles[350];
00069   int iNumCaptureHandles;
00070 
00071 #define MAX_NUM_CAPTURED_KEYS 100
00072   // We should log and clear when the buffer is full, or when the
00073   // logger is stopped, whichever comes first.
00074   time_t iCapturedKeys[MAX_NUM_CAPTURED_KEYS];
00075   int iNumCapturedKeys;
00076   GString* iKeysText; // buffer for text to log
00077 };
00078 
00079 #endif // __KEYPRESS_ENABLED__ && __HAVE_ANIM__
00080 
00081 #endif /* __epoc_keypress_anim_hpp__ */
00082 
00083 /**
00084 
00085 epoc-keypress-anim.hpp
00086 
00087 Copyright 2009 Helsinki Institute for Information Technology (HIIT)
00088 and the authors. All rights reserved.
00089 
00090 Authors: Tero Hasu <tero.hasu@hut.fi>
00091 
00092 Permission is hereby granted, free of charge, to any person
00093 obtaining a copy of this software and associated documentation files
00094 (the "Software"), to deal in the Software without restriction,
00095 including without limitation the rights to use, copy, modify, merge,
00096 publish, distribute, sublicense, and/or sell copies of the Software,
00097 and to permit persons to whom the Software is furnished to do so,
00098 subject to the following conditions:
00099 
00100 The above copyright notice and this permission notice shall be
00101 included in all copies or substantial portions of the Software.
00102 
00103 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00104 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00105 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00106 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00107 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00108 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00109 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00110 SOFTWARE.
00111 
00112  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1