diff options
Diffstat (limited to 'symbian/ext/Moped/Msg')
-rw-r--r-- | symbian/ext/Moped/Msg/Msg.mmp | 1 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/Msg.pkg | 16 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/Msg.pm | 9 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/Msg.xs | 51 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/README | 49 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/bld.inf | 4 | ||||
-rw-r--r-- | symbian/ext/Moped/Msg/location.pl | 8 |
7 files changed, 138 insertions, 0 deletions
diff --git a/symbian/ext/Moped/Msg/Msg.mmp b/symbian/ext/Moped/Msg/Msg.mmp new file mode 100644 index 0000000000..7736d2ab57 --- /dev/null +++ b/symbian/ext/Moped/Msg/Msg.mmp @@ -0,0 +1 @@ +LIBRARY etel.lib gsmbas.lib
diff --git a/symbian/ext/Moped/Msg/Msg.pkg b/symbian/ext/Moped/Msg/Msg.pkg new file mode 100644 index 0000000000..eb7aed02f5 --- /dev/null +++ b/symbian/ext/Moped/Msg/Msg.pkg @@ -0,0 +1,16 @@ +; MoDev::Msg installation script
+;
+; The supported languages
+&EN;
+;
+; The installation name and header data
+;
+#{"MoDev::Msg"},(0x0FFFFFFF),0,1,0
+;
+; Platform supported is Series 60
+;
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
+; The files to install
+;
+"Msg.pm"-"!:\System\Libs\Perl\5.9.3\MoDev\Msg.pm"
+"\epoc32\release\thumb\urel\Msg.dll"-"!:\System\Libs\Perl\5.9.3\thumb-symbian\Msg.dll"
diff --git a/symbian/ext/Moped/Msg/Msg.pm b/symbian/ext/Moped/Msg/Msg.pm new file mode 100644 index 0000000000..e1aaef8344 --- /dev/null +++ b/symbian/ext/Moped/Msg/Msg.pm @@ -0,0 +1,9 @@ +package Moped::Msg; +use strict; +use vars qw(@ISA $VERSION); +require DynaLoader; +@ISA = qw(DynaLoader); +$VERSION = '0.01'; +bootstrap Moped::Msg; +1; + 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))); + + diff --git a/symbian/ext/Moped/Msg/README b/symbian/ext/Moped/Msg/README new file mode 100644 index 0000000000..2d31c298a0 --- /dev/null +++ b/symbian/ext/Moped/Msg/README @@ -0,0 +1,49 @@ +NOTE: this is just a sample of how building Symbian specific +extensions COULD work. This is most probably far from the best +or final way of doing things. + +The Moped::Msg currently defines just a single static method, +get_gsm_network_info(), which returns the GSM network and cell id. + +The extension code is in Msg.xs (which gets translated by xsubpp into +Msg.cpp), the Perl glue code is in Msg.pm. To understand the .xs +syntax studying perlxstut and perlxs is recommended. + +The prerequisites for compiling this extension are: + +(1) The Perl for Symbian SDK installed (either done "make sdkinstall", + or separately installed the perlXYZsdk.zip). + +(2) The etelbgsm.h header, which is available for example from + the Symbian 6.1 SDK (the Communicator SDK). This must be + copied to ...\epoc32\include. + +(3) The etel.lib and the gsmbas.lib, they should come both + with the 6.1 and 7.0s SDK. The WINS udeb and THUMB urel + versions of these must be copied to the directories + ...\epoc32\release\wins\udeb and ...\epoc32\release\thumb\urel, + respectively. + +To compile (assuming Perl 5.9.3 and Series 60 SDK 2.6 for Visual C): + + perl \symbian\perl\5.9.3\bin\xsbuild.pl --cpp --extversion=0.1 ext\symbian\Moped\Msg + +The --symbian indicates the Symbian and SDK version, the --cplusplus +indicates that one should generate a .cpp file instead of a .c file. + +The xsbuild.pl both configures and builds the extension. +To clean do "make clean" or "make distclean". + +The location.pl demonstrates using the extension. + +To create a SIS: + + makesis -d%EPOCROOT% ext\Moped\Msg\Msg.pkg + +TODO: automate the determination of the EXTVERSION (from .pkg?) +and of creation of .pkg (the location of the .dll in the build +and in the target). + + + + diff --git a/symbian/ext/Moped/Msg/bld.inf b/symbian/ext/Moped/Msg/bld.inf new file mode 100644 index 0000000000..121a66a720 --- /dev/null +++ b/symbian/ext/Moped/Msg/bld.inf @@ -0,0 +1,4 @@ +PRJ_MMPFILES
+Msg.mmp
+PRJ_PLATFORMS
+wins thumb
diff --git a/symbian/ext/Moped/Msg/location.pl b/symbian/ext/Moped/Msg/location.pl new file mode 100644 index 0000000000..50df335041 --- /dev/null +++ b/symbian/ext/Moped/Msg/location.pl @@ -0,0 +1,8 @@ +use Moped::Msg; +my ($MCC, $MNC, $LAC, $Cell) = + Moped::Msg::get_gsm_network_info(); +print "MCC = $MCC\n"; +print "MNC = $MNC\n"; +print "LAC = $LAC\n"; +print "Cell = $Cell\n"; + |