Methods for encapsulating ctelephoney, including IMEI, imsi, brand, model, and call function)

Source: Internet
Author: User
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:

  1. # Ifndef mytelephony_h
  2. # Define mytelephony_h
  3. # Include <e32base. h>
  4. # Include <etel3rdparty. h>
  5. Class cmytelephony: Public cactive
  6. {
  7. Public:
  8. Static void getimsil (TDES & aimsi );
  9. Static void getimeil (TDES & aimei );
  10. Static void getphonetype (TDES & aphonetype );
  11. Static void dialphone (const tdesc & aphoneid );
  12. Static cmytelephony * newl ();
  13. Protected:
  14. Void docancel ();
  15. Void runl ();
  16. PRIVATE:
  17. Static cmytelephony * newlc ();
  18. ~ Cmytelephony ();
  19. Cmytelephony ();
  20. Void constructl ();
  21. Void getsubscriberid ();
  22. Void getphoneid ();
  23. PRIVATE:
  24. Ctelephony * itelephony;
  25. Ctelephony: tcancellationrequest irequest;
  26. Ctelephony: tsubscriberidv1 isubscriberid;
  27. Ctelephony: tsubscriberidv1pckg isubscriberidpckg;
  28. Ctelephony: tphoneidv1 iphoneid;
  29. Ctelephony: tphoneidv1pckg iphoneidpckg;
  30. Ctelephony: tcallid icallid;
  31. Tbuf <32> iphonetype;
  32. Public:
  33. Void dialnewcall (const tdesc & atelnumber );
  34. };
  35. # Endif // mytelephony_h

CopyCode

Author: Ghost King Time:

Source file:

  1. // Mytelephony. cpp
  2. //
  3. # Include <e32svr. h>
  4. # Include "mytelephony. H"
  5. # Include <f32file. h>
  6. Class ctelephony;
  7. Cmytelephony * cmytelephony: newlc ()
  8. {
  9. Cmytelephony * Self = new (eleave) cmytelephony;
  10. Cleanupstack: pushl (Self );
  11. Self-> constructl ();
  12. Return self;
  13. }
  14. Cmytelephony * cmytelephony: newl ()
  15. {
  16. Cmytelephony * Self = cmytelephony: newlc ();
  17. Cleanupstack: Pop (Self );
  18. Return self;
  19. }
  20. Void cmytelephony: getimsil (TDES & aimsi)
  21. {
  22. # Ifdef _ wins __
  23. Cmytelephony * telephony = cmytelephony: newl ();
  24. Telephony-> getsubscriberid ();
  25. Aimsi = telephony-> isubscriberid. isubscriberid;
  26. Delete telephony;
  27. # Else
  28. _ Increment (kdebugimsi, "000000000000000 ");
  29. Aimsi = kdebugimsi;
  30. # Endif
  31. }
  32. Void cmytelephony: getimeil (TDES & aimei)
  33. {
  34. # Ifndef _ wins _ // real device this only works on target machine
  35. Cmytelephony * telephony = cmytelephony: newl ();
  36. Telephony-> getphoneid ();
  37. Aimei = telephony-> iphoneid. iserialnumber;
  38. Delete telephony;
  39. # Else // simulator return a fake IMEI when working onemulator
  40. _ Dimensions (kemulatorimei, "000000000000000 ");
  41. Aimei = kemulatorimei;
  42. # Endif
  43. }
  44. Void cmytelephony: getphonetype (TDES & aphonetype)
  45. {
  46. # Ifndef _ wins __
  47. Cmytelephony * telephony = cmytelephony: newl ();
  48. Telephony-> getphoneid ();
  49. Aphonetype. Copy (telephony-> iphoneid. imanufacturer );
  50. Aphonetype. append (telephony-> iphoneid. imodel );
  51. Delete telephony;
  52. # Else // simulator return a fake IMEI when working onemulator
  53. _ DEFINE (kphonetype, "nokia5500d ");
  54. Aphonetype = kphonetype;
  55. # Endif
  56. }
  57. Void cmytelephony: dialphone (const tdesc & aphoneid)
  58. {
  59. # Ifndef _ wins _ // real device this only works on target machine
  60. Cmytelephony * telephony = cmytelephony: newlc ();
  61. Telephony-> dialnewcall (aphoneid );
  62. # Else // simulator return a fake IMEI when working onemulator
  63. # Endif
  64. }
  65. Void cmytelephony: docancel ()
  66. {
  67. Itelephony-> cancelasync (irequest );
  68. Itelephony-> cancelasync (ctelephony: edialnewcallcancel );
  69. }
  70. Void cmytelephony: runl ()
  71. {
  72. Cactivescheduler: Stop ();
  73. }
  74. Cmytelephony ::~ Cmytelephony ()
  75. {
  76. Delete itelephony;
  77. }
  78. Cmytelephony: cmytelephony ():
  79. Cactive (cactive: eprioritystandard), isubscriberidpckg (isubscriberid ),
  80. Iphoneidpckg (iphoneid)
  81. {
  82. Cactivescheduler: add (this );
  83. }
  84. Void cmytelephony: constructl ()
  85. {
  86. Itelephony = ctelephony: newl ();
  87. }
  88. Void cmytelephony: getsubscriberid ()
  89. {
  90. Cancel ();
  91. Irequest = ctelephony: egetsubscriberidcancel;
  92. Itelephony-> getsubscriberid (istatus, isubscriberidpckg );
  93. Setactive ();
  94. Cactivescheduler: Start ();
  95. }
  96. Void cmytelephony: getphoneid ()
  97. {
  98. Cancel ();
  99. Irequest = ctelephony: egetphoneidcancel;
  100. Itelephony-> getphoneid (istatus, iphoneidpckg );
  101. Setactive ();
  102. Cactivescheduler: Start ();
  103. }
  104. /* Void cmytelephony: GetType ()
  105. {
  106. _ Partition (kpath, "Z: \ resource \ versions \ model.txt ");
  107. Cancel ();
  108. Rfs fs;
  109. Rfile typefile;
  110. User: leaveiferror (FS. Connect ());
  111. Tfiletext myfile;
  112. User: leaveiferror (typefile. Open (FS, kpath, efilesharereadersonly ));
  113. // Read from position 0: Start of File
  114. Myfile. Set (typefile );
  115. Myfile. Read (iphonetype); // readbuf1 is now "write"
  116. FS. Close ();
  117. Setactive ();
  118. Cactivescheduler: Start ();
  119. }*/
  120. /*
  121. * Call
  122. **/
  123. Void cmytelephony: dialnewcall (const tdesc & atelnumber)
  124. {
  125. Ctelephony: ttelnumber telnumber (atelnumber );
  126. Ctelephony: tcallparamsv1 callparams;
  127. Callparams. iidrestrict = ctelephony: esendmyid;
  128. Ctelephony: tcallparamsv1pckg callparamspckg (callparams );
  129. Itelephony-> dialnewcall (istatus, callparamspckg, telnumber, icallid );
  130. Setactive ();
  131. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.