Commit | Line | Data |
d0d72822 |
1 | #include <eikenv.h> |
2 | #include <e32std.h> |
3 | |
4 | #include "etelbgsm.h" // From Symbian 6.1 SDK (the Communicator SDK) |
5 | |
6 | #ifdef __cplusplus |
7 | extern "C" { |
8 | #endif |
9 | #include "PerlBase.h" |
10 | #include "EXTERN.h" |
11 | #include "perl.h" |
12 | #include "XSUB.h" |
13 | #ifdef __cplusplus |
14 | } |
15 | #endif |
16 | |
17 | _LIT(KTsyName, "phonetsy.tsy"); |
18 | |
19 | #define XS_SYMBIAN_OR_EMPTY(e, c) errno = (e) = (c); if ((e) != KErrNone) XSRETURN_EMPTY |
20 | |
21 | MODULE = Moped::Msg PACKAGE = Moped::Msg |
22 | |
23 | PROTOTYPES: ENABLE |
24 | |
25 | extern "C" void |
26 | get_gsm_network_info() |
27 | PREINIT: |
28 | TInt error; |
29 | TInt enumphone; |
30 | RTelServer server; |
31 | RBasicGsmPhone phone; |
32 | RTelServer::TPhoneInfo info; |
33 | MBasicGsmPhoneNetwork::TCurrentNetworkInfo networkinfo; |
34 | PPCODE: |
35 | if (GIMME != G_ARRAY) |
36 | XSRETURN_UNDEF; |
37 | XS_SYMBIAN_OR_EMPTY(error, server.Connect()); |
38 | XS_SYMBIAN_OR_EMPTY(error, server.LoadPhoneModule(KTsyName)); |
39 | XS_SYMBIAN_OR_EMPTY(error, server.EnumeratePhones(enumphone)); |
40 | if (enumphone < 1) |
41 | XSRETURN_EMPTY; |
42 | XS_SYMBIAN_OR_EMPTY(error, server.GetPhoneInfo(0, info)); |
43 | XS_SYMBIAN_OR_EMPTY(error, phone.Open(server, info.iName)); |
44 | XS_SYMBIAN_OR_EMPTY(error, phone.GetCurrentNetworkInfo(networkinfo)); |
45 | EXTEND(SP, 4); |
46 | PUSHs(sv_2mortal(newSViv(networkinfo.iNetworkInfo.iId.iMCC))); |
47 | PUSHs(sv_2mortal(newSViv(networkinfo.iNetworkInfo.iId.iMNC))); |
48 | PUSHs(sv_2mortal(newSViv(networkinfo.iLocationAreaCode))); |
49 | PUSHs(sv_2mortal(newSViv(networkinfo.iCellId))); |
50 | |
51 | |