Title: The ctelephoney encapsulation method includes IMEI, imsi, brand, model, and call function.
[Print this page]
Author: Ghost King
Time:
Title: The ctelephoney encapsulation method includes IMEI, imsi, brand, model, and call function.
Edited by ghost Wang at, September 6
In Symbian, I learned how to obtain IMEI from Chen ziteng Daxia on the Nokia forum, and then how to add some common functions to help new users ..
Header file:
-
- # Ifndef mytelephony_h
-
- # Define mytelephony_h
-
-
- # Include <e32base. h>
-
- # Include <etel3rdparty. h>
-
-
- Class cmytelephony: Public cactive
- {
-
- Public:
-
- Static void getimsil (TDES & aimsi );
-
- Static void getimeil (TDES & aimei );
-
- Static void getphonetype (TDES & aphonetype );
-
- Static void dialphone (const tdesc & aphoneid );
-
- Static cmytelephony * newl ();
-
- Protected:
-
- Void docancel ();
-
- Void runl ();
-
-
- PRIVATE:
-
- Static cmytelephony * newlc ();
-
-
- ~ Cmytelephony ();
-
- Cmytelephony ();
-
- Void constructl ();
-
-
- Void getsubscriberid ();
- Void getphoneid ();
-
-
- PRIVATE:
-
- Ctelephony * itelephony;
-
- Ctelephony: tcancellationrequest irequest;
-
- Ctelephony: tsubscriberidv1 isubscriberid;
-
- Ctelephony: tsubscriberidv1pckg isubscriberidpckg;
-
- Ctelephony: tphoneidv1 iphoneid;
-
- Ctelephony: tphoneidv1pckg iphoneidpckg;
-
- Ctelephony: tcallid icallid;
-
- Tbuf <32> iphonetype;
-
- Public:
-
- Void dialnewcall (const tdesc & atelnumber );
-
- };
-
-
- # Endif // mytelephony_h
CopyCode
Author: Ghost King
Time:
Source file:
-
- // Mytelephony. cpp
-
- //
-
- # Include <e32svr. h>
-
- # Include "mytelephony. H"
-
- # Include <f32file. h>
-
-
- Class ctelephony;
-
- Cmytelephony * cmytelephony: newlc ()
-
- {
-
- Cmytelephony * Self = new (eleave) cmytelephony;
-
- Cleanupstack: pushl (Self );
-
- Self-> constructl ();
-
- Return self;
- }
-
-
- Cmytelephony * cmytelephony: newl ()
-
- {
-
- Cmytelephony * Self = cmytelephony: newlc ();
-
- Cleanupstack: Pop (Self );
-
- Return self;
-
- }
-
-
- Void cmytelephony: getimsil (TDES & aimsi)
-
- {
-
- # Ifdef _ wins __
-
- Cmytelephony * telephony = cmytelephony: newl ();
-
- Telephony-> getsubscriberid ();
-
- Aimsi = telephony-> isubscriberid. isubscriberid;
-
- Delete telephony;
-
- # Else
-
- _ Increment (kdebugimsi, "000000000000000 ");
-
- Aimsi = kdebugimsi;
-
- # Endif
-
- }
-
-
- Void cmytelephony: getimeil (TDES & aimei)
-
- {
-
- # Ifndef _ wins _ // real device this only works on target machine
-
- Cmytelephony * telephony = cmytelephony: newl ();
-
- Telephony-> getphoneid ();
-
- Aimei = telephony-> iphoneid. iserialnumber;
-
-
- Delete telephony;
-
- # Else // simulator return a fake IMEI when working onemulator
- _ Dimensions (kemulatorimei, "000000000000000 ");
-
- Aimei = kemulatorimei;
-
- # Endif
-
- }
-
-
- Void cmytelephony: getphonetype (TDES & aphonetype)
-
- {
-
- # Ifndef _ wins __
-
- Cmytelephony * telephony = cmytelephony: newl ();
-
- Telephony-> getphoneid ();
-
- Aphonetype. Copy (telephony-> iphoneid. imanufacturer );
-
- Aphonetype. append (telephony-> iphoneid. imodel );
-
-
- Delete telephony;
- # Else // simulator return a fake IMEI when working onemulator
-
- _ DEFINE (kphonetype, "nokia5500d ");
-
- Aphonetype = kphonetype;
-
- # Endif
-
- }
-
-
- Void cmytelephony: dialphone (const tdesc & aphoneid)
-
- {
-
- # Ifndef _ wins _ // real device this only works on target machine
-
- Cmytelephony * telephony = cmytelephony: newlc ();
-
- Telephony-> dialnewcall (aphoneid );
-
-
- # Else // simulator return a fake IMEI when working onemulator
-
- # Endif
-
- }
-
- Void cmytelephony: docancel ()
- {
-
- Itelephony-> cancelasync (irequest );
-
- Itelephony-> cancelasync (ctelephony: edialnewcallcancel );
-
- }
-
-
- Void cmytelephony: runl ()
-
- {
-
- Cactivescheduler: Stop ();
-
- }
-
-
- Cmytelephony ::~ Cmytelephony ()
-
- {
-
- Delete itelephony;
-
- }
-
-
- Cmytelephony: cmytelephony ():
-
- Cactive (cactive: eprioritystandard), isubscriberidpckg (isubscriberid ),
- Iphoneidpckg (iphoneid)
-
- {
-
- Cactivescheduler: add (this );
-
- }
-
-
- Void cmytelephony: constructl ()
-
- {
-
- Itelephony = ctelephony: newl ();
-
- }
-
-
- Void cmytelephony: getsubscriberid ()
-
- {
-
- Cancel ();
-
- Irequest = ctelephony: egetsubscriberidcancel;
-
- Itelephony-> getsubscriberid (istatus, isubscriberidpckg );
- Setactive ();
-
- Cactivescheduler: Start ();
-
- }
-
-
- Void cmytelephony: getphoneid ()
-
- {
-
- Cancel ();
-
- Irequest = ctelephony: egetphoneidcancel;
-
- Itelephony-> getphoneid (istatus, iphoneidpckg );
-
- Setactive ();
-
- Cactivescheduler: Start ();
-
- }
-
-
- /* Void cmytelephony: GetType ()
-
- {
-
- _ Partition (kpath, "Z: \ resource \ versions \ model.txt ");
- Cancel ();
-
-
- Rfs fs;
-
- Rfile typefile;
-
- User: leaveiferror (FS. Connect ());
-
- Tfiletext myfile;
-
- User: leaveiferror (typefile. Open (FS, kpath, efilesharereadersonly ));
-
-
- // Read from position 0: Start of File
-
- Myfile. Set (typefile );
-
- Myfile. Read (iphonetype); // readbuf1 is now "write"
-
-
- FS. Close ();
-
- Setactive ();
-
- Cactivescheduler: Start ();
- }*/
-
- /*
-
- * Call
-
- **/
-
- Void cmytelephony: dialnewcall (const tdesc & atelnumber)
-
- {
-
- Ctelephony: ttelnumber telnumber (atelnumber );
-
- Ctelephony: tcallparamsv1 callparams;
-
- Callparams. iidrestrict = ctelephony: esendmyid;
-
- Ctelephony: tcallparamsv1pckg callparamspckg (callparams );
-
- Itelephony-> dialnewcall (istatus, callparamspckg, telnumber, icallid );
-
- Setactive ();
-
- }