John.Wiley.and.Sons.Rapid.Mobile.Enterprise.Development.for.Symbian.OS.An.Introduction.to.OPL.Application.Design.and.Programming.May.2005.eBook-LinG (779881), страница 24
Текст из файла (страница 24)
When you have more than oneicon in your mbm file, you should order them {Icon, Mask, Icon, Mask}with the smallest size first, going to the largest size last.8.2 Symbian Installation System – SIS FilesYou can’t ask the end user to move the individual files into the correctdirectory. We’d be looking (for a simple application) at three files (the.app, the .aif, and the .mbm file), and there would be a strong chancethat the connectivity package they are using would not allow them theopportunity to see the underlying directory structure of their phone.This is where we can harness the Symbian Installation System (SIS)method.
On your PC you would gather together all the files that need tobe installed, and run a command line tool, makesis.exe, that wouldput these together in one file (much like a ZIP file) along with a text file ofinstructions that say where all the files go on the phone, which the phoneitself will read and follow like a script. This single file can then be sent tothe phone through IrDA, Bluetooth, downloaded via WAP, emailed, orany other valid method. It should appear on the phone as a received file124CREATING APPLICATIONS AND INSTALLERSin the messaging application. By selecting and running this file, the enduser will install your application.8.2.1 Putting Together your SIS Package FileLooking at our suggested directory structure on the PC, you’ll see there isa directory called SIS.
We’re going to use this directory as we constructthe SIS file.Firstly, copy all the files that you need to be in the SIS file into thisdirectory. We’ll use the Event Core as our example application to createa SIS file. These files are:Core.appCore.aifWhen we create the SIS file, we should use the full path name to thesefiles on our PC, which gives us:C:\OPL\Core\SIS\Core.appC:\OPL\Core\SIS\Core.aifWe also need to know where to put these files on the phone when itis installed:C:\System\Apps\Core\Core.appC:\System\Apps\Core\Core.aifThis isn’t exactly right, as applications should be able to be installed toany drive on the phone.
When a SIS file is installed, the user is askedwhich drive to install the application onto (if more than one is available).This gives us the letter to use at the start of the path name, so we have awild card symbol (an exclamation mark) for the path name:!:\System\Apps\Core\Core.app!:\System\Apps\Core\Core.aifThere may be circumstances when a file has to go onto the C:\ (e.g. youmight provide an initial INI file that, by convention, must be on the C:\drive).
If this was the case, we’d have the following paths:!:\System\Apps\Core\Core.app!:\System\Apps\Core\Core.aifC:\System\Apps\Core\Core.iniSYMBIAN INSTALLATION SYSTEM – SIS FILES125The text file that goes into the SIS file is called the package file (.pkg) andcontains the information we have gathered above:"C:\System\Apps\Core\Core.app"-"!:\System\Apps\Core\Core.app""C:\System\Apps\Core\Core.aif"-"!:\System\Apps\Core\Core.aif"The only thing we are missing now is the name of the application and theUID number.Package Header InformationWe now add the UID and the name of the application to the package file:#{"Event Core"},(0x101F5447),1,0,0"C:\System\Apps\Core\Core.app"-"!:\System\Apps\Core\Core.app""C:\System\Apps\Core\Core.aif"-"!:\System\Apps\Core\Core.aif"The line we’ve added is made up of four sections, each doing a specificjob in the installation process.#: This signifies that the rest of this line will contain the applicationname, the UID number, and the three-part version number.{"Event Core"}: This is the name of the application which will be shownto the user at install-time.(0x101F5447): This is the UID number of the application.
Note thatthis is the actual UID number of the Event Core application, so you shouldnot use this number in your own applications. Also note the number is inhexadecimal format here.1,0,0: This is the version number of your application. If you open upthe Applications Manager on your phone, you’ll see that each installedapplication also has a version number (you might need to look for a menuoption for ‘further details’ on some phones).
The three numbers showthe major number, minor number, and build number. So 1,0,0 would beversion 1.0(000). 2,51,188 would be versions 2.51(188). Note that if youwant to make your application 1.10(188), you must specify 1,10,188 inyour PKG file, rather than 1,1,188 – the latter corresponds to a version of1.01(188) instead.When you release an updated version of your application (perhapsbecause you found some bugs and have now fixed them) you shouldincrement the major or minor numbers, and the build number, so thatwhen the end users install the newer version, the phone knows it is anewer version.LanguagesSymbian OS is a multi-language operating system, so it is important tosay which language your SIS file supports.
While it is possible to have SIS126CREATING APPLICATIONS AND INSTALLERSfiles support multiple languages, we’re not looking at the more in-depthoptions for SIS files here, so we’ll specify just one language, which isUK English.We start a language option line with "&" and then the two-letterlanguage code, in this case "EN" for UK English. A full list of languagecodes can be found in the documentation that came with the SDK youdownloaded. While the docs will be primarily for C++ coders, thereis a section for creating SIS files, and if you feel ready to make morecomplicated SIS files in the future, this is the best place to start.Platform DependencyOne thing to remember with SIS files is that a SIS file can in theory beinstalled on any Symbian OS user interface platform, no matter which UIit uses (Series 60, UIQ, etc.).
While OPL programs can be written thatwill run on all the platforms from one compiled version, there may becircumstances when you want to only have a SIS file installed if it is beingtargeted at a specific platform.Each UI of Symbian has its own UID (after all, the UI is a type ofprogram as well) and you can specify inside a SIS file to only installthe file if you are on a certain UI version. For UIQ you would use thefollowing command:(0x101F617B),2,0,0,{"UIQ20ProductID"}Here we see the UID number, the minimum version number that thetarget platform should be, and the application name. A full list of theUID numbers, versions, and names can be found in the SDK documentation.If you do not have a dependency line, then two things will happen.Many phones will require a dependency line to be included, in whichcase your SIS file would not be installed, and an error message displayed to the user saying that an incorrect version is being installed willbe shown.Products that do not require a dependency will install the file, butthere may be a conflict of interest here as a UIQ OPL application maynot run correctly on a Nokia Communicator (depending on how youprogrammed it, of course).Our Finished Package FileSo here it is, our finished package file for Event Core.
The final commandshown here is the semi-colon, which acts just like rem in OPL. Anythingon the line after the semi-colon is ignored, so it can be used to put incomments and aide memoirs as you go along:SYMBIAN INSTALLATION SYSTEM – SIS FILES127; Package File For EVENT CORE.;; Specify the supported language.&EN;; Installation name and header data;#{"Event Core"},(0x101F5447),1,0,0;<BEGINS>;Files to remove on uninstallation""-"C:\System\Apps\Core\Core.ini",FN;<ENDS>; Files to install; "Path on PC"-"Path on phone";"C:\System\Apps\Core\Core.app"-"!:\System\Apps\Core\Core.app""C:\System\Apps\Core\Core.aif"-"!:\System\Apps\Core\Core.aif";; Which UI Platform is this intended for;(0x101F617B),2,0,0,{"UIQ20ProductID"}8.2.2Generating the SIS FileOur SIS folder now has the following files:Core.pkgCore.appCore.aifThe OPL SDK will have placed a copy of the command line utilitymakesis.exe in the correct directory path, so open a command lineprompt and navigate to your SIS directory.
Now use the command:makesis Core.pkg Core.sisThis creates the SIS file Core.sis, which can be sent to the phone,packaged up in a ZIP file for downloading on the Internet, or whateverelse is required of it.8.2.3Notes on SIS FilesThe SIS file is a powerful facet of Symbian OS, and not every feature of SISfiles has been covered here.
The main area not covered here is securitycertificates. These provide a method to authenticate a SIS file using a pairof digital keys (one private, one public) and are used to identify the authorof a SIS file, and to verify that a SIS file has not been tampered with sinceit was created.128CREATING APPLICATIONS AND INSTALLERSDetails on using certificates in SIS files can be found in the SDKdocumentation.8.3 SummarySIS files are the key to making a good user experience.
They makeyour program much easier to install, and should be used whenever youdistribute an application. We looked at how Symbian provides a uniquenumber for every application, and how to include this in your SIS file.We also looked at how to make an OPL program appear as anapplication on the main screen of icons on a phone, and how to includeyour own icon.Finally, some extra features of SIS files (specifying languages andplatform dependencies) were introduced.9Where Now With OPL?Over the years, as we’ve seen, OPL has appeared on many differentplatforms, and over 2000 applications have been released online – withcountless more being used as bespoke applications in business. Startingfrom a list of commands and basic principles, hundreds of authors havebecome programmers in their own right, using OPL on their pocketcomputers and smartphones.
To give you an idea of what OPL can do,let’s look at three applications written in OPL, to inspire you.9.1 RMRBank, by Al Richey (RMR Software)Al Richey has been around and seen almost every computer platformsince the ZX81 and BBC B Micro in the early 1980s. He got to grips withOPL on the Psion Series 3a. Why? Because of the Money application thatcame with the Psion Series 3.The first version of ‘Psion Money’ suited Al and his needs perfectly.He was also writing OPL programs to use himself to track shares, fuelconsumption in his car, and the gas and electricity in his house. Allthese apps were originally just for his own use – exactly the type of thingOPL is so useful for.