×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Communication between Connection and Logic Class

    So I'm creating an application that uses the same type of framework that the chat example implements. My difference is that in my case I will have some server side authentication going on. This means that I will need to test some received messages and then handle the UI accordingly. My problem is that I don't know how to either:

    1) Test in the Connection class and alert the UI that authentication has passed/failed.

    or

    2) Test the received message in the UI for validation. The problem here is that the UI won't know when the message has been received to test it in the first place.

    What the best way to approach this problem?

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    47

    Re: Communication between Connection and Logic Class

    Hi,
    You can use call back mechanism.
    Now suppose you wanna to give callback to container class where you are making object of your communication class. So have to add listener in communication class and as soon as you received authentication, you can give callback. Consider following code

    Call back class
    class CommCallback
    {
    public:
    pure virtual void CallbackFun(TInt aErrorCode, const TDesC& aMessage)=0;
    }


    now derive your view class from this class

    class MyViewublic CAknview, public CommCallback
    {
    :
    :
    :
    public:
    void CallbackFun(TInt aErrorCode, const TDesC& aMessage);

    private:
    //your comm class object
    CCommunicationToServer* iServer;
    }

    in CCommunicationToSErver class include
    CommCallback& iListener; as a member.

    Initialise iLister in Constructor;

    Now whenever you want to inform your view class, just call
    Listener.GiveCallback(errorcode, message);
    In this way UI can be informed.

Similar Threads

  1. HTTP Connection problem
    By bacalao in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2007-02-02, 13:39
  2. stream connection throws IOException
    By getbalajim in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-02-08, 13:29
  3. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-08-31, 18:47
  4. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java General
    Replies: 0
    Last Post: 2004-08-31, 18:45
  5. How to discover a connection close
    By jacobckh in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-10-21, 09:00

Posting Permissions

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