E32USER-CBase No. 46 when trying to write to file

Login to reply to this topic.
Thu, 2006-04-27 16:12
Joined: 2005-10-10
Forum posts: 37
Hi all,

I'm using the Mobinfo library to collect network parameters and i'm trying to write them on to a file.  I'm getting Error Number 46.  But the file is getting created... Also there are some junk characters in the file

This is the code i use:
Code:
/*****************************************************************************

Description: CMobInfoActive.cpp
*****************************************************************************/

#include "eikenv.h"
#include "CallEngine.h"
#include <e32cons.h>

#ifndef __WINSCW__
_LIT(KLog_try3, "C:\\NetworkLog.txt");
_LIT(KDummy, "");
_LIT(KFiller, "$");
#else
        _LIT(KLog_try3, "C:\\NetworkLog.txt");
_LIT(KDummy, "");
_LIT(KFiller, "$");
#endif


CMobInfoActive* CMobInfoActive::NewL(CCallEngineAppView* aAppView)
{
CMobInfoActive* self=new(ELeave) CMobInfoActive;
CleanupStack::PushL(self);
self->ConstructL(aAppView);
CleanupStack::Pop(self);
return self;
}

CMobInfoActive::CMobInfoActive() : CActive(0)
{
}

void CMobInfoActive::ConstructL(CCallEngineAppView* aAppView)
{
iAppView=aAppView;

mi = CMobileInfo::NewL();
ni = CMobileNetworkInfo::NewL();
iMobileContext = CMobileContext::NewL();

User::LeaveIfError(iFileSession.Connect());
if(iFile.Open(iFileSession,KLog_try3,EFileWrite)==KErrNone)
{
fileWriteBuf.Copy(KDummy);
iFile.Write(fileWriteBuf);
iFile.Flush();
}
else
{
iFile.Create(iFileSession,KLog_try3,EFileWrite);

fileWriteBuf.Copy(KDummy);
iFile.Write(fileWriteBuf);
iFile.Flush();
}


CActiveScheduler::Add(this);
}

CMobInfoActive::~CMobInfoActive()
{
iFile.Close();
iFileSession.Close();
Cancel();
delete mi;
delete ni;
delete iMobileContext;

}

void CMobInfoActive::Start()
{
_LIT(KMobinfoPanic, "Mobinfo panic");
__ASSERT_ALWAYS(!IsActive(), User::Panic(KMobinfoPanic, 1));

state = 1;
mi->GetIMSI(imsi, iStatus);
SetActive();
}


void CMobInfoActive::RunL()
{
if(state == 1)
{

fileWriteBuf.Append(KFiller);
fileWriteBuf.Append(imsi);
state = 2;
iAppView->imsi = imsi;
ShowText();

mi->GetIMEI(imei, iStatus);
SetActive();
}
else if(state == 2)
{
fileWriteBuf.Append(KFiller);
fileWriteBuf.Append(imei);
state = 3;
iAppView->imei = imei;
ShowText();

ni->GetCellId(cellid, iStatus);
SetActive();
}
else if(state == 3)
{
fileWriteBuf.Append(KFiller);
fileWriteBuf.Append(cellid);
state = 4;
iAppView->cellid = cellid().iCellId;
ShowText();
iMobileContext->GetSignalStrengthLevel(SignalStrength,iStatus);
SetActive();
}
else if(state == 4)
{
fileWriteBuf.Append(KFiller);
fileWriteBuf.Append(SignalStrength);
state = 5;
iAppView->SignalStrength = SignalStrength;
ShowText();
ni->GetHomeNetwork(iNetwork,iStatus);
SetActive();

}
else if(state == 5)
{
fileWriteBuf.Append(KFiller);
fileWriteBuf.Append(iNetwork.iNetworkCountryCode);
state=6;
iAppView->iMCC = iNetwork.iNetworkCountryCode;
ShowText();

fileWriteBuf.Append(KFiller);
iFile.Write(fileWriteBuf,iStatus);

}
else if(state == 6)
{
if(!IsActive())
{
iFile.Flush();
}
else
{
state=6;
//SetActive();
}

}

}

void CMobInfoActive::DoCancel()
{

}
void CMobInfoActive::ShowText()
{
iAppView->DrawNow();
}


Do correct me if i'm wrong....

This is the file that is created: NetworkLog.txt

$404220400113879$351965-00-888252-3-03$   0             0   2 2                 [   $$404$


I'm not able to understand where i'm going wrong....

Thanks...

The Cruise is on...


Thu, 2006-04-27 17:17
Guest (not verified)
Forum posts: 2043
Re: E32USER-CBase No. 46 when trying to write to file
How about a SetActive() when your state is 5
Thu, 2006-04-27 18:10
Joined: 2005-10-10
Forum posts: 37
Re: E32USER-CBase No. 46 when trying to write to file
Really silly error!!!! Grin

Solved it...

But i still get only junk characters in the file:

The output is as follows:
$404220400113879$351965-00-888252-3-03$   0             0   2 2                 [   $$404$




The Cruise is on...

  • Login to reply to this topic.