hi all
i must read the Imsi code and sent it in a j2me application...
is this possible?
Thanks you!!
hi all
i must read the Imsi code and sent it in a j2me application...
is this possible?
Thanks you!!
I think the only public API would be Symbian C++ API called CTelephony, and wiki would have examples on how it can be used.
Hi symbianyucca...
thanks for your help... 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
Anyway, easy search strings like CTelephony IMSI wiki nokia with google would give you the link..
Searching simply for imsi will be enough.http://discussion.forum.nokia.com/fo...76&postcount=4
Nokia Developer Wiki Moderation team
Thanks for your help guys...
now i have this file:
IMSI.h
IMSI.cppCode:#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(); };
and a hello word example file.cppCode:#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); }
eseguibile.hCode:#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; }
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?Code:#ifndef __ESEGUIBILE_H__ #define __ESEGUIBILE_H__ // Include Files #include <e32base.h> // Function Prototypes GLDEF_C TInt E32Main(); #endif // __ESEGUIBILE_H__
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...
You can do it like as follows:
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.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); } ... ...
Nokia Developer Wiki Moderation team
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!!!!
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
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
The error is this: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
Code:make: *** [TARGETESEGUIBILE] Error 2
You have to add following library and capability in your .mmp file.
Build your application again after making these changes. If you get any error then show full build output from "console" tab from Carbide.c++.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
Nokia Developer Wiki Moderation team
Thanks Kiran... now i see the imsi code...
but i have problems on create txt file...
the error is on this code:
this is my console output: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();
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