Upload
stephanie-shelton
View
213
Download
0
Embed Size (px)
Citation preview
©2001 PocketSmalltalk.com
Introduction toPalm™ Economy, Palm OS®and Pocket Smalltalk™ IDE
By
Eric Arseneau
Joey Gibson
©2001 PocketSmalltalk.com
Goals
• Learn about the Palm™ Economy– What is it ?– How to make money in it ?
• Learn about Palm OS®– Get some high level technical details
• Learn to work with Pocket Smalltalk– Use Smalltalk to build applications
©2001 PocketSmalltalk.com
Assumptions
• Interested in the business of building solutions for the Palm™ Economy
• Somewhat familiar with another dialect of Smalltalk
©2001 PocketSmalltalk.com
Who are we ?
Eric Arseneau• Has been doing
Smalltalk since 1985• Independent consultant
for over 15 years• Trying to expand the
Smalltalk marketplace• Trying to get out of
doing Java for a living:-)
Joey Gibson• Has been doing
Smalltalk since 1999• Sees the light and loves
Smalltalk :-)• Major contributor to
Pocket Smalltalk• Sun Certified Java2
Programmer:-)
©2001 PocketSmalltalk.com
Q&A
• No explicit Q&A at the end– Ask questions as we go along– PLEASE interrupt us at any time, we are here to
help you, not just hear ourselves talk
• Due to airline misplacing my luggage, we do not have any cool Palm gear– Leave us your snail mail address and we will mail it
• If we run out of time that’s okay; all of this stuff can be found on-line at– http://www.PocketSmalltalk.com/solutions01/
©2001 PocketSmalltalk.com
Q&A
Palm™ Handheld• How many have one ?• Heard of them ?• Knew you could build
applications for them ?• Want to build
applications for them ?• Waiting to see what you
hear today ?
Pocket Smalltalk™ IDE• Heard of it ?• Used it ?• Would use it ?• Waiting to see what
you hear today ?
©2001 PocketSmalltalk.com
Legal Stuff
• All copyrights, trademarks and service marks are owned by the appropriate parties, even if not directly acknowledged
• We are not associated with Palm or any of its licensees
• Information presented here is a combination of facts and conjecture on our parts
©2001 PocketSmalltalk.com
Palm™ Economy - Agenda
• What is the “Palm™ Economy” ?• What is a Palm Powered™ Handheld• Palm™ Economy Products• Customer Profiles• Markets• Making $Money$• Wireless• Looking Ahead• Sources of Information
©2001 PocketSmalltalk.com
What is the “Palm™ Economy” ?
• A term used to describe a market place where Palm Powered™ solutions are sold and used everyday– Handhelds– Software– Accessories– Services
• In the beginning was a hopeful wish that there would be a market place needing a name– No longer a wish
©2001 PocketSmalltalk.com
Excuse the Interruption
• We interrupt this important tutorial to show you an advertisement introducing you to the
Palm™ Economy
©2001 PocketSmalltalk.com
Palm Powered™ Handhelds Lead
• 13 MILLION handhelds sold !!!
• 8,500+ applications available
• 130,000+ registered developers
• Palm Powered™ handhelds– 76% worldwide Personal Companion share, 2000
IDC– 90% US retail share, Jan 2001 PC Data
• #1 in: US, UK, Europe, Asia Pacific
©2001 PocketSmalltalk.com
Palm Powered™ Handhelds Lead.
• Market share of devices sold in January 2001– Palm 65.7%– Handspring 18.8% Total Palm 86.4%– Casio 5.5% Total other 13.6%– Compaq 3.2%– HP 3.2%– Sony 1.9%
• According to research firm NPD Intelect
©2001 PocketSmalltalk.com
.What is a Palm Powered™ Handheld ?
• Device running Palm OS®
• Memory: 2Mb-8Mb
• Touch screen
• Four basic built-in apps– Date Book
– Address Book
– To Do List
– Memo Pad
• Global Search
• I/R
• One button HotSync® synchronization function
©2001 PocketSmalltalk.com
.What is a Palm Powered™ Handheld ?
• Stylized hand writing
– Graffiti®
• On-screen keyboard
– Beginners
– Intermediates to get punctuation
• Hard buttons
– For 4 basic apps
– Scroll buttons
• Graffiti® Area
– Home - Calculator
– Menu - Search
©2001 PocketSmalltalk.com
What ISN’T aPalm Powered™ Handheld ?.
• A replacement for computer
– It is a companion to one
• Just smaller computer
– they are different devices with different needs and requirements
– Things are done differently than on desktop
• No major data entry expected
– Use main computer for bulk of data entry
©2001 PocketSmalltalk.com
.Palm Powered™ Keys to Success.
• User Experience– Elegant Device Design
– Simplicity
– Ease of Use
– Excellent out of the box experience
• Simple synchronization between handheld and desktop
• Transparent Technology– Apply technology to be
transparent to users
– Solve real problems for real people in a mobile, personal, wearable world
• Palm™ Economy
©2001 PocketSmalltalk.com
The Competition.• Ground Rules
– Simplicity: instant access, beyond “ease of use”– Wearability: small, light to carry always– Mobility: access to information always
• Difference between Palm & Others– Others think that users are trapped without a PC, want
palm/pocket sized PC– Is it really a problem of being trapped without a PC ?
• It’s a battle of philosophy• Palm assumes that other handhelds will catch up
– Or at least try :-)
©2001 PocketSmalltalk.com
Palm Powered Solutions™
• Handhelds– Palm™ handhelds
– Palm OS® licensees
• Accessories• Expansion• Software
– On Handheld
– On Desktop
– On Server
• Content & Access
©2001 PocketSmalltalk.com
Palm™ Handhelds
• m505, m500• m105, m100• VIIx• Vx, V• IIIc, IIIx, III, IIIxe• Palm Pilot Personal, Pro• Pilot 1000, 5000• Localized editions: EEFIGS
– And Japanese
©2001 PocketSmalltalk.com
Platform Licensees
©2001 PocketSmalltalk.com
Expansion
• CompactFlash
• Springboard™
• SecureDigital/SD/MMC
• Sony Memory Stick™
©2001 PocketSmalltalk.com
Software – On handheld• Business/Professional
– Small Business, Enterprise Solutions, Legal, Medical
• Personal Productivity – Personal Finance, Document Readers, Organizers, Notetaking & Forms,
Reference, Date and Time, Calculators
• Education/Reference – Computer/Engineering, History, Personal Healthcare, Religion,
Science/Math, Social Sciences, Literature/E-text, Other
• Entertainment – Movies, Music, Sports, FireViewer Videos and Images, Multimedia and
Graphics, Food/Health, Hobbies, TV, Radio, Just for Fun, Games
• Travel– City Guides, Maps, Languages, Restaurants, Currency Converters,
Transportation, Other• And more …
©2001 PocketSmalltalk.com
.Software – On Desktop
• Palm™ Desktop Software for Windows & Mac Conduits
– To synchronize documents and information from deskop applications, such as Outlook and Excel, with the handheld
• Front Ends to handheld applications– Editors, translators, …
• Developer Tools• Platforms
– Windows, Unix, Linux, Mac, …
©2001 PocketSmalltalk.com
.Software – On Server
• Asset Management• Configuration Management• Software Distribution• Palm HotSync Server• Aether ScoutSync
©2001 PocketSmalltalk.com
Content & Access: Palm.net
• Gateway for Palm VII device• Provides a mechanism to “browse” the web• Uses Web Clipping concept
– Strips big data items like pictures, sounds, and only lets through the vanilla HTML
• 650+ web-clipping apps• Provides mobile access to AOL, Yahoo,
Fidelity, ABC News, Wall Street Journal, …• 150K+ subscribers in North America
©2001 PocketSmalltalk.com
Content & Access: MyPalm Portal
• My.Palm.com• Aggregated content listings• Wireless refresh of calendar• Complete search & browse of Internet• Personalized MyAccount• Integrated POP3 e-mail account access• Ability to download apps & games wirelessly• Location-based events• Start – 250K Users sign up for beta
©2001 PocketSmalltalk.com
Content & Access: AvantGo
• www.AvantGo.com
• Offline web content viewer
• Can subscribe to content channels
• Content is placed on device when the HotSync function is invoked
©2001 PocketSmalltalk.com
Content & Access: Archives.
• www.PalmGear.com
• www.Handango.com
• www.Tucows.com
• www.shareware.com
• …
©2001 PocketSmalltalk.com
Individuals - Profile
• 85% Male
• Average age 42
• Income > 80K
• Very connected – all use e-mail
• 20% in Technology industry
©2001 PocketSmalltalk.com
Individuals - Profile
• Percentage of time using– Address Book 71% Calendar 60%– To Do 30%– Business 68% Personal 32%
• 80% of Palm units are synchronized at work
• 90% Aware of 3rd Party Software
• 74% Download 3rd Party Software
• 67% Games
©2001 PocketSmalltalk.com
Individuals - Paid for by.
• 50% Paid for by themselves
• 25% Refunded by company
• 10% Bought by company
• 75% Have visited Palm.com site• > 10% are deployed by businesses
©2001 PocketSmalltalk.com
Enterprise
• Currently biggest focus of Palm Inc• From PIM to Corporate Information Management• Solutions so IT departments can manage handheld
productivity tools• Solutions that are platform and device neutral• Server-based synchronization platform to connect
mobile devices to their business applications• Connect legacy systems and business applications to
their mobile work force
©2001 PocketSmalltalk.com
Education.
• Example – Wake Forest University– Thinkpad & Workpad to all students– Curriculum & other paper based items are changed
to use Workpad - paperless– Can do queries/requests
• Abstract sent to handheld
• Next time they logon to a desktop, the selected information is available in full
• Growing market
©2001 PocketSmalltalk.com
Making $Money$
• Shareware
• Shrink wrap
• Enterprise
• Job Market & Consulting
• Content
©2001 PocketSmalltalk.com
.Shareware
• Most common source of income• Many make >$10K/month• Some make >50K/month• Some make much less• How is this possible ?
– With internet can act like a big company– Palm market is large and growing– Word of mouth– Marketing from archives & Palm
©2001 PocketSmalltalk.com
Shrink wrap
• Don’t have very much information
• Pricing is not totally right for this
• Not much shelf space available
• Not too many distributors
• Starting to appear more in stores
• Franklin Covey® stores have tons of shelf space dedicated to Palm software
©2001 PocketSmalltalk.com
Enterprise
• Can make bigger sales
• Have pricing model that is flexible for enterprise wide licensing
• Harder sell as companys must trust in your survival
• Must provide good customer support
• Beware of companies that buy one copy and “share” it
©2001 PocketSmalltalk.com
.Job Market & Consulting
• Many available– Monster.com lists 50+ - More than Smalltalk jobs
• Got me my current job• Wireless a REALLY big deal for this• Good number of companies are looking to add PDA
and wireless to their product lines• Low level programming skills to build device drivers,
protocol stacks as well as enhancing existing apps• www.elance.com
©2001 PocketSmalltalk.com
Content.
• Archives– Provide a location for consumers to find, try and purchase
3rd party applications
– Provide a location for 3rd party developers to sell their products
• Portal– Provide access to Palm data from anywhere, web interface
• Information– Provide news and access to information relating to PDA
space
– For consumers and developers
©2001 PocketSmalltalk.com
Getting $Money$.
• Palm Venture Fund– “Palm Ventures will invest in companies that are exciting and innovative
members of the Palm Economy”
– http://www.palm.com/about/venture1.html
• VCs– Are always present at PalmSource™
– Looking for BIG results - $500M+
– I asked question “Other than Palm, as a developer how can I come up with software that will make $500M+ ?”
– Answer “It’s up to you to find it”
– My thought “Don’t waste time with VCs, unless you have a really big idea !!!”
• How the hell does one make a $500M+ company by selling software ???
©2001 PocketSmalltalk.com
Shareware
• Succeeding
• Registration
• Biggest Complaints
• Marketing
• Distribution
©2001 PocketSmalltalk.com
.Shareware – Succeding• Leverage internet
– Your own web site
– Publish on all the archives
• Give great service
• Make sure quality is high– Get beta testers
– Pay attention to UI
• 30 Second experience– Get the customers attention in the first 30 seconds
– If app is too complex for that, create a 30 second demo
• See what is popular on archives
• Target a broad audience or sell for a lot
©2001 PocketSmalltalk.com
Shareware – Succeding• Provide private labels/custom versions• Provide good documentation• Don’t just think U.S.
– Sell globally and create international editions– Example: Sales of a very popular app, DateBk3
• 30% Japan• 50% Outside US
• Types of apps used– Databases/Reference - Utilities– Games - Graphics– Calculators
©2001 PocketSmalltalk.com
.Shareware – Succeeding• Large majority of users not in high tech• Users are older on average than you might think• If users are very satisfied, they are very likely to recommend,
very likely to buy upgrades and add-ons• I/R Usage is known but not used much, is going up• Lot of pass-along activity• 3 types of customers
– Want info mgmt & wireless– Want great info mgmt– Want info mgmt & entertainment
• Remember: Today it’s a business tool, but personal usage gets mixed in
©2001 PocketSmalltalk.com
Shareware - Registration• Registration code based on user name to reduce
sharing• Have painless reminders to register
– Don’t necessarily use time bombs– If people keep app on handheld, they can talk about it and
keep using it
• Using limited functionality for un-registered is not always a good idea
• Have multiple payment options; not everyone likes to use credit card; remember international users
• REMEMBER: If you get 2-5% registration rate of total downloads, you are doing well !
©2001 PocketSmalltalk.com
Shareware - Pricing• Price of device does not lend itself well to standard
commercial pricing• Think around the $5.00-$40.00 range• Make many smaller apps in order to bring in more
money• Create bundles later, to get price up• Higher price can be used if there is a desktop
component to app and/or a conduit– Sell desktop and conduit separately
• Keep costs down by using your limited resources wisely, like support via e-mail/web
©2001 PocketSmalltalk.com
Shareware – Biggest Complaints
• Customer does not get replies from customer support questions
• Provide excellent customer service and support– Provide the service “you” would want as a customer
• Customer finds out that the software they purchased has had three revisions since they bought it, and developer has not told them– Use your customer list
• Go to user groups and visit them
©2001 PocketSmalltalk.com
Shareware – Marketing• Word of mouth
• Online– Participate on the various mailing
lists
– Put you software on every archive you can
• Palm Powered™ Compatible Solution
• Register as a Developer
• Palm and its licensees ALL have programs to help you market, if you succeed THEY succeed
• Palm’s InSync Online eMail Service
• Press– Get e-mails of press people who
previously covered Palm™ stuff
– Send news releases to as many as possible
• Take to Palm or Licensee contacts
• Make an excellent 30 second experience– Even if people don’t use your app
they’ll talk about it
– If app to complex, make a 30 second demo
• Use your customer list
• Attend www.PalmSource.com
©2001 PocketSmalltalk.com
Shareware – Distribution
Online• www.PalmGear.com
– Can handle sales, registration, tech support
• www.Handango.com– Can handle sales,
registration, tech support
• www.pilotzone.com• www.palmpilotsoftware
.com• www.palmspot.com
Palm & Licensees• Palm Powered™
Compatible Solution• Register as a developer
©2001 PocketSmalltalk.com
Shareware - Getting Help.
• Palm and its licensees have different marketing programs you can take advantage of if you become a registered developer and get your product certified by them
• PEF-talk forum: www.markspace.com/lists.html• www.palmos.com/dev/tech/support/• www.massena.com/darrin/pilot/index.html• …
©2001 PocketSmalltalk.com
Wireless
• The hottest thing around currently
• Options– Palm VIIx– CDPD– Bluetooth
©2001 PocketSmalltalk.com
Wireless – Palm VIIx• Palm Query Application (PQA)
– Build “app” using HTML
• Web Clipping, NOT Web browsing
• All request go through Palm.net proxy
• Mobitex Network
• Secure communication
• Has to be on to receive signals
• Next version will have pager for always on behavior
• ~8K baud
• Requires Palm.Net® Wireless Communication Service– Setup $9.99
– $9.99-50KB-$.20/KB
– $24.99-150KB-$.20/KB
– $44.99 – unlimited KB
©2001 PocketSmalltalk.com
Wireless – CDPD
• www.OmniSky.com
• www.NovatelWireless.com
• Palm™ Mobile Internet Kit– Software to I/R with phone
– Available as add-on, built intoPalmOS® 4.0
©2001 PocketSmalltalk.com
Wireless – Bluetooth• http://www.bluetooth.com
• Personal Area Network (PAN)/Piconet’s
• Point-to-point & Point-to-multipoint
• 2.4 GHz
• Short (around 10m), or medium range (around 100m)
• Max capacity of 720Kb/s
• Will be built into all/most future Palm™ handheld devices
• Phones are already out with it built in
• Everybody is getting excited about this
• Not there yet, but BIG names involved, and it will get to be widespread
©2001 PocketSmalltalk.com
Wireless – Bluetooth.
Usage Scenarios• 3 in 1 Phone
– Mobile phone
– Home cordless
– Walkie-talkie
• Internet Bridge• Ultimate headset• Interactive conference• Automatic synchronizer
Examples• VCR
– Walk up to VCR
– UI for VCR appears on handheld
– Program VCR from handheld
– Walk away
• File/business card exchange
©2001 PocketSmalltalk.com
Looking Ahead
• ARM– Next generation devices will be built using ARM
processors, instead of the current 68L Dragonball– Will get rid of memory limitations
• Security– Devices will provide much more thorough security
features
• Backward compatibility– New devices will have an emulator to allow old
applications to still run on new ARM
©2001 PocketSmalltalk.com
Sources of Information
• www.palmos.com
• www.palmos.com/dev/tech/
• www.palmos.com/dev/tech/hardware/
• www.handspring.com
• www.palmsource.com
• www.pocketsmalltalk.com
• www.palmgear.com
• …
©2001 PocketSmalltalk.com
Why are we not doing this ?
• Life is pretty busy: children, wives, friends, …
• Bootstrap process difficult when bills are rolling in– Is a moonlighting effort at start
• Not organized enough
• Have to work for a living during the day, “play” by night
• Too lazy :-)
©2001 PocketSmalltalk.com
After the break ?
• Palm OS®
• Structure of a Palm™ App
• “Hello World” in C
• Pocket Smalltalk– What is it ?– Overview and Friends– “Hello World” in Pocket Smalltalk– Future
©2001 PocketSmalltalk.com
PalmOS®• Mac OS like• Event Based• System calls broken out into managers
– Memory - Pen– Resource - Sound– String - Notification– …
• 32 bit memory addressing• 68K Dragonball Processor @ 12-33Mhz• All OS calls made through the use of a SYSTRAP
instruction
©2001 PocketSmalltalk.com
Zen of Palm• Solve a specific problem well• Simple ! Provide an 80% solution• Optimize taps• “Smart” Compression• There are UI guidelines, but are loose• The key is to do what you need to do in order to make
application work efficiently• Examples:
– Scrollbars used in Memo Pad, scroll buttons in address book– Address book has a list, view & edit forms, To Do has a
single list/view/edit Form
©2001 PocketSmalltalk.com
PalmOS® Development Tools• Metrowerks CodeWarrior
– Mac, Windows
• gcc tool chain – free– Linux, Windows
• Falch.net DeveloperStudio – free for NC– Windows
• Satellite Forms– Windows
• AppForge - VB– Windows
• Waba– Java syntax, custom library– Run on Palm OS™, Win CE, Pocket PC, Windows
• Java
See www.palmos.com/dev/tech/tools/ for a more complete list
©2001 PocketSmalltalk.com
PalmOS® Memory Architecture
• Two types of memory– ROM/FLASH (1-2Mb, soon to be 4Mb)
– RAM (1-8Mb)
• ROM/FLASH has OS and built in applications– No data
• RAM broken up into– Storage Heap
– Dynamic Heap
• All memory broken into 64K Segments
©2001 PocketSmalltalk.com
PalmOS® Memory Architecture• Storage Heap
– Organized into databases– Where application code is stored– Where applications store persistent data– Read no problem– Writing is controlled and slow
• Dynamic Heap– 18-64K in size– Shared between currently running
application and OS– Causes very serious limitations in
what application can do– Contains structures needed while application is running– Can read and write at will– Flushed on app exit
Copyright O’Reilly & Associates; used by permission
©2001 PocketSmalltalk.com
PalmOS® Application Architecture• OS supports non-preemptive multi tasking• Applications are only allowed to have 1 process• One app running at a time
– Going from one app to another requires shutdown of one and startup of next
• RAM or ROM based• Has a main event loop pulling events off of a single Global
system event queue• Has a single entry point that OS uses to execute and do other
special operations with an app• Application UI broken into Forms• Access to standard type of UI widgets
©2001 PocketSmalltalk.com
PalmOS® Structure of an App
• Apps are Event-based like most modern window systems
• Every Palm™ application has a single entry point– PilotMain()
• NOTE: We are talking about the structure of a typical C application
• Main app functions– StartApplication()
– EventLoop()
– ApplicationHandleEvent()
– MyFormHandleEvent()
– StopApplication()
©2001 PocketSmalltalk.com
PilotMain()
• Analogous to standard C main() or Windows WinMain()
• Gets the application moving
• Arguments: launchCode, launchFlags– Used to determine what kind of launch OS wants us
to do
• Starts EventLoop
• Calls StopApplication() function when EventLoop returns, in order to cleanup
©2001 PocketSmalltalk.com
StartApplication()
• Loads the first Form of the application
• Can be used to open any needed databases or resources and allocate needed structures
• This is the place to read preferences information and customize
©2001 PocketSmalltalk.com
EventLoop()• Pulls events off of global event queue• First gives the system a chance to handle the event• Then application attempts to handle event• Then event is passed off to the current Form’s event
handler• Application’s event handler can queue events that will
be processed here in later iterations• This flow of event handling is critical to the
functioning of the OS and application• Gives a chance for an application to override every
aspect of OS event handling
©2001 PocketSmalltalk.com
EventLoop()static void EventLoop(void)
{
do
{
EvtGetEvent(&event, evtWaitForever);
if (! SysHandleEvent(&event))
if (! MenuHandleEvent(0, &event, &error))
if (! ApplicationHandleEvent(&event))
FrmDispatchEvent(&event);
} while (event.eType != appStopEvent);
}
©2001 PocketSmalltalk.com
Event Queue and EventLoop
Copyright O’Reilly & Associates; used by permission
©2001 PocketSmalltalk.com
Event Queue and EventLoop
Copyright O’Reilly & Associates; used by permission
©2001 PocketSmalltalk.com
ApplicationHandleEvent()
• Argument: event
• Decodes event and figures out what to do
• Responsible for loading different Forms of the app based on user actions
• Also associates a form-specific event handler with its form
• Returns true if it handled the event, false otherwise
©2001 PocketSmalltalk.com
MyFormHandleEvent()
• Argument: event
• Need one event handler function per Form (they can be called anything you wish)
• Handles ‘all’ application specific logic
• Basically a giant switch statement deciding what to do based on the current event
• Can call other functions, just like normal C programs can
©2001 PocketSmalltalk.com
StopApplication()
• All cleanup logic should go here
• Close open databases
• Free any memory locks
• Save preferences
©2001 PocketSmalltalk.com
PalmOS® Flow of an App
OS Calls PilotMain()
OS queues events
PilotMain() StartApplication()
EventLoopOS Event Queue
ApplicationHandleEvent()MyFormHandleEvent()
StopApplication()
Pulls events off
OtherFormHandleEvent()
…
SysHandleEvent()
MenuHandleEvent()
FrmDispatchEvent()
©2001 PocketSmalltalk.com
What does all this mean?
• All events are placed on the same queue, not just events for your app
• You should follow this general pattern to properly handle all possible events
• Most of it is boilerplate code…
©2001 PocketSmalltalk.com
‘Hello, World!’ in C
• Classic demo/educational program for any language
• Simply pops up a window saying hello
• Demonstrates all six functions we’ve talked about
• Small for a typical Palm app…
• Easy to understand concepts
©2001 PocketSmalltalk.com
C – PilotMain()#include <PalmOS.h>#include <PalmCompatibility.h>#include "HelloWorldRsrc.h"
DWord PilotMain(Word launchCode, Ptr cmdPBP, Word launchFlags){ Err err = 0;
if (launchCode == sysAppLaunchCmdNormalLaunch) { if ((err = StartApplication()) == 0) { EventLoop(); StopApplication(); } }
return err;}
©2001 PocketSmalltalk.com
C – StartApplication()
• StartApplication() is called from PilotMain
• Displays first form
static Err StartApplication(void)
{
FrmGotoForm(HelloWorldForm);
return 0;
}
©2001 PocketSmalltalk.com
C – EventLoop()static void EventLoop(void) { do { EvtGetEvent(&event, evtWaitForever);
if (! SysHandleEvent(&event)) if (! MenuHandleEvent(0, &event, &error)) if (! ApplicationHandleEvent(&event)) FrmDispatchEvent(&event); } while (event.eType != appStopEvent);}
©2001 PocketSmalltalk.com
C – ApplicationHandleEvent()static Boolean ApplicationHandleEvent(EventPtr event){
FormPtr frm;Int formId;Boolean handled = false;
if (event->eType == frmLoadEvent) {formId = event->data.frmLoad.formID;frm = FrmInitForm(formId);FrmSetActiveForm(frm);switch (formId) {
case HelloWorldForm:FrmSetEventHandler(frm, MyFormHandleEvent);break;
} handled = true; } return handled;}
©2001 PocketSmalltalk.com
C – MyFormHandleEvent()static Boolean MyFormHandleEvent(EventPtr event) { Boolean handled = false;
switch (event->eType) { case ctlSelectEvent: FrmAlert(HelloWorldAlert); handled = true; break; case frmOpenEvent: FrmDrawForm(FrmGetActiveForm()); handled = true; break; case menuEvent: if (event->data.menu.itemID == FirstBeep) SndPlaySystemSound(sndInfo); else SndPlaySystemSound(sndStartUp); handled = true; break; } return handled;}
©2001 PocketSmalltalk.com
Building the C Application
gcc makefilePR = pilrc
CC = m68k-palmos-gcc
OR = m68k-palmos-obj-res
BP = build-prc
CFLAGS = -Os -palmos3.5 -g
LDFLAGS = -g
SRCS = HelloWorld.c
OBJS = HelloWorld.o
RSRC = HelloWorld.rcp
GRCS = *.grc
HelloWorld: $(SRCS) $(RSRC)
$(PR) HelloWorld.rcp
$(CC) $(CFLAGS) -c $(SRCS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)
$(OR) "$@"
$(BP) "[email protected]" "Hello World" HLWD *.grc *.bin
Code Warrior Project
©2001 PocketSmalltalk.com
gcc Progress Messages pilrc HelloWorld.rcp
PilRC v2.6
Copyright 1997-1999 Wes Cherry ([email protected])
Copyright 2000 Aaron Ardiri ([email protected])
Writing ./tFRM03e8.bin
140 bytes
Writing ./MBAR03ee.bin
139 bytes
Writing ./Talt03eb.bin
43 bytes
m68k-palmos-gcc -Os -palmos3.5 -g -c HelloWorld.c
m68k-palmos-gcc -g -o HelloWorld HelloWorld.o
m68k-palmos-obj-res "HelloWorld"
build-prc "HelloWorld.prc" "Hello World" HLWD *.grc *.bin
©2001 PocketSmalltalk.com
Pocket Smalltalk - Agenda• What is Pocket Smalltalk ?
• Tools Overview
• ‘Hello, World’
• Debugging
• Demo Application
• Support
• Coming RSN
• Existing Applications
• Developer Support
• By the end of this portion you should be able to build an application using Pocket Smalltalk
©2001 PocketSmalltalk.com
What is Pocket Smalltalk ?• Smalltalk IDE that runs on Windows, with virtual machine to
run code on Palm OS®– IDE in Squeak coming soon
• VM is ~30K, base image ~18K• Direct bytecode interpreter• Debugging and production VMs available• Mark&Compact garbage collector
– Classes, methods and literals not scanned
• Static set of classes and methods at runtime• No character information for Symbols• Allows direct Palm OS® calls• Why not use Squeak as starting point ?
©2001 PocketSmalltalk.com
Why Would You Want To Use Pocket Smalltalk?
• Provides a Smalltalk abstraction over the UI
• Because of inheritance, all the boilerplate code can be (and is) reused
• For the casual developer you only have to concentrate on your problem, not the scaffolding
• For the advanced developer, you can still get cozy with the low-level API
• Smalltalk = Fun!
©2001 PocketSmalltalk.com
Pocket Smalltalk - Tools Overview
• Windows Version
• Squeak Version
• PilRC
• MathLib
• Palm Emulator
©2001 PocketSmalltalk.com
Pocket Smalltalk - Windows
• Written in Dolphin Smalltalk– www.object-arts.com
• Launcher• Class Browser• Workspace• Package Browser• Constants Browser• Method Finder• Debugger
©2001 PocketSmalltalk.com
Pocket Smalltalk - Squeak• Create a Pocket Smalltalk Project and all of the standard tools
of Squeak work on Pocket Smalltalk code• Not fully released• Cross Platform
1.0 coming soon• Port from Dolphin
being redone to keepbetter portabilitybetween Dolphin &Squeak versions
• Why Squeak ?– Really need cross
platform
©2001 PocketSmalltalk.com
PilRC• Tool used by Palm developers to build resources used by
Palm applications– www.ardiri.com/index.cfm?redir=palm&cat=pilrc
• Compiles resource ‘recipe’ files into binary representations of screen widgets
• Simple text format allows easy hand editing of resources• Cross platform• Language independent – same recipe file used with C as
for Pocket Smalltalk• If using CodeWarrior, it has a built in GUI editor so
PilRC not needed
©2001 PocketSmalltalk.com
PilRC Example RecipeFORM ID 1000 AT (0 0 160 160)
NOFRAME
MENUID 1006
BEGIN
TITLE "Hello, (Palm) World"
BUTTON "Push Me" ID 1001 AT (55 80 AUTO AUTO) USABLE
END
• Code Warrior Constructorequivalent
©2001 PocketSmalltalk.com
MathLib
• Palm OS does not provide good float support• MathLib is a free shared library for Palm OS®
providing IEEE-754 double-precision math functions
• Released under GNU LGPL• Pocket Smalltalk supports Float only if mathlib
is on device, fails otherwise– If your application does not need Floats, then this
issue does not exist
• www.probe.net/~rhuebner/mathlib.html
©2001 PocketSmalltalk.com
Palm OS Emulator (POSER)• Software that emulates almost any
Palm Powered™ handheld hardware
• Freely available from Palm• Invaluable for debugging and
testing• Runs on Windows, Linux, Unix,
BeOS, …• Runs 68K code• Requires ROM containing Palm OS
to function– Can get from Palm or device
itself
©2001 PocketSmalltalk.com
‘Hello, World’ in Pocket Smalltalk
• Create the language independent recipe for the screen widgets (compiled with PilRC)
• Write the code using Pocket Smalltalk IDE
©2001 PocketSmalltalk.com
PilRC Recipe for ‘Hello, World!’FORM ID 1000 AT (0 0 160 160)NOFRAMEMENUID 1006BEGIN TITLE "Hello, (Palm) World" BUTTON "Push Me" ID 1001 AT (55 80 AUTO AUTO) USABLEENDMENU ID 1006BEGIN PULLDOWN "Foo" BEGIN MENUITEM "Beep" ID 1004 END PULLDOWN "Bar" BEGIN MENUITEM "Beep More" ID 1005 ENDENDALERT ID 1003INFORMATIONBEGIN TITLE "A Special Message" MESSAGE "Hello, World!" BUTTONS "OK"END
©2001 PocketSmalltalk.com
Pocket Smalltalk - Hello, World!
• First, create and save a new project: HelloWorld.pst
• Next, create a package for your code using the Package Browser.
• Set it as the default package.
• Subclass Application: e.g HelloWorldApplication
©2001 PocketSmalltalk.com
Pocket Smalltalk - Hello, World!
• First, create and save a new project: HelloWorld.pst
• Next, create a package for your code using the Package Browser.
• Set it as the default package.
• Subclass Application: e.g HelloWorldApplication
©2001 PocketSmalltalk.com
Pocket Smalltalk - Hello, World!
• First, create and save a new project: HelloWorld.pst
• Next, create a package for your code using the Package Browser.
• Set it as the default package.
• Subclass Application: e.g HelloWorldApplication
©2001 PocketSmalltalk.com
Pocket Smalltalk - Hello, World!
• First, create and save a new project: HelloWorld.pst
• Next, create a package for your code using the Package Browser.
• Set it as the default package.
• Subclass Application: e.g HelloWorldApplication
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Define Constants for widgets (changing in PST 2.0)
• Add generated .bin files from PilRC
• Add a VM to the project (changing in PST 2.0)
• Change ##applicationTitle to ‘Hello, World!’
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Define Constants for widgets (changing in PST 2.0)
• Add binary resource files from PilRC
• Add a VM to the project (changing in PST 2.0)
• Change ##applicationTitle to ‘Hello, World!’
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Define Constants for widgets (changing in PST 2.0)
• Add binary resource files from PilRC
• Add a VM to the project (changing in PST 2.0)
• Change ##applicationTitle to ‘Hello, World!’
©2001 PocketSmalltalk.com
Pocket Smalltalk- First Steps (cont)
• Define Constants for widgets (changing in PST 2.0)
• Add binary resource files from PilRC
• Add a VM to the project (changing in PST 2.0)
• Change ##applicationTitle to ‘Hello, World!’
©2001 PocketSmalltalk.com
PST - First Steps (cont)
• Add #formID method to HelloWorldApplication class side
• Add Smalltalk class>>start to launch our HelloWorldApplication class
• Generate Code– Notice that all the widgets show up, they just don’t
do anything useful yet.
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Add #formID method to HelloWorldApplication class side
• Add Smalltalk class>>start to launch our HelloWorldApplication class
• Generate Code– Notice that all the widgets show up, they just don’t
do anything useful yet.
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Add #formID method to HelloWorldApplication class side
• Add Smalltalk class>>start to launch our HelloWorldApplication class
• Generate Code– Notice that all the widgets show up, they just don’t
do anything useful yet.
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Bind widgets and menu items to action methods.
• Write action methods for menu items
• Generate code and run it
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Bind widgets and menu items to action methods.
• Write action methods for menu items
• Generate code and run it
©2001 PocketSmalltalk.com
Pocket Smalltalk - First Steps (cont)
• Bind widgets and menu items to action methods.
• Write action methods for menu items
• Generate code and run it
©2001 PocketSmalltalk.com
Pocket Smalltalk & C Differences
• Smalltalk version has less code
• No pointer dereferencing
• No address passing
• No EventLoop related stuff
• Nothing but Application logic – you can concentrate on the problem, not the boilerplate functions
©2001 PocketSmalltalk.com
Debugging and Testing• Special constants found in System Properties• ##debug
– If set to true, then the generated application will contain all class names, and all selector names
• This allows the debugger on device to show the name of the class and selector where error occurred
– If false, then no symbolic information is kept• Used to deploy an application
– All Symbols become integers on device
• ##optimization removes dead code from final prc file– If set to true, will perform dead code elimination in order to
minimize final size of application– If false, include all code
©2001 PocketSmalltalk.com
What’s Missing ?
• Source level debugger• No Callbacks
– Some widgets require a pointer to a function
• Out of the box VM has limited support for the different launchCodes and launchFlags (will improve!)
• High level portable abstraction layer for UI• Simulator of Palm OS® calls• GUI Painter
©2001 PocketSmalltalk.com
Non Standard Smalltalk Features
Syntax• ## preceding an identifiers is
used to show a reference to a constant
• ::= is a hard assignment operator– Allows the value of an
argument to be assigned to
– Used in one special case
• <systrap: returnType trapNum (argTypes)>
Library
• Not sure what aspects are non compliant yet
• Will start working on compliance as soon as next release, and the Cross Platform edition is done
©2001 PocketSmalltalk.com
What’s Coming RSN?
• Better compliance with ANSI specification• Will add support SIF file-out format• All deviations from standard Smalltalk syntax
will be removed– Except for OS call specifications (<systrap: >)
• Dolphin and Squeak version will use identical codebase, just different UI
• Possibly support platforms other than Palm and GEOS
©2001 PocketSmalltalk.com
Pocket Smalltalk - Developer Support
• PocketSTUG Yahoo! Group: groups.yahoo.com/group/pocketstug
• 223 members
• Moderate traffic
• Many helpful people (including Eric and Joey)
• Also www.joeygibson.com/st; mirror site for distros, and home site of my PST Introduction
©2001 PocketSmalltalk.com
Books
• Palm Programming: The Developer’s Guide– Neil Rhodes & Julie McKeehan– O’Reilly & Associates, ISBN 1-56592-525-4
• Palm™ Programming: The Authoritive Solution– Glenn Bachmann– Sams, ISBN 0-672-31493-2
• See www.palmos.com/dev/tech/docs/ for a complete list
©2001 PocketSmalltalk.com
Existing Pocket Smalltalk Applications
• Telengard
• Palm Nums– $5
– Handango
– 2925 downloads, 103 sold
– PalmGear
– 4500 downloads, < 50 sold
• Knight’s Tour
©2001 PocketSmalltalk.com
Where to Get More Information
• www.pocketsmalltalk.com
• www.joeygibson.com/st/pstIntro
• www.joeygibson.com/st
• Palm DevZone: www.palmos.com/dev
• POSE: www.palmos.com/dev/tech/tools/emulator
• MathLib: www.probe.net/~rhuebner/mathlib.html