Hi! Can u tell me whats wrong in this code? Thanks
Hi guys, i am trying to get the IMSI of N6630. I've searched samples on how to get it, fortunately, i've found one. But this code gives me some errors. Could you look at it and tell whats possibly wrong with this code. Thanks!
Here's the code for getting the imsi:
[CODE]
RTelServer iServer;
RMobilePhone iPhone;
[COLOR="Red"]RMobilePhone::TMobilePhoneSubscriberId imsi;[/COLOR]
TRequestStatus iImsiStatus;
RTelServer::TPhoneInfo info;
User::LeaveIfError(iServer.Connect());
CleanupClosePushL(iServer);
User::LeaveIfError(iServer.GetPhoneInfo(0, info));
User::LeaveIfError(iPhone.Open(iServer, info.iName));
CleanupClosePushL(iPhone);
[COLOR="red"]iPhone.GetSubscriberId(iImsiStatus, imsi);[/COLOR]
User::WaitForRequest(iImsiStatus);
[COLOR="red"]iImsi.Copy(imsi);[/COLOR]
iPhone.Close();
CleanupStack::PopAndDestroy(&iPhone);
iServer.Close();
CleanupStack::PopAndDestroy(&iServer);[/CODE]
The highlighted lines gives an error of:
[QUOTE]
`imsi undeclared(first use this function)
`TMobilePhoneSubriberId' is not a member of type `RMobilePhone'
confused by earlier errors, bailing out
parse error before `;'
[/QUOTE]
Thanks guys for helping! :)
Re: Hi! Can u tell me whats wrong in this code? Thanks
Just guessing as may require platform / SDK information is missing.
1) You have not included header files required.
2) You are sdk does no have required headers.
Re: Hi! Can u tell me whats wrong in this code? Thanks
[QUOTE=skumar_rao;441565]Just guessing as may require platform / SDK information is missing.
1) You have not included header files required.
2) You are sdk does no have required headers.[/QUOTE]
Thanks for quick reply,
Umm i have included the <etelmm.h> and linked against <etelmm.lib> is there any other headers that should be included?
Can you check if i have the correct header file..
Below is the etelmm.h source code:
[CODE]
// ETELMM.H
//
// Copyright (c) 1997-2003 Symbian Ltd. All rights reserved.
//
#ifndef __ETELMM_H__
#define __ETELMM_H__
#include <e32base.h>
#include <s32mem.h>
#include <etel.h>
class RMobilePhone : public RPhone
{
// cut-down version of this class for compilation consistency
public:
// class needed to support TMobilePhoneStoreEntryV1 below
class TMultimodeType
{
public:
IMPORT_C TInt ExtensionId() const;
protected:
TMultimodeType();
void InternalizeL(RReadStream& aStream);
void ExternalizeL(RWriteStream& aStream) const;
protected:
TInt iExtensionId;
};
// enum needed by TGsmSmsTypeOfAddress in gsmuelem.h
enum TMobileTON
{
EUnknownNumber, // 0
EInternationalNumber, // 1
ENationalNumber, // 2
ENetworkSpecificNumber, // 3
ESubscriberNumber, // 4 - Also defined as "dedicated, short code" in GSM 04.08
EAlphanumericNumber, // 5
EAbbreviatedNumber // 6
};
// enum needed by TGsmSmsTypeOfAddress in gsmuelem.h
enum TMobileNPI
{
EUnknownNumberingPlan =0,
EIsdnNumberPlan=1,
EDataNumberPlan=3,
ETelexNumberPlan=4,
EServiceCentreSpecificPlan1=5,
EServiceCentreSpecificPlan2=6,
ENationalNumberPlan=8,
EPrivateNumberPlan=9,
EERMESNumberPlan=10
};
// enum needed below
enum
{
KMaxMobilePasswordSize=10,
KMaxMobileNameSize=32,
KMaxMobileTelNumberSize=100
};
// class needed to support TMobileGsmSmsEntryV1 below
class TMobileAddress
{
public:
IMPORT_C TMobileAddress();
void InternalizeL(RReadStream& aStream);
void ExternalizeL(RWriteStream& aStream) const;
public:
TMobileTON iTypeOfNumber;
TMobileNPI iNumberPlan;
TBuf<KMaxMobileTelNumberSize> iTelNumber;
};
// typedef used by TGsmSmsSlot in gsmumsg.h
typedef TBuf<KMaxMobileNameSize> TMobileName;
// enum needed for CCommsDbAccess in dbaccess.h
enum TMobilePhoneNetworkMode
{
ENetworkModeUnknown,
ENetworkModeUnregistered,
ENetworkModeGsm,
ENetworkModeAmps,
ENetworkModeCdma95,
ENetworkModeCdma2000,
ENetworkModeWcdma
};
};
// class needed to support RMobilePhoneStore below
class RMobilePhoneStore : public RTelSubSessionBase
{
// cut-down version of this class for compilation consistency
public:
// class needed to support TMobileSmsEntryV1 below
class TMobilePhoneStoreEntryV1 : public RMobilePhone::TMultimodeType
{
protected:
TMobilePhoneStoreEntryV1();
public:
void InternalizeL(RReadStream& aStream);
void ExternalizeL(RWriteStream& aStream) const;
public:
TInt iIndex;
};
};
class RMobileSmsMessaging
{
// cut-down version of this class for compilation consistency
public:
// enum needed below
enum
{
KGsmTpduSize = 165, // 140 bytes user data + 25 bytes TPDU header
KCdmaTpduSize = 256 // Max size of Bearer Data in Transport Layer message
};
// typedef needed below
typedef TBuf8<KGsmTpduSize> TMobileSmsGsmTpdu;
// enum needed by CSmsSettings in smutset.h
enum TMobileSmsBearer
{
ESmsBearerPacketOnly,
ESmsBearerCircuitOnly,
ESmsBearerPacketPreferred,
ESmsBearerCircuitPreferred
};
};
class RMobileSmsStore : public RMobilePhoneStore
{
// cut-down version of this class for compilation consistency
public:
// enum needed to support CSmsMessage in gsmumsg.h and gsmumsg.inl
enum TMobileSmsStoreStatus
{
EStoredMessageUnknownStatus,
EStoredMessageUnread,
EStoredMessageRead,
EStoredMessageUnsent,
EStoredMessageSent,
EStoredMessageDelivered
};
// class needed to support TMobileGsmSmsEntryV1 below
class TMobileSmsEntryV1 : public RMobilePhoneStore::TMobilePhoneStoreEntryV1
{
public:
void InternalizeL(RReadStream& aStream);
void ExternalizeL(RWriteStream& aStream) const;
protected:
TMobileSmsEntryV1();
public:
TMobileSmsStoreStatus iMsgStatus;
};
// class needed to support a TGsmSlot constructor used in file gsmumsg.h
class TMobileGsmSmsEntryV1 : public TMobileSmsEntryV1
{
public:
void InternalizeL(RReadStream& aStream);
void ExternalizeL(RWriteStream& aStream) const;
public:
IMPORT_C TMobileGsmSmsEntryV1();
public:
RMobilePhone::TMobileAddress iServiceCentre;
RMobileSmsMessaging::TMobileSmsGsmTpdu iMsgData;
};
};
#endif
[/CODE]
Im guessing that this is not the right header file for getting the IMSI, am i correct?
Thanks again.
Re: Hi! Can u tell me whats wrong in this code? Thanks
Try including both
#include <etel.h>
#include <etelmm.h>
Re: Hi! Can u tell me whats wrong in this code? Thanks
[QUOTE=skumar_rao;441568]Try including both
#include <etel.h>
#include <etelmm.h>[/QUOTE]
I have included both, still same errors..
Re: Hi! Can u tell me whats wrong in this code? Thanks
can you show us total error you are getting from "abld build armi urel" command by pasting it here.
Re: Hi! Can u tell me whats wrong in this code? Thanks
[QUOTE=skumar_rao;441574]can you show us total error you are getting from "abld build armi urel" command by pasting it here.[/QUOTE]
Here is it
[CODE]
removed for some reasons
[/CODE]
Thanks for helping..
Re: Hi! Can u tell me whats wrong in this code? Thanks
as it says [B]TMobilePhoneSubscriberId' is not a member of type `RMobilePhone'[/B]
so replace RMobilePhone::TMobilePhoneSubscriberId imsi; with [B]TBuf<15> imsi;[/B]
Re: Hi! Can u tell me whats wrong in this code? Thanks
[QUOTE=skumar_rao;441577]as it says [B]TMobilePhoneSubscriberId' is not a member of type `RMobilePhone'[/B]
so replace RMobilePhone::TMobilePhoneSubscriberId imsi; with [B]TBuf<15> imsi;[/B][/QUOTE]
an error of "no matching function for call to `RMobilePhone::GetSubscriberId(TRequestStatus &, TBuf<15>&)'" occured
Re: Hi! Can u tell me whats wrong in this code? Thanks
from header
typedef TBuf<KIMSISize> TMobilePhoneSubscriberId;
IMPORT_C void GetSubscriberId(TRequestStatus& aReqStatus, TMobilePhoneSubscriberId& aId) const;
Re: Hi! Can u tell me whats wrong in this code? Thanks
[QUOTE=skumar_rao;441589]from header
typedef TBuf<KIMSISize> TMobilePhoneSubscriberId;
IMPORT_C void GetSubscriberId(TRequestStatus& aReqStatus, TMobilePhoneSubscriberId& aId) const;[/QUOTE]
Can give some more details how/where to put this code? Thanks
Re: Hi! Can u tell me whats wrong in this code? Thanks
in header
TBuf<KIMSISize> imsi;
in CPP
iPhone.GetSubscriberId(iImsiStatus, imsi);
Re: Hi! Can u tell me whats wrong in this code? Thanks
you can define this as-
RMobilePhone::TMobilePhoneSubscriberId imsi;