GLOBE IMS, ctelephony, etel3rdparty, j2me, travel portal :D

Basically a blog which is a mixture of anything that comes up in the author's mind. From the technologies that makes his life convenient to the everyday news in his country.

GLOBE IMS, ctelephony, etel3rdparty, j2me, travel portal :D

Thursday, March 06, 2008

(0) Comments

Our company recently join the GLOBE IMS Challenge which focuses on using IMS technology on mobile. Many things are possible using Ericsson's SDS4 SDK such as the connectivity between different devices from mobile to TV to PS2 it's really amazing. Unfortunately this technology is new in it's nature limiting the developer like me to what we can develop. Its ericsson's  so target mobile are also ericsson's and we are advised to use P990i, P1 etc. SJP3.4 I think which doesn't have Location API such as JP7.

Now, the main module of our project will use Location API so I was force to use C++ for Symbian Programming using the ctelephony class from etel3rdparty.lib. I was successful in making getting the Location data in Symbian such as Cell ID, Location Area Code, etc. However, my main problem right now is how will I compile the DLL in such a way that I can call it in a java code using JNI which, luckily is supported by most P990i phones. I've tried JNI in windows however, I'm not sure about it's compilation in mobile.

Well, for me to not forget my code here it is :D
[code]
#ifndef SYSTEMMANAGER_H
#define SYSTEMMANAGER_H

#include // For CActive, link against: euser.lib
#include // For RTimer, link against: euser.lib

#include

class CSystemManager : public CActive
{
public:
typedef enum {EHandsetIMEI, EHandsetIMSI, EHandsetNetworkInfo } InfoType;
public:
// Cancel and destroy
~CSystemManager();

// Two-phased constructor.
static CSystemManager* NewL();

// Two-phased constructor.
static CSystemManager* NewLC();

public: // New functions
// Function for making the initial request
void StartL();
TDesC& GetIMEI();
TDesC& GetIMSI();
TUint GetLocationAreaCode();
TUint GetCellID();
TDesC& GetOperatorName();
TDesC& GetCountryCode();
TDesC& GetNetworkID();
private:
// C++ constructor
CSystemManager();
// Second-phase constructor
void ConstructL();
private: // From CActive
// Handle completion
void RunL();
// How to cancel me
void DoCancel();
// Override to handle leaves from RunL(). Default implementation causes
// the active scheduler to panic.
TInt RunError( TInt aError );

private:
enum TSystemManagerState
{
EUninitialized, // Uninitialized
EInitialized, // Initalized
EError // Error condition
};
enum TGetInfoState
{
       EStart = 1,
       EGetPhoneInfo,
       EDone
};
private:
TInt iState; // State of the active object
RTimer iTimer; // Provides async timing service

InfoType iPhoneInfoType;
CTelephony* iTelephony;
CTelephony::TPhoneIdV1 iPhoneIdV1;
    CTelephony::TPhoneIdV1Pckg iPhoneIdV1Pckg;
    
    CTelephony::TSubscriberIdV1 iSubscriberIdV1;
    CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg;
    
    CTelephony::TNetworkInfoV1 iNetworkInfoV1;
    CTelephony::TNetworkInfoV1Pckg iNetworkInfoV1Pckg;
    
    CActiveSchedulerWait iActiveSchedulerWait;
    
    TBuf iIMEI;
    TBuf iModelNumber;
    TBuf iIMSI;        
    TUint iLocationAreaCode;
    TUint iCellId;
    TBuf<16> iOperatorName;
    TBuf<4> iCountryCode;
    TBuf<8> iNetworkId;
};

#endif // SYSTEMMANAGER_H

#include
#include
#include
#include
#include
#include

#include "SystemManager.h"

CSystemManager::CSystemManager () : CActive(EPriorityStandard), iPhoneInfoType(EHandsetIMEI),
iState(EStart),
iTelephony(NULL),
iSubscriberIdV1Pckg(iSubscriberIdV1),
iPhoneIdV1Pckg(iPhoneIdV1),
iNetworkInfoV1Pckg(iNetworkInfoV1) { }

CSystemManager* CSystemManager::NewLC()
{
CSystemManager* self = new ( ELeave ) CSystemManager();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}

CSystemManager* CSystemManager::NewL()
{
CSystemManager* self = CSystemManager::NewLC();
CleanupStack::Pop(); // self;
return self;
}

