×

Discussion Board

Results 1 to 10 of 10

Thread: Redraw display

  1. #1
    Registered User
    Join Date
    May 2007
    Location
    Slovakia
    Posts
    12

    Redraw display

    Hi, i have an app (edited bluetooth point to point from SDK with removed listboxes) that connects to remote bluetooth GPS device and read data from it. But how to periodically redraw display with incoming data from gps?

    I have implemented CProjectAppView::Draw() function.

  2. #2
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: Redraw display

    You can use the existing listbox to show the results, you can also use the screen directly using DrawText() inside Draw() function, and there are other options as well, it depends what will suit your requirement.

  3. #3
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Redraw display

    Call DrawNow or DrawDeferred on your CCoeControl "view" to get it re-paint itself.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  4. #4
    Registered User
    Join Date
    May 2007
    Location
    Slovakia
    Posts
    12

    Re: Redraw display

    So, ive tried DrawDeferred & DrawNow, but with problems.

    Lets stop talking, here is the code (BTPO):

    MessageClient.cpp

    Code:
    //-------------------------------------------------------------
    // CMessageClient::WaitOnConnectionL()
    // Wait for data or disconnection (reading data from socket to iSentence)
    // ------------------------------------------------------------
    //
    void CMessageClient::WaitOnConnectionL()
        {
        if ( iState != EConnected )
            {
            User::Leave( KErrDisconnected );
            }
    
            iSendingSocket.Read( iSentence, iStatus );
            SetActive();
        }
    MessageClient.h

    Code:
    ...
    private:
    
        TBuf8<100> iSentence; // data from socket
    So i wrote method for getting data

    MessageClient.cpp

    Code:
    //-------------------------------------------------------------
    // TDesC8& CMessageClient::ReturnGpsData ( void )
    // Returns data as TDesC8
    // ------------------------------------------------------------
    //
    TDesc8& CMessageClient::ReturnGpsData ( void )
    {
        if (!IsConnected())
        {
            iSentence.Copy(_L("No GPS"));
            return iSentence;
        }
        return iSentence;
    }
    and this method i call from ProjektAppView.cpp:

    Code:
    //-------------------------------------------------------------
    // CProjektAppView::Draw()
    // Draws the display
    //-------------------------------------------------------------
    //
    void CProjekctAppView::Draw( const TRect& /*aRect*/  ) const
    {
        CWindowGc& gc = SystemGc();
        TRect rect = Rect();
        gc.Clear( rect );
        
        CEikonEnv* eikonEnv = CEikonEnv::Static();   
        gc.UseFont(eikonEnv->DenseFont());
    
        TBuf16<100> gpsdata;
        TBuf8<100> tmp;
    
        tmp = iMessageClient->ReturnGpsData();
        gpsdata.Copy(tmp);
    
        TPoint point (5, 15);
        gc.SetPenColor(KRgbBlack);
        gc.DrawText(gpsdata, point);
    }
    But nothing comes to display...
    Last edited by ltomuta; 2008-07-06 at 16:52. Reason: Use [code][/code] whenever suitable, it makes the code easier to read

  5. #5
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Redraw display

    You do not show the relevant code, the RunL where you're notified of having new data and where presumably you let the view know that it should redraw itself. Where's your DrawDeferred call?

    Btw, if your aim is accessing the GPS data I would advice you to use the Location Acquisition API, it saves you all this Bluetooth communication headache (or should I say toothache)
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  6. #6
    Registered User
    Join Date
    May 2007
    Location
    Slovakia
    Posts
    12

    Re: Redraw display

    Ok, my question was bad. When i put for example CAknInformationNote with gps data in RunL (EConnected), it shows peridocally all incoming data. So my problem is how to get the data into CProjectAppView. I can get it in CProjectAppUi via instance of iClient, but when i make a new instance in CProjectAppView, my access method returns only dummy buffer.

  7. #7
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Redraw display

    Define an observer and implement it in the View, then pass the view as as parameter to the active object so that it can be notified from RunL that something has happen.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  8. #8
    Registered User
    Join Date
    May 2007
    Location
    Slovakia
    Posts
    12

    Re: Redraw display

    So, thanks, i have implemented small data-transfer observer, my AppView.h has now ability to show the relevant data, but only with display update (Draw). When i try rewrite Draw to DrawNow or DrawDeferred, display becomes only blank-white.

    Can you please show me how to correctly call DrawNow or DrawDeferred?

  9. #9
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: Redraw display

    Code:
    MWantToKnow
    {
    NowYouKnow()=0;
    }
    
    CCurious: CCoeControl, MWantToKnow
    {
    NowYouKnow()
        {GetDataFromEngine(); DrawDeferred();};
    Draw(){//draw label, implicitly or explicitly};
    GetDataFromEngine()
        {iLabel = Engine().GetValue();};
    
    iLabel;
    }
    
    CEngine:CActive
    {
    NewL(MWantToKnow&);
    StartJob();
    RunL(}
        {iCurious.NowYouKnow()}
    
    MWantToKnow& iCurious
    }
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  10. #10
    Registered User
    Join Date
    May 2007
    Location
    Slovakia
    Posts
    12

    Re: Redraw display

    Itomuta, thanks. Your example has solved my big problem.

Similar Threads

  1. Recording in Amr Format
    By losym in forum Symbian Media (Closed)
    Replies: 12
    Last Post: 2009-03-26, 06:41
  2. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  3. Camera streaming to display , how?
    By skela in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2007-11-12, 15:06
  4. Game Developement - Display object on a image background
    By kenkwokkam in forum Mobile Java General
    Replies: 0
    Last Post: 2003-02-08, 14:58
  5. Display question ...
    By kapot in forum Mobile Java General
    Replies: 0
    Last Post: 2002-10-14, 22:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •