[Qt-interest] static function emitting signal

Chandru... sekarwagmare at gmail.com
Thu Mar 25 04:31:03 CET 2010


its not working or i dont know how to use your siggestion ...

see my call back function
void
QtFpsThread::UserCallBack(FTR_USER_CTX Context,FTR_STATE
StateMask,FTR_RESPONSE *pResponse,FTR_SIGNAL Signal,FTR_BITMAP_PTR pBitmap)
//static function
{
   LPBIOPERPARAMS   lpboc = (LPBIOPERPARAMS)Context;            // biometric
operation context
   FTR_PROGRESS     *lpPrgData;       // current progress data
   char             prgTitle[MAX_FILE_NAME];     // progress window text

   //lpboc = (LPBIOPERCONTEXT)Context;
   lpPrgData = (FTR_PROGRESS *)pResponse;


      if( (StateMask & FTR_STATE_SIGNAL_PROVIDED) )
   {
      switch( Signal )
      {
      case FTR_SIGNAL_TOUCH_SENSOR:
                //this->captureImage();
                printf("put your finger on scanner..\n");
                 break;

      case FTR_SIGNAL_TAKE_OFF:
         if( lpboc && lpboc->ioType == BO_ENROLL )
         {
            // update progress
            sprintf( prgTitle, "Enroll %d of %d", (int)lpPrgData->dwCount,
(int)lpPrgData->dwTotal );

         }
                printf("take off the finger from scanner\n");

         break;

      case FTR_SIGNAL_FAKE_SOURCE:
         {
            if( lpboc )
            {
printf( "Undefined signal value" );
         break;
      }                                // switch( Signal )
   }
}


so instead of this printf i should use QString or emit a signal ......


On Thu, Mar 25, 2010 at 4:20 AM, Colin S. Miller <
no-spam-thank-you at csmiller.demon.co.uk> wrote:

> Gabriel M. Beddingfield wrote:
> >
> > A lot of callback API's will do something like this:
> >
> >     typedef void (*SomeCallbackType)(void* arg);
> >     int register_callback(SomeCallbackType function, void* arg);
> >
> > the 'arg' is a handle to... anything you want.  When wrapping this sort
> > of callback API in C++, it's common to do this:
> >
> > class Foo {
> > public:
> >     Foo() {}
> >
> >     static void _callback(void* arg) {
> >         Foo* that = static_cast<Foo*>(arg);
> >     that->my_callback();
> >     }
> >
> > protected:
> >     void my_callback() {
> >         // Do your real work here
> >     }
> > };
> >
> > int main()
> > {
> >     Foo f;
> >     register_callback(Foo::_callback, &f);
> >
> >     //...
> > }
> >
>
> Shouldn't static_cast be reinterpret_cast   ?
>
> Colin S. Miller
>
> --
> Replace the obvious in my email address with the first three letters of the
> hostname to reply.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
WAGMARE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100325/c8870a84/attachment.html 


More information about the Qt-interest-old mailing list