×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 36

Thread: Read Imsi code

  1. #1
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Exclamation Read Imsi code

    hi all

    i must read the Imsi code and sent it in a j2me application...

    is this possible?

    Thanks you!!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Read Imsi code

    I think the only public API would be Symbian C++ API called CTelephony, and wiki would have examples on how it can be used.

  3. #3
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Re: Read Imsi code

    Hi symbianyucca...

    thanks for your help... i don't find this example... can you link it please?

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: Read Imsi code

    Quote Originally Posted by slackware15 View Post
    i don't find this example... can you link it please?
    Let's continue with your other thread. http://discussion.forum.nokia.com/fo...d.php?t=183438
    Nokia Developer Wiki Moderation team

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Read Imsi code

    Anyway, easy search strings like CTelephony IMSI wiki nokia with google would give you the link..

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: Read Imsi code

    Searching simply for imsi will be enough. http://discussion.forum.nokia.com/fo...76&postcount=4
    Nokia Developer Wiki Moderation team

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Read Imsi code

    Quote Originally Posted by kiran10182 View Post
    Searching simply for imsi will be enough. http://discussion.forum.nokia.com/fo...76&postcount=4
    Propablt not if you are using google as I suggested..

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Cool Re: Read Imsi code

    Quote Originally Posted by symbianyucca View Post
    Propablt not if you are using google as I suggested..
    Why should someone use(or suggest) google when we have Wiki! Anyways let it be CTelephony IMSI wiki nokia.
    Nokia Developer Wiki Moderation team

  9. #9
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Re: Read Imsi code

    Thanks for your help guys...

    now i have this file:

    IMSI.h
    Code:
    #include <e32base.h>
    #include <Etel3rdParty.h>
     
    class CIMSIApp : public CActive
    {
    	private:
    		void ConstructL();
    		CTelephony* iTelephony;
    		CTelephony::TSubscriberIdV1 iSubscriberIdV1;
    	        CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg;
     
    	public:
    		CIMSIApp(TDes& aIMSI);
    		static void GetIMSI(TDes& aIMSI);
    		TDes& IMSI;
     
    	private:
        /*
           These are the pure virtual methods from CActive that
           MUST be implemented by all active objects
           */
    		void RunL();
    		void DoCancel();
    };
    IMSI.cpp

    Code:
    #include "IMSIApp.h"
     
    void CIMSIApp::GetIMSI(TDes& aIMSI)
    {
    	CIMSIApp* self= new (ELeave) CIMSIApp(aIMSI);
    	CleanupStack::PushL(self);
    	self->ConstructL();
    	CleanupStack::PopAndDestroy(self);
    }
     
    void CIMSIApp::ConstructL()
    {
    	iTelephony = CTelephony::NewL();
    	CActiveScheduler::Add(this);
     
    	iTelephony->GetSubscriberId(iStatus,iSubscriberIdV1Pckg);
    	SetActive();
    	CActiveScheduler::Start();
    }
     
    CIMSIApp:: CIMSIApp(TDes& imsi): CActive(EPriorityStandard),IMSI(imsi), iSubscriberIdV1Pckg(iSubscriberIdV1)
    {
    	//default constructor
    }
     
    void CIMSIApp::RunL()
    {
    	if(iStatus==KErrNone)
    	{
    		IMSI = iSubscriberIdV1.iSubscriberId;
    		CActiveScheduler::Stop();
    	}
    }
     
    void CIMSIApp::DoCancel()
    {
    	iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel);
    }
    and a hello word example file.cpp

    Code:
    #include "eseguibile.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h>			// Console
    
    //  Constants
    
    _LIT(KTextConsoleTitle, "Console");
    _LIT(KTextFailed, " failed, leave code = %d");
    _LIT(KTextPressAnyKey, " [press any key]\n");
    
    //  Global Variables
    
    LOCAL_D CConsoleBase* console; // write all messages to this
    
    
    //  Local Functions
    
    LOCAL_C void MainL()
    	{
    	//
    	// add your program code here, example code below
    	//
    	console->Write(_L("Hello, world!\n"));
    	//console->Write(TDes& aIMSI);
    	}
    
    LOCAL_C void DoStartL()
    	{
    	// Create active scheduler (to run active objects)
    	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    	CleanupStack::PushL(scheduler);
    	CActiveScheduler::Install(scheduler);
    
    	MainL();
    
    	// Delete active scheduler
    	CleanupStack::PopAndDestroy(scheduler);
    	}
    
    //  Global Functions
    
    GLDEF_C TInt E32Main()
    	{
    	// Create cleanup stack
    	__UHEAP_MARK;
    	CTrapCleanup* cleanup = CTrapCleanup::New();
    
    	// Create output console
    	TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
    			KConsFullScreen, KConsFullScreen)));
    	if (createError)
    		return createError;
    
    	// Run application code inside TRAP harness, wait keypress when terminated
    	TRAPD(mainError, DoStartL());
    	if (mainError)
    		console->Printf(KTextFailed, mainError);
    	console->Printf(KTextPressAnyKey);
    	console->Getch();
    
    	delete console;
    	delete cleanup;
    	__UHEAP_MARKEND;
    	return KErrNone;
    	}
    eseguibile.h
    Code:
    #ifndef __ESEGUIBILE_H__
    #define __ESEGUIBILE_H__
    
    //  Include Files
    
    #include <e32base.h>
    
    //  Function Prototypes
    
    GLDEF_C TInt E32Main();
    
    #endif  // __ESEGUIBILE_H__
    Now the project run (print a hello word! in console mode). i want chage this code for read on display the IMSI code... can you help me?

    My Java application need this c++ application...

    c++ application must get Imsi and send it to my application java by socket connection, or alternativity write the Imsi code on txt document and the i read this txt...

    I hope in your help...

  10. #10
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: Read Imsi code

    You can do it like as follows:
    Code:
    #include "IMSIApp.h"
    ...
    ....
    ....
    LOCAL_C void MainL()
    	{
    	//
    	// add your program code here, example code below
    	//
    	console->Write(_L("Hello, world!\n"));
            TBuf<25> IMSI;
            CIMSIApp::GetIMSI(IMSI);
    	console->Write(IMSI);
    	}
    ...
    ...
    NOTE: You will require ReadDeviceData capability in your .mmp file. As this capability is not user-granted, you need to sign your application with developer certificate. You can go for OpenSigned Online option.
    Nokia Developer Wiki Moderation team

  11. #11
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Re: Read Imsi code

    Thank kiran for your help... now i'm trying...

    Can now insert the imsi code in a variable and send it to the java application?? I don't know how open a socket in c++ programs... is good write imsi on txt file also.

    if you post me the code, i'm very happy!!!!

  12. #12
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: Read Imsi code

    I don't know how to use connection with Java ME from Symbian C++. If you want to write IMSI in file then you can do it easily. Something like:

    Code:
    _LIT(KFileSpec,"C:\\data\\IMSI.txt");
    RFs fs;
    fs.Connect();
    RFile file;
    TInt err=file.Replace(fs,KFileSpec,EFileWrite); // This will replace the file if already exists or create a new one if not
    if(err==KErrNone)
    {
            TBuf8<25> data;
            data.Copy(IMSI); // Since you require 8-bit data to be written in file
    	file.Write(data);
    	file.Close();
    }
    fs.Close();
    Nokia Developer Wiki Moderation team

  13. #13
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Re: Read Imsi code

    oh kiran... you are my god!!!

    i'm trying the modification for print imsi... but i have an error...

    i think wrong .mmp file...

    this is my mmp file

    Code:
    TARGET		  eseguibile.exe
    TARGETTYPE	  exe
    UID			 0 0xE1B8E2E0
    
    USERINCLUDE	 ..\inc
    SYSTEMINCLUDE   \epoc32\include
    
    SOURCEPATH	  ..\src
    SOURCE		  eseguibile.cpp IMSIApp.cpp
    
    LIBRARY		 euser.lib
    
    #ifdef ENABLE_ABIV2_MODE
    DEBUGGABLE_UDEBONLY
    #endif
    CAPABILITY ReadUserData
    The error is this:

    Code:
    make: *** [TARGETESEGUIBILE] Error 2

  14. #14
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Re: Read Imsi code

    You have to add following library and capability in your .mmp file.

    Code:
    TARGET		  eseguibile.exe
    TARGETTYPE	  exe
    UID			 0 0xE1B8E2E0
    
    USERINCLUDE	 ..\inc
    SYSTEMINCLUDE   \epoc32\include
    
    SOURCEPATH	  ..\src
    SOURCE		  eseguibile.cpp IMSIApp.cpp
    
    LIBRARY		 euser.lib
    LIBRARY          etel3rdparty.lib
    
    #ifdef ENABLE_ABIV2_MODE
    DEBUGGABLE_UDEBONLY
    #endif
    CAPABILITY ReadUserData ReadDeviceData
    Build your application again after making these changes. If you get any error then show full build output from "console" tab from Carbide.c++.
    Nokia Developer Wiki Moderation team

  15. #15
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    55

    Re: Read Imsi code

    Thanks Kiran... now i see the imsi code...

    but i have problems on create txt file...

    the error is on this code:

    Code:
    RFs fs;
    	fs.Connect();
    	RFile file;
    	TInt err=file.Replace(fs,KFileSpec,EFileWrite); // This will replace the file if already exists or create a new one if not
    	if(err==KErrNone)
    	{
    	        TBuf8<25> data;
    	        data.Copy(IMSI); // Since you require 8-bit data to be written in file
    		file.Write(data);
    		file.Close();
    	}
    	fs.Close();
    this is my console output:

    Code:
    "\S60\devices\S60_5th_Edition_SDK_v1.0\EPOC32\BUILD\Symbian\Carbide\workspace\eseguibile\group\ESEGUIBILE\WINSCW\ESEGUIBILE.WINSCW" UDEB
    eseguibile.cpp
    ..\src\eseguibile.cpp:42: undefined identifier 'RFs'
    ..\src\eseguibile.cpp:43: undefined identifier 'fs'
    ..\src\eseguibile.cpp:44: undefined identifier 'RFile'
    ..\src\eseguibile.cpp:45: undefined identifier 'file'
    ..\src\eseguibile.cpp:50: undefined identifier 'file'
    ..\src\eseguibile.cpp:51: undefined identifier 'file'
    ..\src\eseguibile.cpp:53: undefined identifier 'fs'
    
    Errors caused tool to abort.
    make[1]: *** [\S60\devices\S60_5th_Edition_SDK_v1.0\EPOC32\BUILD\Symbian\Carbide\workspace\eseguibile\group\ESEGUIBILE\WINSCW\udeb\eseguibile.o] Error 1
    make: *** [TARGETESEGUIBILE] Error 2

Similar Threads

  1. Read IMSI in c++
    By slackware15 in forum Symbian
    Replies: 1
    Last Post: 2009-10-20, 17:33
  2. Connect as master with N82?
    By mikrodidakt1 in forum Bluetooth Technology
    Replies: 5
    Last Post: 2009-05-01, 11:09
  3. How to read bar code through cellphone camera
    By asahlot in forum Mobile Java Tools & SDKs
    Replies: 8
    Last Post: 2009-03-03, 13:51
  4. [defect report] carbide.cpp code formatter can't produce code conforming to s60 style
    By simo.salminen in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2008-10-27, 10:56
  5. IMSI COde or SIM card No.
    By jshanoo in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2004-06-22, 12:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×