uint32
SymbianFileHandler::getModificationDate() const
{
   // The day the unix time starts. Used to get the time down
   // to a reasonable value.
   TDateTime epoch( 1970, EJanuary, 01, 0 , 0 , 0 , 0);
   TTime aTime( epoch );
   TInt res = m_fileServer.Modified( *m_fileName16, aTime );
   if ( res != KErrNone ) {
      return MAX_UINT32;
   }
   TTimeIntervalMicroSeconds interval = aTime.MicroSecondsFrom( epoch );   
   return LOW( interval.Int64() / 1000000 );
}
Ejemplo n.º 2
0
const char *MSLabelOut::formatOutput(MSString &buffer_,double data_)
{
  if (data_<UINT_MAX)
   {
     unsigned index=unsigned(data_);
     if (index<labels().length())
      {
	buffer_=labels()(index);
	return buffer_.string();
      }
   }
  switch (format().formatType())
   {
   case MSFormat::Date:
     {
       MSDate aDate((MSJulian)data_);
       return aDate.format(buffer_,format());
     }
   case MSFormat::Money:
     {
       MSMoney aMoney(data_);
       return aMoney.format(buffer_,format());
     }
   case MSFormat::Rate:
     {
       MSRate aRate(data_);
       return aRate.format(buffer_,format());
     }
   case MSFormat::Time:
     {
       MSTime aTime((time_t)data_);
       return aTime.format(buffer_,format());
     }
   case MSFormat::Float:
   default:
     {
       MSFloat aFloat(data_);
       return aFloat.format(buffer_,format());
     }
   }
  /* return buffer_.string(); */
}
Ejemplo n.º 3
0
 void AbstractMonitorItem::incrementTimer() {
   second++;
   QTime aTime(0,0,second,0);
   lblTime->setText(aTime.toString("hh:mm:ss"));
 }
Ejemplo n.º 4
0
int
main(int argc, char **argv)
{
    int winWidth, winHeight, display;
    sail sageInf; // sail object
    double rate = 10;  //by default stream at 1fps

    aInitialize();

    if (argc < 6)
    {
        fprintf(stderr, "\nUsage> VNCviewer <hostname> <display#> <width> <height> <password> [fps]\n\n");
        exit(0);
    }

        // VNC Init
    server    = strdup(argv[1]);
    display   = atoi(argv[2]);
    winWidth  = atoi(argv[3]);
    winHeight = atoi(argv[4]);
    passwd    = argv[5];
    if (argc > 6)
        rate = atoi(argv[6]);


#if defined(USE_LIBVNC)
    // get a vnc client structure (don't connect yet).
    // bits, channels, bytes
    vnc = rfbGetClient(8,3,4);
    vnc->canHandleNewFBSize = FALSE;
    // to get position update callbacks
    vnc->appData.useRemoteCursor=TRUE;
    //vnc->appData.compressLevel=3;
    //vnc->appData.qualityLevel=5;

    /* open VNC connection */
    vnc->MallocFrameBuffer=resize_func;
    vnc->GotFrameBufferUpdate=update_func;
    vnc->HandleCursorPos=position_func;
    vnc->GetPassword=password_func;
    //client->FinishedFrameBufferUpdate=frame_func;


    int margc = 2;
    char *margv[2];
    margv[0] = strdup("vnc");
    margv[1] = (char*)malloc(256);
    memset(margv[1], 0, 256);
    sprintf(margv[1], "%s:%d", server, display);
    if(!rfbInitClient(vnc,&margc,margv)) {
        printf("usage: %s server:port password\n"
               "VNC client.\n", argv[0]);
        exit(1);
    }
    if (vnc->serverPort==-1)
        vnc->vncRec->doNotSleep = TRUE; /* vncrec playback */

    winWidth  = vnc->width;
    winHeight = vnc->height;

#else

        // Connection to VNC server:
        //	host, display number, x offset, y offset, width, height, passwd
        //	passwd is by default 'evl123' but a different one can be specified so that one will be used
    vnc = new sgVNCViewer(server, display, 0,0,winWidth,winHeight, passwd);
#endif

        // Sage Init
    sailConfig scfg;
    scfg.init("VNCViewer.conf");
    scfg.setAppName("VNCViewer");
    scfg.rank = 0;

    scfg.resX = winWidth;
    scfg.resY = winHeight;

    sageRect renderImageMap;
    renderImageMap.left = 0.0;
    renderImageMap.right = 1.0;
    renderImageMap.bottom = 0.0;
    renderImageMap.top = 1.0;

    scfg.imageMap = renderImageMap;
#if defined(VNC_SAGE_USE_24bit)
    scfg.pixFmt = PIXFMT_888;
#else
    scfg.pixFmt = PIXFMT_8888;
#endif
    scfg.rowOrd = TOP_TO_BOTTOM;
    scfg.master = true;

    sageInf.init(scfg);


        // data pointer
    unsigned char *buffer = 0;
    unsigned char *vncpixels;

    double t1, t2;
    t1 = aTime();

        // Main lopp
    while (1)
    {
#if defined(USE_LIBVNC)
        double now = sage::getTime();
        while ( (sage::getTime() - now) < (1000000/rate)) {
            int i=WaitForMessage(vnc,100000);
            if(i<0) {
                rfbClientLog("VNC error, quit\n");
                sageInf.shutdown();
                exit(0);
            }
            if(i) {
                if(!HandleRFBServerMessage(vnc)) {
                    rfbClientLog("HandleRFBServerMessage quit\n");
                    sageInf.shutdown();
                    exit(0);
                }
            }
        }

        // Copy VNC buffer into SAGE buffer
        buffer    = (unsigned char *) sageInf.getBuffer();
        vncpixels = (unsigned char *) vnc->frameBuffer;

        for (int k =0 ; k<winWidth*winHeight; k++) {
            buffer[3*k + 0] = vncpixels[ 4*k + 0];
            buffer[3*k + 1] = vncpixels[ 4*k + 1];
            buffer[3*k + 2] = vncpixels[ 4*k + 2];
        }


        // SAGE Swap
        sageInf.swapBuffer( );

        // Process SAGE messages
        sageMessage msg;
        if (sageInf.checkMsg(msg, false) > 0) {
            switch (msg.getCode()) {
            case APP_QUIT:
                sageInf.shutdown();
                exit(0);
                break;
            }
        }
#else

        if (!vnc->Step())
        {
            sageInf.shutdown();
            exit(0);
        }

            // if it's been (roughly) xxx second since the last
            // sent frame, send another one
        t2 = aTime();
        if ( (t2-t1) > (1.0/rate) )
        {

                //fprintf(stderr, "Rate: %.2f\n", 1.0/(t2-t1) );
            buffer = (unsigned char *) sageInf.getBuffer();
            vncpixels = (unsigned char *) vnc->Data();
#if defined(VNC_SAGE_USE_24bit)
            for (int k =0 ; k<winWidth*winHeight; k++) {
                buffer[3*k + 0] = vncpixels[ 4*k + 0];
                buffer[3*k + 1] = vncpixels[ 4*k + 1];
                buffer[3*k + 2] = vncpixels[ 4*k + 2];
            }
#else
            memcpy(buffer, (unsigned char *) vnc->Data(), winWidth*winHeight*4);
#endif
            sageInf.swapBuffer( );
            t1 = aTime();
        }

        sageMessage msg;
        if (sageInf.checkMsg(msg, false) > 0) {
            switch (msg.getCode()) {
                case APP_QUIT:
                    exit(0);
                    break;
            }
        }
#endif
    }

    return 1;
}