SMS Reading
| Mon, 2007-12-03 17:06 | |
|
Hi all, I am using the below code for SMS receiving in 60 series 3rd edition and using carbide.c++ but i got a error for declaring object; void CinboxreadAppUi::ConstructL() iSmsreceiver = CSMSReceiver::NewL(iObserver); } class CSMSReceiver; CSMSReceiver* iSmsreceiver; MSMSRecCallBack* iObserver; please help me for solving the error i.e. illegal implicit conversion from MSMSRecCallBack* to MSMSRecCallBack& Sanjay Singh |
|






Forum posts: 1058
Just a guess: Try this, with an added "*" for more C++ fun:
iSmsreceiver = CSMSReceiver::NewL(*iObserver);René Brunner
Forum posts: 6
Thanks for reply but i have already tried this but still getting problem
this time i make changes in SMSReceive.h
class MSMSRecCallBack;
MSMSRecCallBack& iObserver;
and in appui.cpp
iSMSReceiver = CSMSReceiver :: NewL(*iObserver);
but i got error
a pointer/array type was expected for this operation instead of MSMSRecCallBack
& reference member 'iObserver' is not initialise
actually i am using SMSReceiver.cpp and SMSReceiver.h code is there any other way to read the content of inbox message in 9.1.
Sanjay Singh
Forum posts: 34
Hi sanjay,
Do little modification as follows:
Derive your Appui class with MSMSRecCallBack and
Implements all methods of MSMSRecCallBack in Appui
Create object of CSMSReceiver iSmsreceiver = CSMSReceiver::NewL(*this);
Thanks & Regards,
Symbi
Forum posts: 6
Hi,
I tried this CSMSReceiver iSmsreceiver = CSMSReceiver::NewL(*this); but stll I am getting error.
Please help if there is any alternative.
Thanks.
Sanjay Singh
Forum posts: 2
await.....
Forum posts: 37
Hi,
I am just a beginner and am trying to help!!!!
May not be technicaly so good(neither symbian nor C++).So, please forgive if I write anything wrong....
I am not sure, but ,think something wrong in the way ---------
void CinboxreadAppUi::ConstructL()
{
iSmsreceiver = CSMSReceiver::NewL(iObserver);
}
MSMSRecCallBack* iObserver;
------------------------------------------------------------
Here,
1.Constructor is called to initialise heap memory of AppUi class.
2.All pointer type member variables are initialised to NULL
3.Then 2-phase constructor starts
4.Pointer variables are to be initialised there.
5. iSmsreceiver = CSMSReceiver::NewL(iObserver);
--------This line requires that "iObserver"(which is also a pointer variable) should be initalised inside ConstructL() before a call to this line is made.
------So, it depends on sequence of calls to initialise pointer variables
So, there arises 3 options
a.make sure "iObserver" is initialised before iSmsReceiver(in ur second reply you have used "&iObserver" which gives error "& reference member 'iObserver' is not initialise")
b.else make iObserver a direct variable , not pointer variable(not sure if it can be done)
c.else use inheritance to get "iObserver" object
About other approach->
To read body of incoming sms, there is another approach in osv9.2
derive from MMsvSessionObserver,
and write your code under case EMsvEntries Created:
of HandleSessionEvent()
Sorry if I am wrong!!!!!!!!
Forum posts: 95
Hi,
The solution suggested by Rene should work.
Do not change the definition of "iObserver", keep it as a pointer variable.
//In .h header file
class CSMSReceiver;
class MSMSRecCallBack;
CSMSReceiver* iSmsreceiver;
MSMSRecCallBack* iObserver;
//In .cpp file
void CinboxreadAppUi::ConstructL()
{
iSmsreceiver = CSMSReceiver::NewL(*iObserver);
//This must be declared as " CSMSReceiver::NewL(MSMSRecCallBack& )" in its header file
}
Chao,
Raghav
Forum posts: 33
MSMSRecCallBack& iObserver;This will not work as wheneve u declare a referance it shoul b initialised (irrespective of the type of reference).
So the soln posted by raghav_an sud work .if its not pls tell the error u r getting so that we can help.
Regards,
Amogh
Amogh