View
224
Download
0
Category
Preview:
Citation preview
8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
1/17
Mob ile printing on HP p rinters with Bluetooth from Palm OS 5.0
CALIFORNIA SOFTWARE LABS
R E A L I Z E Y O U R I D E A S
California Software Labs6800 Koll Center Parkway,
Suite 100 PleasantonCA 94566, USA.
Phone (925) 249 3000
Fax (925) 426 2556info@cswl.com
http://www.cswl.com
mailto:info@cswl.comhttp://www.cswl.com/http://www.cswl.com/mailto:info@cswl.com8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
2/17
www.cswl.com
CSWL Inc, Pleasanton, California - 2
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Mobile printing on HP printers with Bluetooth from
Palm OS 5.0
A Technical Report
INDEX
INTRODUCTION............................................................................................................. 3
MOBILE PRINTING TODAY........................................................................................ 3
PRINTER DRIVERS............................................................................................................. 3
DRIVER-LESS PRINTING .................................................................................................... 4
BLUETOOTH TECHNOLOGY.................................................................................. 5
BLUETOOTH TECHNOLOGY........................................................................................... 5BLUETOOTH SPECIFICATION OVERVIEW: .......................................................................... 6
Bluetooth Protocol Stack ............................................................................................ 6What is a Bluetooth Profile?....................................................................................... 7
COMMUNICATION BETWEEN BLUETOOTH DEVICES .......................................................... 7
BLUETOOTH PROFILE OVERVIEW..................................................................................... 8BLUETOOTH SECURITY .................................................................................................... 8
PALM OS SUPPORT FOR BLUETOOTH................................................................... 9
Palm OS Bluetooth architecture................................................................................. 9
MOBILE PRINTING SUPPORT FOR HP PRINTERS ............................................ 11
BLUETOOTH SUPPORT FOR HP PRINTERS ....................................................................... 11
BLUETOOTH PRINTING SUPPORT ........................................................................ 11
BASIC PRINTING PROFILE ............................................................................................... 11
SAMPLE INTEGRATION AND IMPLEMENTATION........................................... 12
SAMPLE PROGRAMMING ON PALMOS............................................................................. 12OVERVIEW OF IMPLEMENTATION................................................................................... 13
Pre-requisite for Palm Bluetooth development: ....................................................... 13 Implementation: ........................................................................................................ 13
SOURCE-CODE BASICS ................................................................................................... 15
Opening serial Port code:......................................................................................... 15
Sending data over serial Port code: ......................................................................... 16
Close serial Port code: ............................................................................................. 16
CONCLUSION ............................................................................................................... 16
REFERENCES: ................................................................................................................. 17
8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
3/17
www.cswl.com
CSWL Inc, Pleasanton, California - 3
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Introduction
This document aims to provide some basics of using the Bluetooth technoloy for
mobile printing, from a Palm handheld. Mobile printing techniques are introduced
first, followed by a brief coverage of Bluetooth technology. Subsequently, features
of the Bluetooth stack as it applies to PalmOs 5 are taken up. The discussion ends
with sample code snippets that demonstrate communication with a Bluetooth
enabled printer, such as certain HP Deskjets.
Mobile Printing Today
Mobile Printing is the term used for printing from mobile devices such as a Palm
handheld, a laptop, a PocketPC or similar device, without cables and without
complex printer drivers, and directed towards a printer in the vicinity. Mobile
printing is essentially wireless printing.
Depending on the capabilities of the mobile device, and that of the printer, the
following scenarios are possible:
Printing via printer drivers.
Driver-less printing
Printer drivers
Printer drivers are printer-specific code, and not very suitable for smaller devices.
They are useful in mobile devices like notebooks that run operating systems such as
Windows and Linux. However, it is possible to address a whole family of printers
(such as the DeskJet series from HP) using a monolithic driver built from toolkits
such as the HP APDK.
While it is possible to have specific printer drivers loaded on devices such as a
Palm handheld, this generally curtails mobility, restricting printing to those printers
alone.
http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
4/17
www.cswl.com
CSWL Inc, Pleasanton, California - 4
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Driver-less printing
With mobile devices having smaller footprints of memory, display and other
resources, driver-less printing is the method of choice. To support this, the
following techniques are used:
Dynamic Printer discovery
Identification of document to print
Sending a print stream to the printer
Dynamic printer discovery is possible using protocols such as Bluetooth, IrDA,
UPnP, and through next generation print services on the LAN (WiFi) or WAN
(cellular - GSM/GPRS/CDMA2000). In the latter case, a print service way bediscovered on the local wireless LAN, or an ISP hosted service may be consulted,
with the requests routed via a VPN to a corporate setting. This would result in a
user selection from a choice of printers offered. As of this writing such protocols
have been established and are being implemented (for details, see Printer Working
Group at www.pwg.org).
Identifying the document to print could be accomplished in a number of ways. For
devices such as a mobile phone, a URL is one option. For less heavy content, the
document may be present on the device itself.
Sending a print stream to the printer after discovery can be done in the following
ways:
Send a URL to the printer. Printer can fetch the URL content, transform to a
print stream (perhaps using another print service) and print
Send the URL to a print service with printer description. Proper print stream
formatting may be done by the print service. The resulting stream may be
sent from the print service to the printer directly, or siphoned through the
mobile device to the printer.
http://www.pwg.org/http://www.pwg.org/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
5/17
www.cswl.com
CSWL Inc, Pleasanton, California - 5
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Use a standard document format such as XHTML and send the stream to
the printer
Use a standard protocol such as IPP (Internet Printing Protocol), which is
supported by many new printers.
Use Generic Object Exchange formats used in printing address books,
business cards etc. Many printers support this.
Bluetooth technology
Bluetooth Technology
The Bluetooth technology is an open specification for short-range wireless
communication between electronic devices. It has become a standard for
interconnecting small mobile devices in wireless world. Bluetooth specification is
developed, published and promoted by Bluetooth Special Interest Group (SIG).
Bluetooth technology is used for Wireless Personal Area Networks (WPANs) with
range around 10 m. It is a low-power short-range radio communication technology.
The characteristic of the technology offers lot of advantages as listed below:
Low power requirementmakes it ideal for small mobile devices, which run
on battery.
Low Costmakes it ideal for mobile device manufactures to built in
Bluetooth support.
Short Rangeof 10 m makes ideal for mobile users to connect to other
mobile device in a room or adjacent room eliminating wired connection.
Transmission speedof 800 kbps makes it good enough for transferring
small to medium size files.
2.4 GHz ISM bandenabling developing devices and solutions, which can
work worldwide.
http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
6/17
www.cswl.com
CSWL Inc, Pleasanton, California - 6
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Bluetooth Security, specification provides support for security at its core
protocol level, includes authentication, encryption and secure link.
Bluetooth specification overview:
Bluetooth Protocol Stack
The below diagram show the core building layers of the Bluetooth architecture.
Source www.palmos.com
Baseband
The baseband layer and the link control layer enable the physical Radio Frequency (RF)link between Bluetooth devices. Two kinds of physical links can be formed with their
corresponding baseband packets: Synchronous Connection-Oriented (SCO) and
Asynchronous Connectionless (ACL).
Link Manager Protocol (LMP)
The Link Manager Protocol is responsible for setting up the link between Bluetooth
devices. This includes security aspects like authentication and encryption by generating,exchanging, and checking of link and encryption keys.
Logical Link Control and Adaptation Protocol (L2CAP)
L2CAP provides both connection-oriented and connectionless data services to the upper
layer protocols with protocol multiplexing capability, segmentation and reassembly
operation, and group abstractions. L2CAP is defined only for ACL links and not
supported for SCO links, as specified by the Bluetooth Specification.
http://www.palmos.com/http://www.palmos.com/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
7/17
www.cswl.com
CSWL Inc, Pleasanton, California - 7
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Service Discovery Protocol (SDP)
SDP is used to get specific information about a remote device, such as available services.
Using SDP characteristics of these services can be queried.
RFCOMMThe RFCOMM protocol provides emulation of serial ports over the L2CAP protocol. The
protocol is based on the ETSI standard TS 07.10. Only a subset of the TS 07.10 standardis used, and some adaptations of the protocol are specified in the Bluetooth RFCOMM
specification.
What is a Bluetooth Profile?
The Bluetooth Specification defines a set of usage models or scenarios for using
Bluetooth enabled radio devices. These usage modules, referred to as profiles, define
standard ways of communicating with Bluetooth-enabled devices. It is intended toreduced the risk of interoperability issues between different manufacturers and provide a
basis for the development of a common set of functions that Bluetooth enable deviceswill support. A profile does not need to include all the protocols defined in the Bluetoothprotocol stack. It can be a subset of various protocols in the stack
Communication between Bluetooth devices
Piconets (a, b) and Scatternet (C) (Source www.palmos.com)
Point-to-Point connection:
In this type of connection, only two Bluetooth devices are involved. One device
acts as a master and other as a slave. The two devices form a network called Piconet.
http://www.palmos.com/http://www.palmos.com/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
8/17
www.cswl.com
CSWL Inc, Pleasanton, California - 8
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Point-to- Multipoint:
In this type of connection, two or more (Max 8) Bluetooth devices are involved.
One device acts as a master and others act as a slave. These devices form a network
called Piconet.
Scatternet:
Two or more Piconet when connected form a Scatternet.
Bluetooth Profile Overview
Bluetooth specification v1.1 includes following general profiles:
1. General Access Profile
2. Service Discovery Application Profile3. Cordless Telephony Profile
4. Intercom Profile5. Serial Port profile
6. Headset Profile
7. Dial-up Networking Profile8. Fax Profile
9. LAN Profile
10. Generic Object Exchange Profile11. Object Push Profile
12. File Transfer Profile
13. Synchronization Profile
Additional profiles for a Printing usage model:
1. Basic Printing Profile2. Hardcopy cable replacement Profile
Bluetooth Security
Bluetooth security includes both authentication and encryption, and is based around the
SAFER+ encryption algorithm.
http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
9/17
www.cswl.com
CSWL Inc, Pleasanton, California - 9
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Palm OS support for Bluetooth
Palm OS 5.0 has a built in support for Bluetooth.
Palm OS Bluetooth architecture
(Reference: Palm documentation www.palmos.com)
Recent releases of Palm OS includes a Bluetooth stack and SDK for developers.
The Palm Bluetooth SDK includes the Palm bluetooth library and bluetooth
specific drivers.
As of this writing, PalmOS does not support all Bluetooth profiles. In the diagram,
the profiles marked in red are not supported on Palm.
8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
10/17
www.cswl.com
CSWL Inc, Pleasanton, California - 10
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
(Source www.palmos.com)
Bluetooth specifications specify three security modes for a device.
Security mode 1 (non-secure): A device will not initiate any security
procedure. Security mode 2 (service-level enforced security): A device does not initiate
security procedures before channel establishment at L2CAP level. This
mode allows different and flexible access policies for applications,
especially running applications with different security requirements in
parallel.
Security mode 3 (link level enforced security): A device initiates security
procedures before the link set-up at the LMP level is completed.
Palm currently supports security modes 1 and 2.
http://www.palmos.com/http://www.palmos.com/http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
11/17
www.cswl.com
CSWL Inc, Pleasanton, California - 11
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Mobile printing support for HP Printers
Bluetooth support for HP Printers
HP has included built-in support for Bluetooth in its mobile printer DeskJet 995c.
Other printers may be expected to follow suit. In any case, HP also makes available
Bluetooth printer adapters so that existing printers may be Bluetooth enabled.
HPs Mobile printing initiative and associated software also has Bluetooth as a key
ingredient.
Bluetooth Printing Support
Bluetooth specification has define following profile related to printing
Basic Printing profile (BPP):
Supports driverless printing for mobile devices such as mobile phones,
pagers, and PDAs. BPP is explained below.
Hard Copy Replacement profile
The data is rendered through the use of a driver on the client device like
mobile laptops and desktop computer.
Basic Printing profile
This application profile defines the application requirements for Bluetooth devices
necessary for the support of the Basic Printing usage model.
This Profile makes use of the Generic Object Exchange Profile (GOEP) to define the
interoperability requirements for the protocols needed by applications. The most commondevices using these usage models are mobile devices such as mobile phones, pagers, and
PDAs, although more complex devices are not excluded. Usage models include printingof text emails, short messages, and formatted documents. Optional support for the
printing of structured data objects such as vCard and vCalendar is also defined, as well as
methods for negotiating the use of other formats supported by the printer.
http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
12/17
www.cswl.com
CSWL Inc, Pleasanton, California - 12
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
The Basic Printing Profile is dependent on the Generic Object Exchange, Serial Port, andGeneric Access Profiles.
Sourcewww.bluetooth.org
Sample Integration and Implementation
Sample programming on PalmOs
A sample mobile printing application was developed to print to an HP995c printer
from Palm Tungsten OS 5.0 using Bluetooth wireless technology.
Platform and Devices considered for sample implementation:
Palm OS 5.0
Palm OS 5.0 has a built-in support for Bluetooth in its architecture.
http://www.bluetooth.org/http://www.bluetooth.org/http://www.bluetooth.org/http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
13/17
www.cswl.com
CSWL Inc, Pleasanton, California - 13
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Palm OS supports Service Discovery Profile, Serial Port profile and Object
Push profile.
HP DeskJet 995c
HP 995c has built-in support for Bluetooth. It supports Service DiscoveryProfile, Serial Port Profile and Object push Bluetooth profiles.
Overview of Implementation
Pre-requisite for Palm Bluetooth development:
Palm OS SDK:
Palm OS SDK can be downloaded from website. They have a developer
program to which we can register and get the SDK, which has a support for
Bluetooth.
Palm Tungsten:
Palm Tungsten is the current lastest model of Palm which comes with Palm
OS 5.0.
Development Environment:
Metrowerks CodeWarrior or Falch.Net developer studio.
Implementation:
1. Simple Palm OS application was created.2. Palm Bluetooth library support was included in the application.
The Palm Bluetooth Library is a shared library that provides an API fordeveloping Bluetooth enabled application. The API provides functions in
the following areas:
Managing remote devices, piconets
Communicating with Bluetooth devices at L2CAP and RFCOMMprotocol level.
Advertising services and querying for remote services using SDP
Maintaining a list of trusted devices
An applications should check if the Bluetooth system is running on thehandheld before using any Bluetooth APIs.
To do so, the following code was include in the Application open routine:
UInt32 btVersion;// Make sure Bluetooth components are installed
8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
14/17
www.cswl.com
CSWL Inc, Pleasanton, California - 14
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
// This check also ensures Palm OS 4.0 or greaterif (FtrGet(btLibFeatureCreator, btLibFeatureVersion,&btVersion) !=
errNone)
{
// Alert the user if it's the active applicationif ((launchFlags & sysAppLaunchFlagNewGlobals) &&
(launchFlags & sysAppLaunchFlagUIApp))FrmAlert (MissingBtComponentsAlert);
return sysErrRomIncompatible;
}
3. Serial Port Profile was implemented using the Palm Virtual Serial
Manager:
The Bluetooth system implements the serial port profile with a Virtual
Serial Driver. Virtual Serial driver work with RFCOMM protocol toemulate cable-less serial connection.
This driver has the following characteristics:
Opens a background thread for the Bluetooth stack.
Supports only one current active serial channel (point-to-pointconnection ) at a time.
Opens the device as a client or server
An RFCOMM-based virtual serial port is less symmetrical than a physicalserial port. In a traditional serial port there is no need to establish the
underlying transport. When establishing a Bluetooth serial port, there areroles for a client and a server device on three different stack levelsACL,
L2CAP, and RFCOMMas well as responsibilities for registering withand querying SDP.
4. Scenario used
The Palm hand-held acts as a Bluetooth client to the HP printer. The palm
device first uses Bluetooth SDP to search for a printer in the vicinity. Theprinter and any other bluetooth enabled device in the vicinity responds
with its address (48 bit number), which is unique for each Bluetooth
device. This process of searching for Bluetooth device is called DeviceDiscovery Process. Once the device is identified, an RFCOMM-virtual
serial channel is created between the client (Palm) and server (Printer).
This process creates a data channel between the client and server through
which a print stream is sent.
8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
15/17
www.cswl.com
CSWL Inc, Pleasanton, California - 15
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
Following data streams were used:ASCII Test data
PCL data stream generated from HP APDK
Reference on using the HP APDK is available at
http://www.cswl.com/hpapdk andhttp://www.cswl.com/whiteppr/tech/printing.html
Source-code Basics
Opening serial Port code:
SrmExtOpen API is used for opening an RFCOMM-virtual serial port.
Parameters for this API1. Type of port i.e. Bluetooth RFCOMM
2. Port configuration structure3. Size of port configuration structure
4. Port id, output param
//opening virtual serial port
Err err;
SrmOpenConfigType config;
BtVdOpenParams btParams;
BtLibSdpUuidType sppUuid;
// Set up a SerialPort service class UUID
MemSet
( &sppUuid,sizeof
(sppUuid), 0 );sppUuid.size = btLibUuidSize16;
sppUuid.UUID[0] = 0x11;//corresponds to serial port
sppUuid.UUID[1] = 0x01;//corresponds to serial port
// // Set up a Bluetooth parameter block: play client role, use
null remote device address,
// // and use sdp to search for the serial port profile service
class uuid.
// //
MemSet( &btParams, sizeof(btParams), 0 ); // note this leaves
the remote dev addr null
btParams.role = btVdClient; // we are theclient side
btParams.u.client.method = btVdUseUuidList; // use SDP to
look for service class uuids
btParams.u.client.u.uuidList.tab = &sppUuid; // the list of
service uuids to search for
btParams.u.client.u.uuidList.len = 1; // the number of
uuids in the list
//
http://www.hpdevelopersolutions.com/join/want_to_leave.cfmhttp://www.cswl.com/whiteppr/tech/printing.htmlhttp://www.cswl.com/whiteppr/tech/printing.htmlhttp://www.hpdevelopersolutions.com/join/want_to_leave.cfm8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
16/17
www.cswl.com
CSWL Inc, Pleasanton, California - 16
Mobile printing on HP printers with Bluetooth from Palm OS 5.0
// // Set up the SrmExtOpen param block to reference our
Bluetooth param block
// //
MemSet( &config, sizeof(config), 0 );
config.function = 0; // must be zero
config.drvrDataP = (MemPtr)&btParams; // Bluetooth-
specific params go hereconfig.drvrDataSize = sizeof(btParams); // size of
Bluetooth-specific params
//
// // Call SrmExtOpen with the parameters we just set up.
// //
err = SrmExtOpen (
sysFileCVirtRfComm, // type of port == Bluetooth RfComm
&config, // port configuration params
sizeof(config), // size of port config params
&btPortId // receives the id of this virtual port
instance
);
Sending data over serial Port code:
UInt32 tosend, numsent;
char msg[] = "Hello World\n";//Fill the array with PCL or//ASCII file when testing those mode.
tosend = StrLen(msg);
numsent = SrmSend (btPortId, msg, tosend, &err);
Close serial Port code:
SrmClose
(btPortId);
Conclusion
Bluetooth is a key ingredient to enabling mobile printing from low-cost low-power
devices. Not only printing, the technology is relevant to a very wide range of
industry segments like computing, telecom, networking, automotive, consumerelectronics, medical and military. With industry leaders like Erricson, Nokia and
Intel adopting and driving the technology, and the explosive growth of mobile
market and the need to be Always connected, Bluetooth is becoming a very
significant and crucial technology. Industry experts project that, by the year 2006,
there will be a shipment of 150 million Bluetooth enabled devices from Western
http://index/8/2/2019 w Mobile Printing HPprinterswith Bluetooth From Palm
17/17
www.cswl.com
CSWL Inc, Pleasanton, California - 17
Mobile printing on HP printers with Bluetooth from Palm OS 5 0
Europe itself. Also it is projected that by the year 2004, there will be more than 1
billion mobile subscribers using the internet in some form.
Techniques described in this document can be easily adapted to printing from other
mobile platforms as well, such as a PocketPC or mobile-phone. Mobile printingopens an opportunity in the software market to create sophisticated mobile printing
network solutions, and this field is still in its early stages.
References:1. Plam Bluetooth support document http://www.plamos.com
2. Bluetooth specifications and profiles http://www.Bluetoothsig.org
3. Bluetooth official sitehttp://www.bluetooth.org
4. Printer Working Group http://www.pwg.org
5. Hewlett Packardhttp://www.hp.com
6. HP Appliance Printing Development Kit http://www.hpapdk.com7. Palm APDK printing http://www.cswl.com/whiteppr/tech/printing.html
------------------------------------------------------------------------------------------------------------Copyright Notice:
2002 California Software Labs. All rights Reserved. The contents on the document are
not to be reproduced or duplicated in any form or kind, either in part or full, without the
written permission of California Software labs. Product and company names mentionedhere in are the trademarks of their respective companies.
http://www.plamos.com/http://www.bluetoothsig.org/http://www.bluetooth.org/http://www.bluetooth.org/http://www.pwg.org/http://www.hp.com/http://www.hp.com/http://www.hpapdk.com/http://www.cswl.com/whiteppr/tech/printing.htmlhttp://www.cswl.com/whiteppr/tech/printing.htmlhttp://www.hpapdk.com/http://www.hp.com/http://www.pwg.org/http://www.bluetooth.org/http://www.bluetoothsig.org/http://www.plamos.com/Recommended