common class

Login to reply to this topic.
Mon, 2008-03-17 17:50
Joined: 2008-03-11
Forum posts: 26

Hi, i would like to share some information between 2AOs and somebody told me to create a common class. The idea of creating a common class isn't clear for me. Which is the structure of doing a common class? Sorry for the question but i'm very lost. thanks


Mon, 2008-03-17 18:38
Joined: 2007-09-23
Forum posts: 132
Re: common class

It is impossible to answer without more details. For example, are both AOs owned by another class, or owned by separate classes, does one AO own or could it own the other? Is it data you want to share or notifications? What sort of data?

Mon, 2008-03-17 20:50
Joined: 2008-03-11
Forum posts: 26
Re: common class

Both AO are in different classes(AO1 and AO2). I want to share the data that I receive with AO1 with the AO2. Is it possible? thanks!

Tue, 2008-03-18 17:46
Joined: 2007-09-23
Forum posts: 132
Re: common class

I know both active objects are in different classes A01 and A02, it could not be any other way. What I meant is who owns them, are they owned and created by the same class or by separate classes, if by separate classes is there another class that creates both those etc. etc.?

Sun, 2008-03-23 12:48
Joined: 2008-03-11
Forum posts: 26
Re: common class

Hello!
This is the structure of my application. First of all, I opened the helloworldbasic example to learn a little bit of symbian. Then I added both AOs in different classes and they are called in the helloworlbasicappui.cpp. Now I want to share information between AOs, precisely data information because the first AO receives information of a bluetooth device and I want to send this information in a http connection. I hope this is clear so anybody can help me. Thanks!

Tue, 2008-03-25 09:12
Joined: 2008-03-11
Forum posts: 26
Re: common class

Please can anybody help me?

Tue, 2008-03-25 09:20
Joined: 2005-11-20
Forum posts: 1058
Re: common class

You can use the AppUi as an "information center" for your program. See e.g. here:
http://www.newlc.com/forum/transmitting-data-between-views


René Brunner

Wed, 2008-03-26 09:26
Joined: 2008-03-11
Forum posts: 26
Re: common class

I've read this link but have you got any examples of the use of Appui as an "information center"?does anybody know any link to check to learn more information about this?thanks

Wed, 2008-03-26 09:55
Joined: 2005-11-20
Forum posts: 1058
Re: common class

Maybe there is a lot less to it than you think: Just declare some public member variables in your AppUi class, set them in one view and read them in another view...


René Brunner

Wed, 2008-03-26 10:06
Joined: 2008-03-11
Forum posts: 26
Re: common class

So, I declare for example:
TBuf8<20> t;
in the public part of the AppUi class. And then if I use this variable in another class it will be available? I've tried this and it's not.

Wed, 2008-03-26 10:23
Joined: 2005-11-20
Forum posts: 1058
Re: common class

Your comment sounds very strange. That has really not much to do with Symbian, but that's basic C++, just get a pointer to the AppUi and then access like this:

appUi->t

How to get a pointer to the AppUi is decribed in the other post that I linked to.


René Brunner

Wed, 2008-03-26 11:45
Joined: 2008-03-11
Forum posts: 26
Re: common class

I'm sorry but I can't find the description of how to get a pointer to the AppUi in the link Sad

Wed, 2008-03-26 11:55
Joined: 2005-11-20
Forum posts: 1058
Re: common class

"The AppUI is visible from everywhere at any time with the help of CEikonEnv::Static()."

Or, more exactly, the EikAppUi() method of the returned object gives you a pointer to the AppUi. You are then just a type transfer away from a pointer to your AppUi, like this:

(MyAppUi*)(CEikonEnv::Static()->EikAppUi())


René Brunner

  • Login to reply to this topic.