void CSystemManager::ConstructL()
{
User::LeaveIfError( iTimer.CreateLocal() ); // Initialize timer
CActiveScheduler::Add( this ); // Add to scheduler
iTelephony = CTelephony::NewL();
}

CSystemManager::~CSystemManager()
{
Cancel(); // Cancel any request, if outstanding
delete iTelephony;
iTimer.Close(); // Destroy the RTimer object
// Delete instance variables if any
}

void CSystemManager::DoCancel()
{
switch(iPhoneInfoType)
{
case EHandsetIMEI: 
iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
break;
case EHandsetIMSI:
iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel);
break;
default:
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
break;
}
}

void CSystemManager::StartL()
{
Cancel(); // Cancel any request, just to be sure
//iState = EUninitialized;
//iTimer.After( iStatus, aDelay ); // Set for later
iState = EGetPhoneInfo;
switch(iPhoneInfoType)
{
case EHandsetIMEI:
{
iTelephony->GetPhoneId(iStatus, iPhoneIdV1Pckg);
break;
}
case EHandsetIMSI:
{
iTelephony->GetSubscriberId(iStatus, iSubscriberIdV1Pckg);

break;
}
case EHandsetNetworkInfo:
{
iTelephony->GetCurrentNetworkInfo(iStatus, iNetworkInfoV1Pckg);
break;
}
}
SetActive(); 
iActiveSchedulerWait.Start();
}

void CSystemManager::RunL()
{
iState = EDone;
if ( iActiveSchedulerWait.IsStarted() )
{
iActiveSchedulerWait.AsyncStop();
if(iStatus == KErrNone)
{
switch(iPhoneInfoType)
{
case EHandsetIMEI:
{
iIMEI = iPhoneIdV1.iSerialNumber;
}
break;
case EHandsetIMSI:
{
iIMSI = iSubscriberIdV1.iSubscriberId;
}
break;
case EHandsetNetworkInfo:
{
iLocationAreaCode = iNetworkInfoV1.iLocationAreaCode;
iCellId = iNetworkInfoV1.iCellId;
iOperatorName = iNetworkInfoV1.iLongName;
iCountryCode = iNetworkInfoV1.iCountryCode;
iNetworkId = iNetworkInfoV1.iNetworkId;
}
break;
}
}
else
{
// Do nothing
}
}
}

TDesC& CSystemManager::GetIMEI()
{
iPhoneInfoType = EHandsetIMEI;
iIMEI.Zero();

StartL();
return iIMEI;
}

TDesC& CSystemManager::GetIMSI()
{
iPhoneInfoType = EHandsetIMSI;
iIMSI.Zero();

StartL();
return iIMSI;
}

TUint CSystemManager::GetLocationAreaCode() {
iPhoneInfoType = EHandsetNetworkInfo;
iLocationAreaCode = 0;
StartL();
return iLocationAreaCode;
}

TUint CSystemManager::GetCellID() {
iPhoneInfoType = EHandsetNetworkInfo;
iCellId = 0;
StartL();
return iCellId;
}

TDesC& CSystemManager::GetOperatorName()
{
iPhoneInfoType = EHandsetNetworkInfo;
iOperatorName.Zero();

StartL();
return iOperatorName;
}

TDesC& CSystemManager::GetCountryCode()
{
iPhoneInfoType = EHandsetNetworkInfo;
iCountryCode.Zero();

StartL();
return iCountryCode;
}

TDesC& CSystemManager::GetNetworkID()
{
iPhoneInfoType = EHandsetNetworkInfo;
iNetworkId.Zero();

StartL();
return iNetworkId;
}

TInt CSystemManager::RunError( TInt aError )
{
return aError;
}
[/code]

Actually parts of the code are from sonyericsson and developer.symbian and the uiq 3 documentation the .chm file. I've just paste them together :-).

Currently, I am doing 2 other major projects in short I am really busy and I haven't touch this project for days. For record the other 2 are: 
1.) a Travel web Portal wherein you can book your flights online (search for flights and it's info - how much, when, etc.)
.) J2ME project that will cater the department stores, items' inventory will now be inventoried though mobile using GPRS so a not so very high model phone is required.:D

See I was quite versatile and now I'm writing this 'coz my head is about to explode buwahahaha....

0 Responses to "GLOBE IMS, ctelephony, etel3rdparty, j2me, travel portal :D"

Post a Comment

Contributors