summaryrefslogtreecommitdiff
path: root/symbian/ext/Moped/Msg/Msg.xs
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2005-11-07 15:32:15 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-11-07 11:39:57 +0000
commitd0d72822ba0a68d160ea4c98ca80f24b8f73969b (patch)
tree735ce6a98b4d91d05a26f9573f8e62ca8f91738f /symbian/ext/Moped/Msg/Msg.xs
parent7d0beb42a2610634ab455d4519a64df3ca90bc2f (diff)
downloadperl-d0d72822ba0a68d160ea4c98ca80f24b8f73969b.tar.gz
Symbian update blead@26025
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F24E7A70C@esebe105.NOE.Nokia.com> p4raw-id: //depot/perl@26030
Diffstat (limited to 'symbian/ext/Moped/Msg/Msg.xs')
-rw-r--r--symbian/ext/Moped/Msg/Msg.xs51
1 files changed, 51 insertions, 0 deletions
diff --git a/symbian/ext/Moped/Msg/Msg.xs b/symbian/ext/Moped/Msg/Msg.xs
new file mode 100644
index 0000000000..ae47e0a556
--- /dev/null
+++ b/symbian/ext/Moped/Msg/Msg.xs
@@ -0,0 +1,51 @@
+#include <eikenv.h>
+#include <e32std.h>
+
+#include "etelbgsm.h" // From Symbian 6.1 SDK (the Communicator SDK)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "PerlBase.h"
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#ifdef __cplusplus
+}
+#endif
+
+_LIT(KTsyName, "phonetsy.tsy");
+
+#define XS_SYMBIAN_OR_EMPTY(e, c) errno = (e) = (c); if ((e) != KErrNone) XSRETURN_EMPTY
+
+MODULE = Moped::Msg PACKAGE = Moped::Msg
+
+PROTOTYPES: ENABLE
+
+extern "C" void
+get_gsm_network_info()
+ PREINIT:
+ TInt error;
+ TInt enumphone;
+ RTelServer server;
+ RBasicGsmPhone phone;
+ RTelServer::TPhoneInfo info;
+ MBasicGsmPhoneNetwork::TCurrentNetworkInfo networkinfo;
+ PPCODE:
+ if (GIMME != G_ARRAY)
+ XSRETURN_UNDEF;
+ XS_SYMBIAN_OR_EMPTY(error, server.Connect());
+ XS_SYMBIAN_OR_EMPTY(error, server.LoadPhoneModule(KTsyName));
+ XS_SYMBIAN_OR_EMPTY(error, server.EnumeratePhones(enumphone));
+ if (enumphone < 1)
+ XSRETURN_EMPTY;
+ XS_SYMBIAN_OR_EMPTY(error, server.GetPhoneInfo(0, info));
+ XS_SYMBIAN_OR_EMPTY(error, phone.Open(server, info.iName));
+ XS_SYMBIAN_OR_EMPTY(error, phone.GetCurrentNetworkInfo(networkinfo));
+ EXTEND(SP, 4);
+ PUSHs(sv_2mortal(newSViv(networkinfo.iNetworkInfo.iId.iMCC)));
+ PUSHs(sv_2mortal(newSViv(networkinfo.iNetworkInfo.iId.iMNC)));
+ PUSHs(sv_2mortal(newSViv(networkinfo.iLocationAreaCode)));
+ PUSHs(sv_2mortal(newSViv(networkinfo.iCellId)));
+
+