首页资源分类嵌入式系统 > java蓝牙开发

java蓝牙开发

已有 445487个资源

下载专区

上传者其他资源

    文档信息举报收藏

    标    签:蓝牙

    分    享:

    文档简介

    有效帮助蓝牙开发,里面有源代码

    文档预览

    Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Bluetooth for Java Back Cover by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Bluetooth is a Internet from hteocmhneA/oolpofrfgeicysesf,o©bru2w0t0iir3se(lt3ey5sp2sicpcaaogllemys)musuendicfaotriosnh.oIrtt is similar in functionality to the way laptops connect to the burst communications instead of a continuous connection. Because of this diffeTrhenecaeu,tBhlourestooof tthhiiss tmexotredetyspcricibaellyhofowuntod dseuvpeplorptewdirienlewsisreJlaevsas phones and personal devices. Bluetooth for Java isapnpolticaantionvseruvsieinwg oBfluBelutoeotothotfho.r Ian vtahreiebtoyookf, pBlarutfcoermHos.pkTihnis and Ranjith Antony describe how to develop wireless JaviancalupdpelicsaatnionAsPIuosivnegrvBileuwetoofothefoJravaavlaibrrieatryy,odf epvlaetlofoprmmesn. tTohfis includes an API overview of the Java library, developBmlueentot ootfhB-bluaesteodotshe-rbvaicseesd, sheigrvhilcigehs,tshoigfhsleigchutrsitoyfcsoenccuerritnys,coancderns, and walkthroughs for development with sommoereo.f the different tools available. Programs will not be just J2ME (micro devices) based, but will also be for J2SE (client/desktop). Table of Contents About the Authors Bluetooth for Java Bruce Hopkins is an early adopter of Java technology, and has used it in a wide variety of applications, ranging from eImntbreoddduecdtiosnystems to enterpise applications. He currently works as a technical architect at Redwood Solutions, an ICThsaeprtveicre1s fir-mInitnroLdivuocniniag, BMluicehtiogoatnh. Chapter 2 - Bluetooth 1.1 Ranjith Antony is the technical lead for Atinav, an early Bluetooth "provider"/adopter. Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars BluetootBhlueftooorthJava for Java by Bruce Hopkins and Ranjith Antony BRUCE HOPKINASprAeNssD© 2003 (352 pages) ISBN:1590590783 RANJITH ANTONThYe authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. TaCbolepyorfigChotn©te2n0t0s3 by Bruce Hopkins and Ranjith Antony Bluetooth for Java Introduction CAhallprtiegrht1s re- sIenrtvroeddu.cNinogpBalurteotofoththis work may be reproduced or transmitted in any form or by any means, Cehlaepctterron2ic -orBlmueetcohoathni1c.a1l, including photocopying, recording, or by any information storage or retrieval Cshyasptteemr 3, wi-thBoeufot rtheeYopurioGrewt Sritttaerntepdermission of the copyright owner and the publisher. ISBN (pbk): 1-59059-078-3 Chapter 4 - Understanding the Java Bluetooth API CPharipntteerd5an-dBblouuetnodotinh twhiethUJn2iMteEdMSItDaPtes of America 12345678910 Chapter 6 - Creating a Bluetooth Print Server with JPS API CTharapdteerm7ark-eJdavnaaamnedsOmBEaXy appear in this book. Rather than use a trademark symbol with every occurrence Cohfapatetrra8dem- aUrskinegd anaBmlueet,owoethuSsiemtuhleatonrames only in an editorial fashion and to the benefit of the trademark Cohwapnteerr,9with- BnloueintoteonthtioSnecoufriintyfringement of the trademark. CThaepcthenr i1c0al-RWeivreielewsserE:mAbneddrdeewd SSytrsintegmesr with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CEhadpittoerri1a2l D-iBrelucettoorosth: Danadn JAinpipleman, Gary Cornell, Simon Hayes, Karen Watterson, John Zukowski Appendix A - javax.bluetooth AAppsesnidsitxanBt-Pjuavbalixs.hobeerx: Grace Wong APpproenjedcixt CMa- nJaavgaeBrlaunetdooDthevDeeloveplmopemnetnEt dointothr:eTPraalmcyOBSroPwlatnfoCrmollins Appendix D - BlipNet 1.1 API InCdoexpy Editor: Ami Knox List of Figures LiCstoomf pTaobslietsor: Impressions Book and Journal Services, Inc. LiAstrtoisf tLiasntindgCs over Designer: Kurt Krames List of Sidebars Indexer: Valerie Robbins Production Manager: Kari Brooks Manufacturing Manager: Tom Debolski Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17, 69112 Heidelberg, Germany. In the United States, phone 1-800-SPRINGER, email , or visit http://www.springer-ny.com. Outside the United States, fax +49 6221 345229, email , or visit http://www.springer.de. For information on translations, please contact Apress directly at 2560 9th Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax: 510-549-5939, email , or visit http://www.apress.com. The information in this book is distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. Bluetooth for Java The source codebfyorBtrhuicsebHooopkkiisnsavaanidlaRbalenjtiothreAandtoenrys at http:IS/B/Nw:1w5w90.5a90p7r8e3 ss.com in the Downloads section. Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java First and foremosatp, pI ldiceadtiiocnasteutshinisgbBoluoektotootthhefoLr oardvaJreiestuysoCf phlraistfto, rwmitsh.oTuhtiswhom I could not have written this book. I also dinecdliucdaetes athnisAPbIooovketrovimewy loofvtihneg Jwavifea,liSbcrahrrye,lld, eavnedlompmy etwntoowf onderful children, Lydia and Bruce Jr. Bluetooth-based services, highlights of security concerns, and more. —Bruce Hopkins TaDbelediocfatCeodnttoenmtys parents, Prof. Antony Mampilly and Prof. Kochurani Mampilly. Bluetooth for Java In—trRodauncjittihonAn ton y Chapter 1 - Introducing Bluetooth About the Authors Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ABppreuncdeixHBop- kjainvasxi.sobae6x-year Java veteran with experience in distributed computing and wireless networking. AHppeehndaisx aCn-eJlaevcatriBclauleatonodthcoDmevpeuloteprmeenngt ionneethriengPadlmegOrSeePlfarotfmormWayne State University in Detroit and has Aipnpteenredsixt iDn -roBblioptNicest, 1m.1icAroPcI omputing, and electronics. He has worked in Java since JDK 1.0a, and his Inredesxearch studies include distributed computing, clustering, encryption, and pervasive computing. He Licsut rorfenFitglyurweosrks as an independent consultant in the Metro Detroit area. List of Tables List of Listings List of Sidebars Ranjith Antony earned his bachelor of technology degree in computer engineering from the College of Engineering, Chengannur, Kerala, India, an institute affiliated with Cochin University of Science and Technology. He became a lecturer in the Department of Computer Engineering of the Government Model Engineering College, an institute affiliated with Cochin University of Science and Technology. In June 1998, he joined Atinav as a software engineer. Presently, he is working as a senior technical manager and is managing the Bluetooth-related Java products from Atinav. About the Technical Reviewer Andrew Stringer was educated at the Dublin Institute of Technology in computer science and software engineering, receiving a bachelor of science degree. Andrew joined Rococo Software in 2001 as a trainer and consultant in the field of wireless software development. Andrew has great experience in developing and delivering courses with J2ME and also with Java APIs for Bluetooth Wireless Technology (JABWT). Andrew lives in DBulbuleint,oIorethlanfodr. Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 AcknowledgmenAtpsress © 2003 (352 pages) The authors of this text describe how to develop wireless Java I personally wantatpoptlhicaantikonasll uthsiengpeBolupeletowothhofohrealpveadrimetye oinf wplraittifnogrmthse. Tbhoisok that you're holding. Never in a million years wouilndclIuhdaevseanthAoPuIgohvt ethrvaitewI woofutlhdebJeavwaolribkrinagryw, ditehvGelaorpymCeontrnoefll and John Zukowski, both of whom are very reBslpueetcoteotdh-Jbaavsaedaustehrovircse.sI,'mhivgehrliyghgtrsatoeffsuel cthuraittyGcaornycaenrnds,Joanhdn accepted my proposal way back in January omf o2r0e0. 2. For that matter, I want to thank the rest of the team at Apress including Tracy Brown, Ami Knox, Kari Brooks, and Wanshun Tam. More honor, however, goes to Tracy. Many thanks to TaAbnledroefwCSontrtinegnetsr from Rococo for tech reviewing this book; I never knew that I could have been wrong so Bmlueatnoyotthimfeors.JaItv'sagood to have an expert at your disposal. InBtrluoedtuocotitohnequipment isn't cheap, so I also want to acknowledge all the great companies around the world C(hlaiteptrearlly1) th-aItngtraovdeucRinagnjBitlhueatnodotmh e hardware loans and technical assistance. For instance, Jeff Day and Cthhaeptreerst2of -thBeluteetaomothat13.1Com (including Ken Morley, Brent Nixon, and Randy Rollins) were very helpful in Cphraopvtiedrin3g u-sBwefitohreBYluoeutoGoetthSatadratpedters and tech support. Mahendra Tailor from TDK Systems in the UK was Cvhearpytehre4lpfu-lUinndperorsvtiadnindginugsthweithJaevqauBiplumeteonotthasAPwIell. Rococo was very kind to allow us to have an extended Cehvaaptluear t5ion-pBelruioedtoointhorwdiethr tJo2MwEritMeItDhPe chapter on Bluetooth simulation. Thanks to Geraldine, Karl, and the Crheaspttoerf t6he-teCarmeatiinngIrealaBnlude.tLoiomthSPiroinntgSHeurvaetrfrwoimth MJPoSbAiwPaI ve in Singapore was very helpful in allowing us to Cuhsaepttehre7ir p-roJtaovcaoal nadnaOlByzEeXr for the security chapter. Peter Duchemin from Smart Network Devices in CGhaeprtmera8ny w- aUssivnegrya hBelulpetfouol tinh gSeimttiunlgatomre the inside scoop on their Micro BlueTarget. I also want to thank CNhaiepltse-rC9hris-tiBalnueGtojeorthrildSefcroumrityEricsson in Sweden for hardware and documentation on the Ericsson BlipNet Cshyasptteemr 1. 0No-rWthiroeflethsseEbmobrdeeddr,eidn SCyasnteamdas ,wI iathlstohereMceicirvoedBlauesTsiasrtgaentce from Dr. Steven Knudsen regarding the Cihnateptgerrat1io1n-oEfnJtienriparinsde BBlluueettooootthh.Applications with the Ericsson BlipNet CThahpisteisr 1m2y-fiBrslut ebtooookth, saondI dJeinfiinitely have to thank all the wonderful teachers at Grant, Cass Tech, and AWppSenUdiwxhAo-hjealvpaexd.bmlueettooogthet here. You'll never forget a good teacher, and I've had many in my lifetime. I Awppaenntdtiox tBha-njkavpaexr.soobnexally Mrs. Smith, Mrs. Parent, Mr. Walker, and Mrs. Cowan from Grant School. At ACppaesnsdTixeCch-, JIahvaadBtlhueetpoolethasDuerveetloopsmtuednyt uonndtehre MPar.lmMOilSlePr,laMtfro.rRmaymond, and Mrs. Ashford. Dr. Steve Kahn AwppaesnadixlitDtle-dBisliappNpetoi1n.t1edAPthI at I didn't finish my degree with the Mathematics Department after I joined the InEdmexerging Scholars Program, but he deserves to be mentioned. I also want to thank Dr. Chaudhary for LigsitvoinfgFimguerethse opportunity to study and research with him in the Parallel and Distributed Computing Lab at LiWstaoyfnTeabSletaste. Very few students were eligible to work in the undergraduate research program, and I'm LigsrtaotfefLuislttiongBsill Hill for allowing me to be a part of it. List of Sidebars I wouldn't be the person that I am today without the spiritual guidance of my pastors at Bethlehem Temple Church. Many thanks to the late Bishop Jackson, the late Bishop Porter, Elder Clark, and the whole church family. I'm the youngest of seven children, so each one of my siblings played a role in shaping my life and career. Thanks to Theresa, Valerie, Darlene, Barbara, Mark, and Tyrone. I definitely have to give special thanks to Mom and Dad, because they've dealt with me for 26 years of my life. They did an excellent job raising all seven children with college educations. Thanks to Thaddeus Johnson for being a good friend. In order to stay smart, you have to hang around smart people. Finally, I want to thank my wonderfully sweet wife, Schrell. She was very patient and understanding while I wrote this book. She is truly a virtuous woman. —Bruce Hopkins Numerous people have provided assistance, advice, and encouragement during the preparation of this book. Major contributors of material, ideas, insights, solutions, and explanations that have found their way into this book include James Jose, Salman Ali, Rajesh Rabindranath, Sudhin Latheef, Vaishali Patil, and Sajith M Nair. Besides them, my teammates at Atinav, especially George Mathew, Cipson Jose, and Dinkar Raj, have contributed suggestions, fixed program bugs, and made imperceptible contributions too numerous to mention. I am also grateful to Mr. Lim Siong Huat and his colleagues at Mobiwave for extending their support by providing timely advice and necessary equipment. Without him, the chapter on Bluetooth security would not have materialized. Bluetooth for Java —Ranjith Antonyby Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars IntroductBiluoetnooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 In the near futureA, pBrleusesto©o2t0h03w(i3r5e2lepsagseste) chnology will be embedded into nearly every consumer electronics device. Devices liTkheemauotbhiloerspohfotnheiss,tePxDt Adses, claripbteophos,wdteosdketovpeslo,pcawlicreulleastos rJsa,vwaatches, keyboards, mice, printers, scannersa,pcpalicmateioranss,uasnindgvBidlueeotogoatmh efocr oanvsaorlieestyaorfepjulastftoarmsasm. Tphlies of what device manufacturers will be embeddingiBnlcuwleuittdhoeoBsthlau-nebtaAosPoeItdho.sveTerrovvdiiceaewys,,oBhfliugthheeltiogJohatvthsaoclifhbsirpaesrceyu,trsidtycevacenolonbpceemrpenunsr,tcaohnfadsed (in mass quantities) for $5, so it's only a mattmeroroef.time before many of your personal devices become Bluetooth enabled. With Java, you get the ability to create applications that are agnostic of their underlying hardware platform. TaAbsleyoouf Ccoanntseenets, this makes Java the perfect programming language for Bluetooth! Regardless of the Bhluaertdowotahrefoor rJaOvSa used for your PDA, mobile phone, watch, etc., you can use the same programming Inlatrnogduuacgtieonto create your Bluetooth applications. This book is all about how to create wireless applications CuhsaipntgerJ1ava- aInntdroBdluuceintogoBthlu. etooth Chapter 2 - Bluetooth 1.1 CHhapotwer 3Th- BisefoBreoYooukGeIst StOarrtegdanized Chapter 4 - Understanding the Java Bluetooth API CHhaeprtee'sr 5an -ovBelurveiteowothofwwithhaJt'2sMcEovMeIrDePd in this book: ChaptCerh6apt-erC1re:aIntintrgodauBcliunegtoBoltuhePtorointth:SIefryvoeur 'wreitchoJmPSplAePteI ly new to Bluetooth, then this chapter is for you. In ChaptCerh7apt-erJa1v,awaendgivOeBEaXbrief introduction to Bluetooth, with a general explanation of what you can do with Chapttehre8tec-hUnsoinloggay.Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 2: Bluetooth 1.1: In this chapter, we dive right into the dirty details of the Bluetooth protocol. ChaptHere1re0 w- eWdireefleinses tEhmebreodledsedanSdysrteelmatsiownisthhitphsebMeitcwroeeBnlutehTearBgleutetooth stack, Bluetooth profiles, and ChaptBerlu1e1to-oEthnthearprdriwsearBelu. eIftoyootuh'vAepspeliecantiBonlusewtoitohththteerEmriicnsosloongyBlbipeNfoetre, but you don't know the difference Chaptberet1w2e-enBlSueDtPooathndanSdDJAinPi for instance, then this chapter will help clear things up. Appendix A - javax.bluetooth AppenCdihxaBpt-erja3v:aBx.eofboerex You Get Started:Chapter 3 is very appropriately named because it covers all the AppenldoioxsCe -enJadvsathBalutentoeoetdh tDoebveelaopdmdreenstsoend tbheefoPraelmwOeSsPhloatwfoyromu how to integrate Bluetooth and Java. Appendix D - BlipNet 1.1 API Chapter 4: Understanding the Java Bluetooth API: This chapter covers the full life cycle of a Bluetooth Index application (whether you're using Java or not). This chapter also shows you how to use the List ofjFaigvuarxes.bluetooth package of the official Java Bluetooth API (the JSR-82) in order to create List ofBTlaubelteosoth applications. List of Listings List ofCShidaepbtearrs5: Bluetooth with J2ME MIDP: The first complete example of a Java Bluetooth application is explained in Chapter 5. Before we present the code, however, we provide a short review of the J2ME MIDP. Chapter 6: Creating a Bluetooth Print Server with JPS API: Now with a complete example under your belt, things will start to get pretty exciting. In Chapter 6, we introduce you to the Java Printing API and show you how to create a Bluetooth print server. Chapter 7: Java and OBEX:Chapter 7 covers the foundation of the OBEX protocol and provides an example on how to transfer files using the javax.obex package of the JSR-82. Chapter 8: Using a Bluetooth Simulator: As you might have guessed, this chapter is all about how to create Java applications that interact with virtual Bluetooth devices. In this chapter, the entire Bluetooth network is simulated in software. Chapter 9: Bluetooth Security:Chapter 9 covers the security measures provided by the Bluetooth specification in order to make wireless applications more secure. Chapter 10: Wireless Embedded Systems with the Micro BlueTarget: The primary focus of Chapter 10 is the Micro BlueTarget by Smart Network Devices. In this chapter, we explore the possibilities of creating applications with a fully functional computer that fits in your hand and includes an implementation of the JSR-82. Chapter 11: Enterprise Bluetooth Applications with the Ericsson BlipNet: In Chapter 11, we introduce you to enterpBrilsueetBoluotehtofootrhJaapvpalications and show you how to construct them using Java and the Ericsson BlipbNyeBt.ruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Chapter 12: BThlueeatouoththorasnodf Jthinisi: tIenxtthdeesficnraibl echhaowptetor odfevtheelobpowoikre, lwesespJarovvaide an overview of Jini network technology aanpdpdliceastciorinbseuhsoinwg tBoluimetpoloetmh efonrtaJivnairaientdy Boflupelatotfootrhmtso.gTehtihser. includes an API overview of the Java library, development of Appendix A: Bjaluveatxo.obtlhu-ebtoasoethd:Aseprpveicneds,ixhAighisligahhtsanodf yserceuferirteynccoenctherantsc,oanntdains all the method signatures of the javaxm.obrleu. etooth API. Appendix B: javax.obex:Appendix B is a handy reference that contains all the method signatures of Table othfeCjoanvtaexn.tsobex API. Bluetooth for Java IntrodAupctpioenndix C: Java Bluetooth Development on the PalmOS Platform:Appendix C provides a quick Chaptoerve1rvi-ewInotrfohdoucwintgo Bgleutestotaortthed creating Java Bluetooth applications on the Palm OS platform. Chapter 2 - Bluetooth 1.1 ChaptAerp3pen-dBixefDor:eBYliopuNeGte1t .S1taArPteI:dAppendix D contains full descriptions of the classes, exceptions, and interfaces that comprise the BlipNet API. This appendix will be really useful to have on hand when Chapter 4 - Understanding the Java Bluetooth API developing BlipNet applications. Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Intended AuBldueiteonotchefor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 So who are you?ATphriesssbo©o2k00r3e(a3l5l2yphaagess)two audiences. If you're a Java developer, then this book assumes that you're an inteTrhmeeaduitahtoersJaovfathdisevteexlotpdeerscwriitbhelihttolewotor ndoeveexlopperwieirnecleesws iJtahvBaluetooth. You'll get the most out of this book ifaypopuli'cvaetiwonristteunsinagfeBwlueJtaovoathcflaorssaevsaorinetyyooufrpolawtnfo(remssp.eTchiaislly J2ME applications). includes an API overview of the Java library, development of If you're a BluetooBtlhuedtoeovtehl-obpaesre,dthseenrvtihceiss,bhoiogkhlbigehctsomofessecuusreitfyulctoonycoerunas,ftaenrdChapter 2. If you've never used Java before, thenmwoere'd. suggest that you read the first few chapters of a J2ME book before you read this book. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars The Code Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The source codeAfporretshsis©b2o0o03k(3is52apvaagielas)ble at http://www.apress.com in the Downloads section. The book's companion Web site, http://www.javabluetooth.com, also contains the source code, as The authors of this text describe how to develop wireless Java well as other useafuplprleicsaotiuorncseusssinugchBlausetaoolitsht foofrraecvoamriemtyeonfdpeldatBfolurmetso.oTthhishardware for running the exam pl es. includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter B1lu:etIonotthrfoordJauvacing Bluetooth by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Simply stated, BluAeptroeossth©is20a03w(3ir5e2lpeasgsesc)ommunication protocol. As such, you would use Bluetooth to communicate to tTwhoe oarutmhoorrseoofththeirs Bteluxtetdoeostchr-ibceaphaobwletoddeevviceelosp. IwnirtheilsessseJnasvea, Bluetooth is like any other communication parpoptoliccaotliothnastuysoiungmBaluyeutosoethevfeorryadvaayrileiktyeoHf TpTlaPtf,oFrmTPs.,TShMisTP, or IMAP. Bluetooth is also like these protocoiBnllsculeiuntdoteohstahat-nibt aAhsPaeIsdoasveecrrlviveiicenewts-s,oehfrivgtheherligJaharvtcsahoiltiefbcsraeturcyrue,r.idtIyenvcBeollonupceemtroenonst,thao, nfthde one who initiates the connection (the cmlieonret). is the master, and the one who receives the connection (the server) is the slave. The purpose of this chapter is to give you an introduction to Bluetooth. We'll briefly compare it with Tacbolme opfetCinogntteecnhtsnologies like Infrared and 802.11b and explain where Bluetooth fills the gaps that these Bolutehteorottehcfhonr oJlaovgaies leave open. Next, we'll show you what Bluetooth can do and where it is currently used Inintraodpupclitcioantions today, just in case you're unfamiliar with the capabilities of the technology. Finally, we'll Cwharaptperup1 th-isIncthraopdtuecrinwgitBhluaefteowothscenarios for how Bluetooth will be used in the near future. Chapter 2 - Bluetooth 1.1 CBhapluteer 3to-oBtehforvesY.ouInGeftrSatraertedd Chapter 4 - Understanding the Java Bluetooth API COhafpctoerur5se,-wBilrueeletososthcowmitmh Ju2nMicEatMioInDPbetween two computers is not new. PDAs have been able to do that Cfhoarpyteerar6s u-sCinrgeaintifnragraedBltueecthonotohloPgryin. tOSneervderrawwibthacJkPStoAiPnIfrared is that the devices involved must be a few feet apart, and most importantly, the infrared transceivers must see each other "eye to eye." If either of Chapter 7 - Java and OBEX those conditions are not met, then the transmission will fail. Bluetooth overcomes the first limitation by Chapter 8 - Using a Bluetooth Simulator having a nominal range of about 10 meters (30 feet). Bluetooth overcomes the second limitation because Ciht awpoterkrs9lik-eBalureatdoioot,hsoSetcraunristymissions are omnidirectional. Consequently, there are no line-of-sight issues Cwhahpetnerc1o0m-mWunireiclaestisonEmocbecuddrsedbeStywseteemnstwwoithBltuheetoMoicthrodBeluviecTeasr.get Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Bluetooth vBslu.e8to0o2th.1fo1r bJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 If you've heard ofABplrueessto©o2th00b3e(3fo52rep,agtehse)n you've certainly heard of 802.11b (the wireless LAN protocol), another wireless Tchoemamutuhnoicrsatoiof nthpisrotetoxctodle. sBclruibeetohootwh atondde8v0e2lo.1p1wbirweleerses cJarevaated to accomplish two different goals, alathpopluicgahtiobnosthutseincghnBoluloetgoieosthofpoer raatvearinietthy eofsapmlatefofrrmeqs.uTehnicsy band: 2.4 GHz. includes an API overview of the Java library, development of Note HavingBblouethtotoetchh-nboasloegdiesserovipceersa, theigahtltighhetssaomf seecfruerqituyecnocnycerrannsg,eanddoes not mean they'll interfere when pmlaocreed. in range of each other, according to a Forrester Research study conducted in 2001. Go to http://www.forrester.com/ for details on that report. TaTbhlee ogfoCaol onftewnirtesless LAN (802.11b) is to connect two relatively large devices that have lots of power at BhluigethoostpheefodrsJ.aTvyapically, this technology is used to connect two laptops within 300 feet at 11 Mb/s. This Intetrcohdnuocltoiogny is also useful for network administrators who want to extend their LAN to places where it is Cehiathpteerre1xpe-nIsnitvreodourciinncgoBnlvueentoieontht to run cables. Chapter 2 - Bluetooth 1.1 COhanptthere3oth-eBr ehfaonred,YBouluGeetotoSthtairsteindtended to connect smaller devices like PDAs and mobile phones within a Crhaanpgteero4f 3-0Ufenedtearsttaanrdaitnegotfh1e MJabv/as.BSluleotwooetrhdAaPtaI rates and shorter ranges allow Bluetooth to be a low- power wireless technology. Compared to 802.11b devices, some Bluetooth devices can easily consume Chapter 5 - Bluetooth with J2ME MIDP 500 times less power, which can make a huge difference in the battery life of many mobile devices. Chapter 6 - Creating a Bluetooth Print Server with JPS API CBhalupetetoro7th i-sJaalvsaoainntdenOdBeEdX to be used as a cable replacement technology. If you have multiple peripherals Cchoanptneerc8ted-toUsyinoguracBolmueptouotethr uSsiminuglaRtoSr-232 or USB, then Bluetooth is the ideal solution if you want to use Cthhaopsteerd9evi-ceBsluwetiroeoltehssSleyc. uItr'istyalmost impossible to connect peripherals to your computer using 802.11b Ctheacphtnerol1o0gy- (Wwierell,eessxcEempbt efoddr epdrinStyesrtse)m. Bs luweitthooththe eMvicerno hBaluseaTabrugeiltt-in capability for wireless audio Cchoamptemr u1n1ic-atEionnte.rprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Can either technology replace the other? Hardly. Bluetooth will never replace 802.11b because it's bad at Appendix A - javax.bluetooth handling the following: Appendix B - javax.obex AppenLdaixrgCe-fiJleavtaraBnlsufeetrosotbhetDweeveenlopdmeveincteson the PalmOS Platform Appendix D - BlipNet 1.1 API IndexLong-range communication (only Class 1 Bluetooth devices have a range of 300 feet) List of Figures CROSSList ofRTEaFblEeRs ENCE List of Listings See "Bluetooth Device Power Classes" in Chapter 2 for details about power classes. LiOstnotfhSeidoetbhaerrshand, 802.11b will never replace Bluetooth because 802.11b can't be used to communicate to peripherals. 802.11b requires too much power for communication. 802.11b is overkill for small data transfers. 802.11b wasn't designed for voice communication. In the wireless communication arena, there is no technology that is best suited for every possible application. Either Bluetooth or 802.11b can be used for wireless communication between computers. Both have their place in the market and can perform in their niches well. Newer wireless LAN protocols like 802.11a and 802.11g will further clear the distinction between Bluetooth and wireless LAN because they extend 802.11b's bandwidth limitation to 54 Mb/s. Bluetooth DBleuevtiocoethsfoor nJavtahe Market Today by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Now, let's take a Aloporkesast©B2l0u0e3to(3o52thpadgeevs)ices that you can get at any consumer electronics store today. We'll highlight the probTlehme asutthhaotrBs loufetthoios tthexstodlveesscraibnedhgoivwetsoodmeveeslocpenwairreiolessfsoJrauvsaing this technology. If you're already familiar waipthplcicoamtiomnos nusuisnaggBelusecteoontahriofosr oafvBalruieettyoootfhpdlaetfvoicrmess,.tThheins feel free to skip this section. includes an API overview of the Java library, development of Wireless DaBmlutoareet.oTotrha-bnassedfeserr:vicPeDs, AhightloighPtshofosneceurity concerns, and Almost everyone owns a mobile phone nowadays. These devices are very convenient, compact, and cute Ta(bwlello, faCt olenatsetnstosme of them). However, they suffer from two major limitations: Bluetooth for Java IntrodMucotbioilne phones have limited memory for phone book entries. ChaptDera1ta e-nItnrytroodnumcinogbiBlelupehtooontehs can be cumbersome. Chapter 2 - Bluetooth 1.1 CWhaep'tveer a3ll b-eBeenfotrheeYreoubeGfeotreS.taErntetdering data on a mobile phone is very tedious because you're dealing with Cahanpitneer-b4utt-oUnnkdeeyrpstaadndtointgyptheeaJlapvhaanBulumeteoroicthteAxPtI. Also, mobile phones don't have a lot of memory for Cshtaoprtaegre5, so- Byoluue'treooltimh iwteitdhtJo2oMnElyM5ID0Por 100 entries. On top of that, you'll also need to truncate some Cnhaapmteers6wh-enCraedadtiinnggapBholuneetoeonthtriPersin, tsoSe"rAvuerntwCitlharJiPsSsaAJPoI hnson" becomes "Ant Clrssa Jnsn." CIhf aypotuero7wn-aJaPvDaAa,ntdheOnBEyoXu probably agree that PDAs are also useful devices. They can store thousands Cohfapctoenrta8ct -enUtsriinegs,aaBnlduethtoeoytharSeimaulolattobretter for entering data compared to mobile phones. Since you can't Cshtaoprteeryo9ur -eBnltuireetocootnhtaScetculisrittyon your mobile phone, you probably have it stored on your PDA. CUhanpftoerrtu1n0at-eWly,iriet'lsesas lEittmlebeindcdoendvSeynsietenmt tsowloitohkthuep MaicprhooBnleuenTuamrgbeet r on the PDA and then manually dial the Cnhuapmtebre1r 1on- tEhnetemrporbisieleBpluheotnoeo.th Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AWppiethndaixBAlu-etjoaovathx-.ebnluaebtoleodthPDA and a Bluetooth-enabled mobile phone, you can keep your entire contact AlpispteondnixthBe -PjDaAvawx.hoebreex it's far more convenient. Don't even bother to store phone numbers on your phone. AWppheendniexvCer-yJoauvaarBelureetaodoythtoDedviaelloapnmuemntboenr,tyhoeuPjaulmstOloSoPklautpfotrhme number on the PDA and send the phone Anpupemnbdiexr Dov-eBrltiopNthete1p.h1oAnPeI; no wires, no hassle. Figure 1-1 is a picture of one of HP's advanced Bluetooth- enabled PDAs. Index List of Figures List of Tables List of Listings List of Sidebars Figure 1-1: The short antennae on HP iPAQ 5400 series Pocket PC allows it to communicate via Bluetooth and 802.11b. For added security, this model also includes a fingerprint reader. Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 ConnectionApSrehssa©r2i0n03g(3:52Lpaageps)top to Phone The authors of this text describe how to develop wireless Java If you're a prograampmpliecrataionndsyuosuinhgaBvleueatolaopthtofpo,r yaovuakrineotywohf opwlatcfuormmbse. rTshoims e it is to get a dial-up Internet includes an API overview of the Java library, development of connection on yoBulrumetoobotilhe-bpahsoendes.eYrvoiucems,ahyighhalivgehtasnoIfnsteecrnueritt-yrecaodnyceprhnos,naen,dbut you may not have the right cable. Maybe youmhoareve. the right cable (which isn't cheap), but you need additional software to establish the dial-up connection. Sometimes, you need to connect two cables together to accomplish this feat. Bluetooth eliminates all the hassle from this scenario by creating a standardized method for wireless dialTaubplenoeftwCoornkitnegn.tYs ou can even keep your wireless phone at your hip or in your purse while you surf the Web Bolunetyooouthr lfaoprtoJapv.aThe same applies for PCs or PDAs that want to use your phone to connect to the Internet. InTthroisduisctrieoanlly convenient whenever your broadband connections at home go down for servicing. You can Cshiampptelyr 1plac-eInytoroudruwciirnegleBslsuepthoootnhe in the vicinity of your PC and that's it, you're connected. Chapter 2 - Bluetooth 1.1 CPhaeptresr 3on-aBel fNoreeYtowu oGertkSsta:rtPedC to PC Chapter 4 - Understanding the Java Bluetooth API CBhalupetetoro5th i-sBglureeatot ofothr cwoitnhnJe2cMtiEngMtIwDoP PCs together at a moderate speed. If you want higher speeds or if Cyhoauptneree6d t-oCtraeantsinfegr alaBrglueetfoileotsh, tPhreinnt ySoeurv'reer bweittherJPoSffAuPsIing Wireless LAN technology. On the other hand, CBhalupetetoro7th i-sJgaovaodanadt cOrBeEaXting small, personal networks. So this is a great technology if you're having an Cihmapptreorm8ptu- mUseinegtinagBwluitehtocootwh oSrikmeursla.toBrluetooth also has the added capability to discover new devices when Cthhaepyteern9ter -yBoulurentoeotwthoSrke.curity Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CChapatberl1e1 R- EenptelrparciseeBmlueetnootth: APpCplicattoionPs weirthipthhe eErricaslsson BlipNet Chapter 12 - Bluetooth and Jini AYppoeundcaixnAim- ajagvinaex.Bblluueettooootthh as functioning like any other protocol to connect to your peripherals, such as Aspeperinadl i(xRBS--2j3a2v)a,xp.oabraexllel, USB, or Firewire. In the near future, your personal computer will be equipped AwppitehnadiBx lCue-toJaovtha "Bpluoertt"ooinththDeesvealmopemmenatnonnerththeaPtaitlmcuOrSrePnlatltyfofrematures a serial and USB port. AYppoeuncdaixnDus-eBlBipluNeetto1o.t1hAtoPIconnect to your peripherals wirelessly and effortlessly. Have you ever been to a Inredemxote location with a laptop and wanted to use a printer to print out some files? If you don't have the right LipsrtinotfeFrigdurirveesr or the right cable, then you'll need to give your file to someone who does have it. If that Lipset rosfoTnabdloeessn't have the right program to read your file, then you're out of luck; no printing for you. If you Lihsat dofaLBistluinegtsooth laptop and that printer was a Bluetooth printer (regardless of the manufacturer), then Liysotuo'fdShidaevbeanrso problem. With Bluetooth, you can ask the printer for the right driver if you don't have it, and then you can print your file with no problem. The Power User So what if you're a power user? You most likely have a PDA, a wireless phone, a printer or two, a scanner, an MP3 player, a digital camera, and a DV camera. The back of your computer probably looks like a rat's nest of wires and cables. Some devices you may leave disconnected until you really, really need them. Bluetooth solves all this by allowing you to have virtually an unlimited number of peripherals wirelessly connected to your computer. The only limitation is that you can only have seven active connections at the same time. That should be fine because it would be quite rare for you to print, scan, upload pictures, and sync your PDA all at the same time. Interoperability: Any Device to Any Device In the previous scenario, your non-Bluetooth-enabled devices are definitely not interoperable. In other words, if you want to send a picture from the camera to the PDA, then you'll need to use the computer to interconnect them. The same also goes if you want to scan a document and send it to the printer (i.e., to act like a copier) or send it to the PDA; you'll always need your PC to be the "man in the middle." Of course, you can buy a cable or two to do some of those tasks, but those cables are rare and expensive. Bluetooth solves all this by allowing your devices to communicate among themselves with no hassle and with no cables. It's essentially the universal cable! Bluetooth for Java Bluetooth ibAnyprtBerhsusec©e 2SH0o0m3pk(3ian52lslpaaOngedsf)Rfaicnjieth oAnrtoHnyome Office ISBN:1590590783 In the small officeThseetatiuntgh,ohrsowofdthoisyoteuxsthdaersecrpibeeriphohweratolsdleikveelaoppwrinirteeler sasmJaovnag users? Let's say you have a applications using Bluetooth for a variety of platforms. This $300 printer that iynoculuwdeasnat ntwAoPIusoeversrvoienwyoouf rthneeJtwavoarklibtorasrhy,adree.vYelooupmr cehnetaopf est option is to buy a print server—but that'sBaluneotothoethr-$b3a0se0d! Yseoruvicmeisg,hhtiaghsliwghetlsl boufyseacnuortihtyecropnrcinetrenrsf,oarntdhat kind of money. With Bluetooth, if bothmyoourer.users are in range, no print server is needed because both users can connect to the printer as if it were a local printer. For that matter, the printer should be able to print for every Bluetooth user within range; but remember that it can only handle seven active connections at the same time. Table of Contents Bluetooth for Java InBtroluduecttioonoth for Voice Applications Chapter 1 - Introducing Bluetooth Now, Bluetooth is great at transferring data wirelessly, but it also has the capability to transmit voice and Cshoauptnedr a2s w- eBlllu. eStoooifthyo1u.1had a Bluetooth headset, you could use the same headset to answer calls on your CBhalupetetoro3th--enBaebfolreedYwoiureGleest sStpahrotende as well as answer calls on your Bluetooth-enabled home phone. You Cchoauptldera4lso-uUsnedtehrestsaanmdineghtehaedJsaevtatoBlluisetteonottho AyPoIur Bluetooth-enabled portable radio. Chapter 5 - Bluetooth with J2ME MIDP CBhalupetetor o6th c- aCnreaaltsinogbae BelnuaebtoleotdhinPryinotuSr ecravresr owtihthatJPifSyoAuPI're driving and you receive a call on your wireless Cphhapotneer,7you- cJaavnasaimndpOlyBtEraXnsfer the call to the hands-free system built right into the car. Your phone stays Cohnapytoerur8hip-,Uosrining yaoBulrubertoieoftchasSeim. Yuloautocr an also use the same technology to initiate a call in your car without Cthoaupctherin9g y-ouBrlupehtooonteh aSteaclul.riItny either case, if you've arrived at your destination and you want to continue the Cchoanptveerrs1a0ti-onW, iyreoluesjsusEtmtrbaendsdfeedr tShyestceamllsbwaictkh ttohethMeicprhooBnluee. Target Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CBhapluteer 1to2 -oBtlhuetfoootrh aWndirJieniless Gaming Appendix A - javax.bluetooth AOppfecnoduixrsBe,-yjoauvacxa.onbuesxe Bluetooth for wireless gaming. It's always a hassle when you want to connect two AhpapennddhiexldC v-idJaevoagBalumeetosoythsteDmevselaonpdmpenlatyoangtahiensPtaalmfrOieSnPdl.atMfoorsmt cables were about 6 feet long, so if both players were on a school bus, they needed to sit right next to each other to play. With Bluetooth, you just Appendix D - BlipNet 1.1 API have to come within range of your opponent to play. Index LiOstkoafy,Fiwguer'rees grownups now. But what do you do if you're in a boring meeting and you have some time to Liksitllo?fWTaitbhleBsluetooth, you and your equally bored colleague can both get out your PDAs and play a game of Licsht eocf kLeisrtsin. gPsDAs are business tools, so no one will ever know if you are taking down notes or getting Lidsot uobf lSeidjuebmaprsed. Figure 1-2 shows a Bluetooth-enabled mobile gaming device that could revolutionize the portable gaming industry: the Nokia N-Gage. Figure 1-2: The Bluetooth-enabled Nokia N-Gage wireless gaming system Devices of BthlueetoFouthtfuorreJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 So, what kind of dAepvriecsess©, a20p0p3li(c35a2tipoangse,s)or innovations can we expect to see in the future that involve Bluetooth? Well, Thheereauatrheojrussotfathfeiswtethxtatdwesecrcibaen hthoiwnktoofd:evelop wireless Java applications using Bluetooth for a variety of platforms. This Bluetooth locianctolurdseyssatenmAPI overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Personalizedmfoarme.ily car The new arcade: a restaurant lobby Table of Contents BTluheetofootlhlofworinJgavsaections describe these in more detail. Introduction CBhapluteer 1to-oItnhtroLduocicngaBtlouertoSotyh stem Chapter 2 - Bluetooth 1.1 CLheapt'tsesrt3art -ofBfewfoitrheaYoBuluGeetot oSttha-retendabled home, which means that wherever you go in your home, you are Cwhaitphtinerr4ang-eUonfdtehrestwanirdeilnegssthneeJtawvoarkB.luWetitohotahBAlPuIetooth-enabled home, you have the ultimate locator system. All your Bluetooth-enabled devices can never be misplaced if they are within the bounds of your Chapter 5 - Bluetooth with J2ME MIDP home. If an item ever gets lost, all you need to do is go to your PC and start up the Bluetooth locator Chapter 6 - Creating a Bluetooth Print Server with JPS API system program. For basic systems, you tell the program what device you are looking for, and the device Cwhailpl tbeere7p u-nJtialvitaisanfoduOnBdE. XFor advanced systems, the Bluetooth locator system will display a map of your Chhoaputseer a8nd-sUhsoinwgyaouBlwuehtiocohthroSoimmuhlaatsoryour lost item. This solution is ideal for people who always misplace Cshmapatlelrb9ut e-sBsleunettioaoltihteSmesculirkiteyPDAs, wireless phones, keys, TV remotes, watches, and baby pacifiers! Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CPhaeptresr 1o1n-aEnlitzereprdiseFBalumetoioltyh Car Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AIpnpethnidsixexAam- jpalvea,xl.ebt'lsuesttoaortthoff with a Bluetooth-enabled car. With a Bluetooth-enabled car, all you need to Adppoeinsdtiox sBe-t tjhaevamx.iorrboerxs, seats, and radio stations just once and store your preferences on a BluetoothAepnpeanbdleixdCde- vJiacveathBaluteytoooutchaDrreyvewliothpmyoenutaollnththeetiPmalem, OlikSePalatwfoirremless phone, PDA, or a watch. It wouldn't AmppaetntedrixifDso-mBleipoNneet e1l.s1eAuPsIed your car, because all your preferences are stored on the device you keep Inwdiethx you. After someone uses your car, all you need to do is upload your preferences from your BluetoothLiesnt aobf lFeigdudresvice (like your watch—see Figure 1-3) and be on your merry way. List of Tables List of Listings List of Sidebars Figure 1-3: Although the Fossil Wrist PDA doesn't contain any Bluetooth hardware, it does come preloaded with a Bluetooth-enabled OS— the Palm OS 4.1. Palm OS is a registered trademark of Palm, Inc. Bluetooth for Java The New ArbcyaBrducee:HAopkRinseasndtaRuanrjaithnAtntLonoybby Apress © 2003 (352 pages) ISBN:1590590783 Finally, let's say tThhaet saoumtheotrismoef itnhitshetexntedaer sfcurtiubreeh, oyowuto(adnedvesleovpewrairleolethsserJapveaople) are waiting for a seat at a restaurant. WhileaypopulicaarteiownsauitisninggfoBrluyeotuorottahbfloer, athvearhieotsyteosfspglaivtfeosrmyos.uTahilsittle gaming device to help you kill time. This BluetooiBntlchule-uetdoneoastbhal-nebdaAsdPeIedvosivceeerrvvniiceoewtso,onhfliygthhleelitgJshayvtsoauolifbpsrlaaercyyug,riadtymevceeoslonapcegmraeninns,tsatontfhde computer, but you can also play games with omthoreer.people in the lobby! When your table is ready, your game unit vibrates automatically, so the hostess doesn't even need to call you. When you turn your device in to the hostess, your score is automatically uploaded to the high scores list. If your score is good enough, you may even Tawbilne aoffrCeoenmteenatls. Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Bluetooth is a greAaptrteescsh©n2o0lo03g(y35f2opr awgeirse) less connections between power-conservative computer devices. It is also a great caTbhlee raeupthlaocresmofetnhtistetcehxnt odleosgcyribfoerhPoCwstoanddevlaelpotpopwsir.eItlecsasnJafuvanction as a universal connector between your peraipphpelicraatlisonasndusdinegviBceluse,taoontdhyfoour amvaayrineteyveofr palgaatfionrmnese. dThaiscable (some of which can be expensive) to coninncelcutdyeosuarndAePvIicoevsertovigeewthoefrt.he Java library, development of Bluetooth-based services, highlights of security concerns, and In the next chaptemr,owree. 'll dig right in to the Bluetooth protocol. If you're new to Bluetooth, this will be your first introduction to a lot of new terminology. We'll explain to you the components of the Bluetooth stack and the purpose of Bluetooth profiles. When you create your wireless applications, you'll interact with the Table of Contents stack and profiles to send and receive data. Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter B2lu:etBooltuh feortJoavoa th 1.1 by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Overview The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This The main focus oifncthluisdecshaanptAePr IisotvoerdveieswcroibfeththeeJainvnaelirbwraorryk,indgevseolofpBmlueenttooofth. The most current revision of the protocol is veBrsluioento1o.t1h.-bAalmseodssteervveicreysd, ehvigicheligohntsthoef smecaurkrietyt tcoodnacyerisnsc,oamndpliant with Bluetooth version 1.1, although yoummorigeh. t be able to find some devices that use the 1.0B version of Bluetooth. The differences between Bluetooth 1.0B and 1.1 are beyond the scope of this book. The differences are TamblineimofaCl,oanntdenthtsey really don't apply to Java programmers. BWluehtaoot tchanfoyr oJuaveaxpect for future versions of Bluetooth like 1.2 and 2.0? Whenever the Bluetooth SIG (the Ingtrrooudpucotifocnompanies that developed the Bluetooth spec) plans to release later revisions of the spec, you Cchaanpteerxp1ec-t sInotmroeduthciinnggsBlliukeetohoigthher speeds, more profiles, and backward compatibility with 1.1. We Cwhaoputledrn2't ex-pBelucet ttohoethne1w.1er versions to try to compete with 802.11 speeds, but you might see data rates of C4h,ap8t,eorr3eve-nBe1f2orMe bY/osu. BGleuteStotaortthe'sd niche is as a low-power wireless communication protocol, so don't Cehxapetecrt 4Blu-etUonodtehrs2t.a0ntdoinbgetahepoJawvearBhluoegt.ooth API Chapter 5 - Bluetooth with J2ME MIDP ChaptCerR6OS-SC-reating a BlueStoeoethCPhraipntteSre1rvfeorr waitdhisJcPuSssAiPoIn of Bluetooth versus 802.11b. REFERENCE Chapter 7 - Java and OBEX CThahpistecrh8apt-erUissinagllaaBboluuettoBoluthetSoimothul.aWtore'll give you brief history on how it began and how it got its name. CNhaepxtte, rw9e'll-sBhlouwetyoootuhthSeecruarditiyo spectrum and where Bluetooth fits in with devices that you probably already Ckhnaoptwera1b0ou-t.WAirfetelerwssaErdmsb, ewded'ellddSeyssctreibmes twheithanthaetoMmicyroofBalueBTluaergtoeot th-enabled device by giving a description CohfapBtleure1to1o-thEhnaterrdpwriasreeB, ltuheetoBoltuhetAopoptlhicasttaiocnks, wanitdh BthleueEtroicostshopnroBfliipleNse.tFor the remainder of this book, when Cwhaeprterfe1r2to- BBluettoootthh,awnde aJirnei referring to the 1.1 version of the spec. Now, let's dig in to Bluetooth! Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars A Brief HistBolureytoootfh BfolruJaevtaooth by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Bluetooth got its nAapmreessf©ro2m003K(in35g2 Hpaageras)ld Blätand (Bluetooth) of Denmark. His most notable accomplishment Twhaesatuhtahtohrse oufntihteisdtDexetndmesacrrkibaenhdoNwotrowdaeyvuelnodpewr iCrehlerissstiaJanvitay in the 10th century. In 1994, Ericsson conductaepdptlihceatfioirnsts ruessiengarBclhuesttouodtihesfoorfaavwairrieetleysosf tpelachtfnoormlosg.yTthoislink mobile phones and accessories. Yeairnsclluadteersinan1A9P9I7o, vEerricvsieswonoffothrme eJadvtahleibBralurye,todoetvhelSopmeceiantl Ionfterest Group (Bluetooth SIG) so that other compaBnliueestcoootuhl-dbuasseedasnedrvpicreosm, ohtigehtlhigehttescohfnsoelcougryit.yActotnhcaetrtnims,ea,ntdhe Bluetooth SIG consisted of the following prommootreer. companies: Ericsson Table of Contents BluetoIoBtMh for Java Introduction ChaptIenrte1l - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Nokia Chapter 3 - Before You Get Started ChaptTero4shib-aUnderstanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP CLhaapteterro6n, in- C1r9e9a9tinagftearBthlueet1o.o0thspPercinifticSaetriovenrwwaitshrJePleSaAsPeId, the Bluetooth SIG added four more members: Chapt3erC7om- Java and OBEX Chapter 8 - Using a Bluetooth Simulator ChaptAerg9ere- Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaptMeric1r1os-oEftnterprise Bluetooth Applications with the Ericsson BlipNet ChaptMero1to2ro- lBaluetooth and Jini Appendix A - javax.bluetooth ATppoednadyi,xtBhe-Bjaluveaxto.oobthexSIG has well over 2,000 members that are all interested in promoting and improving AtphpeenBdluixeCtoo- tJhavsataBnlduaertodo. th Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars The Radio SBlpueetocottrhufmor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Wireless commuAnpicraetsiosn© b20e0t3w(e35e2npcagoems) puters is either in the form of light or radio signals. Infrared technology is theTchoemamutohnorws aoyf tthoiscotenxdtudcetsschriobret rhaonwgteowdierevelelosps wcoirmelemsusnJiacvaations and obviously uses light. Conversely, Blueatopoptlhicateticohnns oulsoignyg uBslueestoraotdhiofosriganvaalsr.ieTtyabolfep2la-t1fogrmivess. Tahliisst of common everyday items that rely on radio signianlcslufdoer scoanmAmPuInoivceartvioienw. Aosf tyhoeuJcaavna lsiberea,rBy,ludeetvoeolothp,mceonrdt loefss phones, 802.11b, and 802.11g fall in theBl2u.e4toGotHhz-braasnegdes.eHrvoipceesf,ulhlyig,hthligishwtsilol fdseemcuyrsittiyfyctohneceBrlnuse,toaondth concept if you are new to all this; it's just a radmioo. re. TaTbalebloef2C-o1n: tCeonmtsmon Radio Frequencies BluIetToEoMth for Java Introduction ChaApMterra1dio- Introducing Bluetooth FREQUENCY RANGE 535 kHz-1.6 MHz ChaGpaterar g2e d-oBolrueotpoeonther1s.1 Chapter 3 - Before You Get Started ChaBpatbeyr 4mo-niUtonrdserstanding the Java Bluetooth API 40 MHz 49 MHz ChaTpVtecrh5ann-eBlslu2e–to6oth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaFpMterra7dio- Java and OBEX 54 MHz-88 MHz 88 MHz-108 MHz ChaTpVtecrh8ann-eUlssin7g–1a3Bluetooth Simulator 174 MHz-216 MHz Chapter 9 - Bluetooth Security ChaTpVtecrh1a0nn-eWlsir1e4le–s8s 3Embedded Systems with the Micro BlueTa5r1g2etMHz-806 MHz ChaCpDteMr A11ce-llEunlaterrpphrioseneBluetooth Applications with the Ericsson82B4lipMNHetz-894 MHz Chapter 12 - Bluetooth and Jini AppGeSndMixcAell-ujlaavr apxh.bolnueetooth 880 MHz-960 MHz AppCeonrddixleBss-pjhaovanxe.sobex 900 MHz Appendix C - Java Bluetooth Development on the PalmOS Platform Global Positioning System 1.227 GHz-1.575 GHz Appendix D - BlipNet 1.1 API IndPeCx S cellular phone 1.85 GHz-1.99 GHz List of Figures 802.11b List of Tables 2.4 GHz-2.483 GHz List80of2.L1is1tgings 2.4 GHz-2.483 GHz List of Sidebars Bluetooth 2.4 GHz-2.483 GHz Cordless phones 2.4 GHz 802.11a 5.15–5.35 GHz Bluetooth Devices So, if a Bluetooth device is just a radio, then what do these radios look like? Well, Figures 2-1,2-2, and 2-3 are just a sample of devices that are Bluetooth radios. Some of these items are used in development kits, while others are meant to be used by consumers. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth ChaptFerig2ure- 2B-lu1e:tToohteh 31C.1OM USB Bluetooth module Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AppenFdiigxuDre- 2B-li2p:NTeth1e.1CSAPRI BlueCore 1. This single-chip solution includes a microprocessor, RAM, I/O Indexcontroller, and Bluetooth implementation in a single package! This is most likely the smallest radio List ofthFaigtuyroeus've ever seen. List of Tables List of Listings List of Sidebars Figure 2-3: The Palm SD Bluetooth card for Palm OS 4 devices. Palm OS is a registered trademark of Palm, Inc. The examples in this book will use a variety of Bluetooth devices from multiple vendors. The example in Chapter 8, however, uses no Bluetooth devices at all! In that example, we simulate the entire Bluetooth network in software using the Rococo Impronto Simulator. Point-to-Point and Multipoint One factor that distinguishes various Bluetooth devices is their connection capabilities. If a Bluetooth device can only sBulpupeotrotoptohinfto-troJ-apvoaint communication, then it can only communicate to a single Bluetooth device at a time. bFyigBurruec2e-4Hodpekminos nasntdraRteasnjpitohinAtn-ttoo-npyoint commIuSBnNic:1a5t9io0n59i0n78B3luetooth. Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction ChaptFerig1ure- 2In-4tr:oYduocuincgaBnluoentloyoctohnnect to one Bluetooth device at a time if you have hardware that only Chaptseur p2po-rtsBlpuoetinoto-ttho-1p.o1int communication. Chapter 3 - Before You Get Started CNhaopwte, rp4oint--tUon-pdoeirnsttacnodminmg uthneicJaatvioanBislune'ttonoetcheAsPsIarily a bad thing. If you have a Bluetooth phone, you really Cohnaplytenre5ed -onBeluectoononthecwtiiothn Jt2oMyEouMrIBDlPuetooth phone. Frankly, it doesn't make sense to have multiple Chheapatdesre6ts b-eCarebaletintog caoBnluneetcotottohyPoruinrtpSheorvneer wwhitihleJyPoSuAaPrIe using it. Chapter 7 - Java and OBEX COhanptthere8oth-eUr hsianngda, BalumeutoltoipthoinSitmduelvaitcoer is able to communicate with up to seven other devices at the same Cthimapet.eFrig9ure- B2l-u5etisooathdiSaegcruarmityof a multipoint device communicating to other devices within range using CBhalupetetor o1t0h t-eWchirneolelossgyE.mbedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 2-5: You can connect to up to seven Bluetooth devices at a time if you have multipoint-capable hardware. Bluetooth Device Power Classes Bluetooth hardware devices are broken up into three power classes. Table 2-2 describes the device classes and their capabilities. Table 2-2: Bluetooth Device Power Classes CLASS POWER RATING Class 1 Class 2 100 mW 2.5 mW Class 3 1 mW RANGE 100 meters 20 meters 10 meters So as we stated in Chapter 1, Bluetooth devices are not limited to 10 meters in range. CROSS BluetooStheefo"rBJluaevatooth vs. 802.11b" in Chapter 1 for details on the initial discussion of REFERENCEby BruceBHluoeptkoionstha'sndraRnagnej.ith Antony ISBN:1590590783 Apress © 2003 (352 pages) How can you determine a Bluetooth device's power class, and thereby know its range? The power class is The authors of this text describe how to develop wireless Java rarely printed on tahpepluicnaitti,osnos huesirneg'sBaluheitnotoitfhyofour'raevtrayriinegtytoofdpislatitnfogrumissh. Tthheispower class of a device that you've never seeinncbleufdoerse.anIf AthPaItodveevrivcieewisopfotwheerJeavdablyibbraartyte,rdieesv,eolorpimf iet nfittsoifn your hand (like a wireless phone or a headsBelut)e,ttohoetnh-ibt aissemdossetrlvikiceelsy, ahiCghlalisgsht2s oorf s3edcuerviitcyec.oIfntcheernBsl,uaentodoth device is built right into the hardware of anotmheorreu.nit, and that unit is plugged into AC power, then it is most likely a Class 1 device. Don't worry about Bluetooth device classes too much; just be aware that Bluetooth can communicate at TagbrleeaotefrCdoisnttaennctess than 10 meters. Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars The BluetooBltuhetoPorthoftoor cJaoval Stack by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Your computer isAaprpersestt©y 2p0o0w3 (e3r5f2upl adgeesv)ice. It has a processor, memory, bus, hard drive, and other neat things. The unforTtuhneaateutthhoinrsg oisf tthhiast ttehxet cdoesmcpribuetehr odwoetosnd'tehvealvoep twhierealebsilsityJatvoause peripherals by itself. Common periphearpaplsliclaikteioCnsDu/DsinVgDBdlurievteoso,thgrfaoprhaicvdarisieptlyaoysf ,pmlaticfoer,mkse.yTbhoiasrds, modems, printers, and scanners all needindclruivdeerss.anYoAuPrI coovmerpviuetweronf etheedsJaavadrlivberarrtyo, idnesvtreulocpt mit ehnotwotfo use a peripheral. By itself, the computer has noBidlueeatohoothw-btoasperdinstetroviacepsr,inhtiegrholigrhstcsaonf wseitchuraitsyccaonnnceerr.nTs,haencdomputer is pretty powerful, but also pretty helplemsso.rTe.he device driver is the controlling agent that helps the computer to communicate with its peripherals. Table of Contents The Bluetooth stack and Bluetooth hardware have a similar relationship. The Bluetooth stack is a BcluoenttorootlhlinfgoraJgaevnat (it could be software, firmware, hardware, or a combination of all three) that implements InthtreodBulucteiotonoth protocol and also allows you to control your Bluetooth device programmatically. The CBhalupetetor o1th s- tIanctkroadlulocwinsg yBoluuettooodtoh these two things: Chapter 2 - Bluetooth 1.1 ChaptCero3mm-uBneicfoarteeYwoiuthGoetthSetraBrtleudetooth devices Chapter 4 - Understanding the Java Bluetooth API Control your own Bluetooth device Chapter 5 - Bluetooth with J2ME MIDP CShaop, tief ryo6u'r-eCfraematiliinagr wa iBthlutehteooHthTTPrPinpt rSoetorvceorl wstiathckJPaSndAPhIow it works, then you can relate to the Bluetooth Cphraopttoecro7l st-acJakv.aAaWndeObBbErXowser uses an HTTP protocol stack so that it can receive Web content like HTML Cphaapgteesr,8ima-gUessin, gfileasB,launetdoobtehsSt iomf uallal,toJrava applets. A Web server also uses an HTTP protocol stack to Csheanptderou9t W- eBblucetoonottehntSetocuWriteyb browsers over the network. So, like the HTTP protocol stack, a Bluetooth Cphraopttoecro1l0st-acWkirweliellsasllEomwbBedludeetdooStyhstcelmiesntwsiathndthseeMrvicerros BtoluseeTnardgeatnd receive data over a wireless network. Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CShaophteorw1d2o-tBhleueBtlouoethtooanthd dJienviice and the Bluetooth stack work together? What is their relationship? Well, a Bluetooth device without a stack can be compared to a computer without an operating system. More Appendix A - javax.bluetooth specifically, it's like a computer peripheral without a driver. Figure 2-6 illustrates this concept. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 2-6: A) The computer may be attached to its peripherals, but it can't control them without a driver. B) The computer may be attached to a Bluetooth device, but it can't control it without a stack. So, in order to communicate with the Bluetooth protocol and to control a Bluetooth radio, your computer uses a Bluetooth stack. Now, let's break down the Bluetooth stack into its individual components and see how they work. Each component of the stack is called a layer. Layers of the Protocol Stack For application developers, the Bluetooth protocol can be broken up into two main items: layers and profiles. All the layers of the Bluetooth protocol form the protocol stack. Figure 2-7 shows how the following layers of the Bluetooth protocol "stack up": Host Controller Interface (HCI) Logical Link Control and Adaptation Protocol (L2CAP) Service Discovery Protocol (SDP) RFCOMM Bluetooth for Java Telephony CboyntBrroulcPeroHtoopckoinl sSpanedcifRicaantjiiothn A(TnCtoSn-yBIN) Apress © 2003 (352 pages) ISBN:1590590783 Wireless AccTehsesaPurtohtoorcsoolf(WthiAs Pte)xt describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Object Exchainncglued(eOsBaEnXA)PI overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Bluetooth Nemtwoorerk. Encapsulation Protocol (BNEP) Human Interface Device Protocol (HID) Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security ChaptFerig1u0re- 2W-i7re: lTeshseEBmlubeetdodoetdh Spyrsotteomcoslwsittahctkhe Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaptNero1te2 N- oBwlu,eitfoyoothu'raendfaJminiiliar with the Java Collection Framework, then you've heard of java.util.Stack. Please erase that idea from your mind completely, or you'll be thoroughly Appendix A - javax.bluetooth confused here. Bluetooth uses some terms like stack and profile, which unfortunately are used Appendix B - javax.obex in Java as well. This chapter is all about Bluetooth, so we'll clear up the confusion whenever Appendix C - Java Bluetooth Development on the PalmOS Platform there is a clash of terminology here. Appendix D - BlipNet 1.1 API InYdoeux may notice that some of these layers are called "protocols" as well. That's because these items are Lissut bopf rFoigtoucroesls of the Bluetooth protocol stack. Others like TCP/IP, OBEX, and WAP were not originated by LitshteoBf Tluaebtloeos th SIG, but they have been incorporated into the Bluetooth protocol. Those subprotocols are Liksnt oowf Lnisatsingasdopted protocols. List of Sidebars Host Controller Interface (HCI) The Host Controller Interface is a layer of software that passes all your data from your computer to your attached Bluetooth device. For instance, if you are trying to communicate wirelessly from your PC (the host) and you have a Bluetooth device (the controller) attached to your USB port, then you'll need a layer that can understand the USB calls and send that information to the upper layers of the stack. Everything (voice and data) passes though the Host Controller Interface. Logical Link Control and Adaptation Protocol (L2CAP) The Logical Link Control and Adaptation Protocol is the core layer of the stack through which all data must pass. L2CAP boasts some powerful features like packet segmentation and reassembling of data, as well as protocol multiplexing. If you are trying to pass a very large packet of data, L2CAP breaks up the packet and sends smaller ones. Conversely, L2CAP also reassembles segmented packets when accepting data. With protocol multiplexing, L2CAP can accept data from more than one upper protocol at the same time (like SDP and RFCOMM). Only data passes through the L2CAP layer; audio links have direct access to the Host Controller Interface. Service Discovery Protocol (SDP) A Bluetooth device uses Service Discovery Protocol in order to discover services. What's a Bluetooth service? A good eBxlaumetpoloethwofourldJbaevaa Bluetooth printer. A Bluetooth printer will publish itself with a message such asb,y"IBarumceaHporpinktienrs, ahnodwRcaannjitIhhAelnptoynoyu?" If you hISaBvNe:1a59d05o9c0u7m83 ent, and you want to print it, then you would uAseprtehses ©Se20rv0i3c(e35D2 ipsacgoesv)ery Protocol to find a printer that offers a printer service in your range. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of RFCOMM Bluetooth-based services, highlights of security concerns, and more. RFCOMM is commonly known as the wireless serial port, or the cable replacement protocol. The name is derived from the fact that your serial ports are called COMM1, COMM2, etc. RFCOMM simulates the Tafbulnectoiof nCaolnityteonftas standard serial port. For instance, a Bluetooth-enabled PDA would use the RFCOMM Bllaueyteorottohsfyonr cJharvoanize its data to a Bluetooth-enabled PC as if they were physically connected by a cable. Introduction CCThhaaeppttleeerrp12 h--oIBnnlutryeotdoCuoctohinn1g.1BtrluoetlooPthrotocol Specification (TCS, TCS Binary, TCSBIN) Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API CThaepleteprh5ony-CBolunettroooltPhrwotiothcoJ2l MSpEeMcIifDicPation (TCS, TCS Binary, TCS-BIN) is used to send control signals to Cdheapvticeer s6tha- tCwreaanttintog aemBlpuleotyooththe ParuindtioSecarvpearbwiliittihesJPwSitAhPinI Bluetooth. For example, a Bluetooth cordless phone would use this layer of the protocol to send signals to the base station indicating that the user has Chapter 7 - Java and OBEX requested to hang up the current call, or to use call waiting, or to place a three-way call, etc. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security CWhapitrere1le0 s- WsirAelcescs eEmsbsedPderdoSytsotecmos lw(itWh thAePM)icro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet If you've used an Internet-enabled wireless phone before, then you've used WAP. In Bluetooth, this is an Chapter 12 - Bluetooth and Jini adopted protocol, so the Bluetooth SIG has incorporated the existing WAP protocol into the Bluetooth ApprpoetnodcixolAto-fjiat vBalux.ebtlouoettho'osthneeds. WAP requires that PPP, IP, and UDP be present in the stack. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AOppebnjdeixcDt-EBlxipcNeht a1.n1 gAPeI (OBEX) InOdBexEX is a communication protocol initially defined by the Infrared Data Association (IrDA). Unless you've Liwstoorkf eFdigwurieths infrared, you've probably haven't heard of OBEX. Just like WAP, OBEX was defined by Liasnt ootfhTearbglersoup, but it was adopted by the Bluetooth SIG. OBEX is pretty useful when you want to transfer Liosbt joefcLtsistliiknegsfiles between Bluetooth devices. OBEX does not require that TCP and IP be present in the LissttaocfkS, ibduetbtahres manufacturer is free to implement OBEX over TCP/IP. Note A Bluetooth vendor does not need to implement all the Bluetooth protocol layers into its product in order to be Bluetooth compliant. For instance, a Bluetooth cordless phone may very well only have HCI, SDP, L2CAP, and TCS implemented into its stack. That's perfectly fine because a cordless phone may not need any extra functionality. Bluetooth Network Encapsulation Protocol (BNEP) The Bluetooth Network Encapsulation Protocol is a layer in the Bluetooth stack that allows other networking protocols to be transmitted over Bluetooth, namely Ethernet. A Bluetooth vendor has many options if it wants to implement TCP/IP networking in its Bluetooth device. BNEP is a popular choice because it encapsulates TCP/IP packets in L2CAP packets before handing off the data to the L2CAP layer in the stack. Human Interface Device Protocol (HID) The Human Interface Device Protocol is another adopted protocol in the Bluetooth specification. It was originally defined in the USB specification, and it lists the rules and guidelines for transmitting information to and from human interface devices like keyboards, mice, remote controls, and video game controllers. Table 2-3 is a handy guide that gives a brief description of the layers of the Bluetooth stack and their purpose. Bluetooth for Java Table 2-3: LayerbsyoBfrtuhcee BHolupkeitnosoathndPRroantojitchoAl Snttoancyk Apress © 2003 (352 pages) ISBN:1590590783 SHORT NAME TFhUeLaLuthNoArMsEof this text describe hDoEwStCoRdIePvTelIoOpNwireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of HCI BHluoesttoCoothn-tbroaslleedr Isnetrevrifcaecse, highlighTtsheoflasyeecurrtihtyatcionntecerfrancse, santhde host (i.e., the PC) more. and the controller (the Bluetooth module) L2CAP Logical Link Control and Table of Contents Adaptation Protocol The layer that handles all data transmissions from upper layers Bluetooth for Java SDP Service Discovery Protocol Introduction Chapter 1 - Introducing Bluetooth ChaRpFteCrO2MM- BluetoRoFthC1O.1MM Chapter 3 - Before You Get Started The layer that discovers services on Bluetooth devices in the area The layer that allows you to create a virtual serial port and to stream data ChaTpCteSr-B4IN- UnderTstealnedpihnogntyheCJoanvtaroBl luetooth API The layer that allows you to create control signals Chapter 5 - Bluetooth with J2ME MIDP Protocol Specification for audio applications Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaWptAePr 7 - Java aWndireOlBeEsXs Access Protocol Chapter 8 - Using a Bluetooth Simulator The adopted protocol that allows you to view content in Wireless Markup Language (WML) Chapter 9 - Bluetooth Security OBEX Object Exchange The adopted protocol that allows you to send and Chapter 10 - Wireless Embedded Systems with the MriecrcoeiBvleueoTbajergcetst Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaBpNteErP12 - BluetoBoltuheatonodthJinNi etwork The layer that encapsulates other protocol data Appendix A - javax.Ebnluceatopostuhlation Protocol packets into L2CAP packets Appendix B - javax.obex HID Human Interface The layer that traffics the controls signals and Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNeDt e1v.1iceAPPIrotocol data for input devices like keyboards and mice Index List of Figures Note For an exhaustive list of all the new and upcoming Bluetooth protocols, go to the Bluetooth List of TableMs ember site at http://www.bluetooth.org. List of Listings List of Sidebars Profiles Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 So, let's say that Ayopureossw©n 2a00B3l(u3e52topoagthes-)enabled PDA and a Bluetooth-enabled wireless phone. Both of the devices have BlueThtoeoathutshtoarcskosf. tHhoiswtecxatndyeoscuritbeellhifoywoutor ddeevveicloeps wwiirlleilnestesrJaacvtaproperly and allow you to synchronize the pahpopnliecaltiisotnssbuestwinegeBnlueeatocohthotfhoerra? vHaoriwetywiollf ypolautfkonrmows.ifTyhoisu can send a phone number from the PDA to the phinocnlued?eAs nadn mAPoIsot vimerpvioerwtaonftlyth, ehoJawvacalinbryaoryu,ddetveerlmopinmeeniftthofese devices will allow you to browse the InternBeltuoetnooththe-PbaDsAedusseinrvgictehse, phhigohnlieghatss aofwsierceuleristsy mcoondceermns?, and more. That's why the Bluetooth SIG defined profiles. A Bluetooth profile is a designed set of functionality for Bluetooth devices. For instance, using the examples just listed, the phone and the PDA must both support Table of Contents the Synchronization Profile in order to synchronize data between themselves. In order to send object data Blliukeetoao.tvhcffofrileJafvraom the PDA to the phone, both devices need to have the Object Push Profile implemented. InAtrnoddfuinctaiollyn, the PDA and the wireless phone must both support the Dial-Up Networking Profile in order for CthhaeptPeDr A1 to- wInirteroledsuscliyngbrBoluwesteooththe Internet from the phone. If you want your Bluetooth-enabled devices to Cihnateptraerct2, ha-vBinlugetaoBotlhue1t.o1oth stack is not good enough. Those devices also need to implement the same Cphraopftieler.3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API CNhaopwte, rh5ere-'sBaluleisttoootfhmwainthy Jo2fMthEeMBIDluPetooth profiles and a description of what they do. For most of them, Cyhoauptcear n6 ba-sCicraeallytinggueasBsluwehtoaottthhePyrindtoS; ethrveenr awmitehsJPaSreAnPoI t cryptic. ChaptNero7te F-oJravaanaenxdhaOuBsEtXive list of all the Bluetooth profiles, go to the Bluetooth Member site at Chapter 8 h-ttUps:i/n/wgwawB.lbuleuteotootohthS.iomrugl.ator Chapter 9 - Bluetooth Security Generic Access Profile Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CThahpeteGre1n2er-icBlAucetcoeostsh PanrodfiJleiniis the most common Bluetooth profile. All other profiles use this profile for AbpapesnicdicxoAnn-ejcatvioanx.ebslutaetboloisthhment. This is the java.lang.Object in the Bluetooth Profile realm; every AppproefnildeixnBee-djsavtoaxu.soebetxhe functionality of the GAP. Appendix C - Java Bluetooth Development on the PalmOS Platform ASppeenrdvixicDe- BDlipiNsect 1o.1vAePrIy Application Profile Index LiTstheofSFeigruvircees Discovery Application Profile is a profile that directly interacts with the Service Discovery LiPstrootfoTcaobl l(eSsDP) layer in the Bluetooth protocol stack. This profile is used to find services on BluetoothLiesnt aobf lLeisdtidnegsvices in the area. List of Sidebars Serial Port Profile The Serial Port Profile is a profile that interacts directly with the RFCOMM layer in the Bluetooth protocol stack. This profile is used to create a virtual serial port on your Bluetooth-enabled device. For instance, some Bluetooth kits come with a driver that will allow your operating system to communicate over the virtual serial port as if it were an actual serial port. As far as the operating system is concerned, it's just another serial port, as shown in Figure 2-8. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 ChaptFerig3ure- 2B-e8fo:rAesYoyouuGceat nStsaerteeidn Windows 2000, the operating system thinks that COMM10 and ChaptCerO4MM-1U1ndaerersatacntudainlgsethreialJapvoartBsl!uetooth API Chapter 5 - Bluetooth with J2ME MIDP ChaptNero6te O- fCcreoautrinseg,aifBylouuetwooatnhtPtorinctoSnenrevcetr towiathnoJPthSeArPdIevice over the air using your virtual serial port, then Chapter 7 y-oJua'vllanaeneddOaBnEoXther Bluetooth-enabled device in the area that also supports the Serial Port Chapter 8 P- rUosfiilneg. a Bluetooth Simulator Chapter 9 - Bluetooth Security CDhapiatelr-1U0p- WNireeletsws oEmrkbeidndegd SPysrtoemfislewith the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CIhf aypotue'rve12us-eBdluaetmoootdheamndbJeinfoi re, then you should be familiar with the concept of dial-up networking. The ADppiaeln-dUixp ANe-twjaovarkxi.nbgluPetrooofitlhe allows you to mimic the functionality of a modem. Just like the Serial Port APpproefnidleix, sBom- jeavBalxu.eotboeoxth kits come with a driver that will allow your operating system to communicate over AtphpeenvdiritxuaCl -mJoadveamBluaestoifoitthwDeerevealonpamcetunat lomn othdeePmal(mseOeS FPilgatufroerm2-8). As far as the operating system is AcpopenncdeirxnDed-, Bit'lsipjNuestt 1a.n1oAthPeI r modem. IndexNote For such an example to work, you'll need another Bluetooth-enabled device in the area that also List of Figurseuspports the Dial-Up Networking Profile, like a network access point or a wireless phone. List of Tables LiFstAofXLisPtinrgos file List of Sidebars Using the FAX Profile, a Bluetooth-enabled computer can send a fax wirelessly to a Bluetooth-enabled fax machine or to a Bluetooth-enabled wireless phone. Headset Profile The Headset Profile is primarily designed for connecting Bluetooth-enabled headsets to Bluetoothenabled wireless phones. LAN Access Profile A Bluetooth-enabled device such as a PC or laptop will use the LAN Access Profile to connect to a network access point connected to a LAN. Personal Area Networking Profile The Personal Area Networking Profile is pretty much similar to the LAN Access Profile, except it also has support for devices to form ad-hoc networks among themselves. The PAN Profile also has a requirement that BNEP be present in the underlying protocol stack. Cordless TeBllueeptohotohnfoyr JPavraofile The Cordless TelbeypBhrouncye PHroopfikleinas lalonwdsRyaonujitthoAunsteonayBluetooth-ISeBnNa:b15le90d59h0a7n83dset to connect to a Bluetoothenabled "landlineA"pprhesosn©e 2t0o0p3 l(a35c2epcagaelsls) . For instance, through this profile, you continue to receive calls to your home phoneT,hbeuatuytohuorhsaovfeththisetceoxtndveesncierinbceehoowf atnosdweevreinlogptwhairtecleaslsl oJanvyaour Bluetooth wireless phone, without using theainmpcpilnuliudcateetssioaonnsf AtuhPseIinocgvaeBllrilnuvigeetwopoloathfntfohoferyJaoauvvraarwliiebirtryealroeyfs,spdlapethvfeoolrnomeps.m.eTnhtisof Bluetooth-based services, highlights of security concerns, and Intercom Prmoorfei.le TaIbf ltewoofBCluoenttoeonthts-enabled devices are within range, and they support the Intercom Profile, then they can Bfluuentcotoiothn fjuosr tJalikvea regular intercoms. Introduction CGhapetnere1ri-cInOtrobdujecicngtBEluxetocohthange Profile Chapter 2 - Bluetooth 1.1 The Generic Object Exchange Profile is the generic profile that all profiles use if they want to employ the Chapter 3 - Before You Get Started functionality of the OBEX protocol in the Bluetooth stack. Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP COhapbtejer 6ct-PCureastihngPa rBolueftioleoth Print Server with JPS API Chapter 7 - Java and OBEX The Object Push Profile provides the functionality for a device to push and pull an object. Using this Chapter 8 - Using a Bluetooth Simulator profile, though, you are limited to a certain class of objects like vCards. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CFhaiplteerT11ra- nEnstefreprrisPe Brloueftioloeth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini The File Transfer Profile is a more robust profile for transferring objects. You can use the File Transfer APpproefnidleixtoAtr-ajnasvfaexr.bfillueestoaontdh folders from one Bluetooth-enabled device to another. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform ASppyenndcix hDr-oBnlipiNzeat 1t.i1oAnPIProfile InYdoeux use the Synchronization Profile to synchronize data between two Bluetooth-enabled devices. The Limstoosft Fciogmurmeson applications for this profile would be to synchronize data between a PDA and a PC. List of Tables LLiiBsstt aooffsSLiiisdcteinbPgasrrsinting Profile The Basic Printing Profile allows a Bluetooth-enabled device to send plain text to a Bluetooth-enabled printer for printing. Hard Copy Cable Replacement Profile The Hard Copy Cable Replacement Profile is what we call the "Advanced Printing Profile." With this profile, you can print any printable document to a Bluetooth-enabled printer. If you don't already have the driver for that printer, that's okay; the printer will give it to you. Basic Imaging Profile The Basic Imaging Profile is intended to be used by imaging devices like cameras for remote control, image transfers, and downloading. Hands Free Profile The Bluetooth-enabled hands-free kits in automobiles use the Hands Free Profile to allow the driver to place and receive calls from a Bluetooth-enabled phone. Human InteBrlufaetcooethDfoervJaicvae Profile As you might havbeygBureuscseeHdo, pthkeinsHaunmdaRnaInnjtitehrfAancetoDnyevice ISBN:1590590783 Profile has a requirement that the HID Protocol must exist in the uAnpdreesrsly©in2g00B3lu(3e52topoatghess) tack. This profile defines the case scenarios for using Bluetooth- enabled human inThteerfaauctehodresvoicf ethsislikteexktedyebsocarirbdeshaonwdtmo idceev.eOlonpewoirfetlheessgJoaavlas of this profile is that a Bluetooth-enableaidnpcdpluelidcvaeictsieoantnhsaAutPscIinoognvfeBorlruvmieetswootoothftthfhoeerHJaaIDvvaaPrliierbotryfailroeyf,sphdlaeotvufeoldlromrpusmn.eTfnhotirsotfhree months on three AAA alkaline batteriesB. luetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Profile InterBdlueetpooetnh dfoer nJacvaies by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The profiles are hAeparvesilys ©de20p0e3n(d35e2nptaugepso) n each other, and you should already know that every profile depends upon theThGeeanuethriocrsAcocf ethsiss Pterxotfidlee.sTcrhibeeBhluowetotootdhepverolofpilewsirweelersesdJeavsaigned to be building blocks, where a higher leavpepllpicraotfioilensisudsienpgeBnldueetnotouthpofonrtahevafurinectytioonf aplliatytfoorfmthse. Tlohwiser profiles to exist. Take a look at Figure 2-9 and seineclhuodwesthaen BAPluIeotvoeortvhiepwroofiflethseaJraevdaelipbernardye,ndteuvpeloonpmeaecnht oofther for functionality. Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AppenFdiigxuDre- 2B-li9p:NBetlu1e.1tooAPthI profile interdependencies Index LiFstorofeFxaigmurpelse, in order for a PDA vendor to say that it supports the Synchronization Profile for its new LiBstluoeftoTaobthle-senabled BJL 200 PDA, it also must support the Generic Object Exchange Profile, Serial Port LiPstrooffileLi,satinngdsGeneric Access Profile because the Synchronization Profile cannot function without them. If a Lipsht oonf eSimdeabnarusfacturer claims that its new Bluetooth-enabled TLJ 50 headset supports the Headset Profile, then it must also include the Serial Port Profile and the Generic Access Profile. Bluetooth Profiles vs. J2ME Profiles Do not get Bluetooth profiles confused with J2ME profiles. J2ME profiles are a set of Java classes that extend the functionality of a J2ME Configuration. For instance, the PDA and MID Profiles are both a set of Java classes that extend the functionality of the Connected Limited Device Configuration. On the otherhand, a Bluetooth profile can be implemented in any language and on any platform, because it refers to a defined set of functionality for a Bluetooth-enabled device. So, the Object Push Profile can be implemented on a Palm OS PDA in C++, and it can also be implemented on a Bluetooth-enabled printer in Assembler; it's just a defined set of functionality. Personal ArBeluaetoNoethtfworoJrakvas: Piconets and Scatternets by Bruce Hopkins and Ranjith Antony ISBN:1590590783 When two or morAepBrelsuset©o2o0t0h3-e(3n52abpalegeds)devices come within range and establish a connection, a personal area network is foTrhmeeadu.thAoprseorsfothniasl taerxetadensectrwiboerkhocwantoeidtheevrelboep awipreicleosnseJtaovraa scatternet. Figure 2-10 shows Bluetooth adpepvliiccaetsioinnsaupsiicnognBeltu.etooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptFerig7ure- 2Ja-1va0:aInndaOpBiEcXonet, the slaves can only communicate to the master. Chapter 8 - Using a Bluetooth Simulator CAhaBptlueer t9oot-hBpliuceotnoeotthhSaescaursitinygle master and up to seven slaves. No matter what kind of Bluetooth devices Cahraeptinervo1l0ve-dW(tirheeleyscsaEnmbbeedpdheodnSesy,staecmcseswsitphotihnetsM, PicDroABsl,uleaTpatrogpest, headsets, etc.), the master of the piconet Cihsatphteero1n1e -thEanttienriptiaritseesBthlueetcooonthneAcptpiolinca. tTiohnes dweitvhictehethEarticascscoenpBtslipthNeetconnection automatically becomes the slave. Master/slave roles are not predefined, so if a piconet exists between a laptop and a PDA, either Chapter 12 - Bluetooth and Jini device could be the master or the slave. Appendix A - javax.bluetooth AppenNdioxteB I-njcaevartxa.ionbceoxnditions, a role switch between the master and slave is allowed. These conditions Appendix C a-rJeaveaxpBlaluineteodotinh tDheeveBlloupemtoeontthosnptehceifPicaalmtioOnS. Platform Appendix D - BlipNet 1.1 API InSdoexwhat happens to the piconet if a new Bluetooth device wants to join the piconet after the master has Liasct qouf iFreigdurseesven slaves? Does it shut down? Will older members of the piconet get kicked off? No, actually, Litshteomf Taasbtleersof the piconet will not invite new members to join until at least one the old members leaves (or Ligsot eosf Linisttoinagns inactive state). Now, on the other hand, if one of the slaves in the Bluetooth piconet also happens to be multipoint-capable, then the newcomer can create a piconet with that slave, thereby List of Sidebars creating a scatternet (as shown in Figure 2.11). A scatternet will also be created if the master of the existing piconet becomes a slave to the newcomer. Figure 2.11: A scatternet is formed when a slave in one piconet is the master in another piconet. The BluetooBltuhetoQotuhafolrifJiacvaa tion Process by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Okay, so what doAepsreitstsa©ke20t0o3t(u3r5n2 paagperso) duct that uses Bluetooth technology into an official Bluetooth- certified product?TWheeallu,tyhooursfiorsf tthniesetdexttodjoesincrtihbee BholuwettooodtehvSelIoGp. wHiorewledsos Jyaovuajoin? Just go to http://www.blauppelticoaotiotnhs.uosringgaBnldueftiollootuhtftohreamvearmiebtyerosfhpiplatffoorrmm.sA. Tftheirsbecoming a member, you need to submit your proindculucdtefsoratnesAtPinIgovbeyrvaieBwluoeftothoethJaQvuaalilbifricaaryti,odneBvoeldoyp.mTehnet Qofualification Body will test your device against theBlcuuetroreontht-Bblauseetdoosethrvsicpeesc,ifhicigahtiloignhtassowf esellcausritinytceoronpceerrnasb,ilaitnydwith other devices that use your Bluetooth prmofoilrees.. Note Java developers really don't need to join the Bluetooth SIG or undergo the qualification process Table of Contents if prequalified Bluetooth materials (i.e., stacks and radios) are used in their products. However, if Bluetooth foyroJuavwaant to use that really cool-looking Bluetooth logo on your products, then you need to join Introductionthe SIG. Chapter 1 - Introducing Bluetooth COhanpcterte2stin- gBlhuaetsoboethen1.c1ompleted, and if your device passes the tests, it will be listed on the Bluetooth CQhaupatleifric3atio-nBeWfoerbe sYioteu (GhetttSpta:r/te/dqualweb.bluetoothsig.org). Most companies will postpone Cahnapntoeurn4cin-gUthnedeirrnsteawndBinlugetthoeotJha-veanBalbuleetdooptrhoAdPuIct until it has been certified, so check that site often to see C"hwahptoe'sr 5doin- gBlwuehtaoto"tihn wBiltuheJto2MotEh.MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 In this chapter yoAuplreeasrsn©ed20a03ll (a35b2opuatgeBsl)uetooth devices, and you found out what they look like. By now, you should also knowThaeboauutththoersrooflethoifs ttheextBdlueesctoriobethhporwottoocodel vsetalocpk wainrdelehsoswJaitvianteracts with your Bluetooth hardware. You shaopuplldicatatikoensauwsainygfrBolmuettohoisthchfoarpatevraarifeintyiteofkpnlaotwfolermdgse. TohfisBluetooth profiles, and you should know the purposeintchluadt ethseaynsAePrIveo.veFrinviaelwly,oyfotuhesJhaovualdlibbrearayw, daereveolof pthmeedntiffoefrence between piconets and scatternets, and yBoluuestohootuhl-dbaksneodwsewrhvaicteist,tahkigehsligtohtgseot fasBecluureittoyoctohndceervnicse, acnedrtified. more. Great! You now should have a good understanding of how the Bluetooth protocol works. In the next chapter, we'll see what happens when we throw in Java. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter B3lu:etBooethffoorrJaevaYou Get Started by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Okay, now that yoAuprkensosw© 2th00e3 i(n3s52apnadgeso)uts of Bluetooth, you're probably eager to find out how to integrate Bluetooth with JaTvhae. Wauethllo, rthsisofcthhaisptteexr tisdaesllcaribboeuhtodwoitnogdjeuvsetltohpawt.iBreulet swsaJiat!vaBefore you learn about how to use Bluetooth anadpJpalivcaat,ioyonus unseinegd Btolukentooowthwfhorena ivt aisrientoytoaf gpolaotfdoirdmesa. Ttohiusse the two technologies together. includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and When NOTmtooreU. se Bluetooth and Java You should not use Bluetooth with Java for the following purposes: Table of Contents BluetoSoitghnfaolrsJtarevangth indicator Introduction ChaptVero1ice -aIpnptlriocdautiocinnsg Bluetooth ChaptDeris2tan-cBelumeetoaostuhri1n.g1 Chapter 3 - Before You Get Started CThahpetenre4xt fe-wUnsdeecrtsiotannsdeinxgpltahien Jwahvya tBoluaevtoiodththAoPsIe scenarios. Chapter 5 - Bluetooth with J2ME MIDP CShaipgtenr 6al -SCtrreaetinnggathBluIentodotihcParitnot Srerver with JPS API Chapter 7 - Java and OBEX CLheapt'tsesr a8y th-aUtsyinogu ahaBvlueettwooothBlSuiemtouolatthorunits, and you want to know what the signal strength is between Cthhaepmte.rA9 go-oBdlueextaomothpleSeiscuwrihtyen you want to use the services of a network access point. A signal strength Cihnadpictearto1r0w-oWulidrelleetssyoEumkbneodwdeidf ySoyustwemersewwitihthtinheraMnigcreo. WBlueelTl,aJragveat is not the ideal language for that sort of Cahpapptliecra1ti1on- bEenctearupsriesethBaltukeitnodotohfAinpfpolricmataiotinosnwisitnhottheexEproicssesdontoBtlhipeNleetvel where a JVM would have access to Ciht.aTptheer J1V2M- BwliullelteotoythouankdnoJiwniif you are within range or not within range; there is no middle ground. In this AspcpeenndairxioA, y-ojua'vreaxb.beltuteertoooftfhusing a native language for your device such as C or C++. Appendix B - javax.obex AVppoenidcixeCA- pJavpalBicluaettoioothnDsevelopment on the PalmOS Platform Appendix D - BlipNet 1.1 API InNdoewx , you've already read Chapter 2, and you realize that Bluetooth is a really great technology because LiysotuofhFaivgeurtehse ability to transmit voice and data information wirelessly to other Bluetooth devices. Suddenly, you get ideas bubbling in your head about how great it would be to create a speech-to-text application on List of Tables your Bluetooth-enabled phone. Unfortunately, Java (especially J2ME) is not well suited to this arena just List of Listings yet. Performance is a key factor in voice-based applications, and once again, in this case, you're better off Liusst ionfgSaidneabtaivrse language such as C. However, this application may be feasible to do in Java if the Java Real-Time Technology can be incorporated. Distance Measuring The best wireless technology for accurately measuring distance is light waves and not radio signals. Light waves are direct, and the calculations can be pretty simple because the speed of light (in various mediums) is pretty well documented. Using radio signals to measure distance can be quite tricky, and one of the best ways to do that is to use triangulation, like GPS transceivers do. Whether you are using Java or C, Bluetooth might be a viable technology for triangulation, but definitely not for calculating or measuring accurate distances. Note The key word here is accurate. You can definitely use Bluetooth for proximity measurement (i.e., where in the building is Bruce Hopkins?). In fact, the Ericsson BlipNet does exactly that! See Chapter 11 for more information on the Ericsson BlipNet. So, to put it succinctly, you can only do what is possible using the constraints of the Bluetooth technology and what the JVM exposes to you. If the JVM only gives you access to the RFCOMM layer for communication, then you're stuck with it. If the OBEX layer is not exposed to the JVM, then don't expect to be able to send objects. To increase application portability, your Java Bluetooth vendor should implement the Java Bluetooth specification created through the JCP. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars UnderstandBilnuegtootthhefoJr JCaPva by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The JCP is the JaAvpareCssom© 2m00u3n(i3ty52Ppraogecse)ss, and it is the formal procedure to get an idea from a simple concept incorporaThteedaiuntthootrhseoJf athvias stetaxntddaersdc.riTbehishopwrotcoedsesvaellloopwwsirdeelevsesloJpaevars and industry experts to shape the future aopf pthliecaJtiaovnas sutsainngdaBrldu.etPooopthulfaorr AaPvIasrileiktey oJfavpalatUfoSrmB,sJ. aTvhaisReal-Time, Java Printing, Java New I/O, J2ME MinIDclPud1e.s0,aJn2AMPEI oMveIDrvPie2w.0o,fJtDheBCJav3a.0l,ibEraJrBy,2d.0e,vealnodpmeeventnoJfDK 1.4 all went through the Java CommunityBPluroectoeostsh.-bIfaysoeud wsearnvitcteos,ahdidghsloigmhtes noef wsefcuunrcittyiocnoanlciteyrtnos,thaendJava language, or if you want to suggest a newmAoPrIe,.or if you think that some new classes should have a package name of java.* or javax.*, then you need to go through the JCP. Table of Contents BTluehtoeotRh foorlJeavoa f the JSR-82 Introduction CAhaJpSteRr 1is a-JIanvtraoSdupceincgificBalutieotnooRthequest in the Java Community Process. The JSR-82 is the formal JCP Cnhaapmteerf2or t-heBlJuaetvoaoAthP1Is.1for Bluetooth. When a proposed JSR is approved, an Expert Group is formed by Cthhaeptsepre3cific-aBteiofonreleYaodu. TGheet Sstpaertceifdication lead for the JSR-82 was Motorola, and together with the JSR-82 CEhaxppteerrt 4Gro-uUpn, dtheersytacnrediantgedthteheJaovfaficBilauleJtaoovtahBAlPuIetooth APIs. The following companies participated in the JSR-82 Expert Group: Chapter 5 - Bluetooth with J2ME MIDP ChaptEerxt6end-eCdreSaytisntgema sBluetooth Print Server with JPS API Chapter 7 - Java and OBEX ChaptIeBr M8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Mitsubishi Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaptNere1w1bu- rEynNteertpwriosrekBsluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AppenNdioxkAia- javax.bluetooth Appendix B - javax.obex Parthus Technologies Appendix C - Java Bluetooth Development on the PalmOS Platform AppenRdiexsDea-rcBhlipinNeMt o1t.i1onAP(RI IM) Index List ofRFoigcuorceos Software List ofSThaabrlepsElectronics List of Listings List ofSSoidneybEarriscsson Smart Fusion Smart Network Devices Sun Microsystems Symbian Telecordia Vaul tus Zucotto The JSR-82 Expert Group also had three individual experts: Peter Dawson, Steven Knudsen, and Brad Threatt. What Is the RI and TCK? According to the Java Community process, the specification lead company is responsible for creating a Reference Implementation (RI) and also a Technology Compatibility Kit (TCK). The Reference Implementation is basically a proof of concept to prove that the specification can be implemented. Other companies are free to implement the JSR-82, and in order to certify that their vendor kit is compliant to the JSR-82 standardB, tlhuaettoveonthdofor'rs Jparvodauct must pass the TCK. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The JSR-82 specAifpicreastiso©n 2a0c0t3u(a35ll2yphaagess)two Reference Implementations and Technology Compatibility Kits. Why did they do tThhise?aRutehcoarsll oinf tChhisatpetxetr d2esthcaritbtehheoBwluteotdoeovtheloSpIGwhiraelsesasdJoapvtaed some preexisting protocols in the Bluetooth sappepcliicfiactaiotinosn,unsianmg eBlyueOtoBoEthX.foTrhaevOarBieEtyXopfroptlaotcfoorlmwsa.sTuhsised with infrared technology for object transmissioinncsluldoensgabneAfoPrIeoBvelurveiteowotohf wthaesJeavveanlibinrvaeryn,teddev. eTlhoepmdeenstigonfers of the Java Bluetooth specification deciBdleudetnoootthto-btaieseOdBsEerXvictoesB, lhuiegtholoigthhtswhofesneccureriatytincgonthceerJnas,vaanBdluetooth standard. Therefore, more. the JSR-82 actually consists of two independent packages: Table ojfaCvoanxt.ebnltus etooth (the 13 classes and interfaces that are needed to perform wireless BluetocoothmfmoruJnaicvaation with the Bluetooth protocol) Introdjuactvioanx.obex (the 8 classes that are needed to send objects between devices, independent of the Chaptterran1sp-oIrnt tmroedcuhcainngisBmlubeetotwotehen them) Chapter 2 - Bluetooth 1.1 CShaop, tteor a3nsw- BerefyooreurYnoeuxGt eqtuSetsatirotend, yes, you can use OBEX without Bluetooth. Bluetooth is simply one of Cmhaapnteyrtr4ans-pUonrdtserwstitahnwdihnigchthOe BJaEvXa cBalunetoopoethraAteP.I Chapter 5 - Bluetooth with J2ME MIDP The classes and interfaces that comprise the Java Bluetooth specification are briefly described in Tables C3h-a1ptaenr d63--2.CTrehaetsinegcalaBslsueestoaonthdPthrienitr SmeervtherodwsitharJePScoAvPeIred as needed in the following chapters, and their CAhaPpIstear r7e li-stJeadvainadnedtaOiBl iEnXAppendix A and Appendix B. Chapter 8 - Using a Bluetooth Simulator CThaapbtleer 39-1:-CBllausetsoeosthinSethcuerijtayvax.bluetooth Package Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaCpLtAerS1S1 N-AEMnEterprise Bluetooth Applications wDEithSCthReIPErTicIsOsNon BlipNet ChaDpitserco12ve-rByluLeitsoottehnaenrd Jini TheDiscoveryListener interface allows an Appendix A - javax.bluetooth application to receive device discovery and service Appendix B - javax.obex discovery events. Appendix C - Java Bluetooth Development on the PalmOS Platform AppLe2nCdAixPDCo-nBnliepcNteti1o.n1 API TheL2CAPConnection interface represents a Index connection-oriented L2CAP channel. ListLo2fCFAigPuCroens nectionNotifier List of Tables TheL2CAPConnectionNotifier interface provides an L2CAP connection notifier. List of Listings ServiceRecord List of Sidebars TheServiceRecord interface describes characteristics of a Bluetooth service. DataElement TheDataElement class defines the various data types that a Bluetooth service attribute value may have. DeviceClass TheDeviceClass class represents the class of device (CoD) record as defined by the Bluetooth specification. DiscoveryAgent TheDiscoveryAgent class provides methods to perform device and service discovery. LocalDevice TheLocalDevice class represents the local Bluetooth device. RemoteDevice TheRemoteDevice class represents a remote Bluetooth device. UUID TheUUID class defines universally unique identifiers. BluetoothConnectionException ThisBluetoothConnectionException is thrown when a Bluetooth connection (L2CAP, RFCOMM, or OBEX) cannot be established successfully. BluetoothStaBtlueeEtxocoethptfoiroJnava TheBluetoothStateException is thrown when a by Bruce Hopkins and RanjitrheAqnuteosntyis made toISthBeN:1B5l9u0e59to07o8th3 system that the Apress © 2003 (352 pages) system cannot support in its present state. ServiceRegisTtheraatutihoonrsEoxfctehpisttieoxtndescTrihbeSheorwvtiocdeeRvelgoipswtirrealetsisoJanvEaxception is thrown applications using Bluetoothwfohreanvthareireetyisofapflaaitlfuorremtso. aTdhdis a service record to the iBnlculeutdoeostha-nbaAsPeIdosveerrvviiceews,ohfilgtohhcelaigJlhaSvtsaerolvifbicsraeercDyu,risidtcyeovcveoelonrpcyemDrenanst,taabonaf dse (SDDB) or to modify more. an existing service record in the SDDB. TaTbalebloef3C-o2n: tCelnatssses in the javax.obex Package Bluetooth for Java IntrCoLdAuSctSionNAME DESCRIPTION ChaAputterhe1nt-iIcntartodourcing Bluetooth This interface provides a way to respond to authentication Chapter 2 - Bluetooth 1.1 challenge and authentication response headers. Chapter 3 - Before You Get Started ChaCpltieren4tS-eUsnsdieorsntanding the Java BTluheetCooltiheAnPtISession interface provides methods for OBEX Chapter 5 - Bluetooth with J2ME MIDrPequests. ChaHpetaerde6rS-eCtreating a Bluetooth PrinTt hSeerHveear dweitrhSJePtS AinPteI rface defines the methods that set and get Chapter 7 - Java and OBEX the values of OBEX headers. Chapter 8 - Using a Bluetooth Simulator Operation TheOperation interface provides ways to manipulate a single Chapter 9 - Bluetooth Security OBEX PUT or GET operation. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaSpetsersi11on-NEontteirfpirieserBluetooth AppTlichaetiSoenss swiitohntNheotEirifcsiseorn BinltipeNrfeatce defines a connection notifier Chapter 12 - Bluetooth and Jini for server-side OBEX connections. AppPeansdsixwAor-djaAvuatxh.belunettiooctahtion This class holds user name and password combinations. Appendix B - javax.obex AppReensdpixoCns-eJCavoadeBlsuetooth DevelopmTehnteRonesthpeoPnaslmeCOoSdPelastfcolramss contains the list of valid response Appendix D - BlipNet 1.1 API codes a server may send to a client. IndSeexrverRequestHandler List of Figures List of Tables TheServerRequestHandler class defines an event listener that will respond to OBEX requests made to the server. List of Listings List of Sidebars The BenefitBslueotofotthheforJJaavvaa Bluetooth API by Bruce Hopkins and Ranjith Antony ISBN:1590590783 There are two keAypardevsas n©ta20g0e3s(3t5o2 upasginesg) the official Java Bluetooth API versus a C-based (or native) API: API is indepeTnhdeeanut tohfotrhseofsttahcisk taenxtddreasdcioribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of StandardizedBlBuleuteotootoh-thbaAsPedI services, highlights of security concerns, and more. API Is Independent of Stack and Radio Table of Contents So what makes the official Java Bluetooth API better than a C/C++ Bluetooth API? One of the principle Brlueeatsooonths fisorthJaavt athe JSR-82 API is independent of the stack and the Bluetooth hardware. That gives you the Inatbroilidtyucttoiownrite applications without any knowledge of the underlying Bluetooth hardware or stack. And Cthhaaptt'sere1sse-nItniatlrloydwuhciantgJBalvuaetgoiovtehs you today. If you write standard Java code (without any native methods), Cyhoauptcear n2 ru-nBylouuetrocoothde1.o1n basically any hardware platform and on any OS with little or no modification. CWhahpetethr e3r it-'sBaenfoareppYloi-ucaGteiotnS,taaprtpeldet, midlet, servlet, or EJB, you can code your application on one platform Cahnapdtedrep4loy- UtonadenrostthaenrdipnlgattfhoermJa. va Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP CThahpteer O6 n-lCyreSatitnagnadBlauertodoitzhePrdintBSelruveertwoitoh tJPhS AAPPI I Chapter 7 - Java and OBEX CIhf aypotuerh8ave- aUsCin/Cg baaBsleudetBooluthetSoiomthulSatDoKr , then you are basically at the mercy of the vendor. There is no Cshtaapntderar9d fo- rBaluCet/oCobthasSeedcuBriltuyetooth SDK, so each vendor is free to name functions and methods to Cwhahpatteerv1e0r t-heWyircehleosossEem. Vbeednddeodr SAymsteamy shawvitehftivhee pMriocrfioleBsluineTitasrSgeDtK, and Vendor B may only have three. If Cyhoauptwera1n1t t-o EcnhtaenrpgreisBelBuleuteotootohthhaArpdpwlicaarteioonrsswtaitchktlhiberaErriiecsss,othneBnlipyNoeut'll need to rewrite your Bluetooth Cahpapptliecra1ti2on- aBnlude/toorocthhaanngdeJiintsi functionality. Because the JSR-82 is the official Java API for Bluetooth, all AvpepnenddoirxsAw-hojaivmaxp.lbelmueetnoot tthhe standard must include a core set of layers and profiles in their Bluetooth SDK. Appendix B - javax.obex A JSR-82-compliant Bluetooth stack must include the following layers: Appendix C - Java Bluetooth Development on the PalmOS Platform AppenHdioxsDt C-oBnlitproNlelet r1I.n1teArPfIace (HCI) Index List ofLFoigguicraelsLink Control and Adaptation Protocol (L2CAP) List ofSTearbvliecse Discovery Protocol (SDP) List of Listings List ofRSFidCeObaMrsM These profiles are also required: Generic Access Profile Service Discovery Application Profile Serial Port Profile Generic Object Exchange Profile CROSSREFERENCE See "The Bluetooth Protocol Stack" and "Profiles" in Chapter 2 for details on the Bluetooth protocol stack and profiles just in case you forgot. The first thing that may come to your mind is, "Hey, wait a minute, doesn't the Bluetooth specification contain more profiles than that? Why did they implement only a few profiles in Java?" Well, here are two major reasons: First of all, the JSR-82 team wanted to get the Java Bluetooth specification in the hands of developers as quickly as possible. Recall in Chapter 2 that Bluetooth profiles are designed to be functional enough where higher profiles extend the functionality of the lower, or base, profiles. Refer to Figure 2-9, which shows a diagram of the relationship of the profiles of the Bluetooth specification. Secondly, by implementing the base profiles (Generic Access Profile, Service Discovery Application Profile, Serial PorBtlPuerotfoiloet,hanfodrGJaevnaeric Object Exchange Profile), the SDK vendor or the application developer is freebtoy iBmrupcleemHeopnkt itnhseahnidghRearnpjirtohfAilenstoonfythe BluetoIoSBthN:s1p59e0c5i9fi0c7a83tion. Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars What You NBelueetdootthofoGr eJatvaStarted by Bruce Hopkins and Ranjith Antony ISBN:1590590783 We know that thisApqrueessst©io2n00h3a(s35b2epeagneso)n your mind for a while. Well, here's a list of what you'll need: Bluetooth deTvhiceesau(tahtolresaosft ttwhios)text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth hoBstlu(eattoloetahs-bt aosneed) services, highlights of security concerns, and more. Bluetooth stack Table oJaf vCaoBntlueenttosoth API BNluoetwooletht'sfocroJvaevraall these components in detail and describe how they all work together. Introduction Chapter 1 - Introducing Bluetooth CBhapluteer 2to-oBtlhuetDooethv1i.c1es CBhalupetetoro3th d- eBveifcoerse wYoeureGceot vSetarertdedin Chapter 2, but just in case you forgot, take another look at Figures 2-1, C2h-a2p,tearn4d 2--3U. nRdeemrsteamndbienrg, tBhleueJtaovoathBldueetvoicoeths AaPreI simply radios, so getting a single device is just like getting Cahaspintegrle5 wa-lkBileuettaolkoiteh; wit'isthpJr2eMttyE uMsIeDlePss. If your Bluetooth device is point-to-point capable, then that means Ciht acpatnero6nly-taClrketaotinagsiangBllueeBtoluoethtoPortihntdSeevricveerawt iathtimJPeS.AIfPiIt is multipoint capable, then it can talk to up to Csheavpetenr d7ev-icJeasvaataandtimOeB.EXThe Bluetooth device is also known as the controller. Chapter 8 - Using a Bluetooth Simulator CBhapluteer 9too- BtlhuetHooothsStecurity Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CThahpeteBrlu1e1to-oEtnhtheropsrtisise tBhleuectooomthpuAtpeprltihcaattioisnsphwyitshictahlelyEcroicnsnseonctBedliptNoetthe Bluetooth device. For the most part, Cthhaisptiesry1o2ur-dBelusekttooopthPCan, dlaJpintoi p, PDA, or smart phone. Usually, the connection is USB, RS-232, or UART. Appendix A - javax.bluetooth ANppoewn,dyixoBu a-rjeavdaexf.inobiteexly going to need two Bluetooth devices, but you can get away with having only one ABpplueentdoiox tCh h- oJasvt.aHBoluwetdoooeths Dtheisvewlooprmk?enWt eolnl, tihf eyoPualhmaOvSe PalaPtCfortmhat has two serial ports or two USB ports (or Abpopethn)d,ixthDen- yBoliupNceatn1c.1onAnPeIct both of your Bluetooth devices to your PC's ports. In order for this to work, you need to start two instances of your JVM; each JVM will have its own Bluetooth device. Index LiTstheofBFliugeutroeosth host must meet the minimum requirements for the CLDC, so you need at least 512k total Limsteomf oTaryblfeosr the JVM. List of Listings LiBst louf eSidtoeboartsh Stack A Bluetooth stack is required in order for a Bluetooth host (the PC) to properly communicate to the Bluetooth device (the controller). If you go back to Figure 2-6, which shows a diagram of the Bluetooth stack, the bottom layer of the stack is the Host Controller Interface! See, it does make sense. The Host Controller Interface is literally the software required to interface the Bluetooth host and the Bluetooth device (the controller). Since this book is all about Java and Bluetooth, you might think that the Bluetooth stack needs to be written completely in the Java language. Well, not exactly. Some Bluetooth vendors have implemented a completely all-Java stack, while others have implemented a Java interface (i.e., JNI or other means) to a native stack. Either way, you need to access the stack through Java code, whether or not the stack is in Java. Java Bluetooth API Finally, you're going to need a set of libraries to interface with your stack. For the most part, a company will sell you a Java Bluetooth API and Bluetooth stack together in a kit. Just be sure to ask them what Bluetooth devices their kit supports. Another question to ask your Java Bluetooth kit vendor is if their product is JSR-82 compliant. Currently, JSR-82 can only be implemented on the J2ME platform. JSR-82 cannot be implemented on the J2SE platform because the J2SE does not support the Generic Connection Framework. Hopefully, the Generic Connection FramBelwuoertkoowtihll fboer iJmapvlaemented by JDK 1.5. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Note The offAicpiarel sJsS©R2t0o03im(3p52lepmageesn) t the GCF in the JDK is JSR-197. The authors of this text describe how to develop wireless Java Does this mean thapapt liitcaistiiomnps ousssinibgleBltuoedtoooJthavfaoraanvdaBrileutey toofopthladtfeovrmelso.pTmheisnt on the J2SE platform? No, it simply means thaint cwluhdaetsevaenr AJPaIvoavBelruveietwooothf tkhiet tJhaavtayloiburaorbyt,adinevfoelroJp2mSeEntwoifll not be compliant with JSR-82 until the Generic BClouentnoeocthti-obnasFeradmseerwviocerks,ishiigmhpliglehmtseonftesedciunriJty2ScoEn. cTehrnesm, aanjodr ramification of this problem is that your J2ME amndorJe2.SE code may be drastically different from each other, even if you are doing the same thing. Table of Contents BJlueatvooath BfolruJaevatooth Vendor SDKs Introduction CShaop, twerho1's -ofIfnetrriondguJcainvga BBlulueetotooothth SDKs, and which are JSR-82 compliant? Fortunately, there is a plethora CohfapJtaevra2Blu-eBtlouoetthooSthDK1.s1to fit the needs that your application requires. Vendor support is available for Java CBhalupetetoro3th d- eBveefolorepmYoeunGt oent Satawritdeed range of operating systems and JVM platforms. Table 3-3 displays various attributes of many Java Bluetooth SDKs. Chapter 4 - Understanding the Java Bluetooth API Chapter Table 5 - Bluetooth with J2ME MIDP 3-3: Java Bluetooth SDK Vendors [*] Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaCpOtMerP7ANY- Java anJdSORB-E8X2 JSR-82 SUPPORTED SUPPORTED ChaNpAtMerE8 - Using aJBAlVueAtXo.otBhLSUiEmTuOlaOtoTrH Chapter 9 - BluetooSthUPSPecOuRrTity JAVAX.OBEX SUPPORT JAVA PLATFORMS OPERATING SYSTEMS Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Atinav Yes Yes J2ME, J2SE Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AppBelundeiGx iAga- javax.bNluoetooth No Waba JVM Win-32, Linux, Pocket PC uClinux AppEernicdsixsoBn- javax.oNbeox No Appendix C - Java Bluetooth Development on the PalmOS Platform AppEesnmdiexrtDec- BlipNetY1e.1s API No Index List of Figures J2SE J2ME Win-32, Linux Win-32, Palm OS, Pocket PC, many others ListHoafraTaldbles No List of Listings List of Sidebars Possio Yes No J2SE Win-32, Linux, others Yes J2ME Win-32, Linux Rococo Yes Yes J2ME, J2SE Win-32, Linux, Palm OS, Pocket PC Smart Yes Network Devices No J2ME HyNetOS SuperWaba No No Waba JVM Palm OS Zucotto No No J2ME, J2SE Win-32 [*]The information in this table is subject to change, so check the companion Web site http://www.javabluetooth.com for up-to-date information. Palm OS is a registered trademark of Palm, Inc. Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This chapter hasAopnrleysssk©im20m03e(d35t2hpeagseusr)face of how to integrate Java Bluetooth. You learned about the advantages of usTinhge Jaauvthaovres rosfutshiCs tfeoxr tadpepslcicriabteiohnodwevtoeldoepvmeleonpt.wYiroeulesaslsJoavleaarned about JSR-82 as well as what it takes toapgpelitctahtiinognss uuspinagnBdluruentonointhg.for a variety of platforms. This includes an API overview of the Java library, development of In the next chapteBrl,uweteo'ollthfo-cbuassemd oserervoicnesin, theiggrhalitginhgtsJoafvsaecaunrdityBlcuoentcoeortnhs,,aasndwell as introduce some example code. more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter B4lu:etUoonthdfoer Jrasvatanding the Java Bluetooth API by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This chapter will bAepryeosus r©f2o0r0m3 a(3l5i2nptraogedsu) ction to the Java Bluetooth API. We'll cover a vast majority of the classes in the javax.blTuheetaouotthhorspaocf kthaigseteaxntddeesxcarmibeinheohwowtotdoeuvseelopthwemirelinesysoJuarvaapplications. Rather than looking at every class and inatpeprlfiacacteioinnsdiuvsidinugalBlylu, ewtoeo'llthtafkoer aa vdaifrfieertey notfapplaptrfooarmchs.bTyhfisirst looking at the basic components of a typical Bluetooth iBanlpculpeultdioceoastthiao-nnbaA(sJPeaIdvoasveeorrvrviioceetwhse,orhfwigtihsheeli)gJ.haAvtsfateolirfbswraeercyuh,raidtvyeevceiodlonepcnemtrifeniens,tdaotnhf dese components, we'll explain how to use the Java Bluemtoooreth. API in order to create wireless applications. The Basic Components of a Bluetooth Application Table of Contents BTluheetoboathsifcorcoJamvpaonents of any Bluetooth application consist of the following items: Introduction ChaptSerta1ck -inIintitarloizdautcioinng Bluetooth Chapter 2 - Bluetooth 1.1 Device management Chapter 3 - Before You Get Started ChaptDere4vice- Udinsdceorvsetarynding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP ChaptSere6rvic-eCdriesactoinvgeray Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Service registration Chapter 8 - Using a Bluetooth Simulator ChaptCero9mm-uBnluiceattoiootnh Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CThahpeteJra1va1 B- lEunetteoroptrhissepBelcuiefitcoaottihonAappdldicsataiosnpsewciiathl cthoemEproicnsesnont tBolitphNeemt ix called the Bluetooth Control Center C(hBaCptCer).1W2 e-'lBl ltuaelktoaobthouatntdheJinBi CC in the next section because in some vendor implementations, stack initialization AipspheandnidxleAd-thjarvoauxg.hblutheetoBoCthC. Appendix B - javax.obex ATpphenedixBClu- JeatvaoBolutehtooCthoDnevterlooplmCenet nontethre PalmOS Platform Appendix D - BlipNet 1.1 API InTdheex Bluetooth Control Center is an awkward beast due to its ambiguity. It is required to exist in a JSR-82 Licsot mofpFliiagnutreims plementation, but there are no guidelines in the official Java Bluetooth specification about how it should be implemented. One vendor could implement the BCC as a set of Java classes, and another vendor List of Tables could implement it as a native application on the Bluetooth host. But no matter how it is implemented, it is an List of Listings integral part of your security architecture because the BCC defines device-wide security settings for your LiBstluoef tSooidtehbdaresvice . Now, for the most part, if you are working with a JSR-82-compliant Java Bluetooth development kit within your development environment, then the BCC will probably be implemented as one or more Java classes. But because the BCC is vendor specific, the classes that form the BCC will not have a javax.bluetooth package name; they will be in the form of something like com.vendor.bluetooth.bcc. Now, if you're working with a device that comes with the Java Bluetooth standard (like a mobile phone or a PDA), then there is a high probability that the BCC would be implemented as a native application on that device. According to the Java Bluetooth specification, these are the requirements of the BCC: Include base security settings of the device. Provide a list of Bluetooth devices that are already known. The devices do not need to be within range. Provide a list of Bluetooth devices that are already trusted. The devices do not need to be within range. Provide a mechanism to pair two devices trying to connect for the first time. Provide a mechanism to provide for authorization of connection requests. Information contained in the BCC must not be modified or altered other than by the BCC itself. Depending upon the JSR-82 implementation that you're using, the BCC may need to be packaged and deployed with your application code. Bluetooth for Java Stack Initialization by Bruce Hopkins and Ranjith Apress © 2003 (352 pages) Antony ISBN:1590590783 Now before you cTahne daoutahnoyrsthoinf gth, iysotuerxtstdaecskcrnibeeedhoswtotobedeinvietilaolpizwedir.eRleessmJeamvaber, a Bluetooth stack has direct applications using Bluetooth for a variety of platforms. This access to the undinecrlluydinegs BanluAePtoIootvhedrveiveiwceo. fStthaecJkaivnaitilaiblirzaartyio, ndecvaenlocpomnesnisttooff a number of things, but its main purpose is to get BthlueetBolouteht-oboatsheddesveircveicreesa, dhyigtholisgthatrst owfirseelceusrsitycocmonmceurnnisc,aatinodn. Stack initialization sequences can vary, and it's heavmiloyrde.ependent upon the underlying OS and Bluetooth radio. In some cases (in particular, with the Rococo Palm DK) no code is needed at all to initialize your stack. In other cases, you'll need to write a bit of code to get your stack initialized because you need to specify baud rates for your RS-232 interface. Table of Contents BFluoertoinosthtafnocreJ,aLviasting 4-1 shows the snippet of code that you would need in order to initialize your stack if you were InutsroindgucthtieonAtinav SDK with a RS-232-based Bluetooth device. Chapter 1 - Introducing Bluetooth CLhaispttienrg24-1- :BSluteatcokotIhni1t.ia1lization Code for the Atinav SDK Chapter 3 - Before You Get Started Cihampptoerrt4 c-oUmn.daetrsitannadvin.gbtchce.J*a;va Bluetooth API C.ha.p.ter 5 - Bluetooth with J2ME MIDP CBhaCpCt.erse6tP-oCrrteaNtainmgea("BCluOeMto1o"th);Print Server with JPS API CBhaCpCt.erse7 tB-aJuavdaRaantde(O5B7EX600); CBhaCpCt.erse8 tC-oUnsninegcataBbluleeto(otthruSeim)u;lator CBhaCpCt.erse9 tD-iBsluceotovoetrhaSbelcuer(itDyiscoveryAgent.GIAC); C.ha.p.ter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AEppsemnedirxteAc -tajkaevsaxa.bdluifefetoreontht approach for stack initialization. Their JSR-82 implementation and stack tends to be AuppseenddmixoBst-lyjabvyawx.iorebleexss device OEMs. Listings 4-2 and 4-3 show the Java classes that would be part of a startup AspepqenudeinxcCe -toJainviatiaBlliuzeettohoethsDtaecvkeflooprmtheenteonntirtehedePvailcmeO. AS fPtelarttfhoermdevice has started (which consequently means that AtphpeensdtaixckDis- BallispoNientit1ia.1lizAePdI), other Java applications that reside on the device no longer need to include code to Inindietixalize the stack. List of Figures LiLstisotfinTgab4le-2s: BluetoothSetup1.java List of Listings LiistmopfoSritdebcaorsm.jbed.bluetooth.*; import java.io.IOException; public class BluetoothSetup1 { private static int device; private static BCC myBCC; static { device = DeviceProperties.DEVICE_1; try { myBCC = BCC.getInstance(); myBCC.startUp(device); myBCC.initDriver(); System.out.println("Bluetooth Started"); } catch (IOException exc) { System.out.println("IOException: " + exc.getMessage()); exc.printStackTrace(); System.out.println("Bluetooth Probably NOT Started "); } } } Bluetooth for Java by Bruce Hopkins and Ranjith Antony Listing 4-3: DevAicperPesrso©pe20r0ti3e(s35.j2apvaages) ISBN:1590590783 The authors of this text describe how to develop wireless Java import com.jbaeppdl.icbaltiounestuosointghB.l*u;etooth for a variety of platforms. This includes an API overview of the Java library, development of import com.jbBelude.tobolthu-ebtaoseodtshe.rHvicceisT,rhaignhslipghotrsto;f security concerns, and import java.umtoirel..Hashtable; public final class DeviceProperties { Table of Contents BluetoopthubfolriJcavastatic final int DEFAULT = 0; Introdupctuiobnlic static final int ERICSSON = 1; Chapterpu1bl-iIcntrsodtuactinigcBlfuietnoaolth int CSR = 2; Chapterpu2bl-iBcluesttooatthi1c.1 final int SILICONWAVE = 3; Chapterpu3bl-iBcefosrteaYtoiucGeft iSntaarltedint NON_SECURE_MODE_1 = 1; Chapterpu4bl-iUcndsetrsatatnidcingfithneaJlavainBtlueStoEoRthVIACPIE_LEVEL_MODE_2 = 2; Chapterpu5bl-iBcluesttooatthiwcithfJi2nMaElMiIDnPt LINK_LEVEL_MODE_3 = 3; Chapterpu6bl-iCcreasttinagtaicBlufeitonoathlPriinnttSeTrRveUrSwTiEthD_JPDSEAVPIICE = 0; Chapterpu7bl-iJcavastanadtiOcBEXfinal int UNTRUSTED_DEVICE = 1; Chapterpu8bl-iUcsinsgtaatBliucetofoithnaSlimuilanttor UNKNOWN_DEVICE = 2; Chapterpu9bl-iBcluesttooatthiScecfuriitnyal int AUTHORISATION_REQUIRED = 0x1; Chapterpu10bl-iWciresltesastEimcbefdidneadlSyistnetmsAwUiTthHEthNeTMIiCcrAoTBIlOuNeT_aRrEgeQtUIRED = 0x2; public static final int ENCRYPTION_REQUIRED = 0x4; Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet static int SERVICE_TABLE_SIZE = 32; Chapter 12 - Bluetooth and Jini static int DEVICE_TABLE_SIZE = 8; AppendpixuAbl-ijacvasxt.baluteitcootfhinal int DEVICE_1 = 0; AppendpixuBbl-ijacvasxt.oabteixc final int DEVICE_2 = 1; AppendsixtCat-iJcavainBltueNtoAoPth_GDNev_eMloOpDmEen=t oDnEtVhIeCPEa_lm2O;S Platform AppendsixtDat-iBclipiNnett1.P1AANPUI _MODE = DEVICE_1; Index static int DATA_MTU = 1691; List of Fsigtuarteis c int HEADER_LENGTH = 14; List of Tpaubblelsic static int maximumServiceRecordCount = 0xffff; List of Lpisutbinlgisc static int maximumAttributeByteCount = 0xffff; List of Ssitdeabtairsc int SDP_SERVER_THREADS = 4; static int SDP_CLIENT_THREADS = 4; static int BNEP_CHANNELS = 4; static int MAX_IN_L2CAP_BUFFERS = 32; static int SDP_THREAD_TIMEOUT = 120000; static int BLUETOOTH_EVENT_TIMEOUT = 180000; public static String DEVICE1_NAME = "Little Device1"; public static String DEVICE2_NAME = "Little Device2"; static int DEVICE1_IP = 0x0a110101; // 10.17.01.01 static int DEVICE2_IP = 0x0a110102; // 10.17.01.02 static int NETMASK = 0xFFFFFF00; // 255.255.255.0 static int BROADCAST = 0x0a1101FF; // 10.17.01.255 static int DST_UUID = Sdp.UUID_PANU; static int SRC_UUID = Sdp.UUID_GN; Hashtable ht; private ExternalSecurityControlEntity myEsce; String pin = "123"; HciTransport hciTransport; String device1SerialPort = "COM1"; String device2SerialPort = "COM1"; int device1BaudRate = 19200; // 38400; //57600; //9600; //115200; int devicBelu2eBtaouodthRafotreJa=va19200; // 57600; //38400; //9600; //115200; int roleSbwyiBtrucche H=opHkcinisCaonndnReacntjiithonATntaobnlye.REFUSIES_BNR:O15L9E05_9S07W8I3TCH; int securAiptreysMso©d2e003=(35S2EpRagVeIs)CE_LEVEL_MODE_2; The authors of this text describe how to develop wireless Java DeviceProapppelrictaitioenss(uisnintg Bdleuvetiocoeth)fo{r a variety of platforms. This ht = iBnnlcueleuwtdoeoHsthaa-snbhaAtsPeaIdboslveeerr(vvi)icee;ws,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and myEscmeore=. new ESCESample(pin); // SerialIFHciTransport is a simple UART connection Table of Contiefnt(sdevice == DEVICE_1) { Bluetooth for Java hciTransport = new SerialIFHciTransport(device1SerialPort, Introduction device1BaudRate); Chapter 1 - Introd/u/cinHguBmlaunetoroethadable form of the device name Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 - Bluethoott.hp1u.1t("bluetooth.device.name", DEVICE1_NAME); -}BeefolrseeYo{u Get Started - UndehrsctainTdrinagnsthpeoJratva =BluneetowothSeArPIialIFHciTransport(device2SerialPort, - Bluetooth with J2ME MIDP device2BaudRate); - Creat/in/g aHuBmluaentoortheaPrdinatbSleervefrowrimth oJPfS tAPhIe device name ht.put("bluetooth.device.name", DEVICE2_NAME); - Java and OBEX } - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security ht.put("bluetooth.api.version", "1.0a"); Chapter 10 -hWti.repluests(E"mbbleudedteodoStyhst.esmescwuirthitthye.MmiocrdoeB"l,ueTIanrtgeetger.toString(securityMode)); Chapter 11 -hEtn.tepruptri(se"bBlluueetotoothotAhpp.llic2atcioanps.wriethcethievEerMicTsUso.nmBalxip"N,et Integer.toString(DATA_MTU)); Chapter 12 -hBtlu.eptuoott(h"abnlduJeinti ooth.connected.devices.max", "7"); Appendix A -hjatv.apxu.btlu(e"tbooltuhetooth.connected.inquiry", "true"); Appendix B -hjtav.apxu.otb(e"xbluetooth.connected.page", "true"); Appendix C -hJtav.apuBltu(e"tobolthueDtevoeolotphm.ecnotnonnetchteePda.lmiOnSquPilartfyo.rmscan", "true"); Appendix D -hBtli.ppNuett1(."1bAlPuIetooth.connected.page.scan", "true"); Index ht.put("bluetooth.master.switch", "true"); List of Figurehs t.put("bluetooth.sd.trans.max", Integer.toString(SDP_CLIENT_THREADS)); List of Tablesht.put("bluetooth.sd.attr.retrievable.max", "64"); List of Listings List of SidebatrsestProperties(); } ExternalSecurityControlEntity getEsce() { return myEsce; } private void testProperties() { int i; if (hciTransport == null) { throw new Error("No connection to Host Controller defined"); } i = getInt("bluetooth.security.mode"); if (i < NON_SECURE_MODE_1 || i > LINK_LEVEL_MODE_3) throw new Error("bluetooth.security.mode must be NON_SECURE_MODE_1, SERVICE_LEVEL_MODE_2, or LINK_LEVEL_MODE_3"); if (getInt("bluetooth.l2cap.receiveMTU.max") < 48) throw new Error("bluetooth.l2cap.receiveMTU.max must be at least" + Bluetooth for Java " 48 bytes, default value is 672"); } by Bruce Hopkins and Ranjith Antony ISBN:1590590783 private iAnptresgs e©t2I00n3t(3(5S2tpragiesn)g prop) { returTnhe Ianuttheogrseorf.tphaisrtseextIdnets(cr(ibSetrhoiwngto) dhevte.logpewt(irpelreosspJ)a)v;a } } applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. TaSbole, aosf wCoenstteantetsd earlier, stack initialization must occur before you can do any real work in your Bluetooth Balupeptolioctahtiofonr (Jwahvaether you invoke it directly in your code or not). Introduction CDhapetveric1 e- MIntaronduacgineg Bmlueetnootth Chapter 2 - Bluetooth 1.1 CLhaopctaerlD3ev-iBceefo,RreeYmooutGeeDteSvtiacrted, and DeviceClass are the classes in the Java Bluetooth specification that Cfhoarpmtetrh4e G-eUnnedriecrsAtaccnedisnsgPthroefiJleavaanBdluaeltlooowthyoAuPIto perform device management. These classes allow you to query Cshoampteers5tati-stBicluael tinoofothrmwaitthionJ2aMbEoMutIDyoPur own Bluetooth device (LocalDevice) and also some information on the Cdheapvticeer s6in -thCereaarteinag(RaeBmluoettoeoDtehvPiricnet )S.eTrvheer DweitvhiJcPeSCAlPaIss object gives you information about the official class of Cdheapvticeer 7(Co-DJ)avaas adnedfinOeBdEXin the Bluetooth specification. Chapter 8 - Using a Bluetooth Simulator javax.bluetooth.LocalDevice Chapter 9 - Bluetooth Security CThahpetreer i1s0a-faWmiroeulesssquEomtbeetdhdaetdsaSyyss,te"mKnsowwiththtyhseelMf."icrWo eBlllu, ethTiasrgcleatss allows you to do exactly that. The CLhaopctaerlD11ev-iEcnetecrplarissseiBsltuheetocolathssApthpalitcagtiivoenss ywoiuthinthfoermEraictsiosnonaBbolipuNt eytourself, the local Bluetooth device. Being a Cshianpgtleerto1n2 o-bBjelucet,toyootuh caannd oJinnliy have a single instance of this object in your JVM at a time. Its constructor is ApppreinvdaixtAe,-sjoavyaoxu.bclauentoinostthantiate it by using the static getLocalDevice() method: Appendix B - javax.obex ALppoecnadlixDCev-iJcavea lBlouceatolodthevDievceelop=meLnotcoanltDheevPiaclmeO.SgePtlaLtfoocrmalDevice(); Appendix D - BlipNet 1.1 API Index LipstuobfliFcigSutrreins g getBluetoothAddress() List of Tables Bluetooth devices have unique addresses, which are quite similar to MAC addresses for network cards on your LiPstCo.fTLhisistincglasss allows you to find out what your Bluetooth address is with the getBluetoothAddress() Limsteothf oSdid.eIbt arersturns a 12-character String in the form of something like 00FE3467B092. In most cases, your Bluetooth radio shows what your address is somewhere externally, but it's nice to have a way to access it pr og ram ma tically. public boolean setDiscoverable(int mode) In order to allow remote Bluetooth devices to find your device, you need to set the discovery mode of your Bluetooth device. Table 4-1 contains a list of valid modes and descriptions for the Bluetooth discovery modes. Table 4-1: Bluetooth Discovery Modes ACCESS MODE FULL NAME NOT_DISCOVERABLE Not Discoverable GIAC LIAC General/Unlimited Inquiry Access Code Limited Inquiry Access Code DESCRIPTION Don't allow any devices to discover your device. Allow all devices to discover your device. A temporary access mode that will revert back to a previous state after 1 minute. VALUE 0 10390323 10390272 One question that might be on your mind is why the values for the access modes are 0, 10390272, and 10390323. WouldBnlu'teittoboetshimfoprleJrafvoar the values to be something like 0, 1, and 2? Well, the codes for NOT_DISCOVERAbByLBEru,LceIAHCo,pakninds GanIdACRaanrjeithalAl ndteofninyed in the BISluBeNt:o15o9t0h59A0s7s83igned Numbers document from http://www.blAuperetsoso©t2h00.3o(r35g2.pEagaecs)h entry in the document (which has more than just codes for Bluetooth discovery modes)Thheasauathuonrisquoef tchoisdteexint hdesxcardibeecihmoawl tfoordmevaet.loTphweiareclteusaslJcaovdaes for LIAC and GIAC as described in the Bluetooth AaspspiglicnaetdionNsuumsibnegrsBlduoetcouomthefnotraareva0rxie9tyE8ofBp0l0atf(oformr LsI. TAhCi)s and 0x9E8B33 (for GIAC). For your convenience, theiBsnelculevutadoleoustehas-nbaaArsePeIadovsvaeeirlravvbiiceleews,toohfyigtohhueligaJhasvtspauolibfblsricaerccyuo,rnidtsyetvaceonlontspceminrentnsh,teaoDnf idscoveryAgent class: more. // javax.bluetooth.DiscoveryAgent.java ... Table of Contents public static final int NOT_DISCOVERABLE = 0; Bpluuebtoloithc fosrtJaatvaic final int LIAC = 0x9E8B00 // 10390272 Inpturobdluicctionstatic final int GIAC = 0x9E8B33 // 10390323; C.ha.p.ter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Cphaupbtleicr 5int -gBeltuDeitsocoothvewritahbJle2(M)E MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Call this method if you want to know the current discovery mode of your Bluetooth device. This will (obviously) Crheatputrenr a7n i-nJtavtahaatn'sd eOitBhEeXr NOT_DISCOVERABLE,LIAC, or GIAC. Chapter 8 - Using a Bluetooth Simulator Cjhaavptaexr .9bl-ueBltuoetooothth.RSeecmuriotyteDevice Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CThahpetReer m1o1t-eEDnetevripcriesecBlalusestgooivtehsAypopulicaacticoenssswtoithatshiengElreicrsesmonoBtelipBNluetetooth device in the area. The most common Cwhaapytetor 1o2bt-aiBnluaerteofoethreanncdeJtionia RemoteDevice is through device discovery, which is covered in the next section. AHppeernedaixreAtw- ojavuasxe.fbullumetoeoththods that pertain to device management. Appendix B - javax.obex public final String getBluetoothAddress() Appendix C - Java Bluetooth Development on the PalmOS Platform AAppseynoduixpDro-bBalbiplyNehta1v.e1aAlrPeIady assumed, this method returns to you the 12-character Bluetooth address of the Inredemxote device. List of Figures LipstuobfliTcaSbltersing getFriendlyName(boolean alwaysAsk) LiKstnoofwLinisgtinthges Bluetooth address of the RemoteDevice is fine, but it is even better to know the "friendly name" of LitshtaotfdSeivdiecbea.rTs he friendly name of a Bluetooth device is something like "Andrew's PDA", "Home Office Printer", or "Ranjith's MP3 Player". javax.bluetooth.DeviceClass This class represents the class of device in the Bluetooth specification. A device class is simply a classification of Bluetooth devices. Why is this class useful? Well, by simply calling the methods of this class, you can determine what kind of devices are in the area, like computers, laptops, phones, PDAs, access points, etc. The methods provided to accomplish this task are getMinorDeviceClass() and getMajorDeviceClass(), both of which return an int.Table 4-2 shows some common major and minor device classes. Table 4-2: Bluetooth Major and Minor Device Classes [*] MAJOR CLASS MINOR CLASS MAJOR CLASS DESCRIPTION 0 Misc. major device 256 0 Computer 256 4 Computer 256 8 Computer MINOR CLASS DESCRIPTION Unassigned, misc. Desktop Server 256 Bl1u2etooth for Java Computer Laptop 256 by1B6ruce Hopkins andCRomanpjiuthteAr ntony ISBN:159S05u9b0-7la83ptop 256 Apress © 2003 (352 pages) Th2e0authors of this teCxot mdepsuctreibre how to develop wirelePssDJAava 256 ap2p4lications using BluCeotomopthutfeorr a variety of platforms.WThaistch size includes an API overview of the Java library, development of 512 Blu0etooth-based servPicheosn, ehighlights of security concerUnsn,aasnsdigned, misc. more. 512 4 Phone Cellular Tab5le12of Contents 8 Phone Household cordless Bluetooth for Java 512 12 Introduction Cha5p1t2er 1 - Introduc1i6ng Bluetooth Phone Phone modem Smart phone Cha7p6t8er 2 - Bluetoot0h 1.1 LAN/network access point Chapter 3 - Before You Get Started Cha7p6t8er 4 - Underst3a2nding the Java BluLeAtNoo/nthetAwPoIrk access point Fully available 1–17% utilized Cha7p6t8er 5 - Bluetoot6h4with J2ME MIDPLAN/network access point Chapter 6 - Creating a Bluetooth Print Server with JPS API Cha7p6t8er 7 - Java and96OBEX LAN/network access point 17–33% utilized 33–50% utilized Cha7p6t8er 8 - Using a 1B2lu8etooth SimulatoLrAN/network access point Chapter 9 - Bluetooth Security Cha7p6t8er 10 - Wireless16Em0 bedded SystemLAs Nwi/tnhettwheorMkicarcocBelsuseTpaorignet t 50–76% utilized 67–83% utilized Cha7p6t8er 11 - Enterpri1s9e2Bluetooth ApplicLaAtiNon/nsewtwitohrkthaecEcreicssssopnoiBnltipNet 83–99% utilized Chapter 12 - Bluetooth and Jini App7e6n8dix A - javax.bl2u2et4ooth LAN/network access point 100% utilized, no service available App1e0n2d4ix B - javax.ob0ex Audio/video device Appendix C - Java Bluetooth Development on the PalmOS Platform App1e0n2d4ix D - BlipNet 41.1 API Audio/video device Index Unassigned, misc. Headset (must conform to the Headset Profile) List10of24Figures 8 Audio/video device Hands-free device List of Tables 1024 16 List of Listings Audio/video device Microphone List10of2S4idebars 44 Audio/video device VCR 1024 72 Audio/video device Video game system 1280 64 Computer peripheral Keyboard 1280 128 Computer peripheral Mouse, trackball, etc. 1280 12 Computer peripheral Remote control 1536 16 Imaging device Display device 1536 32 Imaging device Camera 1536 64 Imaging device Scanner 1536 128 Imaging device Printer 7936 Unclassified major device [*]This table has a majority of the major and minor device classes listed in the Bluetooth Assigned Numbers document on the Bluetooth Web site: http://www.bluetooth.org. So, that's about all it takes to perform device management with the Java Bluetooth APIs. Now, let's take a look at the concept in Bluetooth that allows you to discover other Bluetooth devices: device discovery. Device DiscBlouveteoortyh for Java Your Bluetooth debyvicBeruhcaesHnoopkidinesaaonfdwRhaantjioththAenrtBonluyetooth ISBN:1590590783 devices are in the area. Perhaps there are l aptop s, desktops, printersA,pmreosbsi©le2p00h3o(n35e2sp,aogersP) DAs in the area. Who knows? The possibilities are endless. In order to find out, your BlueThtoeoathutdheovrsicoefwthililsutseextthdeesdcerivbiecehodwisctoovdeervyeclolapswsierselethsastJaarvea provided in the Java Bluetooth API to see what's out theainprcepl.ulidcaetsioanns using Bluetooth API overview of for the a variety of platforms. This Java library, development of Bluetooth-based services, highlights of security concerns, and Which Bluetooth mdeovreic.es should use device discovery? Well, if you are planning to use a peer-to-peer application in Bluetooth, like two PDAs in a chat session, then either device would use device discovery to find the other device. If you are planning to use a client-server type application, like printing from a lap-top to a printer, then the Tacblileenot fisCmonotsetnlitksely to perform device discovery. It doesn't make sense for the printer to constantly look for Bdlueevtiocoetsh tfhoar tJwavaant to print something. Introduction CNhaopwte, rle1t's -taIknetraodloucoikngatBtlhueetotwoothclasses needed in order for your Bluetooth device to discover remote Bluetooth devices in the area: DiscoveryAgent and DiscoveryListener. Chapter 2 - Bluetooth 1.1 Cjhaavptaexr .3bl-ueBetfooroetYho.uDGisetcSotavreterdyAgent Chapter 4 - Understanding the Java Bluetooth API CAhaftpetregr e5ttin-gBaluLetoocoathlwDeithviJ2cMeEoMbjIeDcPt, the most logical next step for device discovery is to instantiate the CDhaipstcerov6er-yCArgeaetnintg oabBjelucet.toYootuh Parcicnot mSeprlvisehr wthiitshtJaPsSk AbPyIcalling LocalDevice.getDiscoveryAgent(). Chapter 7 - Java and OBEX CLhaopctaerlD8ev-iUcseinglaocBaluledtoeovthicSeimu=latLoor calDevice.getLocalDevice(); CDhaipstcerov9er-yBAlugeetnootthdSiesccuroitvyeryagent = localdevice.getDiscoveryAgent(); Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CWhahpetenr y1o2u-wBalunet ttooodthiscanodveJrinoither Bluetooth devices in the area, DiscoveryAgent gives you two methods to AwppoernkdwixitAh: -sjtaavarxt.Iblnuqetuoiorthy() and retrieveDevices(). ApppuebnldicixbBoo- ljeaavnaxs.otabretxInquiry(int accessCode, DiscoveryListener listener) Appendix C - Java Bluetooth Development on the PalmOS Platform AAppfteenrdyixouDh-aBvleipiNnestta1n.1tiaAtePdI your DiscoveryAgent, you use this method to make your Bluetooth device search Infodrexother devices in the area. The length of the inquiry is totally dependent upon the implementation of the Java LiBstluoeftoFiogtuhresspecification. The accessCode can be one of the following DiscoveryAgent constants: LiNstOoTf_TDaIbSleCsOVERABLE,LIAC, or GIAC. You must also pass a reference to a class that implements the LiDstiosfcLoisvteinrgysListener interface. When new devices are discovered, event callbacks are passed back to this Liosbt joefcSt.idTehbiasrms ethod will return trueif the device successfully went into discovery mode. The startInquiry() method is the only way to perform device discovery without blocking the current thread. public RemoteDevice[] retrieveDevices(int option) Use the retrieveDevices() method to get a list of RemoteDevice objects that were found by previous inquiries. The option field has either the value of 0 for CACHEDor1 for PREKNOWN. For your convenience, CACHED and PREKNOWN are also defined as constants in the DiscoveryAgent class. Unlike the startInquiry() method, this method blocks the calling thread until it returns. CACHED and PREKNOWN devices are determined by the BCC. Note For the most part, a CACHED device is simply a Blue-tooth device that was found from a recent inquiry. Of course, the definition of "recent" is implementation dependent. A PREKNOWN device is a level above aCACHED device and is one that you frequently communicate with. For example, let's say that you own a Bluetooth-enabled PDA. If you have exchanged business cards with another PDA within an hour, an implementation may classify that PDA as CACHED. However, if you own a printer at home, and you print to it often from the PDA, then an implementation may classify the printer as PREKNOWN. Please note that the retrieveDevices() method does not perform a true inquiry for Bluetooth devices, and subsequently, devices found from this method may not be in the area. However, this really isn't a problem, because the purpose of this method is to quickly give you the references to the devices that you want to connect to. The startInquiry() method will guarantee that the device is in the area, but it may take a considerable amount of time in order to find the device that you want. Bluetooth for Java javax.bluetoobtyhB.DrucisecHoopvkeinrsyaLnidsRteannjeithr Antony Apress © 2003 (352 pages) ISBN:1590590783 If you've worked wThiteh aeuvtehnotrshaonf dthliinsgteinxtJdaevsac,ritbheenhothwetocodnecveeplotpowf liirsetleensserJsavisanot new to you. Like all listeners, DiscoveryListaeppnleicratiisonasnuinsitnegrfaBclueettohoatthhfaosr aa mvaeritehtoydotfhpalat tisfocrmalsle. dThbiys the JVM when the desired event occurs. If you wanintctloudbees iannfoArmPIeodvewrhvieenwaofBtlhueetJoaovtah ldibervaircye, disefvoeulonpdmbeyntDoifscoveryAgent.startInquiry(), then your class nBeleudestotoothim-bpalseemdesnertvthiceesD,ihsigcholivghetrsyoLfissectuernityercoinntceerrfnasc,ea.nWd henever a Bluetooth device is found, more. the method deviceDiscovered() is called. Tapbulebloicf CvoonidtednetvsiceDiscovered(RemoteDevice btDevice, DeviceClass cod) BAlusetsotoatthedfoirn Jtahveapreceding section, this method is called by the JVM when a remote Bluetooth device is found Infrtoromduacntioinnquiry. The RemoteDevice object is a reference to the Bluetooth device found from the inquiry. The CDhaepvtierce1Cl-aIsntsroodbujceicntg(wBlhuiecthootethlls you if the remote device is a phone, a PC, a PDA, etc.) is also provided when Cthhaisptmere2tho-dBisluceatolloetdh. 1S.e1e Table 4-2 for common device classes and their numbers. Chapter 3 - Before You Get Started ChaptNero4te T-hUenddeevrsitacnedDinigscthoevJearvaedB(lu)etmooetthhoAPdImay be called more than once for the same Bluetooth device in Chapter 5 t-heBluviectionoittyh. with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Now that you know all the semantics about discovering devices, let's discuss how to find what services (if any) Cthhaaptttehre7se -dJeavvicaeasnodffOeBr.EX Chapter 8 - Using a Bluetooth Simulator Service Discovery Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CAhaftpetreyr o1u1 h-aEvnetelorpcraisteedBdlueevtiocoetshinApthpelicaatrieoan,sitwwitohutlhdebEerircesasollny nBilcipeNteot see what services those devices offer. Of Cchoauptresre,1y2o-uBclaunetaoolwthayasndinJsipnei ct the DeviceClass object, but that may only reveal half the picture. Let's say that AypopuenwdiaxnAt to- jparvinaxt .abltueexttofoilteh. Obviously, if the DeviceClass indicates that the major device class of the ARppeemnodtixeBDe-vjaivcaex.iosbaexprinter, then you're all set. But what if the major device class is a computer? Would it come Atpopemnidnidx tCha-tJyaovua cBalunetaolostohpDreinvtetloopamceonmt opnuttehrethPaaltmisOaScPtinlagtfoarsma print server? Appendix D - BlipNet 1.1 API IndexCROSS- This is actually a good segue for Chapter 6. In Chapter 6, you'll learn how to convert your List ofRFEigFuEreRsENCE desktop computer into a wireless print server. LiTsthoefsTearbvliecse discovery-related classes in the Java Bluetooth specification implement the Service Discovery LiAstpopflicLaisttiionngsProfile. The Service Discovery Application Profile, in turn, uses the Service Discovery Protocol (SDP) Lilsatyoefr SinidyeobuarrsBluetooth stack to find services on remote Bluetooth devices. CROSSREFERENCE SeeChapter 2 for detailed descriptions of profiles and layers in Bluetooth. The following classes are provided in the Java Bluetooth specification for service discovery: DiscoveryAgent, DiscoveryListener,ServiceRecord,DataElement, and UUID. You'll also interact (indirectly) with the SDDB whenever you want to discover services on a remote Bluetooth device. The Service Discovery Database The Service Discovery Database (SDDB) is the central repository for all service records, but it's not a database in the sense of Oracle 9i, Sybase, or even MS Access. It's simply a collection of service records (and no, we don't mean a Java Collections object). The JSR-82 implementation is free to implement the SDDB in any form, so when a ServiceRecord object is stored in the SDDB, it doesn't necessarily mean that the JVM serialized the ServiceRecord object and stored it in a data store. If a particular JSR-82 implementation does not store service records in the SDDB as Java objects, then it must convert them into ServiceRecord objects when a client performs a search for services and a match is found. Figures 4-1 through 4-4 present graphical depictions of the SDDB, ServiceRecord,DataElement, and UUID objects in regard to how they all work together for service discovery. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Figure 4-1: Service records in the SDDB Chapter 3 - Before You Get Started CAhaspytoeru4can- sUenedeinrsFtaignudirneg4t-h1e, JaasvearBvilcueetroeocthorAdPiIs an individual entry in the SDDB (Service Discovery Database). Chapter 5 - Bluetooth with J2ME MIDP CEhanptrtieers6in s-eCrrveicaetinregcaorBdluseatoreotchaPllreindtaStetrrivbeurtewsi.thAJttPriSbuAtPeIs consist of an ID and value. See Figure 4-2 for an Cihllaupstterar t7ion.- Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AppenFdiigxuDre- 4B-li2p:NAetn1in.1diAvPidIual attribute of a service record Index LiAstttorifbuFitgeuIrDess are 16-bit unsigned integers (0x000-0xFFFF). In a ServiceRecord object, attribute values are Lissttooref dTaabsleDsataElement objects as shown in Figure 4-3. List of Listings List of Sidebars Figure 4-3: An illustration of a service record attribute DataElements can be created from the following Java types: int,boolean,UUID, and Enumeration (see Figure 4-4). Figure 4-4: DataElements Figure 4-5 wraps it all up by showing the process of service discovery for a PDA that wants to use the services of a Bluetooth keyboard. A successful service discovery will occur only if there is a match in the UUID of a service record in the SDDBBluoeftothoethRefomroJtaevDaevice. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java IntrodFuicgtuiorne 4-5: The service discovery process for a PDA that wants to use the services of a Bluetooth keyboard Chapter 1 - Introducing Bluetooth CNhaopwte, rle2t's -loBolkueattotohteh s1e.1rvice discovery-related classes in detail. Chapter 3 - Before You Get Started Cjhaavptaexr .4bl-ueUntdoeorstthan.UdinUgIDthe Java Bluetooth API CThahpetUeUr I5D c-lBalsusetisoostihmwpliythaJc2lMaEssMtIhDaPt uniquely identifies services in the Bluetooth protocol (UUID stands for CUhanpivteerrs6al U- nCirqeuaetinIdgeantBifliueert)o. oLteht'PsrsinatyStehravteyrowuithhaJvPeSaABPIluetooth client device that supports L2CAP connections. If Cyhoauptwera7nt t-o JsaevnadaandmOeBsEsXage to a Bluetooth server device, just perform service discovery with the UUID of C0haxp0t1er008, w-hUicshingis athBeluUeUtoIoDthfoSrimL2uClaAtoPr. If you have a Bluetooth-enabled PDA, and you want to send your Cbhuapstineer s9s c-aBrdlu(e.tvocof)thtoSoecthuerirtyBluetooth-enabled devices, then you'll perform service discovery with a UUID of C0haxp1t1er0510, w-hWicihreilsestsheEmUbUeIdDdefodr SthyesteOmBsEwXitOhbthjeectMPicuroshBPlureoTfailreg.eTtable 4-3 lists a sample of UUIDs for Bluetooth Cphraopttoecro1l1la-yeEnrstearnpdrisTeaBbllueet4o-o4thlisAtsppUliUcaIDtiosnfsorwBithluethtoe oEtrhicssesrovnicBelsipaNnetd their corresponding Bluetooth profile. For Cihnasptatenrc1e2, H-eBaludesteotoathndanHdeJaindisetAudioGateway are both distinct services that are a part of the Headset Profile. ATppheenrdeifxorAe,-ejaavcahxs.belruveictoeohthas its own UUID, 0x1108 and 0x1112, respectively. Some profiles, like the FAX APpproefnidleix, oBnl-yjahvaavxe.oobneex service: FAX (which has a UUID of 0x1111). A more exhaustive list of UUID values for ApprpoetnodcioxlsC a-nJdavparoBfliuleetsoeortvhicDeesvcealonpmbeensteoenntihnethPealmBlOuSetPoloatthfoArmssigned Numbers document. Appendix D - BlipNet 1.1 API InTdaebxle 4-3: Common UUID Values for Bluetooth Protocol Layers ListPoRfOFTigOuCrOesL List of Tables ListSoDfPListings UUID (DECIMAL) 1 UUID (HEXADECIMAL) 0x0001 ListRoFfCSOidMebMars 3 0x0003 L2CAP 256 0x0100 HTTP 12 0x000C FTP 10 0x000A TCP 4 0x0004 IP 9 0x0009 UDP 2 0x0002 BNEP 15 0x000F OBEX 8 0x0008 TCS-BIN 5 0x0005 Table 4-4: Common UUID Values for Bluetooth Profiles PROFILE Bluetooth foSrEJRaVvIaCE NAME UUID by Bruce Hopkins and Ranjith Antony IS(BDN:E15C9I0M59A0L78)3 Serial Port Apress © 2003 (352 pages) Serial Po rt 4353 The authors of this text describe how to develop wireless Java Dial-up Networkainppglications uLsAinNgABclcueestosoUtshinfogrPaPvPariety of platfo4r3m5s4. This includes an API overview of the Java library, development of Dial-up NetworkBinlugetooth-baDseiadluseprNviectewso, rhkiginhglights of security c4o3n5ce5rns, and more. Object Push OBEXObjectPush 4357 TabOlebojefcCt oPnutsehnts OBEXFileT ran sfer 4358 BluCetoorodtlhesfosrTJealveaphony CordlessTelephony Introduction ChaAputdeiro1/Vid-eIontCroodnutcroinlg BluetoAot/Vh_RemoteControl Profile Chapter 2 - Bluetooth 1.1 4361 4366 ChaInptteerrc3om- Before You Get StaInrtteedrcom 4368 Chapter 4 - Understanding the Java Bluetooth API Fax Fax Chapter 5 - Bluetooth with J2ME MIDP 4369 ChaGpetenrer6ic A- cCcreassting a BluetooHthePardinstetServer with JPS API 4360 Chapter 7 - Java and OBEX Generic Access HeadsetAudioGateway Chapter 8 - Using a Bluetooth Simulator ChaHpatnerds9fre-eBluetooth SecurityHandsfree 4370 4382 ChaHpatnerds1f0re-eWireless EmbeddedHaSnydstsefmresewAiutdhiothGeaMteicwroayBlueTarget4383 Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaBpatseirc1P2rin- tBinlugetooth and Jini BasicPrinting 4386 AppBeansdicixPArin- tjianvgax.bluetooth PrintingStatus 4387 Appendix B - javax.obex AppHeanrddixCCop-yJaCvaabBleluetooth DevHealordpmCoenptyConabthleeRPeaplmlaOcSemPleatnftorm 4389 AppReenpdliaxcDem- eBlnipt Net 1.1 API IndHexard Copy Cable ListRoefpFl aigcuermese nt List of Tables ListHoafrdLisCtionpgys Cable ListRoefpSl aidceebmaresnt HCR_Print HCR_Scan 4390 4391 Human Interface Device HumanInterfaceDeviceService 4388 Generic Networking n/a 4609 UUID (HEXADECIMAL) 0x1101 0x1102 0x1103 0x1105 0x1106 0x1109 0x110E 0x1110 0x1111 0x1108 0x1112 0x111E 0x111F 0x1122 0x1123 0x1125 0x1126 0x1127 0x1124 0x1201 Now, let's take a look at the constructors for UUID. public UUID(long uuidValue) This is pretty cut and dry—it constructs a UUID object from a long. public UUID(String uuidValue, boolean shortUUID) This method allows you to construct a UUID from a String representation of a UUID. If shortUUID is set to true, then a short UUID is returned (one that is made up of 16 bits instead of 128 bits). Note When using this method, be sure not to include the "0x" prefix in front of the String when constructing this object. javax.bluetooth.DiscoveryAgent Hey, wait a minute, didn't we use this class for device discovery? Well, that's why the authors of the Java Bluetooth specification named this class DiscoveryAgent, because they intended this class to be used for both device and servicBeludeistcooovtehryf.oIrnJoarvdaer to find services on remote devices, you'll use either selectService() or searchServicebsy(B)ru. ce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) public int searchTSheeravuitcheosrs(inoft[t]haistttreSxettd, eUscUrIiDbe[]huouwidtoSdeet,vReleomp wotireeDleesvsiJcaevabtDev, DiscoveryListener discListener) applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of This method allowBlsueytoouottho-sbeasaercdhseforvricaelsis, thoigf hsleigrhvticseosf osencaursitiny gcloenrceemrnost,eaBndluetooth device. The attrSet[] parameter must bmeopreo.pulated with an array of integers that correspond to attributes that you want to see when the services match the UUIDs. The UUID[] parameter is the list of UUIDs of services that you want to look for. TaRbelemootf eCDoenvteinctes is the reference to the remote device that you want to search for services. You must also BplureotvoiodtehafnoroJbajveact that will implement the DiscoveryListener interface in order to receive event callbacks when services that match your UUID criteria are discovered. This method returns an int that is the transaction Introduction ID. You can later use the transaction ID to cancel this search if you need to. Chapter 1 - Introducing Bluetooth Cphaupbtleicr 2Str-inBgluseetoleocthtS1e.1rvice(UUID uuid, int security, boolean master) Chapter 3 - Before You Get Started CThahpistemr e4tho-dUandlseorsatallnodwisngyothuetoJasveaaBrlcuhetfooortsheArvPiIces, but it has a slight twist that makes it different from Cshaepatrerch5Se-rBvluiecteoost(h)w. iTthhiJs2mMEetMhIoDdPaccepts neither a DiscoveryListener nor a RemoteDevice object. By Cuhsaipntgerth6is m- Certheaotdin, gyoauBcluaentopoetrhfoPrrmintaSseervaercr hwfitohr JaPSpaArPticI ular UUID that is available on ANY device in the area. If there is a match, then this method returns a String that will be used in the Connector.open() method in Chapter 7 - Java and OBEX order to establish a connection to that device. Be sure to notice that this method only allows you to search on a Chapter 8 - Using a Bluetooth Simulator singleUUID and not multiple UUIDs, as in searchServices(). Chapter 9 - Bluetooth Security CUhanpftoerrtu1n0at-eWly,irtehleesres EismnboedmdeedthSoydsatevmaislawbiltehinthteheMiJcSroRB-l8u2eTsapregceitfication that will allow you to discover every Cshearpvtiecre1o1ff-erEendtebryprriesemBoltueetdoeovtihceAsp.pBliycautisoinngs weiitthhetrheseEarircscshoSneBrlivpNiectes() or selectService(), you need to Ckhnaoptwerth1e2 U- UBIlDuetoofotthheasnedrvJiicnei that you're looking for before you attempt to perform a search. Appendix A - javax.bluetooth AppenNdioxteB Y-ojauvmaxa.oybbeex able to discover every service on a remote device if that device has all of its services Appendix C c-aJtaevgaoBrilzueedtowotithhDaeBverloopwmseenGtroonupthLeiPsatlmaOttSribPulatetfoinrmthe service record. If not, then you're out of luck. Appendix D S- eBelipthNeetB1lu.1etAoPoIth specification for more details on how to browse for services. Injadevxax.bluetooth.DiscoveryListener List of Figures LiOstuorfgToaobdleosl' buddy DiscoveryListener, which helped us to discover devices, comes back to help us discover Lisset rovficLeisstionngsremote Bluetooth devices. List of Sidebars public void servicesDiscovered(int transID, ServiceRecord[] servRecord) If you use the DiscoveryAgent.searchServices() method (which accepts a DiscoveryListener), then this method is called by the JVM when services are discovered on the remote device. The transaction ID and an array of ServiceRecord objects are provided to this method. With a ServiceRecord in hand, you can do plenty of things, but you would most likely want to connect to the RemoteDevice where this ServiceRecord originated: String connectionURL = servRecord[i].getConnectionURL(0, false); javax.bluetooth.ServiceRecord ServiceRecord objects are representations of individual entries in the SDDB. As you may remember, the SDDB is the central repository of service records for a Bluetooth device. javax.bluetooth.DataElement As we continue to break down the anatomy of service discovery, let's now examine the DataElement object. EachServiceRecord object in the SDDB is made up of attributes. All attributes are stored as DataElement objects. A DataElement object can be from any of the following: Integers Bluetooth for Java Booleans by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Strings Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java UUIDs applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Sequences omf othree.preceding values Be sure to take another look at Figures 4-1 through 4-4 if you're still in the dark about the relationship between TatbhleeSoDf DCoBn, tSeenrtvs iceRecord,DataElement, and UUID objects. Bluetooth for Java InStreodruvciticone Registration Chapter 1 - Introducing Bluetooth CBhaepfoterre2a B-luBelutoeotothotchli1e.n1t device can use service discovery on a Bluetooth server device, the server needs to Crheagpitsetrer3its-sBeervfoicreesYoinuteGrnetaSllyta. rTtehdat process is called service registration. This section discusses what's involved in Cshearpvtiecre4reg-isUtnradteiorsntafonrdiangBltuheetoJaovtha Bdleuveitcoeo,tahnAdPIwe'll also give you a rundown of the classes needed to Cahcacptoemr p5lish- Bthluise.tooth with J2ME MIDP ChaptNero6te I-nCarepaeteinrg-toa-pBelueertoaoptphliPcraintiot nS,elrivkeer awfiitlhe JtrPaSnAsPfeIr or chat application, be sure to remember that any Chapter 7 d-eJvaivcae acnadnOaBcEt Xas the client or the server, so you'll need to incorporate that functionality into your code Chapter 8 i-nUosridnegratoBhluaentodolethbSoitmh uslcaetonrarios of service discovery and service registration. Chapter 9 - Bluetooth Security CHhaeprtee'sr 1a0sc-eWniareriloesosf Ewmhbaet'dsdiendvoSlyvsetdeminsgweittthintgheyoMuircrsoerBvliuceeTraerggeisttered and stored in the SDDB: Chap1te. r C11al-lCEonntenrepcritseorB.luoeptoeonth()ApapnlidcactaiosntsthweitrhetshueltiEnrgicscsoonnneBcliptioNnetto a StreamConnectionNotifier object. Chapter C12on-nBelucettooort.hoapnednJ(in)i creates a new ServiceRecord and sets some attributes. Appendix A - javax.bluetooth Appe2n.dixUBse- tjhaevaLxo.ocbaelx Device object and the StreamConnectionNotifier to obtain the ServiceRecord AppendixthCat-wJaavsacBreluaetteodotbhyDtheevesloypsmteemn.t on the PalmOS Platform Appe3n.dixADdd- oBrlipmNoedt i1fy.1thAePaI ttributes in the ServiceRecord (optional). Index List o4f.FigUusreesthe StreamConnectionNotifier to call acceptAndOpen() and wait for Bluetooth clients to List of Tadbislecsover this service and connect. List of Listings List o5f.SiTdehbearssystem creates a service record in the SDDB. Wait until a client connects. When the server is ready to exit, call close() on the StreamConnectionNotifier. 6. The system removes the service record from the SDDB. StreamConnectionNotifier and Connector both come from the javax.microedition.io package of the J2ME platform. Listing 4-4 is a snippet of code that achieves the service registration process. Listing 4-4: The Service Registration Process ... // let's name our variables StreamConnectionNotifier notifier = null; StreamConnection sconn = null; LocalDevice localdevice = null; ServiceRecord servicerecord = null; // step #1 // the String url will already be defined with the correct url parameters notifier = (StreamConnectionNotifier)Connector.open(url); // step #2 // we will get the LocalDevice if not already done localdevice = LocalDevice.getLocalDevice(); servicerecordBlu=etlooocthalfodreJvaivcae.getRecord(notifier); // step #3 isbyoBprutcieoHnoaplkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) // step #4 The authors of this text describe how to develop wireless Java // this step awppilliclatiobnlsoucskingtBhleuetcouorthrefonrta vtahrireetyaodf pulanttfoirlmsa. Thcilsient responds notifier.acceiBnplcutleuAtdoneodsthOa-pnbeaAnsPe(Id)os;veerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and // the servicmeorer.ecord is now in the SDDB // step #5 Ta/b/le jouf sCtonwteanitts... B/lu/etoaosthsufomreJatvahe client has connected and you are ready to exit Introduction C/ha/pstterep1 #-6Introducing Bluetooth C/ha/ptterhi2s -cBaluuesteoostht1h.1e service record to be removed from the SDDB Cnhaopttierfi3er-.BcelfoorseeY(o)u;Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API And that's all that you need to do service registration in Bluetooth. The next step is communication. Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CChapotmer 9m-uBnluiectoaotthioSnecurity Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Okay, Bluetooth is a communication protocol, so how do you communicate with it? Well, the official Java Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Bluetooth API gives you three ways to send and receive data, but for right now we'll cover only two of them: CRhaFpCteOr M12M-aBnldueLt2oCotAhPa.nd Jini Appendix A - javax.bluetooth ARppFenCdOix MB -MjaCvaox.nonbeexctions Appendix C - Java Bluetooth Development on the PalmOS Platform AAppseynoduixmDa-yBrleipmNeemt 1b.e1rAfProIm Figure 2-9, the most common Bluetooth profiles use the Serial Port Profile as a Infoduexndational layer. List of Figures Note RFCOMM is the protocol layer that the Serial Port Profile uses in order to communicate, but these two List of Tables items are almost always used synonymously. List of Listings LiSsteosfsSioidnesbaarnsd Connections Before we continue, there's a little more terminology to introduce here: sessions and connections. You can only have a single session between two Bluetooth devices. This limitation isn't a big deal, per se, because the definition of a session is simply one or more connections shared between two devices. You can also relate a Bluetooth session in the same way that sessions are created and used on the Web. When a Web server is communicating to a Web client, there is only one session, although there are numerous connections. Now, a Bluetooth device can have multiple sessions only if each session is linked to a different device. This also applies on the Web; powerful application servers have the capability to create multiple sessions and keep them in memory, but each session is linked to a different client. Server Connections with the Serial Port Profile Listing 4-5 demonstrates what is needed to open connections on a Bluetooth device that will act as a server. Listing 4-5: Opening Connections on a Bluetooth Server ... // let's name our variables StreamConnectionNotifier notifier = null; StreamConnection con = null; LocalDevice localdevice = null; ServiceRecordBluseetrovoithceforreJcaovrad = null; InputStream ibnypBurutc;e Hopkins and Ranjith Antony OutputStream Aopuretsps u©t2;003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java // let's creaatppelicaatioUnRsLustinhgaBtlucetoonotthafionr sa vaariUeUtyIoDf ptlahtafotrms. This // has a veryiBnlculleuotdoweosthca-hnbaaAnsPecIdeosveeorrfvviiceecwso,onhffigtlhhielicgJhtavtisanolgifbsrwaerciyut,rhidtyevaceonlonypctemhreninsn,tgaonf d String url = m"obrte.spp://localhost:00112233445566778899AABBCCDDEEFF;name=serialconn"; // let's open the connection with the URL and cast it into a StreamConnectionNotifier Tanboletioff iCeornte=nt(sStreamConnectionNotifier)Connector.open(url); Bluetooth for Java In/t/rodbulcotiocnk the current thread until a client responds Cchaopnter=1 no-tIintfriodeurc.inagcBcleupettoAonthdOpen(); C/ha/ptterhe2 c-lBilueenttoothha1s.1 responded, so open some streams Cihanpptuert3= -cBoenfo.roepYeonuIGnept uSttaSrtterdeam(); Cohaupttperut4 =- Ucnodne.rsotapnedninOgutthpeuJtaSvatrBeluaemto(o)th; API Chapter 5 - Bluetooth with J2ME MIDP C/ha/ptnerow6 t-hCarteattinhgea sBtlureetoaomthsPrainrteSeorpveernw,ithseJPnSdAPaInd receive some data Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CFhaopr ttehre9mo-sBt lpuaetrot,otthhisSiescjuursittyabout the same code used in service registration, and in fact, it is; service Crheagpitsetrra1ti0on- aWnirdelseesrsvEemr cboemddmedunSiycsatteiomnsawriethboththe MaciccroomBpluleisThaerdgeutsing the same lines of code. Here are a few Cihteamptserth1a1t -neEnetdertoprbisee pBoluinetteodotohuAt.pTplhiceatSiotnrsiwnigth uthrelEbriecgssinosn wBiltiphNbett spp://localhost:, which is required if Cyhoaupt'reer g1o2in-gBtloueutsoeotthheanBdluJientiooth Serial Port Profile. Next comes the UUID part of the URL, which is A0pp0e1n1d2ix2A33-4ja4v5a5x6.b6lu7e7t8oo8t9h9AABBCCDDEEFF. This is simply a custom UUID that was made up for this service; any AsptpreinngditxhaBt'-s j1a2v8axb.oitsbelxong could have been used. Finally, we have name=serialconn in the URL String. We AcpopuenlddihxaCve- lJeafvtathBislupeatorot tohffD, bevuet lwopemweannt toonutrhceuPsatolmmOsSePrlvaictfeortmo have a name, so the actual service record in the ASppDeDndBixhDa s- tBhleipfNoellto1w.i1n gAPeIntry: Index LiSsteorfvFiigcuerNeas me = serialconn List of Tables List of Listings LiTsthoefimSidpelebmaresntation has also assigned a channel identifier to this service. The client must provide the channel number along with other parameters in order to connect to a server. Client Connections with the Serial Port Profile Establishing a connection with the Serial Port Profile for a J2ME client is simple because the paradigm hasn't changed. You simply call Connector.open(). StreamConnection con = (StreamConnection)Connector.open(url); You obtain the url String that is needed to connect to the device from the ServiceRecord object that you get from service discovery. Here's a bit more code that will show you how a Serial Port Profile client makes a connection to a Serial Port Profile server: String connectionURL = serviceRecord.getConnectionURL(0, false); StreamConnection con = (StreamConnection)Connector.open(connectionURL); What does a Serial Port Profile client connection URL look like? If the address of the server is 0001234567AB, then the String that the SPP client would use would look something like this: btspp://0001234567AB:3 Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) The 3 at the end Tohf ethaeutUhRorLs Softtrhiisntgexist tdheesccrhibaenhnoewl ntuomdebveerlothpawt tirheelessesrJvaevraassigned to this service when this service was addeadptpolicthateioSnDs DusBin. g Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of L2CAP ConneBlcuteitooonths-based services, highlights of security concerns, and more. Unlike RFCOMM connections, which are stream oriented, L2CAP connections are packet oriented. Before we TacbolveeorfhCoownttoenctresate L2CAP connections, we'll briefly cover a new concept called Maximum Transmission Unit B(luMeTtoUo)t.hWfoer'lJlaavlaso cover the classes needed in order to create L2CAP connections: L2CAPConnection and L2CAPConnectionNotifier. Introduction CMhaapxtiemr u1m-TIrnatrnosdmuciisnsgioBnluUetnoiotth Chapter 2 - Bluetooth 1.1 CBhaepctaeurs3e o-f BtheefofraecYt othuaGt etht eStLa2rtCedAP layer sends data in packets, the official Java Bluetooth API gives you the Cfhleaxpitbeirlit4y to- cUonndterorslthaonwdinlagrtgheetJhaevapaBclukeettosocthanAPbIe. The default MTU is 672 bytes, but you can attempt to negotiate Cahalaptregre5r MT- UBluinetyooouthr cwoitnhnJe2cMtioEnMUIDRPL strings. Here's why we say "attempt": If the client indicates that it can Crheacpeteivre6da-taCirneaptaincgkeatBsliuzeetsoootfh1P0rMinBt ,SaenrvdetrhweitsherJvPeSr AisPIonly capable of sending data at 1kB, then there's no real Cphraopbtelerm7 ; th- eJacvlaieannt'dll OgeBtEiXts data in 1kB packets. Now on the other hand, if the server indicates that it's sending data in 10MB-size packets, and the client is only capable of handling 1kB packets, then the transmission will fail Chapter 8 - Using a Bluetooth Simulator horribly. Chapter 9 - Bluetooth Security CIhnaoptredre1r 0to-fiWndireoluetssthEemlabergdedsetdpSaycskteemt ssizweitthhatht eyoMuiccroanBlrueecTeairvgeeftrom a L2CAP connection, just run the following Cphiaepcteero1f 1co-dEen:terprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ALppoecnadlixDAev-ijacveaxl.boluceatloot=h LocalDevice.getLocalDevice(); ASppternidnixgB r-ejcaveaixv.oebMeTxUmax = local.getProperty("bluetooth.l2cap.receiveMTU.max"); Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InLd2eCxAP Server Connections List of Figures Following is the code that a L2CAP server uses to open a connection to a client: List of Tables List of Listings LiLst2oCfASPiCdeobnanrsectionNotifier notifier = (L2CAPConnectionNotifier).Connector.open(url); L2CAPConnection con = (L2CAPConnection)notifier.acceptAndOpen(); As you can see, it is not much different from the standard StreamConnectionNotifier and Connection used for RFCOMM server connections. L2CAP Client Connections Now here's the code that a client would use in order to establish an L2CAP connection with a server: L2CAPConnection = (L2CAPConnection)Connector.open(url); Once again, it's pretty straightforward. More on MTUs Now, let's look at MTUs one more time, in conjunction with opening connections. For instance, if the server code looked like this: String url = "btl2cap://localhost:00112233445566778899AABBCCDDEEFF;ReceiveMTU=1024;TransmitMTU =1024"; Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The connection SAtprreisnsg©f2o0r03th(3e5c2lpieagnets,)on the other hand, would look something like this: The authors of this text describe how to develop wireless Java String url = a"ppblticla2tiocnaspu:s/in/g2BEl3u4et5oBoBth78fo9r0a2v:a1ri0e5ty5o;fRpelactefoirvmesM. TThUi=s4096;TransmitMTU=512"; includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. As you can see, the server is proposing to send data in packet sizes of 1024 bytes. Since the client is able to receive data packets four times that size, the negotiated connection will have a packet data size of the lowest Tacbolme omfoCnodnetennotmsinator: 1024. On the other hand, the client wants to send its data in packets of 512 bytes. The BslueertvoeorthisfaorblJeavtoa handle that packet size with no problem at all, and the negotiated connection will be 512 byte Inptarocdkuectsti.on Chapter 1 - Introducing Bluetooth Now, let's take a brief look at the two classes used in order to create L2CAP connections and some of their Chapter 2 - Bluetooth 1.1 m eth ods. Chapter 3 - Before You Get Started Cjhaavpatexr.b4lue-toUondthe.rLst2aCndAiPngCtohnenJeacvtaioBnluetooth API Chapter 5 - Bluetooth with J2ME MIDP CThahpisteinr t6erfa-cCereisatjiunsgt aa Bsluubectolaostsh oPrfitnhteSCerovnenr ewcitthiJoPSn AinPtIerface, and you use it in the same manner. The following Cmhaepttheord7s a-reJafvoaunanddinOLB2EXCAPConnection that are not found in Connection: Chaptperu8bli-cUsiinngta BgleutetRoeoctheiSivmeuMlaTtUo(r ): This method gets the negotiated ReceiveMTU value from the Chaptceron9ne-ctBiolune.tooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chaptperu1b1li-cEnitenrtprisgeeBtlTuretaonosthmAiptpMliTcaUt(io)n:sTwhiitshmtheethEordicsgseotns BthliepNneetgotiated TransmitMTU value from the Chaptceron1n2e-ctBiolune.tooth and Jini Appendix A - javax.bluetooth public boolean ready(): This method will return true if there is any data ready to be read. If this AppenmdixetBho-djarevatuxr.nosbetrxue, then a call to receive() will not block the main thread. Appendix C - Java Bluetooth Development on the PalmOS Platform AppenpduixbDli-cBliipNnett 1r.e1cAePiI ve(byte[] inBuf): Regardless of the ReceiveMTU between your device and the Indexremote device, you can set the size of inBuf to be whatever you want it to be. If the size of inBuf is greater List ofthFaignuroersequal to the ReceiveMTU, then you won't lose any data during a transmission. If the size of inBuf[] List ofisTasbmleasller than the size of ReceiveMTU, then inBuf[] will be filled with data for the incoming packet, but List ofthLeistriengmsainder of the data will be lost. List of Sidebars public void send(byte[] data): Use this method to send data to a remote Bluetooth device via the L2CAP protocol. You're free to send any size packet that you want, but if you exceed the TransmitMTU size, then the excess data will be discarded. L2CAP vs. RFCOMM So now that you know how to send data between Bluetooth clients and servers using both L2CAP and RFCOMM, we bet you're wondering about typical usage scenarios for these connections. In other words, why would anyone use RFCOMM instead of L2CAP to send data or vice versa? Well, RFCOMM is also known as the virtual serial port communication protocol. An ideal way to use RFCOMM is in situations when you would replace a serial cable. For instance, if you were a developer for a GPS manufacturer, and your duty was to make one of their units Bluetooth enabled, then RFCOMM would be a likely choice in this scenario. Why? The GPS unit will always have a constant stream of information that needs to be processed, rendered, calculated, etc. So, collect the data from your stream and plot those coordinates on the screen. On the other hand, L2CAP is great for handling packet data. L2CAP can easily be used (and actually is) as a data multiplexer. You can read data from the connection, and based upon a header in the packet, you can route that data to different methods, threads, and classes in your application. Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This chapter gaveApyroeussa©fo20rm03a(3l 5i2ntpraogdesu)ction to the official Java Bluetooth APIs. You should be aware of all the basic componTehnetsauotfhaorBs loufetthoiosthteaxtpdpelicscartiiboen,haoswwtoeldl eavsehloopwwtioreilmespsleJamveant them using the classes and interfaces of the oafpfpicliiacal tJioanvsauBsliunegtoBoluthetoAoPtIh. Tfohrisa cvhaaripettey roaf lpsolatdfoisrcmuss.sTehdisthe importance and the roles that the Bluetooth ConintcroluldCesenatnerA(PBI CovCe)rvpileawysoifnthyoeuJravwairleiblerasrsy,apdpevlicelaotpiomnesn. t of Bluetooth-based services, highlights of security concerns, and Essentially, this cmhaoprete. r showed you how a Bluetooth application works by its components. In the next chapter, we'll look at a full working example of a Java Bluetooth application using the Atinav Java Bluetooth SDK. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter 5: Bluetoo Bluetooth for Java th with J2ME MIDP by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Now that we've coAvpereressd©a2l0o0t3o(3f5t2hpeagfoesu)ndational material, let's start creating some Java Bluetooth applications. ThisTchheaaputtehrowrsillogf itvheisytoeuxtydoeusrcfriirbset fhuollwetxoamdepvleeloopf awiJrealveassBJlauveatooth application, but before we dive right in, waep'prelicgaotiionngstousginivgeBalubertioeoftphrifmorear ovanriJe2tyMoEf apnladtfothrme sM.oTbhiilse Information Device Profile (MIDP). AfterwardiBnslcu,leuwtdoeeo'srteha-gnboaAisnPegIdotosveeerrvxviaicemewsi,nohefigtthwheloigJshaavtsmaolpifblseraearcyup,rpidtliyecvacetoiloonnpcesmr:enSnst,teaoanfltdh Mode and the Piconet Browser. more. Note If you've already developed a MIDlet, or if you have a working knowledge of J2ME, then feel free Table of Contotesnktips down to the example code in the sections "Stealth Mode Example" and "Piconet Browser Bluetooth foEr xJaamvaple." Introduction CJha2ptMer E1 O- Ivnetrordvuiceinwg Bluetooth Chapter 2 - Bluetooth 1.1 CUhanpdteerr t3he-gBeenfeorraelYteorumGeotf SJ2taMrtEed, there are two configurations that correspond to two classes of devices. CThahpetecro4nne-cUtenddedresvtaicnedicnogntfhigeuJraavtiaonBl(uCetDoCot)hisAPaIclassification for devices that have a network connection, Cbhuapt thearv5e le-sBslupertoocoethsswinigthpJo2wMeErMthIaDnP a typical desktop computer. Set-top boxes, appliances, smart Cphhapotneers6, an-dCrheigahti-negnadBPluDeAtosoftithinPtrointthSisercvaetregwoitrhy.JTPSheAPcIonnected limited device configuration (CLDC) classifies many mobile devices; they are capable of making a network connection, but it isn't robust or Chapter 7 - Java and OBEX dedicated. CLDC devices typically don't have a lot of processing power, and many mobile phones, two- Chapter 8 - Using a Bluetooth Simulator way pagers, and some PDAs fit into this category. Chapter 9 - Bluetooth Security CAhaJp2teMrE10Pr-oWfileireisleasssEomftwbeadrdeeldaySeyrstthematsiswbituhiltthoenMtoicprooBf lauecToanrfgigeut ration (not to be confused with a Bluetooth Cphraopftieler)1. 1Co-nEfnigtuerrpartiiosensBltuypeticoaoltlhy AepnpcloicmatpioanssswaitbhrothaedEcrliacssssoifnicaBtliiopNneotf devices, and profiles help to narrow Cthhaeptsecro1p2e,-wBhluileetoporothviadnindgJminiore functionality to the configuration. Figure 5-1 shows the J2ME world, and AtphpeenredilxatAion-sjhavipaxb.ebtlwueeteonotchonfigurations and profiles. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 5-1: J2ME Profiles and configurations The MobileBIlnueftooortmh faotriJoanva Device Profile by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Now, let's take a Aloporkesast©w2h0a03t (is35(2bpyagfeasr)) the most widely used J2ME Profile: Mobile Information Device Profile (MIDP). If Tyhoeu ahuatvheoras Joaf vthai-setneaxbtldeedsmcriobbeilheopwhtoondee, vtheelonp iwt'siremleossst Jliakvealy a MIDP device. As stated earlier, the J2MEaPprpolifcilaetsioenxsteusnidngthBelufeutnocottiohnfaorlitay voaf raiectyonoffigpulartafotiormn.s.TThheisCLDC provides the following packages for theidncelvuedleospaenr iAnPoIrodveerrvtoiecwreoaf tteheJaJvaavaalpibprlaicray,tiodnevseflorpsmmenatllodfevices: Bluetooth-based services, highlights of security concerns, and java.langm(boaresi.c core language classes) java.io (networking classes) Table of Contents Bluetojoathvafo.ruJtavial (utility classes) Introduction javax.microedition.io (more networking classes) Chapter 1 - Introducing Bluetooth ChaptNero2te T-hBeluseetoaorethn1o.t1the full J2SE versions of java.lang,java.io, and java.util APIs. The Chapter 3 C- LBDefCorecoYnotuaiGnsetaSstaurbtseedt of these packages that's optimized for micro devices. Chapter 4 - Understanding the Java Bluetooth API CThahpeteMr ID5 P-aBdldusettohoetshewaitdhdJit2ioMnEalMpIaDcPkages for mobile devices: Chapter 6 - Creating a Bluetooth Print Server with JPS API javax.microedition.lcdui (user interface classes) Chapter 7 - Java and OBEX Chaptjera8vax-.UmsiincgraoBelduiettoioothn.Simmiudlalteotr (core MIDlet classes) Chapter 9 - Bluetooth Security Chaptjera1v0ax-.WmiireclersoseEdmibteidodned.rSmysste(mdastawipthertshiseteMniccreo cBllausesTeasrg) et Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet According to the MIDP specification, these are the qualifications for a MIDP 1.0 device: Chapter 12 - Bluetooth and Jini AppenAdixmAini-mjauvmaxs.cbrlueeetnoortehsolution of 96 54 pixels. Appendix B - javax.obex AppenAdimx Cini-mJuavma oBflu1e2to8oktBh nDoenvveololapmtileenmt oenmtohrey PfoarlmthOeSMPIlaDtPforimmplementation. AppenAdixmDini-mBulimpNoeft 312.1kBAPvIolatile memory for JVM heap space. Index List ofAFimguinreims um of 8kB nonvolatile memory for applications to store persistent data. List of Tables List ofSLoismtinegtsype of input mechanism. List ofSSuidpepboarrtsfor network connectivity. The OS must provide minimal scheduling, exception handling, and interrupt processing. The OS must support writing of bitmapped graphics to display. The OS must be able to accept the input and pass it on to the JVM. The MIDP 2.0 specification raises the bar by requiring at least 256kB of non-volatile memory, and 128kB of memory for the Java heap space. However, the MIDP 2.0 specification also brings along more functionality for wireless applications, including the following: Secure networking with HTTPS Push applications with the javax.microedition.io.PushRegistry class Standardized serial port communications Wireless application deployment with Over-the-Air provisioning (OTA) Better gaming applications with the javax.microedition.lcdui.game package Developing MIDlets What is a MIDlet? A MIDlet is a Java application that runs on a mobile device and uses the Mobile Information DevicBeluPertoofiolet.hMfoIDr lJeatsvacan be created by extending the javax.microedbiytBiruocne.Hmoipdklinesta.nMdIRDalnejitthcAlanstson. yA MIDlet haISsBtNh:1re59e05s9ta07te83s in its life cycle: active, paused, and destAropyreesds. ©T2h0o0s3e(3t5h2rpeaegesst)ates correspond to three methods:startApp(),pauseApp(), anddestroyAppT(h)e.aOuntheorosr omf othreis MteIxDtledtesscpraibcekahgoewdtotodgeevtehleorpinwiareJleAsRs Jfailevaconstitute a MIDlet suite. Software on the mapopbliilceatdioenvsicues(incgalBleludetthoeotahpfpolricaavtioarniemtyaonfapglaetrf)oirsmres.sTphoinssible for loading, running, and includes an API overview of the Java library, development of destroying the MIBDllueett.ooth-based services, highlights of security concerns, and more. The skeletal structure of a typical MIDlet looks like this: Taibmlepoorf tCojntaevnatxs.microedition.midlet.MIDlet; BpluuebtoloithcfocrlJaasvas MyApplcation extends MIDlet In{troduction Chapter 1 - IntrpoduubclinigcBlMuyetAopopthlication() Chapter 2 - Blue{tooth 1.1 Chapter 3 - Befo}re You Get Started Chapter 4 - UndpeursbtalnidcingvtohiedJasvataBrluteAtopopth()API Chapter 5 - Blue{tooth with J2ME MIDP Chapter 6 - Crea}ting a Bluetooth Print Server with JPS API Chapter 7 - JavapuanbdlOicBEXvoid pauseApp() Chapter 8 - Usin{g a Bluetooth Simulator Chapter 9 - Blue}tooth Security public void destroyApp(boolean unconditional) Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget { Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet } C}hapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API IndexNote Sun has created a very handy tool for MIDlet development called the J2ME Wireless Toolkit. List of FigurTeshe tool comes bundled with an emulator and can package, compile, preverify, and run CLDC List of Tableasnd MIDP applications. The examples in this chapter use this tool, and it is available free from List of Listintghse Wireless Java Web site (http://wireless.java.sun.com/). LiUstsoifnSgidetbhaersMIDP User Interface Components The MIDP UI is logically composed of two APIs: high-level and low-level. The high-level API is primarily designed for business applications, and it gives you objects like List,TextBox,ChoiceGroup, and DateField. This API includes a high level of abstraction because you can't define the visual appearance (i.e., shape, color, font, etc.) of those components. When using the high-level UI components, you won't have direct control of the navigation or scrolling, or have direct access to the input device (you can process input, but you won't have direct access to it). All of these items are handled by the MIDP implementation and are device dependent. This abstraction allows the same MIDlet to run on a Blackberry pager as well as on a Palm PDA. Thelow-level API, on the other hand, is designed for applications that need precise placement and control of graphic elements, as well as access to low-level input events. The low-level API is well suited for gaming or entertainment-based applications. Using the RMS for Persistent Storage So, how do you store persistent data on a micro device? If you think about it, a mobile phone probably wouldn't have a file system in order to store its data. It's really overkill for such a small device that keeps names and phones numbers to have a file system just for data storage. Being aware of this, the J2ME architects have developed a viable alternative to storing data persistently called the RecordManagement System (RMS). The javax.microedition.rms package contains all the functionality that will enable your classes to read, write, and sort data in the RMS. Bluetooth for Java The RMS is a recboyrdB-rourcieenHteodpkdinastaabnadsReasntojitrhedAnintothnye nonvolatiIlSeBmN:1e5m90o5r9y07o8f3 the mobile device. Since it is record oriented, tAhperResMs ©S 2is00a3l(s3o52rpeafgeersr)ed to as a flatfile system, where the data is stored in a series of rows in a table, mTuhcehaluiktheotrhseodf athtaisstteoxrteddeisncaribceonhovwenttoiodneavledloaptawbairesele.sEs aJacvharow will have a unique identifier. A logicaalprpelpicraetsioennstautsioinngoBfluaerteocoothrdfosrtoarevairsieiltlyusotfraptleatdfoinrmFsig. uTrheis5-2. includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started ChaptFerig4ure- 5U-n2d:eArstloangdicinagl rtehpereJasveantBaltuioetnoootfhaAnPRI MS record store Chapter 5 - Bluetooth with J2ME MIDP CThahpetemr a6in c- lCarsesaitnintghea RBlMueStoisotjhaPvrainxt .Smeirvcerr oweitdhiJtPiSoAnP.I rms.RecordStore. This class contains the Cmhaepttheord7s fo- rJacvreaaatnindg,OuBpEdXating, deleting, and querying a record store. A few interfaces are also provided is Cthhaisptpear c8kag- eU,sainngdathBeluyehtoeolpthyoSuimwuhlaetonrever you need to enumerate, compare, and filter the data stored Cihnaspidteer t9he -reBclouredtosottohreS.eTcuhreityRMS also includes a listener interface called Cjhaapvtaerx.10mi-cWrioreeledsistEimobne.drdmeds.SRyestceomrsdwLiithsttheenMeircr.oWBhlueenTayroguetassociate this listener with a record store, Cthhaeptinerte1rf1ac-eEnreteproprrtisseevBelunettsotohtahtAcpoprlriecastpioonnsdwtoithintsheertEs,riucspsdoanteBsli,paNnedt deletes of data that are in the record Cshtaoprtee.r 12 - Bluetooth and Jini Appendix A - javax.bluetooth APppeenrdfixoBrm- jianvagx.oIb/eOx with the GCF Appendix C - Java Bluetooth Development on the PalmOS Platform AIpnpeonrddeixr Dfo-r JB2lipMNEeta1p.p1licAaPItions to perform any networking or I/O, they must use the java.io and Injdaevxax.microedition.io packages. These packages together form the Generic Connection LiFstraomf Feiwguorreks(GFC). LiTsthoefgTeanbelersal philosophy behind the GCF is to create a framework to abstract the communication process LitshtroofugLihstaingssingle class called Connector. You can then use Connector to create any connection like file LiIs/Ot osftSreidaembasr,sTCP/IP socket connections, HTTP connections, etc. In order to open a connection, just use theopen method: Connector.open("protocol:address:parameters"); If a user wants to open an HTTP connection, the connection URL will look like this: Connector.open("http://mydomain.com"); Working with the Example Code Before you try out any of the examples in this book, it is recommended that you first get your JSR-82 implementation on your development environment installed and configured. If you don't have your development environment set up, then here's a checklist of the things that you need to do: Select a JSR-82 implementation that supports your OS. You can find an updated listing of JSR-82 implementations at the companion Web site for this book: http://www.javabluetooth.com. Select the Bluetooth hardware that is supported by your JSR-82 implementation. Bluetooth for Java Install anbdycBornufcieguHroepykoinusr adnedveRlaonpjmithenAtnetonnvyironment. ISBN:1590590783 Apress © 2003 (352 pages) Try out the demo programs that are included with your JSR-82 implementation. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Determinineclwuhdaest satnacAkPIinoitviaelrivziaetwionofctohdeeJa(vif aalnibyr)airsyu, sdeedveilnopthmeedntemofo programs. Bluetooth-based services, highlights of security concerns, and The documenmtoarteio.n for your JSR-82 implementation really should point out what you need to do in order to initialize your stack. But just in case they don't, a dead ringer would be a class that you need to import that's not part of the javax.bluetooth or javax.obex packages (see Appendices A and Table BoffoCroannteenxthsaustive list). In some cases, your stack initialization code will also be setting the baud rate BluetofootrhyofourrJBavluaetooth device. Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Stealth ModBleueEtoxotahmfopr Jlaeva by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The Stealth ModeAperxeasms ©pl2e00is3 (a35s2impapgeles) program that illustrates the concepts of stack initialization, device management, anTdhdeeavuictheodrsisocfotvheirsyt.eWxthdeenscthriebephroogwratomdsetvaerltosp, iwt lioreolkesssfoJarvraemote Bluetooth devices as shown in Figure 5a-p3p.lications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 5-3: The application starts, and is now looking for remote Bluetooth devices. Once it finds another device, it goes into nondiscoverable mode, as shown in Figure 5-4. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List ofFFigiguurrees5-4: After a remote device is found, we now go into stealth mode (i.e., nondiscoverable). List of Tables List of Listings In this example, we're using the J2ME Wireless Toolkit configured with the Atinav Bluetooth SDK. The List of Sidebars Bluetooth device that we're using is a TDK USB module, as shown in Figure 5-5. Figure 5-5: The TDK USB Bluetooth device using a CSR Bluetooth radio The code for this example is shown in Listings 5-1 and 5-2. Listing 5-1: Stealth.java import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.bluetooth.*; import java.io.*; import java.util.*; import javax.BmluiectroooethdifotriJoanv.aio.*; import com.atbiynBaruvc.ebHcocp.k*in;s and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 /* The Timer Tahne dautthhoers oBfetahmisTtsekxt dcelsacrsibse ihoswutoseddevetloop wcrirelaetsseJatvhae beam of * 3 concentriacpplciciartiocnlseussinbglBilnuketionogth.foIrta vhaarisetynoof pplautrfopromsse. Theixscept visual enhancement. */ includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and public class mSotree.alth extends MIDlet { private Display display; private GUI canvas; Table opf rCiovntaetnetsTimer tm; BluetoopthrifovraJtaeva BeamTsk tsk; Introdupcrtioinvate String dev; Chapterpr1iv-aItnterodRuecminogtBelDuetvoiocthe device[]; Chapter 2 - Bluetooth 1.1 Chapterpu3bl-iBcefoSrteeYaolutGhe(t )Started Chapter{4 - Understanding the Java Bluetooth API Chapter 5 -dBiluseptlooatyh=wDiithsJp2lMaEyM.gIDePtDisplay(this); Chapter 6 -cCarneavtainsg=aneBwlueGtoUoIth(tPrhinitsS)e;rver with JPS API tm=new Timer(); Chapter 7 - Java and OBEX tsk=new BeamTsk(canvas); Chapter 8 - Using a Bluetooth Simulator tm.schedule(tsk,1000,1000); Chapter 9 - Bluetooth Security } Chapterpr10ot-eWcitreeldessvEomibdedsdteadrStyAstpepm(s)with the Micro BlueTarget Chapter{11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapterdi12sp-lBaluye.tosoetthCaunrdrJeinni t(canvas); Append}ix A - javax.bluetooth Appendix B - javax.obex AppendpixrCot-eJcavtaedBluveotoiodth pDaevuesloepAmpepn(t)on the PalmOS Platform Append{ix D - BlipNet 1.1 API Index } List of Figures List of Tpaubblelsic void destroyApp(boolean unconditional) { List of L}istings List of Spiudebblairsc void exitStealth() { destroyApp(true); notifyDestroyed(); } public void exitTimer(){ tm.cancel(); tsk.cancel() ; } } class GUI extends Canvas implements CommandListener{ private Command exitCommand; private Image img=null; private Image imgArc=null; private Stealth midlet; public int i=0; // used for creating the beam public int count=0; // used to create the blinking public boolean cancel=false; int x=30; int y=30; int wd=5; int ht=10; public GUI(Stealth midlet){ this.Bmluiedtloeotth=mfoirdJlaevta; exitCboymBmruacnedH=onpekwinsCaonmdmRaanndji(th"EAxntiotn"y,CommanIdS.BNE:X15I9T05,9107)8;3 addCoAmpmreasns d©(2e00x3i(t35C2opmagmeas)nd); setCoTmhemaanutdhLoirssotfetnheisrt(extthdiess)cr;ibe how to develop wireless Java applications using Bluetooth for a variety of platforms. This try {iBnlculeutdoeostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and moirem.g=Image.createImage("/phone.png"); } catch (java.io.IOException e){ Table of ContentsSystem.err.println("Unnable to locate or read image (.png) file"); Bluetooth for}Java Introduction try{ Chapter 1 - IntrodBuCcCin.gsBeltuPetoorotthName("COM1"); Chapter 2 - BluetBooCtCh.1s.1etBaudRate(57600); Chapter 3 - BeforBeCYCo.usGeett CSotanrnteedctable(false); Chapter 4 - UndeLrsotacnadlinDgevthiecJeavaloBcluaeltoDoethviAcPIe = LocalDevice.getLocalDevice(); Chapter 5 - BluetdooitshcwoivtheJr2yMAEgMenIDtP = localDevice.getDiscoveryAgent(); Chapter 6 - CreatdinegvaicBelue=toonthewPrinRteSmeortveerDweivthicJPeS[1AP0I]; discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this); Chapter 7 - Java and OBEX }catch(BluetoothStateException btstateex) Chapter 8 - Using a Bluetooth Simulator { Chapter 9 - Bluetooth Security btstateex.printStackTrace(); Chapter 10} - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter}12 - Bluetooth and Jini AppendixpAub-ljaivcaxv.boluiedtoodtehviceDiscovered(RemoteDevice btDevice, DeviceClass cod) Appendix B - ja{vax.obex Appendix C - Java/*BluTehtoeothmeDtevheolodpmiesntfoinrtehde PeavlmeOrSy Ptlaitfmoerma device is discovered. Appendix D - BlipNet 1.*1 ATPhIe inquiry is cancelled after the first device is discovered. Index */ List of Figures BCC.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE); List of Tables cancelInquiry(discoveryAgent); List of Listings} List of Sipdeubbalrsic void inquiryCompleted(int discType) { cancel=true; this.notify(); } /** * paint */ public void paint(Graphics g) { if (i==0){ // Used to clear the portion of the screen g.setColor(255,255,255); g.fillRect(25,10,50,70); } else { // draw the image of phone at given // coordinates at the top left of the screen g.drawImage(img,10,30,Graphics.LEFT|Graphics.TOP); // draw a string at the bottom left g.drawString("Me",10,45+img.getHeight(),Graphics.LEFT| Graphics.BOTTOM); if (!cancBelule)t{ooth for Java // drbaywBruacne HaorpckinastangdiRvaennjithcoAnotrodniynates ISBN:1590590783 g.draAwpArerscs (©x2,00y3,(3w5d2,phagtes,)270,180); } The authors of this text describe how to develop wireless Java else{ applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and g.dramwoIrme.age(img,90,30,Graphics.RIGHT|Graphics.TOP); g.drawString("I am in Stealth Mode",2,100,Graphics.LEFT| Graphics.BOTTOM); Table of Contternyts{ Bluetooth foriJmagva=Image.createImage("/phonegray.png"); Introduction }catch (Exception e){e.printStackTrace();} Chapter 1 -gI.ntdrrodauwcIinmgaBgleu(etiomogth,10,30,Graphics.LEFT|Graphics.TOP); Chapter 2 - Bluetooth 1.1 Chapter 3 -mBiedfolreetY.oeuxGiett TSitamreterd() ; Chapter}4 - Understanding the Java Bluetooth API Chap}ter 5 - Bluetooth with J2ME MIDP C}hapter 6 - Creating a Bluetooth Print Server with JPS API public void commandAction(Command c, Displayable s) { Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator if (c == exitCommand) Chapter 9 - Bluetooth Security midlet.exitStealth(); Cha}pter 10 - Wireless Embedded Systems with the Micro BlueTarget C}hapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex ALppisetnindigx 5C-2- :JaBveaaBmluTestoko.jtahvDaevelopment on the PalmOS Platform Appendix D - BlipNet 1.1 API Inidmepxort java.util.*; LipstuobflFiigcurcels ass BeamTsk extends TimerTask { List of Tables List of Lpisrtiinvgaste GUI canvas; List of S/i*de*baCrsreates a new instance of BeamTsk */ public BeamTsk(GUI canvas) { this.canvas=canvas; } public void run() { //if (canvas.count>5) // canvas.cancel=true; if (canvas.i<3) canvas.i=canvas.i+1; else canvas.i=0; switch (canvas.i){ case 1:{ canvas.x=30; canvas.y=30; canvas.ht=10; break; } case 2 :{ canvas.x=canvas.x+5; canvas.y=canvas.y-3; canvas.ht=canvas.ht+6; Bblureetaoko;th for Java } by Bruce Hopkins and Ranjith Antony case A3p:re{ss © 2003 (352 pages) ISBN:1590590783 Tcheanavutahso.rsxo=fctahnisvtaexst.dxe+s5cr;ibe how to develop wireless Java acppalnicvaatiosn.syu=scinagnBvlauset.oyo-th3;for a variety of platforms. This iBnclcualeuntdoveoasthsa-.nbhaAtsPe=Idcosaveenrrvvviaiceesws.,ohhftigt+hh6eli;gJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and mcoaren.vas.count=canvas.count+1; break; } Table }of Contents BluetocoathnvfoarsJ.arvaepaint(); Introd}uction C}hapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Piconet BroBlwuestoeorthEfxoraJamvaple by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The Piconet BrowAsperresiss ©a 2h0a0n3 d(3y52uptialigtyest)hat demonstrates all the concepts presented in the last example and also includes theTfhuencatuiothnoarlistyoof fthsiesrtveicxet ddeissccroibveerhyo. wIt'storedaelvlyelsoopmweirtehliensgs tJhaavtayou would want to keep with you at all times, saoppalfitceartiyoonus guesitntghiBslueextaomotphlefowr oarvkianrgie,tybeofsuplraetftoormlosa.dTihtiosn your mobile phone or PDA. Using the PiconeitnBclruodwessearn, yAoPuI coavenrsveieewwohf atht eBlJuaevtaoloibthradrye,vdiceevselaorpeminentht eofvicinity. After the list is displayed, you can select a pBlauretitcouoltahr-bBaluseedtosoetrhvidceevs,icheigtohlisgehetswohfastescuerrivtiycecsonitcoerffnesr,sa. nd more. The algorithm for this example is pretty simple. First, the MIDlet creates a form and displays it with buttons labeled Search and Exit (see Figure 5-6). Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 5-6: The initial screen for the Piconet Browser application After pressing the Search button, the application performs a device discovery, and displays the search results (see Figure 5-7). Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List ofFFigiguurrees5-7: The Piconet Browser displays a list of Bluetooth devices in the area. List of Tables List of Listings LiAstftoefr Syoiduebsaerlsect a Bluetooth device, the application will display the services that it offers (see Figure 5-8). Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List ofFFigiguurrees5-8: The Piconet Browser now displays the services offered by the remote device. List of Tables List of Listings LiLsitsotinf Sgid5e-3basrhsows the code for the Piconet Browser. Listing 5-3: PiconetMIDlet.java. import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.bluetooth.*; import java.io.*; import javax.microedition.io.*; import com.atinav.bcc.*; public class PiconetMIDlet extends javax.microedition.midlet.MIDlet implements CommandListener,DiscoveryListener{ private LocalDevice localDevice=null; private RemoteDevice device=null; private DiscoveryAgent discoveryAgent = null; private Command exitCommand; // The exit command private Command srchCommand; //The search command private Command backCommand; private Display display; private Form frm; // The display for this MIDlet private List deviceLst; private LBilusettoSoethrvfoircJeaLvsat; by Bruce Hopkins and Ranjith Antony ISBN:1590590783 int countAp=res0s ;© 2003 (352 pages) The authors of this text describe how to develop wireless Java private Satpprliicnagtio[n]s udseinvg B=lunetuololth;for a variety of platforms. This private IiBnmlcualeugtdoeeosthia-mnbgaA[sPe]Idos=veenrruvviliceelws;,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and private Smtorrie.ng[] services=null; public void startApp() { Table of Contdeinstpslay = Display.getDisplay(this); Bluetooth foreJxaivatCommand = new Command("Exit", Command.EXIT, 1); Introduction srchCommand=new Command("Search",Command.SCREEN,1); Chapter 1 -bIantcrkodCuocminmgaBnldu=etonoethw Command("Back",Command.BACK,1); Chapter 2 -fBrlume=tnooetwh 1F.1orm("Piconet Browser"); Chapter 3 -fBremfo.raedYdoCuoGmemt aSntadr(tesdrchCommand); Chapter 4 Chapter 5 Chapter 6 } Chapter 7 -fUrnmd.earsdtadnCdoinmgmtahnedJ(aevaxiBtluCeotomomthanAdPI); -fBrlume.tosoetthCwoimthmJa2nMdELMisIDtPener(this); -dCirseaptlinagya.sBeluteCtouorthrePrnintt(Sferrmve)r;with JPS API - Java and OBEX Chapter 8 - Using a Bluetooth Simulator public void pauseApp() { Chapter 9 - Bluetooth Security } Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapterpu11bl-iEcntevropiridse dBleusettoroothyAAppppl(icbatoioonlsewainth uthnecEornicdsisotniBolnipaNle)t { Chapter}12 - Bluetooth and Jini AppendpixuAbl-ijacvavxo.biludetcoootmhmandAction(Command c, Displayable s) { Appendix B - javax.obex Appendix C -iJfava(cBlu=e=tooethxiDtevCeolompmmaenndt)on{the PalmOS Platform Appendix D - BlipNdete1s.t1rAoPyI App(false); Index notifyDestroyed(); List of Figure}s List of Tablesif (c == srchCommand) { List of Listings try{ List of Sidebars BCC.setPortName("COM1"); BCC.setBaudRate(57600); BCC.setConnectable(false); BCC.setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE); LocalDevice localDevice = LocalDevice.getLocalDevice(); //device = new RemoteDevice[10]; discoveryAgent = localDevice.getDiscoveryAgent(); discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this); }catch(BluetoothStateException btstateex) { btstateex.printStackTrace(); } try{ deviceLst=new List("Devices",List.IMPLICIT,dev,img); deviceLst.addCommand(exitCommand); srchCommand=null; srchCommand=new Command("Refresh",Command.SCREEN,1); deviceLst.addCommand(srchCommand); deviceLst.setCommandListener(this); display.setCurrent(deviceLst); System.out.println(deviceLst.getSelectedIndex()); }catcBhlue(tEoxocthepfotriJoanvae){e.printStackTrace();} } by Bruce Hopkins and Ranjith Antony ISBN:1590590783 if (cA=p=reLsis s©t2.00S3E(3L5E2CpTag_eCs)OMMAND){ iTnhte aiutnhdoersxo=fdtehvisitceextLdsets.crgibeetShoewletoctdevdeIlonpdwexir(el)e;ss Java //adppolicsaetiornvsiucseingsBelauretcohothfoforr adveavriiectyeo[fipnladtefoxr]ms. This iniBntlcu[leu]tdoeoasthta-tnbraASsPeeIdtosvee=rrvvi{icee1ws0,o0hf}igt;hheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and UUmIoDre[.] uuids = new UUID[1]; uuids[0] = new UUID("9856",true); services=null; Table of Contentisnt transId=discoveryAgent.searchServices(attrSet,uuids, Bluetooth for Java device[i],PiconetMIDlet); Introduction Chapter 1 - IntrSodeurcvinigcBelLusetto=onthew List("Service",List.IMPLICIT); Chapter 2 - Blueftooorth(1i.1nt k=0;k 0) { Bluetooth for Java DocPribnytBJruocbe Hjoopbkin=s apnsdeRravnijicthesA[nt0o]n.ycreatePIrSiBNn:t15J9o05b9(07)8;3 Apress © 2003 (352 pages) // AddTihengautahoPrsroifntthSisttaetxtudsesLcriibsetehonwerto develop wireless Java job.adadppPlriciantiotnJsoubsLinigsBtleuneteoro(thstfoartauvsa)ri;ety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and // Cremaotree. a Doc implementation to pass the print data FileInputStream fInput = new FileInputStream("nicePic.gif"); Doc doc = new SimpleDoc(fInput, flavor, null); Table of Contents Bluetooth fo/r/JaPvarint the doc as specified Introductiontry { Chapter 1 - Intjrodbu.cpinrgiBnltu(etdooocth, attribSet); Chapter 2 }- Bluetooth 1.1 Chapter 3 c-aBtecfohre(YPoruiGnett ESxtacretepdtion e) { Chapter 4 - UnSdyesrsttaenmd.inegrtrh.epJraivantBllune(toeo)th; API Chapter 5 }- Bluetooth with J2ME MIDP Chapter}6 - Creating a Bluetooth Print Server with JPS API else Chapter 7 - Java and OBEX System.err.println("No suitable printers"); Chapter 8 - Using a Bluetooth Simulator } Chapter 9 - Bluetooth Security } Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AppenCdiaxuAtio-njaTvhaxe.bJlPuSetoAoPthI is a part of JDK 1.4, and older versions of the JDK are not capable of running Appendix B - jatvhaex.JoPbSexPrint example. Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars IntegratingBJluPetSooathnfdor BJavlua etooth by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Now that you havAeparefsusll©w2o00rk3 i(n3g52epxaagems)ple of a JPS application under your belt, let's see what it will take in order to turn this ordinaTrhyeJPauSthporrinstosfetrhviisceteixnttodeascBrliubeethooowth-toendaebvleelodp, wwiirreelleessss Jparvinat server (refer back to Figure 6-2). applications using Bluetooth for a variety of platforms. This The algorithm forinthcleudaepspalincaAtiPoInoivseprvreietwty osfimthpeleJ.aTvahelibcroamryp, udetevreltohpamt feunntcotifons as the print server will start an L2CAP server anBdluweatoitoftohr-bcaliesendtssteorvcicoensn,ehcigt.hAligfthetrsaonf isneccoumritiyngcofinleceisrnrse,caenivded by the server, it is printed to a printer using the JmPoSreA. PI. Note As you may have already guessed, this application won't work if you use a JSR-82-compliant Java Table of ConBtlueenttosoth development kit. Why? Well, as we stated in Chapter 3, the official Java Bluetooth API has Bluetooth foar dJaevpaendency on the Generic Connection Framework (GCF) to exist, which unfortunately is not a part Introductionof the J2SE JDK 1.4. Chapter 1 - Introducing Bluetooth Chapter 2 T-hBalut edtooeosthn'1t .m1 ean that Java Bluetooth development kits don't exist for the J2SE. In fact, Atinav, Chapter 3 R- oBceofocroe, YaonudGZeutcSottatorteadll make Java Bluetooth development kits for the J2SE. At the time of this Chapter 4 w- rUitnindge,rsAttainnadivn'sg athned JRaovacoBcluoe'stoJo2tSh EAPimI plementation closely matches that of the JSR-82 implementations. The next example uses the Atinav J2SE Bluetooth development kit. Chapter 5 - Bluetooth with J2ME MIDP CLhiasptitnegr 66-2-isCrtheaetisnegrvaeBr lcuoedtoeotfohrPtrhinetwSierervleesr swpitrhinJtPsSeArvPeIr example, JPSBluetoothPrint.java. As you can Csheaept,eitr i7s si-mJpalvyathaendJOPBSEPXrint.java example with a little Bluetooth code thrown in. All the wireless Cfhuanpctteior n8alit-yUissinegncaaBplsuueltaotoetdh iSnimthuelamtoerthod connectToClientAndPrint(). When this method is called, the Cshearpvteerr w9 ill-wBaliuteutnotoiltha Sceliceunrtitayttempts to connect at an L2CAP channel. After the client connects and sends a Cfhilaep,ttehre1s0e-rvWerirweliellsas tEtemmbpetddtoedprSinytstitewmisthwitisthptrhienMticFriolBelu(e)Tamrgeetht od. Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CLhaispttienrg162-2- :BJluPeStoBoltuheatnodotJhinPi rint.java Appendix A - javax.bluetooth AippmepnodrixtB j-ajavvaa.xi.oob.e*x; AippmepnodrixtC j-aJvavaax.Blpureitonotth.*D;evelopment on the PalmOS Platform AippmepnodrixtDj-aBvliapxN.etp1r.i1nAtP.I event.*; Inidmepxort javax.print.attribute.*; LiistmopfoFrigturjeas vax.print.attribute.standard.*; LiistmopfoTratblejsavax.bluetooth.*; LiistmopfoLristtincgosm.atinav.standardedition.io.*; List of Sidebars class PrintStatus implements PrintJobListener { public void printDataTransferCompleted(PrintJobEvent pje) { System.out.println("Data delivered to printer successfully..."); } public void printJobCanceled(PrintJobEvent pje) { System.out.println("The print job has been cancelled..."); } public void printJobCompleted(PrintJobEvent pje) { System.out.println("The print job completed successfully..."); } public void printJobFailed(PrintJobEvent pje) { System.out.println("The document failed to print .."); } public void printJobNoMoreEvents(PrintJobEvent pje) { System.out.println("No more events to deliver..."); } public void printJobRequiresAttention(PrintJobEvent pje) { System.out.println("Some thing terrible happened which" + "requires attention..."); } } Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class AJpPreSsBsl©u2e00t3o(o35t2hpPagreis)nt implements Runnable { The authors of this text describe how to develop wireless Java L2CAPConneacpptliicoantionls2ucsainpgCBolnuneto=othnufolr la;variety of platforms. This private iniBntlculeumtdoaeoxsthRa-enbcaAvsPeId=osvee-rr1vvi;iceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more. private boolean printFile(String fileName) throws FileNotFoundException{ Table of CSoynstetnetms.out.println("Invoking Common printAPI for printing file : "+ Bluetooth for Java fileName); Introduction Chapter 1Pr-iInttrSodtuactinugsBlsutetaotouths = new PrintStatus(); Chapter 2 - Bluetooth 1.1 Chapter 3//- BCerfoeraetYeoutGheet SDtaorcteFdlavor for GIF Chapter 4Do-cUFnldaevrsotarndfinlgavthoerJa=va DBoluceFtoloathvoArPI.INPUT_STREAM.GIF; Chapter 5 - Bluetooth with J2ME MIDP Chapter 6//- CCrreaetaintgea aBnlueatototthriPrbinuttSeersveertwicthomJPpSriAPsIed of the print instructions PrintRequestAttributeSet attribSet = new HashPrintRequestAttributeSet(); Chapter 7 - Java and OBEX attribSet.add(new Copies(1)); Chapter 8 - Using a Bluetooth Simulator attribSet.add(MediaSizeName.ISO_A4); Chapter 9 - Bluetooth Security Chapter 10//- WLioreclaestseEmpbreidndtedsSeyrstveimcsewsi,th wthheiMcihcrocBalnueTparrigentt a GIF in the manner specified Chapter 11Pr-iEnntteSreprrivseicBleu[e]toopthseArppvliiccateiosns=wiPthrithnetESreicrsvsoincBelLipoNoekt up.lookupPrintServices(flavor, Chapter 12 - Bluetooth and Jini attribSet); Appendix A - javax.bluetooth Appendix Bif- ja(vpasxe.orbveixces.length > 0) { Appendix C - JavDaocBlPureitonotthJoDbevejloopbme=ntposnetrhveiPcaelmsO[S0]P.lactfroermatePrintJob(); Appendix D - BlipNet 1.1 API Index // Adding a PrintStatus Listener List of Figures job.addPrintJobListener(status); List of Tables List of Listings // Create a Doc implementation to pass the print data List of Sidebars FileInputStream fInput = new FileInputStream(fileName); Doc doc = new SimpleDoc(fInput, flavor, null); // Print the doc as specified try { job.print(doc, attribSet); } catch (PrintException e) { System.err.println(e); } } else System.err.println("No suitable printers"); return true; } public void connectToClientAndPrint() throws Exception { System.out.println("Host Device = "+ LocalDevice.getLocalDevice().getBluetoothAddress()); String url = "btl2cap://localhost:" + uuid + ";name=simplePrintServer"; UUID uuid = new UUID("6666", true); L2CAPConnectionNotifier l2capNotifier = Bluetooth for Java (L2CAPConnectionNotifier) Connector.open(url); l2capCboynBnruc=e Hlo2pckainpsNaontdiRfainejirth.aAcntcoenpytAndOpeInS(BN):;1590590783 maxRecAvpre=ss l©22c00a3p(3C5o2npnag.esg)etReceiveMTU(); SystemT.hoe uatut.hporrsionfttlhnis(t"eCxtodnensecrcibteedhowtoto adevcelloipewntir.el.e.ss"Ja+va applications using Bluet"oRoethcefoirvaevabriueftyfoefrplaStifozremsi. sTh:is"+ maxRecv); new ThiBnrlcueleuatdodeo(sthta-hnbiaAssPe)Id.ossveetrravviriceetws(,o)hf;igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and } more. public void run() { Table of Cotnrteynt{s Bluetooth for Jav/a/ packet receive Introduction byte [] data = new byte[maxRecv]; Chapter 1 - Int/r/oduRceinagdBilnugetofoithleName Chapter 2 - Blu/e/toobtlho1c.1ks assuming fileName always less than 48 bytes Chapter 3 - Beifonrte YdoautGaeSt iSztaerte=d l2capConn.receive(data); Chapter 4 - Unbdyetrsetan[d]ingfithleeJNaavameBAluseBtoyotthesAPI= new byte[dataSize]; Chapter 5 Chapter 6 Chapter 7 Chapter 8 - Bluetooth with J2ME MIDP - CrSeaytsintgeam.BalurertoaoythcoPrpinyt(Sdeartvear,w0i,thfiJPlSeNAPaImeAsBytes, 0,dataSize); String fileName = new String(fileNameAsBytes); - Java and OBEX System.out.println("File Name is = "+ fileName); - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security FileOutputStream toFileStrm = new FileOutputStream(new File(fileName)); Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Entterrypri{se Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bSluyesttooetmh.out.println("Starting to Receive file Body"); Appendix B - javax.obex Appendix C - Java Bl/u/etoroethceDievveelopFmielnet obnotdhye PalmOS Platform Appendix D - BlipNetw1h.i1lAeP(I true) { Index if (l2capConn.ready()) { List of Figures dataSize = l2capConn.receive(data); List of Tables List of Listings List of Sidebars // after the whole file, an empty packet is sent from // the other end if (dataSize == 0) { System.out.println("Signal to Stop recieved"); toFileStrm.close(); toFileStrm = null; printFile(fileName); break; } toFileStrm.write(data, 0, dataSize); } try { Thread.currentThread().sleep(10); }catch(Exception genExp) {} } } finally { try {l2capConn.close();}catch(Exception genExp) {} } } catch(Exception genEx) { } } public static void main(String [] args) throws Exception { Bluetooth for Java JPSBlubeytBoruoctehHPorpiknints asnrdvRa=njith nAentwonJyPSBluetIoSoBNt:h15P9r05i9n07t8(3); srv.coAnpnreescs t©T2o00C3l(3i5e2nptagAesn)dPrint(); } } The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Listing 6-3 has the code that a client would use in order to submit a file to the print server. This code would run Taobnleaonfy CBolunetetonottsh-enabled J2ME device. Bluetooth for Java InLtirsotdinucgti6o-n3: JPSBluetoothPrintClient.java Chapter 1 - Introducing Bluetooth Cihampptoerrt2 j-aBvluae.tiooot.h*1;.1 Cihampptoerrt3 j-aBveafo.ruetYiolu.G*e;t Started Cihampptoerrt4 j-aUvnadxe.rsbtalnudeintgoothtehJ.a*va; Bluetooth API Cihampptoerrt5 j-aBvluaext.oootbhewxi.th*J;2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Cphaupbtleric7 c-lJaavsasanJdPSOBBlEXuetoothPrintClient implements DiscoveryListener { ChapterLo8ca-lUDseinvgiaceBluleotocoathl S=imunluatlolr ; ChapterDi9sc-oBvlueertyooAtgheSnetcuraitgyent = null; int[] attrSet = null; Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget RemoteDevice btDev = null; Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet String serviceURL = null; ChapterL212CA-PBCluoentonoetchtainodnJinli 2capConn = null; Appendix A - javax.bluetooth AppendpixuBbl-ijcavaJxP.oSbBelxuetoothPrintClient() throws BluetoothStateException { Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix Dl-oBcliaplNet=1.L1oAcPaI lDevice.getLocalDevice(); Index agent = local.getDiscoveryAgent(); List of Figuraegs ent.startInquiry(DiscoveryAgent.GIAC, this); List of Tablessynchronized(this){ //Waiting for Device Inquiry to be completed List of Listings try{ List of Sidebars this.wait(); }catch(Exception IntE){ System.out.println(IntE.getMessage()); } } } public void deviceDiscovered(RemoteDevice btDevice,DeviceClass cod){ if ("011114378000".indexOf(btDevice.getBluetoothAddress())> -1){ btDev = btDevice;System.out.println("Assigned"); } System.out.println("Device discovered "+btDevice.getBluetoothAddress()); } public void servicesDiscovered(int transID, ServiceRecord[] servRecord){ System.out.println("Discovered a service.... "); for(int i =0; i < servRecord.length; i++){ serviceURL = servRecord[i].getConnectionURL (ServiceRecord.NOAUTHENTICATE_NOENCRYPT,true); System.out.println("The service URL is "+serviceURL); } } Bluetooth for Java public vobiydBrusceerHvoipckeinSseaanrdcRhaCnojimthplAenttoendy(int trIaSnBNs:I15D9,059i07n8t3 respCode){ SystemA.poreusts.©p2r00i3n(t35l2np(ag"eSs)ervice search completed.......... . "); synchrTohne iazutehdo(rstohfitsh)is{te/xt/dUensbcrliboeckhoiwngto tdheveelowpawitirelfeossrJaSvearvice search complete traypp{lications using Bluetooth for a variety of platforms. This iBnlcutleuhtdoieossth.a-nnboaAtsPeiIdfosyveeArrlvvilicee(ws),o;hf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and }cmaotrec.h(Exception IntE){ System.out.println(IntE.getMessage()); } Table of Co}ntents Bluetooth for Java Introdu}ction Chapter 1 - Introducing Bluetooth Chapterpu2bl-iBcluevtoooitdh 1i.1nquiryCompleted(int discType){ Chapter 3 -SByesfotreemY.oouuGte.t pSrtairntetdln("Inquiry completed..."); Chapter 4 -sUynndcehrsrtaonndiinzgedth(etJhaivas)B{lue/to/oUthnbAlPIocking the wait for inquiry complete Chapter 5 - Bluettoortyh{with J2ME MIDP Chapter 6 - Creating athBiluse.tonoothtiPrfinytASlelr(ve)r;with JPS API }catch(Exception IntE){ Chapter 7 - Java and OBEX System.out.println(IntE.getMessage()); Chapter 8 - Using a Bluetooth Simulator } Chapter 9 - Bluetooth Security } Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter}12 - Bluetooth and Jini Appendix A - javax.bluetooth AppendpixuBbl-ijacvavxo.oibdexgetServices(){ Appendix C -UJUavIaD[Bl]ueutouoithdsDev=elonpemwenUtUoInDt[h1e]P;almOS Platform Appendix D -uBuliipdNset[10.]1 A=PI new UUID("6666", true); Index try{ List of Figures if(btDev == null){ List of Tables System.out.println("No device has been discovered, "+ List of Listings "hence not worth proceeding,exiting.... "); List of Sidebars System.exit(1); } System.out.println("Now searching for services....... . "); agent.searchServices(attrSet, uuids, btDev, this); } catch(BluetoothStateException e) { System.out.println(e.getMessage()); System.out.println("Got an exception, so exiting..."); System.exit(1); } synchronized(this){ //Waiting for Service Search to be completed try{ this.wait(); }catch(Exception IntE){ System.out.println(IntE.getMessage()); } } } public boolean sendFile(String fileName){ try {Bluetooth for Java lb2ycBarupcCeoHnonpk=ins(aLn2dCRAaPnCjiothnnAentcotniyon)ConnIeScBNt:o15r9.05o9p07e8n3(serviceURL); Apress © 2003 (352 pages) ITnhepuatutChoonrsnoefctthiisotnextidneCsocrnibne h=ow to develop wireless Java (aIppnlpicuattioCnosnunseincgtBilounet)oCoothnnfoercatvoarri.eotypoefnp(la"tffoirlmes:. /Th/insame="+fileName+";mode=r"); IiBnnlcupleuutdoteoSsthta-rnbeaAasPemIdosfveeirrlvvieiceeRwse,oahfdigtehhreligJh=avtsaiolnifbCsroaercnyun,r.idtyoevpceoelonnpcIemnrenpnsu,ttaoSnf tdream(); more. int maxSendMTU = l2capConn.getTransmitMTU(); byte [] buffer = new byte[maxSendMTU]; Table of Contents Bluetooth for Java // sending fileName Introduction // assuming for the time being that the fileName Chapter 1 - Introd/u/cinwgiBllluetnoootth be greater than 48 bytes Chapter 2 - Bluetloo2tcha1p.1Conn.send(fileName.getBytes()); Chapter 3 - BeforSeyYsotueGme.t oSutatr.tepdrintln("Send the file Name = "+ fileName); Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluet/oo/thsweinthdJi2nMgE MfiIDlPeContent Chapter 6 - Creat/in/g aafBtlueertootthhePrinwthSoelreverfwiilthe JPgSetAPsI transferred, an empty packet is sent. int actualDataSize = -1; Chapter 7 - Java and OBEX byte [] pkt = null; Chapter 8 - Using a Bluetooth Simulator while((actualDataSize = fileReader.read(buffer)) != -1) { Chapter 9 - Bluetooth Security pkt = new byte[actualDataSize]; Chapter 10 - Wireless ESmybsetdedme.daSryrstaeymcsowpiyth(bthuefMfiecrro,Bl0u,eTaprkgett, 0, actualDataSize); Chapter 11 - Enterprisel2BlcuaeptoCoothnnA.ppsleicnatdio(npskwti)th;the Ericsson BlipNet Chapter 12 - Bluet}ooth and Jini Appendix A - javaxS.bylusetteoomt.hout.println("Completed sendng body of file = "+ fileName); Appendix B - javax.obex Appendix C - Java /Bl/useetonodthinDgeveelomppmteyntpoanctkheetPaslmiOgSnaPllaitfnogrmend of file Appendix D - BlipNlet21c.a1pACPoI nn.send(new byte[0]); Index List of Figures List of Tables List of Listing}s fileReader.close(); return true; List of Sidebars catch(IOException e){ System.out.println(e.getMessage()); return false; } finally { System.out.println("Closing connection"); try {l2capConn.close();}catch(Exception genx) {} } } public static void main(String args[]) throws Exception { JPSBluetoothPrintClient client = new JPSBluetoothPrintClient(); client.getServices(); System.out.println(client.sendFile(args[0])); } } Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This chapter wasApprroebsasb©ly20y0o3u(3r5f2irpsatgteims) e working with the new Java Print Service APIs. The JPS is a platform-indepenTdheentauptrhinotrinsgofsothluistiotenxtthdaets'scrnibeewhionwJDtoKd1ev.4e.loInp twhiirseclehsaspJtaevra, you learned about all the steps that are necaepspsliacarytiotonscuresainteg BaluceotmooptlhetfeorJaPSvaaripeptylicoaf tpiolant,fosrumchs.aTshiisdentifying the data format, searching for prinitncsleurdveicseasn, sApPeI coivfyeirnvgieawttroibf uthtesJ,aavnadlibcrraerayt,indgevaenlodpsmuebnmt iottfing print jobs. After creating a simple JPS applicBalutieotno,oytho-ubalesaerdnseedrvhicoews,tohitguhrlnighyotsurofosrdecinuarirtyy pcroinntcesrenrsv,icaenidnto a Bluetooth-enabled print server! more. This chapter demonstrated communication with Bluetooth using the L2CAP protocol. This is ideal if you Table of Contents want to transfer items between two devices that can be broken into packets and reassembled again (such Balusetfioleosth).fLo2r CJaAvPa is a layer below RFCOMM in the Bluetooth protocol stack, so if you optimize your MTU, Inytoruodcuacntioanchieve significantly faster data transfers between wireless devices. In Chapter 7, we'll examine a Cmhaoprteerro1bu-stInBtlruoedtuocointhgpBrlouteotocootlhfor transferring files: OBEX. Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter 7: Java and Bluetooth for Java OBEX by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Overview The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Whether you likeiintcolur dneost,aynoAuP'rIeosvuerrrvoieuwndoefdthbeyJoabvjaelcibtsraervye, rdyedvaelyo.pImn efanct to, fpart of the role of being a good Java programmeBrliusettooofitnhd-boaustewd hseartviisceths,ehbigehsltigwhatsy otof sreeccuorgitnyizceonacnedrncsr,eaanted objects when developing business applicatmioonrse.(and games, too). As we stated in Chapter 4, the Bluetooth specification gives you three protocols to send and receive data: Table oRfFCCoOnMteMnt(sfor stream data) Bluetooth for Java IntrodLu2ctCioAnP (for packet data) Chapter 1 - Introducing Bluetooth ChaptOerB2EX- (Bfolur eotboojethct1d.a1ta) CIhnapthtiesr c3ha-ptBeerf,owree'YlloduisGceutsSsttahretemd echanics of the OBEX protocol, and how to send objects between CBhalupetetor o4th d- eUvnidceerss.tWaned'ilnl gcothveerJtahvea ABlPuIestoinotthheAPjIavax.obex package, and finish things up by Cdheapmteorn5stra-tiBnlguehtoowothtowsiethndJ2fMileEsMbIeDtPween two devices using OBEX. Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars What Is OBBEluXet?ooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 OBEX (which staAnpdrsefsosr©O2B00je3 c(3t5E2 Xpacghesa)nge) is a communication protocol that allows object data to be transferred betweTehne tawuothdoersviocfetsh(isit tdeoxetsdne'st cmribaettehroiwf thtoodseevdeelovpicwesirealreesswJiarevlaessly or physically connected). OBEX was originaapllpylcicraetaiotnesdubsyinthgeBlIunefrtaoroethd fDoar taavAasrsieotyciaotfiopnlat(fIroDrmAs),. bTuhtisit later became one of the Bluetooth adopteidncplurodteoscaonlsA(PliIkeovWerAviPe)w. Toaf ktheeaJalovoaklibartaFryig,udreeve7l-o1pmtoesneteofwhere OBEX fits in the Bluetooth and IrDA protocoBl lsuteatcokost.h-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX ChaptFerig8ure- 7U-s1in:gOaBBElXueitsocotahlleSdimIruOlaBtoErX in the IrDA protocol stack. Chapter 9 - Bluetooth Security CIhnatphteerB1l0ue-toWoitrhelsepssecEimficbaetdiodne,dOSBysEtXemiss twheithunthdeerMlyicinrog BplruoetToacrogletthat is used to implement the following CBhalupetetor o1t1h p- rEonfitleersp:rise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AppenGdiexnAer-icjaOvabxje.bcltuEetxocohtahnge Profile AppenOdibxjeBc-t Pjauvsahx.Pobroefxile Appendix C - Java Bluetooth Development on the PalmOS Platform AppenSdiyxnDch-roBnliipzNaetiton1.P1 rAoPfiIle Index List ofFFilieguTrerasnsfer Profile List ofBTaasbilcesImaging Profile List of Listings List ofBSaidseicbParrsinting Profile Note Did you realize that the official Java OBEX implementation was named javax.obex and not javax.bluetooth.obex? It was named javax.obex because the JSR-82 designers knew that (if structured correctly) the OBEX libraries would be the same regardless of the underlying transmission protocol (also known as the bearer or the transport). So, you can use the classes in thejavax.obex package to send objects between any device that implements the official Java OBEX API. The JSR-82 provides guidelines on how to use OBEX over Bluetooth, IR, and TCP/IP connections. The OBEX protocol has a simple client/server architecture. OBEX clients get objects from and put objects onto OBEX servers. OBEX servers wait around for incoming requests from clients. The OBEX definition can be summarized in two parts: the OBEX Object Model and the OBEX Session Protocol. The Object Model provides the definition of OBEX objects and information on how to transfer them. The Session Protocol defines the handshaking that needs to occur between the client and the server when transferring objects between devices. Let's look at OBEX Object Model and Session Protocol in more detail. The OBEX Object Model In the OBEX Object Model, all the details about an object are represented as attributes called headers. Each header will contain information about the object (i.e., the name of the object) or the object itself. The Object Model defines headers as one byte for the header ID, and one or more bytes for the header's value. A typical OBEX header is illustrated in Figure 7-2. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Figure 7-2: ABnluOetBooEtXh-hbeasaedderservices, highlights of security concerns, and more. The OBEX Object Model has defined 17 headers for OBEX object attributes. However, the official Java OBEX specification uses only 12 of them as constants in the interface java.obex.HeaderSet. These Tacbolnesotaf nCtosnatreenltissted in Table 7-1. Bluetooth for Java InTtarobdleuc7ti-o1n: OBEX Headers in the java.obex.HeaderSet Interface Chapter 1 - Introducing Bluetooth ChaHpEtAerD2ER -IBDlueNtoAoMtEh 1.1 HEADER JAVA TYPE Chapter 3 - Before You Get Started ID Chapter 4 - Understanding the Java BDluEeCtIooMtAhLAPI Chapter 5 - Bluetooth with J2ME MIDVPALUE DESCRIPTION ChaCpOteUr N6T - Creating a Bluetooth Prin1t9S2erver with JPjSaAvPaI .lang.Long Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator ChaNpAteMr E9 - Bluetooth Security 1 java.lang.String Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaTpYtPerE12 - Bluetooth and Jini 66 java.lang.String Appendix A - javax.bluetooth Appendix B - javax.obex The number of objects to be sent The object's name (usually used as the fil ena me ) The type of the object, like text/plain AppLeEnNdGixTCH- Java Bluetooth Developm1e9n5t on the PalmjOaSvPala.tlfoarnmg.Long Appendix D - BlipNet 1.1 API Index ListToIMf EFi_gIuSreOs_8601 68 java.util.Calendar List of Tables The length of the object in bytes The time in ISO 8601 format ListToIMf LEis_t4in_gBsYTE List of Sidebars 196 java.util.Calendar The time represented as a 4- byte integer DESCRIPTION 5 java.lang.String A description of the object TARGET 70 byte[] The name of the service that the object is being sent to HTTP 71 byte[] The HTTP version 1.x header WHO 74 byte[] Refers to the peer OBEX application if peers are involved OBJECT_CLASS 79 byte[] The OBEX object class for the object APPLICATION_BPlAueRtAoMotEhTfEoRr Java76 byte[] by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Data that represents request and response parameters for the OBEX application includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and You are also freemtoorcer.eate your own headers as long as you obey the following guidelines: java.lang.String object types should have a header ID decimal value between 48 and 63. Table of Contents BluetoboytthefaorrrJaayvsa(i.e. byte[]) should have a header ID decimal value between 112 and 127. Introduction java.lang.Byte object types should have a header ID decimal value between 176 and 191. Chapter 1 - Introducing Bluetooth Chaptjera2va.-lBalunegto.oLtohn1g.1object types should have a header ID decimal value between 240 and 255. Chapter 3 - Before You Get Started CThahpteer O4 B- EUnXderSsteansdisnigothne JPavraoBtluoectoootlh API Chapter 5 - Bluetooth with J2ME MIDP CThahpeteOrB6EX- SCeresastiionng ParBoltuoectoolostphePcriifniet sSearlvl reurlewsithanJdPSpAroPcIesses for communication between OBEX clients Cahnapdtesrer7ver-s.JaTvhaeacnodmOmBEuXnication scheme is a simple request-response process: The client sends a Crheaqputeerst8, an- dUtshinegsaerBvleuretroeostphoSnidmsu. lBatootrh requests and responses are sent as packets. Clients communicate Cthoapthters9erv-e rBlvuiaeteooigthtSseimcuprlietyop er atio ns : Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CONNECT Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaptDerI1S2CO-NBNluEeCtoToth and Jini Appendix A - javax.bluetooth AppenPdUixTB - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform GET Appendix D - BlipNet 1.1 API IndexSETPATH List of Figures List ofATBaObRleTs List of Listings CREATE-EMPTY List of Sidebars PUT-DELETE OBEX servers, in turn, return responses back to the OBEX clients, such as the following: SUCCESS FAILURE CONTINUE Note There are a lot more OBEX responses than just these three. All the valid response codes in the javax.obex API are contained in the javax.obex.ResponseCodes class, which is described later in this chapter. Figure 7-3 is an illustration of the message flow that takes place during a simple OBEX session. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 ChaptFerig3ure- 7B-e3fo:rAe sYoaumGpelet mStearstseadge flow between OBEX clients and servers Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP CThahpetecrlie6nt -inCitriaeatetisngthae BcloumetmooutnhicParitniotnSeprrvoecrewssithbyJPsSenAdPiIng a request packet with the CONNECT operation. CThahpeterer q7ue-stJapvaackaentdcOoBnEtaXins the code for the operation, the length of the packet itself, and the headers. CUhappotnerre8ce-ivUinsgintghea rBeluqeuteosott,hthSeimsuelravteorr responds with a response packet that contains the response code, Cthhaeptreersp9on-seBluleentogothth, aSnedcusroitmy e response data. Under normal circumstances, the server returns a packet with a response code of SUCCESS. If, however, some problem has occurred, then the server returns a Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget FAILURE code. Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CThahpetPeUr T12op-eBrlauteiotonoathlloawnds Jthinei client to send an object to the server. It's possible that a small object may fit AipnptoenadisxinAg-lejaPvUaTx.rbeluqeuteosotthpacket. If not, then the client sends multiple packets, and the server responds AwppitehnadixCOBN-TjIaNvaUxE.orbeesxponse code. The server responds to the final PUT packet with a SUCCESS code. Appendix C - Java Bluetooth Development on the PalmOS Platform ASppimenildairxlyD, c-liBelniptsNeatre1.a1bAlePIto retrieve objects from the server by sending a GET request packet. If the server accepts the packet, it responds with either a SUCCESS or a CONTINUE response code. If the server Index responds with a CONTINUE, then the client continues to send a GET request until the server responds with List of Figures aSUCCESS code. List of Tables LiTsthoefcLliiestnint gusses the SETPATH operation in conjunction with a PUT or GET operation in order to change the Lidsitreocf tSoirdyeobanrsthe server. The client can also use the ABORT operation in order to end the session with the server prematurely. The client can create an empty file on the server using the CREATE-EMPTY operation, and it can remove an object from the server using the PUT-DELETE operation. Now that you have a pretty good understanding of the overall functionality of OBEX, let's take a look at the Java OBEX APIs. The OBEX ABlPueItsooitnh ftohr JeavJaSR-82 by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The following eigAhpt rcelassss©e2s00a3n(d35i2npteagrefas)ces make up the javax.obex package in the JSR-82 API. Some of these classes should look somewhat familiar to you—namely HeaderSet,ResponseCodes, and The authors of this text describe how to develop wireless Java Operation. applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of AuthenticaBtluoertooth-based services, highlights of security concerns, and more. ClientSession Table oHfeCaodnetreSnetts Bluetooth for Java Operation Introduction ChaptPera1ssw- oInrtdroAduutchinegnBtliuectaototohr Chapter 2 - Bluetooth 1.1 ChaptRere3spo-nBseefoCroe dYeous Get Started Chapter 4 - Understanding the Java Bluetooth API SessionNotifier Chapter 5 - Bluetooth with J2ME MIDP ChaptSere6rve-rCRreeaqtuinegsatBHlaunetdoloethrPrint Server with JPS API Chapter 7 - Java and OBEX CNhaopwtelret8's t-akUesinagloaoBkluaet tsooomtheSoimf tuhleatsoer classes in more detail. Chapter 9 - Bluetooth Security Cjhaapvtearx1.0o-bWeirxel.eCsslEiembnetdSdeed sSysstieomns with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CThahpetCelr i1e2n-tBSlueestsoiotohnanindteJrifnaice is a subclass of the javax.microedition.io.Connection class, and ArpeppernedsixenAts- ajanvOaxB.bElXuectooontnhection from the client's point of view. You can obtain an instance of this interface AbppyeunsdinixgBth-ejafovlalox.woibnegxline of code: Appendix C - Java Bluetooth Development on the PalmOS Platform ACppleinednixtDSe-sBsliipoNnet 1s.e1sAsPiIon = (ClientSession)Connector.open(connectURL); Index List of Figures This interface provides a way to define headers for OBEX operations. For instance, the methods put() Liasnt dogf eTatb(le)srespectively allow you to create PUT and GET operations. Those methods return a LijstaovfaLxis.toinbgesx.Operation object so that you can complete the operation. List of Sidebars Note See the description of javax.obex.Operation later in this section for more information on how to complete GET and PUT operations. The methods connect(),disconnect(), and setPath() complete their respective operations (CONNECT,DISCONNECT, and SETPATH) and return the result in a javax.obex.HeaderSet object. javax.obex.HeaderSet TheHeaderSet interface can be used to define all OBEX headers (even custom headers). It can be instantiated by calling ClientSession.createHeaderSet(). An example of an OBEX client setting theNAME and TYPE headers is shown here: HeaderSet hdr = clientSession.createHeaderSet(); //Creating a header set to request Hello.txt file from the server hdr.setHeader(HeaderSet.TYPE," text/vCard"); hdr.setHeader(HeaderSet.NAME," Hello.txt"); An OBEX server, in turn, can retrieve the headers sent from the client by calling either getHeader() or getHeaderList(). javax.obex.BOlupeteoorathtfioornJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 TheOperation Ainpterersfasc©e2p00ro3 v(3id52epsaygeosu) with all the methods necessary to complete an OBEX GET or PUT operation. What dTohewaeumtheorasnobfythcisomtepxltetdee?scArisbeyohuowcatno sdeeveeilnopthweirfeollelosws iJnagvacode snippet, an Operation was created usingainpctphluleidcaeptsuioatnn(s)AuPsmIinoegvtheBorluvdieeitnwooCotlhf itfheoernJataSvveaarsliiesbtriyaoroynf,:pdlaetvfeolrompsm.eTnhtisof Bluetooth-based services, highlights of security concerns, and ClientSessionmosree.ssion = (ClientSession)Connector.open(connectURL); Operation op = session.put(null); Table of Contents BHluoetwoeovtherf,otrhJeaOvaperation is not complete until you include the object that you want to send (in the case of InatProUdTu)catinodn add some headers. Following is an example of how to complete a PUT operation: Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 ClientSession session = (ClientSession)Connector.open(connectURL); Chapter 3 - Before You Get Started Operation op = session.put(null); COhaupttperut4St-rUenadmersotauntdin=g tohpe.JoapvaenBOluuettopouthtSAtPIream(); Cohauptt.erwr5 it-eB(lu"eTteoostth"w.igtheJt2BMyEtMesID(P)); Cohauptt.ercl6os-eC(r)ea;ting a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CNhaopwteirn9ord-eBrltuoemtooatkheSaecCuRriEtyATE-EMPTY operation, just open and close the OutputStream without Cwhariptitnegr 1a0ny-dWaitrae,leasss sEhmobwenddheedreS:ystems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CChalpiternt12Se-sBsluieotnootsheasnsdiJoinni = (ClientSession)Connector.open(connectURL); AOpppeenrdaixtAio-njavoapx.b=luesteoostshion.put(null); AOppuetnpduixtBSt-rjaevaamx.oobuetx = op.openOutputStream(); Aoppuetn.dcixlCos-eJ(av)a;Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InTdheex easiest way to create a PUT-DELETE is to call the delete() method of this class. List of Figures LLiijssatt oovffaLTxiasbt.ilonegsbs ex.ResponseCodes LiTsthoefRSeisdpeboanrss eCodes class contains all the valid response codes that an OBEX server can send to its client. Since the OBEX request/response model is very similar to that of HTTP, you will see that the responses are modeled after their HTTP counterparts: OBEX_DATABASE_FULL OBEX_DATABASE_LOCKED OBEX_HTTP_ACCEPTED OBEX_HTTP_BAD_GATEWAY OBEX_HTTP_BAD_METHOD OBEX_HTTP_BAD_REQUEST OBEX_HTTP_CONFLICT OBEX_HTTP_CREATED OBEX_HTTP_ENTITY_TOO_LARGE OBEX_HTTP_FORBIDDEN OBEX_HTTP_GATEWAY_TIMEOUT Bluetooth for Java OBEX_HTTP_bGy OBNruEce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) OBEX_HTTP_INTERNAL_ERROR The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This OBEX_HTTP_inLcEluNdGeTs Ha_nRAEPQI UoIveRrEvDiew of the Java library, development of Bluetooth-based services, highlights of security concerns, and OBEX_HTTP_mMoOreV.ED_PERM OBEX_HTTP_MOVED_TEMP Table of Contents BluetoOoBthEXfo_rHJTavTaP_MULT_CHOICE IntrodOuBctEioXn_HTTP_NO_CONTENT Chapter 1 - Introducing Bluetooth ChaptOerB2EX_- HBTluTePto_oNtOh T1_.1ACCEPTABLE Chapter 3 - Before You Get Started OBEX_HTTP_NOT_AUTHORITATIVE Chapter 4 - Understanding the Java Bluetooth API ChaptOerB5EX_-HBTluTePto_oNtOhTw_itFhOJU2NMDE MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptOerB7EX_- HJTavTaPa_nNdOOTB_EIXMPLEMENTED Chapter 8 - Using a Bluetooth Simulator OBEX_HTTP_NOT_MODIFIED Chapter 9 - Bluetooth Security ChaptOerB1E0X_-HWTiTrePle_sOsKEmbedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaptOerB1E2X_- HBTluTePto_oPtAh RaTnIdAJLini Appendix A - javax.bluetooth OBEX_HTTP_PAYMENT_REQUIRED Appendix B - javax.obex AppenOdBixECX_-HJTavTaPB_lPuRetEoCoOthND_eFvAeIloLpEmDent on the PalmOS Platform Appendix D - BlipNet 1.1 API IndexOBEX_HTTP_PROXY_AUTH List ofOFBigEuXr_esHTTP_REQ_TOO_LARGE List of Tables List ofOLBisEtiXn_gHs TTP_RESET List of Sidebars OBEX_HTTP_SEE_OTHER OBEX_HTTP_TIMEOUT OBEX_HTTP_UNAUTHORIZED OBEX_HTTP_UNAVAILABLE OBEX_HTTP_UNSUPPORTED_TYPE OBEX_HTTP_USE_PROXY OBEX_HTTP_VERSION Note So where are the response codes that we discussed earlier in this chapter like SUCCESS, FAILURE, and CONTINUE? Good question. Well, the OBEX SUCCESS response code is mapped to OBEX_HTTP_OK in the ResponseCodes class. And rather than simply having a generic response code for FAILURE, there are numerous response codes to indicate what kind of failure has occurred. Finally, the CONTINUE response will always be handled by your underlying implementation, so you should never see it. Here is an example of how to use the ResponseCodes class to determine if your PUT operation was a success: ClientSessionBluseetsosoithonfor=Ja(vCalientSession)Connector.open(connectURL); Operation op b=y BsruecsesHioopnk.inpsuatn(dnRualnlji)th;Antony ISBN:1590590783 OutputStream Aopuretss =© 2o00p3.(3o5p2epnagOesu)tputStream(); out.write("TeTshte "a.utgheotrsBoyfttehsis(t)e)xt;describe how to develop wireless Java out.close(); applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of if(op.getRespBolunestoeoCtho-dbea(se)d s=e=rvices, highlights of security concerns, and ResponseCodesm.oOreB.EX_HTTP_OK) System.out.println("PUT operation is success"); Table of Contents Bjluaevtoaotxh .foorbJaevxa .ServerRequestHandler Introduction CThahpetSeer r1ve-rIRnetrqouduecsintgHaBlnudeltoeorthis a very useful class for OBEX servers. It includes an event listener that Crheasppteornd2s t-oBslpueetcoifoicthO1B.1EX requests made to the server. Chapter 3 - Before You Get Started ChaptNero4te T-hUisndiserastcalnadsisnganthdenJoatvaanBilnuteetrofoatcheA, PsIo in order to use its functionality, you need to extend this Chapter 5 c-laBsluseatonodthnowtitihmJp2leMmE eMnItDiPt. Chapter 6 - Creating a Bluetooth Print Server with JPS API This class has the following methods that will be called when incoming client requests contain the Cchoarprteesrp7ond- iJnagvaopaenrdaOtioBnE:X Chapter 8 - Using a Bluetooth Simulator Chaptoern9Con-nBelucetto(o)th Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chaptoern1S1et-PEanttehr(pr)ise Bluetooth Applications with the Ericsson BlipNet Chaptoern1D2el-eBtluee(to)oth and Jini Appendix A - javax.bluetooth AppenodnixGBet- (ja)vax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform onPut() Appendix D - BlipNet 1.1 API InAdfetexr the callback method has been called by the JVM, you can obtain the headers from the Operation Liosbt joefcFt iagsursehsown here: List of Tables LipstuobflLiisctinignst onGet(Operation op) { List of Sidebtarrsy{ HeaderSet hdr = op.getReceivedHeaders(); } javax.obex.SessionNotifier The SessionNotifier interface follows the same pattern as all notifiers in J2ME. A device that wants to be an OBEX server must implement this interface and call the acceptAndOpen() method and wait for clients, as shown in the following code: SessionNotifier sn = (SessionNotifier) Connector.open("btgoep://localhost:1106;name = FTP"); sn.acceptAndOpen(serverRequestHandler); Once the server accepts a connection from a client, it then opens a channel for the client. The subclass of ServerRequestHandler that you passed to the acceptAndOpen() method is notified of all subsequent requests from the client. Now that we've covered many of the classes of the Java OBEX API, let's look at an example that puts these concepts together. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars File TransfeBrluEetoxoathmfoprlJeava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 In the file transferAepxreasms p©le20,0w3 e(3'l5l2epxaagems)ine the code that's needed to send a file between two Bluetooth devices using the OBEX AThPeI oafutthheorJsSoRf -th8i2s. tTexhtedseesrcvreibrechoodwe itso ldeesvsecloopmwpilreexletshsaJnavthae client code, so we'll present that first. applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of File TransfeBmlruoreSet.oeotrhv-beasred services, highlights of security concerns, and Before any clients can connect, the server must register the service in the SDDB. This is accomplished in the Tamblaeinomf Ceothnotdenats shown here: Bluetooth for Java Introdpuucbtiolnic static void main(String args[]) throws IOException { Chapter 1FT-SIentrrvodeurcinsgeBrlvueetroo=th new FTServer(); Chapter 2Lo-cBaluleDteoovtihc1e.1 localDevice = LocalDevice.getLocalDevice(); Chapter 3Se-sBseifoorneNYootuiGfeit eSrtarstend = Chapter 4(S-eUsnsdieorsntaNnodtinigfitheerJ)aCvaonBnlueectotoothr.AoPIpen("btgoep://localhost:1106;name=FTP"); Chapter 5Sy-sBtlueemt.oootuhtw.ipthrJi2nMtElMn(ID"PWaiting for a client connection.... . "); Chapter 6sn-.CarceacteinpgtaAnBlduOeptoeonth(sPreinrtvSeerr)ve;r with JPS API Chapter 7Sy-sJtaveam.anodutO.BpEXrintln("A Client now connected.... "); Chapt}er 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security CAhaspetervric1e0 r-eWcoirredlehsassEnmobwedbdeeednScyrsetaemtesd waintdh tshtoerMedicrino tBhlueeSTDarDgeBt of the server device. Now let's take a closer look Cahtatphteerc1o1nn-eEcnttioenrpUrisReLB: luetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AbpptegnodeixpA:/-/jalvoacxa.blluheotsoott:h1106;name=FTP Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AAppseynoduixcDan- BselipeN, wete1a.1reAuPsI ing a new protocol for communication: btgoep (which stands for Bluetooth Generic InOdbexject Exchange Profile). Because this is a server device, the address will always be localhost. The UUID for LitshtisofseFirgvuicreesis 1106, which is the UUID for OBEX file transfers. List of Tables CROSS- List of Listings REFERENCE List of Sidebars SeeTable 4-4 for UUID values for Bluetooth services and their corresponding profiles. We also gave a friendly name for this service, which is FTP. Our file transfer server has extended the ServerRequestHandler class, and has overridden the onConnect() and onGet() methods. Here, the onGet() method will attempt to read the requested file from the local storage and send the file back to the client. Obviously, the onConnect() and onGet() methods are only called if the clients send a CONNECT or GET operation to the server. The code for the file transfer server is shown in Listing 7-1. Listing 7-1: FTServer.java import javax.microedition.io.*; import java.io.*; import javax.bluetooth.*; import javax.obex.*; public class FTServer extends ServerRequestHandler{ public FTServer() throws BluetoothStateException { // initialize the stack, if needed } public int onConnect(HeaderSet request, HeaderSet reply) { System.out.println("A OBEX connection has received.... "); returBnlueRteosopthonfosreJCaovdaes.OBEX_HTTP_OK; } by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) public iTnhet aoutnhGoersto(fOtpheisrtaexttidoenscroibpe)ho{w to develop wireless Java try{ applications using Bluetooth for a variety of platforms. This //iBnTlcuhleuetdoeossthea-rnbvaAesPerIdoshveearrsvviiceerwse,ochfeigtihhveliegJhdavtsaaolifbGsrEaercTyu,rridtyeevqceoulonepcsemtrennsf,toaornf dclient. Symsotree.m.out.println("Received a GET request from client.... . "); HeaderSet hdr = op.getReceivedHeaders(); Table of ConteSnytsstem.out.println("Server has received a request for the file "+ Bluetooth for Java(hdr.getHeader(HeaderSet.NAME)).toString()); Introduction String url = "file://name=" + Chapter 1 - Intr(odhudcrin.ggBeltuHeteoaodther(HeaderSet.NAME)).toString() + ";mode=r"; Chapter 2 - BlueItnooptuht1C.1onnection inpcon = Chapter 3 - Befo(rIenYpouutGCeot nSntaerctetdion)Connector.open(url); Chapter 4 - UndIenrsptauntdSintgrethaemJaivan B=lueitonopthcoAnPI.openInputStream(); Chapter 5 - Bluebtyootteh[w]ithfJi2lMeEAMsBIDyPtes = new byte[97]; Chapter 6 - Creaitnin.graeaBdlu(eftoioltheAPrsinBtySteersve)r;with JPS API Chapter 7 Chapter 8 Chapter 9 System.out.println("File read fully into the port.... "); - Java and OBEX for(int i =0; i Running an Application in the Simulator Okay, now that you've set up your environment, let's see what it takes to get your code running within the Impronto Simulator environment. In order to link your application code to the virtual Bluetooth devices that you've created, you need to specify an improntolocaldevice.friendlyname property for your application. In the J2SE, you can do this by executing the following line of code at runtime: java -Dimprontolocaldevice.friendlyname=TestPDA RemoteControl That's of course assuming that the name of your application is RemoteControl and the friendly name of your virtual device is TestPDA. You can also specify this property within your Java class itself before calling any JSR-82 code: System.setProperty("improntolocaldevice.friendlyname", "TestPDA"); Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 If you're creating AapJr2esMsE© M20I0D3 P(35a2pppalgiecsa)tion, you can set this property in your MIDlet's Java Application Descriptor (JAD) file. For exaThmepaleu,ththoersJoAfDthfisiletewxot udledsccroibnetahinowthteofdoellvoewloinpgwliinreele: ss Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of impronto.locaBlludeetovoithc-eb.afserdiseenrdvilceysn,ahmigeh:lighftosoof security concerns, and more. You must also insert the following code into your MIDlet's constructor so that Impronto Simulator can read the JAD TafbileleuosfinCgotnhteengtestAppProperty() method of MIDlet: Bluetooth for Java Initmropdourcttioncom.rococosoft.impronto.configuration.*; Cihampptoerrt1 j-aIvntarxod.umciincgrBoleudetiotoithon.midlet.*; Cphaupbtleric2 c-lBalusestooStohm1e.1MIDlet extends MIDlet Chaptperub3li-cBeSfoormeeYMoIuDGleet tS(ta)rte{d Chapter 4Co-nUfnidgeursrtaantdiinogn.thseeJtaCvaonBfluiegtouorthatAiPIon (new MIDPConfigurationImpl(this)); Chapter }5 - Bluetooth with J2ME MIDP C.ha.p.ter 6 - Creating a Bluetooth Print Server with JPS API C}hapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security ChaptNero1te0 A- nWyiraeplepslsicaEmtiobnedthdaetduSsyesstepmusrewJitShRth-8e2McicordoeB(liu.ee.T,anrogevtendor libraries) can run in the simulator as well. The Chapter 11 o-nElnytdeorpwrinsseidBeluiesttohoatht thApepsliicmautiloantsorwwitihll tchreeaEtreicgsseonnerBiclip"Ndeutmmy" devices. Chapter 12 - Bluetooth and Jini ACppehnaditx EA -xjaavmax.pbllueetooth Appendix B - javax.obex ATppheencdhixaCt e-xJaamvaplBeluweetoportehsDeenvtehleopremuesnet sonthteheSPearilaml OPSorPtlaPtrfoofrimle to send text messages from one simulated Bluetooth AdpepevnicdeixtoDa-nBoltihpeNre.tIn1.C1hAaPtI Server.java, the chat server registers its service and waits for a client to connect. After Inadcexlient connects, the server prints the client's message to the command line and prompts the server to respond. In LiCsthaoftFCigluireens t.java, the client searches for the server and creates a Serial Port Profile connection after obtaining Litshteocf oTnanbleecstion URL. Listing 8-2 shows the code for ChatServer.java and Listing 8-3 shows the code for LiCsthoaftLCisltiinegnst.java. List of Sidebars Listing 8-2: ChatServer.java import java.io.*; import javax.bluetooth.*; import com.rococosoft.io.*; class Server { StreamConnection con = null; StreamConnectionNotifier service= null; InputStream ip = null; OutputStream op = null; String serviceURL = "btspp://localhost:1111;name=ChatServer"; public Server() throws IOException{ //Extends a stream for client to connect service = (StreamConnectionNotifier)Connector.open(serviceURL); //Server waiting for client to connect con = service.acceptAndOpen(); //Open streams for two way communication. ip = con.openInputStream(); op = con.openOutputStream(); //Starts a neBwluetthoroethadforfJoarvareading data from inputstream //while the pbryeBsruecnetHotphkrinesaadn,d Rgaonejisth fAontrownayrd and IwSrBNi:t15e905d9a07t8a3 to outputstream //thus enabliAnpgresas ©t2w00o3 (w35a2ypagceos)mmunication with the client ReadThreadTherdatuthhrors=ofntehwis tRexetaddeTshcrribeeahdo(wipto);develop wireless Java rdthr.staratpp(l)ic;ations using Bluetooth for a variety of platforms. This writeData(iBn)lcu;leutdoeostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and } more. private void writeData() throws IOException{ int data = 0; Table doof {Contents Bluetotorthy{for Java Introdduacttioan = System.in.read(); Chaptoerp.1 wr-iItnter(odduactinag)B;luetooth Chapt}erca2tc-hB(luIeOtEooxtche1p.1tion e){} Chapt}erwh3il-eB(etforrueeY)o;u Get Started Chapt}er 4 - Understanding the Java Bluetooth API C}hapter 5 - Bluetooth with J2ME MIDP Cchalpatsers6Re-aCdrTeahtrinegaadBleuxettoeonthdsPrinTthSreeravedr w{ith JPS API InputStream ip = null; Chapter 7 - Java and OBEX public ReadThread(InputStream inp){ Chapter 8 - Using a Bluetooth Simulator ip = inp; Chapter 9 - Bluetooth Security } Cphaupbtleric10 v-oWiidrelresusnE(m)be{dded Systems with the Micro BlueTarget Chaptcerha11r -dEanttear;prise Bluetooth Applications with the Ericsson BlipNet Chaptiernt12 i- B=lue0t;ooth and Jini Appenddoix{A - javax.bluetooth AppentdrixyB{ - javax.obex A/pp/eRnedaixdC d-aJtavaa fBlruoemtootthheDevsetlorpemaemnt on the PalmOS Platform AppenddaixtDa -=Bli(pcNheta1r.)1iApP.I read(); IndexSystem.out.print(data); Li/st/oTfhFiigsuriess a bit sneaky and hard to explain. Li/st/ocfoTmambelenst out the following line to see the difference in how Li/st/otfhLeistainpgpslication behaves. List ofiSfi(dedbaatrsa == 0x0d)System.out.println(); } catch(IOException e){} }while(true); } } public class ChatServer { public static void main(String args[]) throws IOException { System.setProperty("improntolocaldevice.friendlyname", "ChatServer"); Server chatServer = new Server(); } } Listing 8-3: ChatClient.java import java.io.*; import javax.bluetooth.*; import com.rococosoft.io.*; class Client implements DiscoveryListener{ private statiBclueLtoocoathlDfoervJiacvea localDevice = null; private DiscobvyeBrruycAegHeonptkindsiasncdoRvaenrjiythAgAentnotny= null;ISBN:1590590783 private StrinAgprecsos n©n2e00c3t(3i5o2npUagReLs) = null; private RemotTeheDeavutihcoers[o]f tdheisvtiexctede=scrnibuelhlo;w to develop wireless Java private ServiacppelRiceactioonrsdu[s]ingrBelcuoetrodosth =fornauvlalri;ety of platforms. This private booleinacnludiens qauniArPyI Coovemrpvliew=offtahlesJaev;a library, development of int count = 0B;luetooth-based services, highlights of security concerns, and more. int maxSearches = 10; InputStream ip = null; TaObuletpouf tCSotnrteenatms op = null; Bpluuebtoloithc foCrlJiaevant() throws IOException, InterruptedException{ IntrodluoctcioanlDevice = LocalDevice.getLocalDevice(); Chaptderis1 co-vIentrryodAugceinngtBl=uetlooocthalDevice.getDiscoveryAgent(); Chaptderev2ic-eBlu=etnooetwh 1R.1emoteDevice[10] C/ha/ptSerta3rt-sBeifonrqeuYioruyGeft oSrtardteedvices in the proximity and waits till the //inquiry is completed. Chapter 4 - Understanding the Java Bluetooth API System.out.println("\nSearching for Devices...\n"); Chapter 5 - Bluetooth with J2ME MIDP discoveryAgent.startInquiry(DiscoveryAgent.GIAC,this); Chapter 6 - Creating a Bluetooth Print Server with JPS API synchronized(this){ Chaptterhi7 s.-wJaaviat(an)d;OB EX Chapt}er 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security C/ha/pOtnerce10 t-hWeireDleesvsiEcmebeidndqeudiSryysteimss wciothmpthleeMtiecrdo BiltueTsatragertts searching for the C/ha/prteerqu11ir-eEdntesreprrivseicBleu.etoSoethrvAippcleicatsioenasrwcihth ithse EdroicnsesonwBiltiphNett he given uuid. C/ha/pAtferte12r -sBtluaerttooitnhganedaJcinhi search it waits for the result. If the A/pp/ecnodnixnAec-tjaivoanxU.bRluLetioosthnull, ie, if No service Records are obtained, then A/pp/eintdixcBon-tjaivnauxe.osbesxearch in the next device detected. Appendix C - Java Bluetooth Development on the PalmOS Platform AppenidnixtD[]- BalitptNretS1e.t1 A=PI {0,3,4,0x100}; IndexUUID[] uuids = new UUID[1]; List ofuFuigiudrse[s 0] = new UUID("1111",true); List offToarb(leisnt i = 0; i< count;i++) { List ofiLnisttintgrsansactionid = discoveryAgent.searchServices List of Sidebars (attrSet,uuids,device[i],this); if(transactionid != -1){ synchronized(this){ this.wait(); } } if(connectionURL != null) break; }// end of forloop //If the URL returned from SPP Server begins with btspp then //we call the getConnection method which //establishes a connection with the SPPServer and returns it. Connection // returned is of type StreamConnection. //A piece of raw data is being sent over RFCOMM. if(connectionURL == null) System.out.println("No service available.......... ."); else if(connectionURL.startsWith("btspp")){ StreamConnection connection = getconnection(); op = connection.openOutputStream(); ip = connection.openInputStream(); } WriteThreaBdluewtrotohthrfo=r Jnaevwa WriteThread(op); wrthr.starbty(B)ru;ce Hopkins and Ranjith Antony readData()A;press © 2003 (352 pages) ISBN:1590590783 } The authors of this text describe how to develop wireless Java private void arppelaicdaDtioantsau(s)intghBrlouwetsooIthOEfoxrcaevpatriieotyno{f platforms. This char data;iBnlculeutdoeostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and int i = 0;more. do{ data = (char)ip.read(); Table Soyf sCtoenmte.notust.print(data); Bluetoiofth(dfoartJaava== 0x0d)System.out.println(); Introd}uwchtioinle(true); C}hapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 C/ha/pWtheren3 a- BdeefovriecYeouiGset dSitasrcteodvered it is added to the remote device table. Chapter 4 - Understanding the Java Bluetooth API Cphaupbtleric5 s-yBnlucehtroootnhiwziethdJ2vMoEiMdIDdPeviceDiscovered(RemoteDevice btDevice, DeviceClass cod) C{hapter 6 - Creating a Bluetooth Print Server with JPS API System.out.println("New Device discovered : "+btDevice.getBluetoothAddress()); Chapter 7 - Java and OBEX device[count++] = btDevice; Chapter 8 - Using a Bluetooth Simulator } Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget C/ha/pWtheren11 a- EsneterrvpiricseeBliusetodoithscAoppvleicrateiodnsiwnithathpeaErrticiscsounlBalripNdeet vice C/ha/ptaernd12 t-hBeluectooontnheacntdiJoinni url is not null //then the thread that A/pp/einsdixwAai-tjaivnagx.bilunettoohteh main is notified. Appendix B - javax.obex ApppuebnldiixcC s-yJnavcahrBlouneitozoethdDvevoeilodpmseenrtvoinctehseDPiaslmcOoSvePrlaetfdo(rmint transID, Appendix D - BlipNet 1.1 API ServiceRecord[] servRecords) { Indexrecords = new ServiceRecord[servRecords.length]; List ofrFeigcuorreds s = servRecords; List offToarb(leisnt i=0;into0ny) ISBN:1590590783 { Apress © 2003 (352 pages) sTyhencahutrhoonrsiozfetdhis(ttexhtidse)scribe how to develop wireless Java {applications using Bluetooth for a variety of platforms. This iBnlculeutdoteorsthya-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more.{ this.wait(); Table of Contents Bluetooth for Java } } catch (Exception e) {} Introduction } Chapter 1 - Introducing Bluetooth Chapter 2 -iBflu(etrooetcho1r.1d != null ) Chapter 3 -{Before You Get Started Chapter 4 - UndeSrsytasntdeinmg.othuetJ.apvariBnluteltono(th "ARPIecord is not null" ); Chapter 5 - Bluetrooetthuwrinth Jt2rMuEeM;IDP Chapter 6 -}Creating a Bluetooth Print Server with JPS API else Chapter 7 - Java and OBEX { Chapter 8 - Using a Bluetooth Simulator System.out.println( "Record is null" ); Chapter 9 - Bluetooth Security return false; Chapter 10 -}Wireless Embedded Systems with the Micro BlueTarget Chapter}11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Append/ix/A F-ijanvdasx.btluheetooftihrst echo server that is available to send messages to. AppendpixuBbl-ijacvaSxe.orbveixceRecord findEchoServer() Append{ix C - Java Bluetooth Development on the PalmOS Platform Appendix D -/B/lipINfet 1t.h1eArPeI are any devices that have been found by a recent inquiry, Index // we don't need to spend the time to complete an inquiry. List of FigureRs emoteDevice[] devList = agent.retrieveDevices( DiscoveryAgent.CACHED ); List of Tablesif( devList != null ) List of Listing{s List of Sidebars if( searchServices(devList) ) { return record; } } // Did not find any echo servers from the list of cached devices. // Will try to find an echo server in the list of pre-known devices. devList = agent.retrieveDevices( DiscoveryAgent.PREKNOWN ); if( devList != null ) { if( searchServices(devList) ) { return record; } } // Did not find an echo server in the list of pre-known or cached // devices. So start an inquiry to find all devices that could be // an echo server and do a search on those devices. try { agent.startInquiry(DiscoveryAgent.GIAC, this); Bluetooth for Java /b/y BWruacietHoupnktinislanadlRlantjihthe Adnteovniyces areISfBNo:u15n9d059b07e8f3ore trying to start the /A/presses r©v2i00c3e(35s2epaagrecs)h. sTyhencahutrhoonrsiozfetdh(isttheixtsd)escribe how to develop wireless Java {applications using Bluetooth for a variety of platforms. This iBnlculeutdoteorsthya-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more.{ this.wait(); Table of Contents Bluetooth for Java } } catch (Exception e) {} Introduction } Chapter 1 Chapter 2 Chapter 3 Chapter 4 -cIanttrcodhu(cinBglBuleutetooootthhStateException e ) -{Bluetooth 1.1 - BeforSeyYsotueGme.t oSutatr.tepdrintln( "Unable to find devices to search" ); -}Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 -iCfr(eatdinegvaicBeluLeitosotth.sPriinzteS(e)rve>r w0ith) JPS API { Chapter 7 - Java and OBEX devList = new RemoteDevice[deviceList.size()]; Chapter 8 - Using a Bluetooth Simulator deviceList.copyInto( devList ); Chapter 9 - Bluetooth Security if( searchServices(devList) ) Chapter 10 - Wirel{ess Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Brleutetuoronth rAeppcloicratdio;ns with the Ericsson BlipNet Chapter 12 - Bluet}ooth and Jini Appendix A -}javax.bluetooth Appendix B - javax.obex Appendix C -rJeavtaurBlnuentouolthl;Development on the PalmOS Platform Append}ix D - BlipNet 1.1 API Index // This is the main method of this application. List of Fpiguubrleis c static void main(String[] args) List of T{ables List of ListingLs2CAPEchoClient client = null; List of Sidebars // Validate the proper number of arguments exist when starting this // application. if( (args == null) || (args.length != 1) ) { System.out.println( "usage: java L2CAPEchoClient " ); return; } // Create a new EchoClient object. try { client = new L2CAPEchoClient(); } catch( BluetoothStateException e ) { System.out.println( "Failed to start Bluetooth System" ); System.out.println( "BluetoothStateException: " + e.getMessage() ); } // Find an Echo Server in the local area ServiceRecord echoService = client.findEchoServer(); if(ecBhluoeSteorovthicfoer J!a=vanull ) { by Bruce Hopkins and Ranjith Antony ISBN:1590590783 /A/prersest©r2i00e3v(e352tphagees)connection URL string String conURL = The authors of this text describe how to develop wireless Java echoServiacppel.icgaetiotnCsounsninegcBtliuoetnoUoRthL(forSaevravriiectyeoRfepclaotrfodr.mNsO. AThUiTsHENTICATE_NOENCRYPT, false ); includes an API overview of the Java library, development of /B/luectoroetha-tbeasead sneerwvicecsl,iheignhtlighitnssotfasneccuerity concerns, and Emcohroe.Client echoClient = new EchoClient( conURL ); Table of Contents// and send the message give on the command line echoClient.sendMessage( args[0] ); Bluetooth for Java } Introduction else Chapter 1 -{Introducing Bluetooth Chapter 2 -SBylusetteoomt.ho1u.1t.println( "No Echo Server was found" ); Chapter}3 - Before You Get Started C}hapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP C/ha/ptCeral6le-dCrweahteinng aaBdlueevtoiocthePrwinatsSefroveurnwdithduJPrSinAPgI an inquiry. An inquiry C/ha/ptserea7rc-hJeavsa fanodrOdBeEXvices that are discoverable. The same device may C/ha/ptbere8re-tUusrinngeadBmluueltotoithplSeimutliatmoer s. Cphaupbtleric9 v-oBiludetdooetvhiSceecDuriitsycovered( RemoteDevice btDevice, DeviceClass cod ) C{hapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChapterSy11st-eEmn.teoruptri.seprBliunettolonth(A"ppFloicuatniodnsdweivthicthee E=ric"sso+n BbltipDNeevt ice.getBluetoothAddress() ); Chapterde12vi-cBeluLeitsoott.haadnddEJlinei ment( btDevice ); A}ppendix A - javax.bluetooth Appendix B - javax.obex // The following method is called when a service search is completed or Appendix C - Java Bluetooth Development on the PalmOS Platform // was terminated because of an error. Legal values include: Appendix D - BlipNet 1.1 API // SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_TERMINATED, In/d/exSERVICE_SEARCH_ERROR, SERVICE_SEARCH_DEVICE_NOT_REACHABLE Li/st/ofaFnigdurSeEs RVICE_SEARCH_NO_RECORDS LipstuobflTiacblevsoid serviceSearchCompleted( int transID, int respCode ) Li{st of Listings List of SSiydesbtaersm.out.println( "serviceSearchCompleted(" + transID + ", "+ respCode + ")" ); // Removes the transaction ID from the transaction table. removeFromTransactionTable( transID ); serviceSearchCount—; synchronized( this ) { this.notifyAll(); } } // Called when service(s) are found during a service search. // This method provides the array of services that have been found. public void servicesDiscovered( int transID, ServiceRecord[] servRecord ) { // If this is the first record found, then store this record // and cancel the remaining searches. if( record == null ) { System.out.println( "Found a service " + transID ); SysteBmlu.eotuoto.thprfoirnJtalvna( "Length of array = " + servRecord.length ); if( sbeyrBvruRceecHoorpdk[in0s]an=d=RannujilthlA)ntony ISBN:1590590783 { Apress © 2003 (352 pages) STyhse taeutmh.oorsuotf.tphrisitnetxtldne(scr"ibTehehowsetorvdievceeloprweciroelredss Jiasvanull" ); } applications using Bluetooth for a variety of platforms. This recoriBndlculeu=tdoeossthea-rnbvaARsPeeIdcosoveerrrdvvi[icee0ws],o;hf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and if( rmeocreo.rd == null ) { System.out.println( "The second try was null" ); Table of Con}tents Bluetooth for Java Introduction // Cancel all the service searches that are presently Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 -/I/ntrbodeuicningg Bpleuretfooorthmed. -fBolure(tooitnht1.1i=0; idiscType will be A/pp/enIdNixQBUI-RjYav_aCxO.oMbPeLxETED if the device discovery transaction ended normally, A/pp/enIdNixQCUI-RJYav_aERBlRuOeRtooithfDtevheelopdmeevnitcoen tdhiesPcaolmvOeSryPlattfroarmnsaction failed A/pp/entdoix Dco-mBplilpeNtete1.n1oArPmI ally, In/d/exINQUIRY_TERMINATED if the device discovery transaction Li/st/ofwFaigsurceas nceled by calling Li/st/ofDTiasbcleosveryAgent.cancelInquiry(). LipstuobflLiisctinvgosid inquiryCompleted(int discType) Li{st of Sidebars synchronized(this) { try { this.notifyAll(); } catch (Exception e) {} } } } // The EchoClient will make a connection using the connection string // provided and send a message to the server to print the data sent. class EchoClient { // Keeps the connection string in case the application would like to make // multiple connections to an echo server. private String serverConnectionString; // The constructor: creates an EchoClient object that will allow an // application to send multiple messages to an echo server. EchoClient( String server ) { Bluetooth for Java servebryCBoruncneeHcotpikoinnsSatnrdiRnagnji=th sAentrovneyr; } Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java // Sends aapplmiceastiosnasguesintgoBltuheteoosthefrovr earv.ariety of platforms. This public boiBnolculleuetdoaeonstha-snbeaAnsPedIdMoseveesrrsvviaiceegwse,o(hfigtShhtelirgJhaivtnsagolifbmsrsaercgyu,r)idtyevceolonpcemrenns,t of and { more. L2CAPConnection con = null; byte[] data = null; Table of Conitennttsindex = 0; Bluetooth forbJyavtae[] temp = null; Introduction Chapter 1 Chapter 2 Chapter 3 Chapter 4 -tIrntyroducing Bluetooth -{Bluetooth 1.1 - Befor/e/YoCurGeeat tSetaratedconnection to the server - Undecrsotannd=ing(Lth2eCJAaPvaCoBnluneetocotthioAnPI)Connector.open( serverConnectionString ); Chapter 5 Chapter 6 Chapter 7 Chapter 8 - Bluetooth with J2ME MIDP - Creat/in/g aDeBtlueertomoithnePrintthSeermvearxwiimthumJPSamAPoIunt of data I can send to the server. int MaxOutBufSize = con.getTransmitMTU(); - Java and OBEX temp = new byte[MaxOutBufSize]; - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security // Send as many packets as are needed to send the data Chapter 10 - WireledsastEamb=edmdsegd .SgyestteBmystweisth(t)h;e Micro BlueTarget Chapter 11 - EnterwphrisielBel(uetionodthexApp 0) { by Bruce Hopkins and Ranjith Antony ISBN:1590590783 sAypnrecshs r©o2n00i3z(3e5d2 p(agtesh)is) {The authors of this text describe how to develop wireless Java applictartioyns using Bluetooth for a variety of platforms. This iBnlculeutdo{eostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more. this.wait(); } Table of Contents} Bluetooth for}Java catch (Exception e) {} Introduction Chapter 1 -iIfnt(rodrueccinogrBdlu!et=oonthull ) Chapter 2 -{Bluetooth 1.1 Chapter 3 - BeforSeyYsotueGme.t oSutatr.tepdrintln( "Record is not null" ); Chapter 4 - Underrsetatnudrinng tthreuJea;va Bluetooth API Chapter 5 -}Bluetooth with J2ME MIDP Chapter 6 -eClrseaeting a Bluetooth Print Server with JPS API { Chapter 7 - Java and OBEX System.out.println( "Record is null" ); Chapter 8 - Using a Bluetooth Simulator return false; Chapter 9 - Bluetooth Security } Chapter}10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter//12 F-iBnludestootthheanfdiJrinsi t cable replacement peer that is available to connect to. AppendpixuAbl-ijacvaSxe.brluveitcooetRhecord findCableReplacementService() Append{ix B - javax.obex Appendix C -/J/avaIfBlutehtoeortheDaevreelopamneyntdoenvtihceePsalmtOhSatPlahtfaovrme been found by a recent inquiry, Appendix D -/B/lipwNet 1d.o1nA'PtI need to spend the time to complete an inquiry. Index RemoteDevice[] devList = agent.retrieveDevices(DiscoveryAgent.CACHED); List of Figureis f( devList != null ) List of Tables{ List of Listings List of Sidebars if( searchServices(devList) ) { return record; } } // Did not find any cable replacement peer from the list of cached devices. // Will try to find a cable replacement peer in the list of // pre-known devices. devList = agent.retrieveDevices( DiscoveryAgent.PREKNOWN ); if( devList != null ) { if( searchServices(devList) ) { return record; } } // Did not find a cable replacement peer in the list of pre-known or // cached devices. So start an inquiry to find all devices that could be // a cable replacement peer and do a search on those devices. try { agent.startInquiry(DiscoveryAgent.GIAC, this); Bluetooth for Java /b/y BWruacietHoupnktinislanadlRlantjihthe Adnteovniyces areISfBNo:u15n9d059b07e8f3ore trying to start the /A/presses r©v2i00c3e(35s2epaagrecs)h. sTyhencahutrhoonrsiozfetdh(isttheixtsd)escribe how to develop wireless Java {applications using Bluetooth for a variety of platforms. This iBnlculeutdoteorsthya-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more.{ this.wait(); Table of Contents Bluetooth for Java } } catch (Exception e) {} Introduction } Chapter 1 Chapter 2 Chapter 3 Chapter 4 -cIanttrcodhu(cinBglBuleutetooootthhStateException e ) -{Bluetooth 1.1 - BeforSeyYsotueGme.t oSutatr.tepdrintln( "Unable to find devices to search" ); -}Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 -iCfr(eatdinegvaicBeluLeitosotth.sPriinzteS(e)rve>r w0ith) JPS API { Chapter 7 - Java and OBEX devList = new RemoteDevice[deviceList.size()]; Chapter 8 - Using a Bluetooth Simulator deviceList.copyInto( devList ); Chapter 9 - Bluetooth Security if( searchServices(devList) ) Chapter 10 - Wirel{ess Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Brleutetuoronth rAeppcloicratdio;ns with the Ericsson BlipNet Chapter 12 - Bluet}ooth and Jini Appendix A -}javax.bluetooth Appendix B - javax.obex Appendix C -rJeavtaurBlnuentouolthl;Development on the PalmOS Platform Append}ix D - BlipNet 1.1 API Index List of F/ig/urTehs is is the main method of this application. List of Tpaubblelsic static void main(String[] args) List of L{istings List of SidebaSrsPP2COMM client = null; SppServerProcess server = null; int baudrate; // Validate the proper number of arguments exist when starting // this application. if( (args == null) || (args.length != 1) ) { System.out.println( "usage: java SPP2COMM " ); return; } // Create a new SPP2COMM object. try { client = new SPP2COMM(); } catch( BluetoothStateException e ) { System.out.println( "Failed to start Bluetooth System" ); System.out.println( "BluetoothStateException: " + e.getMessage() ); } // geBtluetthoeothbafourdJraavtae for the serial port from the command line baudrate = Integer.parseInt( args[0] by Bruce Hopkins and Ranjith Antony I)S;BN:1590590783 Apress © 2003 (352 pages) // make the connection to the serial port The authors of this text describe how to develop wireless Java try {applications using Bluetooth for a variety of platforms. This /in/clugdeets atnhAePI coovenrnveiecwtoifotnhe Java library, development of sBelureitoaolthp-obratsed=se(rSvitcerse,ahmigCholinghntescotfisoecnu)rCityonconneccetrnosr,.aonpden( "comm:1;baudrate=" + more. baudrate, Connector.READ_WRITE, true ); } Table of Concteanttcsh( Exception e ) { Bluetooth for Java System.out.println( "serial port open exception: " + e ); Introduction System.exit( 0 ); Chapter 1 -}Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 Chapter 4 Chapter 5 Chapter 6 -/B/efoorpeeYnoutGheet Sstaerrteidal port's output stream -tUrnyderstanding the Java Bluetooth API -{Bluetooth with J2ME MIDP - Creatsinegra_oBuluteto=othsePrrinitaSleproverrtw.iothpeJPnSOuAPtIputStream(); Chapter 7 -}Java and OBEX Chapter 8 -cUastincgha(BEluxectoeopthtiSoimnuleato)r Chapter 9 -{Bluetooth Security Chapter 10 - WirelSesyssEtmebme.doduetd.Spyrstienmtslwni(th "thseeMriicraolBlouueTtaprugett stream open exception: " + e ); Chapter 11 - EnterSpyrisseteBlmu.eetoxoitht(App0lic)at;ions with the Ericsson BlipNet Chapter 12 -}Bluetooth and Jini Appendix A - javax.bluetooth // open the serial port's input stream Appendix B - javax.obex try Appendix C - Java Bluetooth Development on the PalmOS Platform { Appendix D - BlipNet 1.1 API ser_in = serialport.openInputStream(); Index } List of Figurecs atch( Exception e ) List of Tables{ List of Listings System.out.println( "serial input stream open exception: " + e ); List of Sidebars System.exit( 0 ); } // Create a new SPP server object. try { server = new SppServerProcess(); server.start(); } catch( Exception e ) { System.out.println( "Failed to start Spp Server" + e ); System.exit( 0 ); } // the main loop runs forever. However, it can be stopped // by terminating the KVM from the command line while( true ) { // Create buffer to receive data from the serial port byte[] rxdata = new byte[64]; int rxlen=0; int data; Bluetooth for Java tbryyBruce Hopkins and Ranjith Antony {Apress © 2003 (352 pages) ISBN:1590590783 The a/ut/horrseoafdthiisnteaxtsdemsacrnibye bhoywtetos dfevreolomp wthirelessseJraival port applic/a/tionassuscinugrBrleunettoloyth afovraaivlaaribeltyeofbpulattfodromsn. oThtisexceed the iBnlculeutdo/eo/stha-cnbuaArsPerIdeosnveetrrvvibiceeuwsf,ofhfeigtrhhelilgJhaevtnsagoltifbhsra.ercyu,ridtyevceolonpcemrenns,t of and more.// The read() method blocks but is periodically released // by an InterruptedIOException in order to allow other Table of Contents Bluetooth for Java // things to happen meanwhile while( true ) { Introduction data = ser_in.read(); Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 - Introducing Bluetroxodthata[rxlen] = (byte)data; - Bluetooth 1.1 rxlen++; - Before You Get Sitafr(tedrxlen >= 64 || data == -1 ) - Understanding the JavabrBeluaekto;oth API - Bluetooth w}ith J2ME MIDP - Creating a SBylusettoeomth.oPruintt.Sperrivenrtwlinth( JP"SdaAPtIa received from serial port, len=" + - Java and OBEX rxlen ); Chapter 8 - Using a Bluetooth Simulator } Chapter 9 - Bluetooth Security catch( InterruptedIOException e ) Chapter 10 - Wirel{ess Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise SBlyusettoeomth.oAupptl.icpatrioinnstwlinth(th"esEerricisasoln BploiprNtet receive timeout: " + e ); Chapter 12 - Bluet}ooth and Jini Appendix A - javaxc.balutecthoo(thException e ) Appendix B - javax{.obex Appendix C - Java BluetoSoythstDeevme.loopumte.nptroinntthlenP(alm"OsSerPilaatflormport receive exception: " + e ); Appendix D - BlipN}et 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars // Did we get any data from the serial port? if( rxlen > 0 ) { // Do we have a Bluetooth connection already? if( bluetoothport != null ) { // Do we have an OutputStream on the BT connection already? if( bt_out == null ) { // no, then create one try { bt_out = bluetoothport.openOutputStream(); } catch( Exception e ) { System.out.println( "Bluetooth output stream open exception: " + e ); } } System.out.println( "send serial data on Bluetooth link" ); try { bt_out.write( rxdata ); bt_out.flush(); } Bluetcoaotthchfo(r JEaxvcaeption e ) by Bru{ce Hopkins and Ranjith Antony ISBN:1590590783 System.ouAtp.repsrsi©n2t00l3n((35"2Bplaguees)tooth output stream write exception: " + e); The a}uthors of this text describe how to develop wireless Java }applications using Bluetooth for a variety of platforms. This eiBnllcusleuetdoeostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and {more. System.out.println( "No Bluetooth link: try to establish one..." ); Table of Contents Bluetooth for Java Introduction // Find a cable replacement service in the local area ServiceRecord cableReplacementService = client.findCableReplacementService(); Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 - Introducing Bluetooth - Bluetooth 1i.1f( cableReplacementService != null ) - Before You{Get Started - Understanding th/e/JarvaetBrluieetovoeth tAhPIe connection URL string - Bluetooth with J2SMtErMinIDgP conURL = - Creating a Bluetooth PrcinatbSleerRveerpwliathceJPmSenAPtIService.getConnectionURL( - Java and OBEX ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false ); Chapter 8 - Using a Bluetooth Simulator try Chapter 9 - Bluetooth Security { Chapter 10 - Wireless Embedded Sy/st/emCsrweiathtetheaMiccroonBnleuceTtairogent to the SPP peer Chapter 11 - Enterprise Bluetooth Abpplluiceattioonostwhipthorthte E=ricsson BlipNet Chapter 12 - Bluetooth and Jini (StreamConnection)Connector.open( conURL ); Appendix A - javax.bluetooth } Appendix B - javax.obex catch(Exception e) Appendix C - Java Bluetooth D{evelopment on the PalmOS Platform Appendix D -SBylisptNetm1..o1uAtP.Iprintln( "Failed to establish Bluetooth link: " + e ); Index } List of Figures List of Tables if( bluetoothport != null ) List of Listings List of Sidebars { try { // open an OutputStream on the Bluetooth connection bt_out = bluetoothport.openOutputStream(); } catch( Exception e ) { System.out.println( "Bluetooth output stream open exception: " + e ); } // and send the data from the serial port System.out.println( "send serial data on Bluetooth link" ); try { bt_out.write( rxdata ); bt_out.flush(); } catch( Exception e ) { System.out.println( "Bluetooth output stream write exception: " + e ); } } } Blueteolosthe for Java by Bru{ce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 200S3y(s35t2epmag.eos)ut.println( "No SPP peer found" ); The a}uthors of this text describe how to develop wireless Java }applications using Bluetooth for a variety of platforms. This } includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. // do we have a Bluetooth connection already? if( bluetoothport != null ) Table of Con{tents Bluetooth for Ja/va/ do we have an InputStream on the Bluetooth connection already? Introduction if( bt_in == null ) Chapter 1 - Int{roducing Bluetooth Chapter 2 - Bluetoot/h/1.1no, then create one Chapter 3 - Before YtoruyGet Started Chapter 4 - Understa{nding the Java Bluetooth API Chapter 5 - Bluetooth withbJt2_MiEnM=IDPbluetoothport.openInputStream(); Chapter 6 - Creating}a Bluetooth Print Server with JPS API catch( Exception e ) Chapter 7 - Java and OBEX { Chapter 8 - Using a Bluetooth Simulator System.out.println("Bluetooth output stream open exception: " + e ); Chapter 9 - Bluetooth Security } Chapter 10 - W}ireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - B/lu/etlooitshtaennd Joinni the bluetooth connection Appendix A - jarvxalxe.bnlue=too0t;h Appendix B - jatvrayx.obex Appendix C - J{ava Bluetooth Development on the PalmOS Platform Appendix D - BlipNet/1/.1rAePaId in as many bytes from the serial port Index List of Figures List of Tables List of Listings List of Sidebars // as currently available but do not exceed the // current buffer length. // The read() method blocks but is periodically released // by an InterruptedIOException in order to allow other // things to happen meanwhile while( true ) { data = bt_in.read(); rxdata[rxlen] = (byte)data; rxlen++; if( rxlen >= 64 || data == -1 ) break; } System.out.println( "data received from bluetooth port, len=" + rxlen ); } catch( InterruptedIOException e ) { System.out.println( "Bluetooth port receive timeout: " + e ); } catch( Exception e ) { System.out.println( "Bluetooth port receive exception: " + e ); } try { System.out.println( "send Bluetooth data on serial link" ); Bluetooth fosreJra_voaut.write( rxdata ); by Bruce Hopskeinrs_aonudtR.afnljiuthshAn(t)o;ny ISBN:1590590783 Apress }© 2003 (352 pages) The autchaotrscohf(thEisxtcexetpdteisocrnibeeho)w to develop wireless Java applica{tions using Bluetooth for a variety of platforms. This SysteiBnmlcu.leuotdoueotsth.a-pnbraAisPenIdtoslveenrr(vviicee"wsB,olhfuigtehhteliogJhoavttsaholifbosruaerctyup,ruidtytevceoslontpcremerenansm,t aownf rdite exception: " + e ); more. } } } Table o}f Contents Bluetooth for Java Introdu/c/tionCalled when a device was found during an inquiry. An inquiry Chapter//1 s-eIantrrcodhuecsingfBolruetdoeovthices that are discoverable. The same device may Chapter//2 b-eBlureettooutrhn1e.1d multiple times. Chapterpu3bl-iBcefovroeiYdoudGeevt iSctaerDteidscovered(RemoteDevice btDevice, DeviceClass cod) Chapter{4 Chapter 5 Chapter 6 } Chapter 7 - Understanding the Java Bluetooth API -SBylusetteoomt.howuitth.Jp2rMiEnMtlIDnP( "Found device = " + btDevice.getBluetoothAddress() ); -dCerveaitcinegLaisBtlu.eatododthElPreinmteSnetr(verbwtiDthevJPiSceAPI); - Java and OBEX Chapter 8 - Using a Bluetooth Simulator // The following method is called when a service search is completed or Chapter 9 - Bluetooth Security // was terminated because of an error. Legal values include: Chapter//10 S-EWRiVreIlCesEs_ESmEbAeRdCdHe_dCSOyMstPeLmEsTwEiDth,thSeEMRiVcrIoCBEl_uSeTEaArRgeCtH_TERMINATED, Chapter//11 S-EERnVteIrCpEri_seSEBlAuReCtoHo_thERARppOlRic,atioSnEsRwViIthCEth_eSEErAicRsCsoHn_BDlEipVNIeCt E_NOT_REACHABLE Chapter//12 a-nBdlueStEooRtVhIaCnEd_JSinEi ARCH_NO_RECORDS AppendpixuAbl-ijacvavxo.biludetsooetrhviceSearchCompleted( int transID, int respCode ) Append{ix B - javax.obex ASppyesntdeixmC.o-uJtav.aprBliunettolonth(D"evseelorpvmiecnetSoenatrhcehPCaolmmOpSlePtlaetfdo(rm" + transID + Appendix D - BlipNet 1.1 API ", " + respCode + ")" ); Index List of Figure/s / Removes the transaction ID from the transaction table. List of TablesremoveFromTransactionTable( transID ); List of Listings List of SidebasrserviceSearchCount—; synchronized(this) { this.notifyAll(); } } // Called when service(s) are found during a service search. // This method provides the array of services that have been found. public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { // If this is the first record found, then store this record // and cancel the remaining searches. if( record == null ) { System.out.println( "Found a service " + transID ); System.out.println( "Length of array = " + servRecord.length ); if( servRecord[0] == null ) { System.out.println( "The service record is null" ); } record = servRecord[0]; System.out.println( "After this" ); Bilufe(toroethcoforrdJa=v=a null ) b{y Bruce Hopkins and Ranjith Antony ISBN:1590590783 ApressS©y2s00t3e(m35.2opuagte.s)println( "The Second try was null" ); T}he authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This iBn/lcu/leutdoCeoasthna-cnbeaAlsPeIdaoslveelrrvviticeehwse,ohfsigtehhrelivgJhiavtcsaeolifbssreaercayur,rcidtyheveceoslonpctemhrenanst,t aoanf rde presently m/o/re.being performed. for( int i=0; idiscType will be Chapter 8 - Using a Bluetooth Simulator // INQUIRY_COMPLETED if the device discovery transactions ended normally, Chapter 9 - Bluetooth Security // INQUIRY_ERROR if the device discovery transaction failed Chapter//10 t-oWicreolemspslEemtbeedndoerd mSaylstleym,s with the Micro BlueTarget Chapter//11 I-NEQnUteIrRpYri_seTEBlRuMeItoNoAthTEADppliicfatiotnhsewidthevthiecEericdsisosncBolvipeNreyt transaction was canceled Chapter//12 b-yBluceatlooltihnagndDJiinsi coveryAgent.cancelInquiry(). AppendpixuAbl-ijacvavxo.biludetioontqhuiryCompleted( int discType ) Append{ix B - javax.obex Appendix C -sJyavnachBlruoentoiozthedD(evetlohpimsen)t on the PalmOS Platform Appendix D -{BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars } try { this.notifyAll(); } catch (Exception e) {} } } class SppServerProcess extends Thread { /* the constructor */ SppServerProcess() { } public void run() { StreamConnectionNotifier Server = null; try { LocalDevice local = LocalDevice.getLocalDevice(); local.setDiscoverable( DiscoveryAgent.GIAC ); } catch( BluetoothStateException e ) { SBylusetteomo.therforr.Jparviantln( "Failed to start service" ); SbyysBtruecme.Heorprk.inpsrainndtRlann(jith"BAlntuoentyoothStaItSeBNE:x15c9e05p9t07i8o3n: " + e.getMessage() ); rAeptreusrs n©;2003 (352 pages) } The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This try includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and { more. // start the SPP server (with a fictional UUID) Server = (StreamConnectionNotifier)Connector.open( Table of Contents "btspp://localhost:FFEEDDCCBBAA99887766554433221100" ); Bluetooth for}Java Introduction catch( IOException e ) Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 -{Introducing Bluetooth - BluetSooytsht1e.1m.err.println( "Failed to start service" ); - BeforSeyYsotueGme.t eSrtarr.tepdrintln( "IOException: " + e.getMessage() ); - Underrsetatnudrinng;the Java Bluetooth API -}Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API System.out.println("Starting SPP Server"); Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator while( true ) Chapter 9 - Bluetooth Security { Chapter 10 - Wirel/es/s EamcbceedpdtedcSoynstneemcstwiiothnstheoMnilcryo BilfueTwaergeatre not yet connected Chapter 11 - Enteripfris(e BSlPuPet2oCoOthMMAp.pbllicuateiotnosowtihthpothretEr=ic=ssonnuBlllipN)et Chapter 12 - Bluet{ooth and Jini Appendix A - javax.bluettoortyh Appendix B - javax.obex{ Appendix C - Java Bluetooth D/ev/elowpamietntfoonrthienPcaolmmOiSngPlactfloirment connections (blocking method) Appendix D - BlipNet 1.1 API SPP2COMM.bluetoothport = Server.acceptAndOpen(); Index List of Figures List of Tables List of Listings List of Sidebars } } catch( IOException e ) { System.out.println("IOException: "+ e.getMessage()); } try { Thread.sleep( 1000 ); } catch( Exception e ) { } } } } Client Options Once you get data feeding the Micro BlueTarget and have SPP2COMM running on it, then you're all set from the server's point of view; you have created a fixed-wireless system. Now on the client side of things, you have a few options. Let's say that the vendor of the PLC makes a program to read and interpret the data from the PLC (when connected serially, of course). You really don't need to use the SPP2COMM in client mode at all; all you need to do is Bluetooth-enable your laptop and pair it with the Micro BlueTarget. The vendor's program will read the data from the PLC (via the Micro BlueTarget) through COMM7 or COMM8 (which are typical Serial Port Profile ports) instead of COMM1 or COMM2. Now let's say that all the preceding conditions exist, but for some reason you can't Bluetooth-enable the laptop that will read the data fromBlutheetoPoLtCh.fDoroJna'tvwaorry, there's hope for you too! All you need to do is attach another Micro BlueTarget to youbrynBornu-cBeluHeotpokoinths-aenndabRlaendjiltahpAtonptoannyd run the ISSPBPN:215C9O05M9M07p8r3ogram. Since this Micro BlueTarget is not collecting data ovAeprrietssss©er2i0a0l3p(o35r2t, pitagwesil)l automatically run in client mode and look for a Serial Port Profile server. It will then read the datTahferoamuththoersSoefrtiahilsPtoerxttPdreosfcilreibseehrvoewr,toanddevpeiploep twhairtedleastsaJatovaits own serial port. Your laptop can then use the vendor prograamppltiocarteioandsaunsdinigntBelruperteototthhefoPrLaCvdaraiteaty(tohfisptlaimtfoermvias.twThoisMicro BlueTargets) through a traditional serial includes an API overview of the Java library, development of port like COMM1Bolur eCtOooMthM-b2a.sIendthsiesrvciaceses,, hyioguhlhigahvtes mofasdeceuaritsyecrioanl-cteor-nwsi,realnedss bridge. more. Now let's say that you're in a very special situation in that the vendor doesn't make a program to read and interpret the data from the PLC. Now, you can be really creative and just make your own! In this case all you need is a JSR-82TaebnleabolfedCocnlietennt tdsevice (like a PDA or laptop), and you have to make a slight modification to SPP2COMM program. For Btluheetocoliethntfomr oJadveapart of it, instead of sending the data to the COMM port, just interpret, display, or process it. Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 In this chapter, yoAuprweessre©i2n0tr0o3d(3u5c2epdagteos)one of the first fully functional computing systems that is JSR-82 compliant: the MiTchroe BaulutheoTrasrogfett.hYisotuexsthdoeuslcdribbee fhuolwly taowdaerveeolofpitws iprehlyessiscaJal vaaspects for computational power, data connaepcptilviciatyt,ioannsduwsiinregleBslusectooomthmfuorniacavtaiorine.tyYoofupslahtofourlmd sa.lsTohibse familiar with HyNetOS, the operating systeminfoclrutdhees ManicAroPIBoluverTvaiergweot.f the Java library, development of Bluetooth-based services, highlights of security concerns, and Due to its small fomromref.actor, low power requirements, and extensibility, the Micro BlueTarget is a great device to create fixed-wireless systems and proofs of concepts for wireless applications. In Chapter 11, we'll explore what it takes to create scalable and robust wireless applications in Bluetooth that can handle Table of Contents more than just seven concurrent users. Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter 11: Enterp Bluetooth for Java rise Bluetooth Applications with by Bruce Hopkins and Ranjith Antony ISBN:1590590783 the Ericsson BlipNet Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Overview includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and As you have seenmionreth.e previous chapters of this book, the JSR-82 is a great API for creating Bluetooth applications with the Java language. With any vendor implementation of the JSR-82, you can create hundreds of client-server, peer-to-peer, cable replacement, and fixed-wireless Bluetooth applications. Table of Contents However, this API falls short when you need to create enterprise Bluetooth applications. So what's an BelunetteoroptrhisfeorBJlauveatooth application? Well, here are the major qualifications of an enterprise Bluetooth Inatpropdliuccattiioonn: Chapter 1 - Introducing Bluetooth ChaptCera2pab-ilBitlyuteotohoathnd1l.e1more than just seven active connections Chapter 3 - Before You Get Started ChaptAer c4onn- eUcntdioenrsrtaanngdeinggrtehaeteJarvthaaBnlujeutsoto3th0 AoPrI300 ft ChaptCere5ntra-liBzleudetcooomthmwuitnhicJ2aMtioEnMtoIDtPhe devices (also called nodes) that comprise your network Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptAer m7 ea-nJsavfoaramndanOaBgEinXg groups of nodes Chapter 8 - Using a Bluetooth Simulator ChaptAer m9 ea-nBslufoetrosoethssSioencumritaynagement when clients move between nodes ChaptNero1te0 O- fWcioreulersses,ECmlabsesdd1edBlSuyesttoeomths dweitvhictehse hMaicvreoaBlruaenTgaergoeft300 ft, but you must realize that if the Chapter 11 c-liEenntteirsparisCelaBsluse2tooorthCAlapspslic3atdioenvsicweit(hliktehemEorsictsmsoonbBilelippNheot nes and PDAs), then it doesn't matter Chapter 12 i-f tBhleuesteorovtehrainsdaJCinliass 1 device (like some LAN access points). Appendix A - javax.bluetooth ATppheendJSixRB-8-2jawvaasx.noobet xcreated to handle enterprise Bluetooth applications, and doesn't provide any way to AapdpednredsixsCth-eJparvoabBlelumetsoothtahtDeenvteelropprmiseenBt lounettohoethPaalmppOliScaPtliaotnfosrcman solve. ACppoennsdidixeDr t-heBlliopcNaettio1n.1s AwPhIere Bluetooth applications will be widely deployed, like shopping malls, airports, Inmdeuxseums, office buildings, and grocery stores. At a mall, for instance, the scaling issue is very important. LiIst'tsonfoFtigpurarecstical to create a Bluetooth-enabled information kiosk at a mall without being able to scale up to Lihsat nodf lTeabmleosre than just seven active connections. In order to accomplish this, your enterprise Bluetooth Liaspt polficLaisttioinngss will contain more than a single Bluetooth-enabled node. List of Sidebars Centralized communication is an important feature in enterprise Bluetooth applications because there's no way to implement group management or session management without it. For instance, in a Bluetoothenabled museum exhibit, there should be a way to activate or deactivate a group of nodes without disturbing the other nodes on the network. Session management comes into play in a Bluetooth-enabled retail location like a grocery store. Without session management, a customer may be offered the same ecoupon multiple times when passing by a different node in a grocery store. In an office building, providing wireless network access to Bluetooth-enabled clients is a common enterprise Bluetooth application. Session management in this scenario is also important so that clients can freely roam around the building without having to reauthenticate when they go in and out of range of different nodes. In order to create enterprise Bluetooth applications, you need more than just a single Bluetooth device and an API. Enterprise Bluetooth applications also require an infrastructure to be in place that will allow your system to be scalable and robust. The EricssoBlnueBtoolitphNfoer Jtava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The Ericsson BlipANperetscso©nt2a0i0n3s(3th52epiangfersa)structure, functionality, and scalability that will allow developers to create enterpriseTBhleueautothoothrsaopfptlhicias ttioexntsduessicnrgibtehehoJwavtao dlaenvgeuloapgwe.irAelnesasrcJahvitaecture diagram of the Ericsson BlipNet is shown ainppFliigcautrieon1s1u-1si.ng Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator ChaptFerig9ure- 1B1lu-e1t:oAotnh aSrecchuitreitcyture diagram of the Ericsson BlipNet Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Note Although the Ericsson BlipNet allows you to create enterprise Bluetooth applications in Java, it Chapter 12 - Bluetooth and Jini does not support the JSR-82. The JSR-82 is oriented toward creating applications where a Appendix A s-injagvleaxB.blulueettooootthhdevice communicates to other devices in a piconet. The BlipNet API is oriented Appendix B t-owjaavardx.mobaenxaging a network of Bluetooth-enabled nodes, where each node has the capability to Appendix C i-ntJearvaactBwluiethtoBotluheDtoeovethlo-pemnaebnlteodnctlhieenPtsa.lmOS Platform Appendix D - BlipNet 1.1 API InBdelxipNet Architecture List of Figures LiTsthoefcToarbelepsart of the BlipNet system is the BlipServer. The BlipServer itself is not Bluetooth enabled at all. LiIst tdoofeLsis, thinogwsever, have a direct TCP/IP connection to each of the BlipNodes (which are Bluetooth enabled) Liasnt dofcSoindterboalsrsthem via Java RMI. In order to create your enterprise Bluetooth applications, you write J2SE classes that interface with the BlipNet API. Now, since you're writing J2SE code here, you may realize that there's nothing preventing you from accessing external resources on behalf of your Bluetooth-enabled clients. In fact, that's the whole point of it. Using the Ericsson BlipNet, external resources such as databases, LDAP directories, Web servers, and e-mail servers are all available at your client's disposal (as long as you can access them via a Java API). This is reflected in Figure 11-2. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started ChaptFerig4ure- 1U1n-d2e:rsYtoanudcinagn tuhseeJtahvea BBlluipeNtoeottAhPAIPaI nd custom J2SE code to access external resources like Chaptdear t5aba-sBelsu,edtoiroetchtowriitehsJ,2aMnEd Me-ImDPail servers. Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CBhalpipteSr 8erv-eUrsing a Bluetooth Simulator Chapter 9 - Bluetooth Security The BlipServer does not require any specialized hardware and can run on either Windows or Linux Cohpapetreartin1g0 s-yWstieremless.sTEhmebsetdadtiesdticSsyostnemthsewBitlihpStheervMeircraoreBlpureeTtatyrgimetpressive: a Pentium 400 MHz computer Cwhaitphte2r5161MB- EonftRerApMrisecaBnlumetaonoathgeAp2p0li0caBtiloipnNs owditehs!the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ABppleipndNixoAd-ejsavax.bluetooth Appendix B - javax.obex AIpnpeanndeixntCer-pJraisvea BBlluueettooootthh Daepvpelilcoaptmioenn,tthoen BthliepSPaelrmveOrScPalnatnfoortmdirectly communicate to your BluetoothAepnpeanbdleixdDcl-ieBnltips;Nietth1a.s1tAoPinI terface with the BlipNodes. Each BlipNode is capable of multipoint Incdoemx munication and includes the following profiles to interact with clients: List ofGFeignuerreics Access Profile List of Tables List ofSLeisrtvinicgesDiscovery Application Profile List of Sidebars LAN Access Profile Object Push Profile Note The BlipNodes also conform to the WAP over Bluetooth interoperability requirements as defined in the Bluetooth specification. Your enterprise Bluetooth application will listen for events from the BlipNodes and act accordingly. For instance, let's say that you want to track where employees are in the building (assuming, of course, that they are wearing Bluetooth-enabled ID badges). When users come within range of a BlipNode, your application will listen to device-discovered events via the Generic Access Profile. The BlipNet system is sophisticated enough to let you know which BlipNode detected a user, so all you need to do is store that data in a database, and create another application to view the results. Now let's say that you're the manager of a hotel, and you want to allow your customers with Bluetoothenabled devices to send e-mails wirelessly from within the conference rooms. At these "e-mail stations," the BlipNodes will use the Object Push Profile to send clients the custom e-mail application (of course, this works well if the app is a JSR-82 application). Clients compose their e-mail using the custom application, and when they are ready to send the e-mail, they simply come within range of an e-mail station and push the e-mail OBEX object to the BlipNode. On the BlipServer, your enterprise Bluetooth application will be listening for an Object Push event, and will connect to an e-mail server to send the e-mail on behalf of the hotel guest. Note This miBglhutebteooathpefrofer cJtatvima e for you to try creating custom headers for your OBEX e-mail object. There'sbnyoBtrhuincge HstooppkpininsgaynoduRfarnojmithdAenfitnoinnyg a customIShBeNa:1d5e90r5f9o0r7t8h3e "to", "from", and "subject" fields foArptrheesse©-m20a0i3l.(352 pages) The authors of this text describe how to develop wireless Java As you can see, tahpepwliciaretiloensss ues-imngaiBl lsuteattoioonthscfoernaarvioarcielteyaorlfypdlaetmfoormnsst.raThteiss the difference between the programming pariancdliugdmess aonf tAhPeI JoSvRer-v8ie2wanofdtthheeJBavliapNliberta. rUys, idnegvtehloepJmSeRn-t8o2f, you can create the client app that generates theBluee-mtoaotilhO-bBaEseXdosberjevcicteasn, dhipghulsighhetss iot ftosetchueristey rcvoenr.ceOrnnse, oafntdhe major drawbacks, however, is that you need tmo oimrep.lement the Object Push Profile in your application code (which may be an inconvenience for inexperienced developers). On the other hand, the Object Push Profile is already TadbelefinoefdCwointhteinntthse BlipNet API, so all you need to do is write the event handling code when your object Balureritvoeosthfrfoomr Jyaovua r Bluetooth-enabled clients. InBtrloipduNctoiodne Installation Chapter 1 - Introducing Bluetooth CIhnasptatellra2tion- oBfluaetBoloiptNh o1d.1e is pretty simple. All you need to do is supply the Ethernet connection and power. CThahpetedre3vice- wBeilflotrheeYnoruegGiestteSrtiatsrteeldf to the BlipNet. Figure 11-3 is a picture of a single BlipNode unit. Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List ofFSigiduerbear1s1-3: A single BlipNode BlipManager Application The BlipManager tool is used to configure and administer the BlipNet system. As shown in Figure 11-4, the BlipManager gives you a visual representation of all the BlipNodes on your network. Figure 11-4: The BlipManager application Out of the box, the BlipManager comes with the following features: Bluetooth for Java Device filterinbgy Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 Security admTinhiestarauttihoonrs of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Node adminiisntcralutdioens an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and With the device fimlteorrien.g feature, you can block certain Bluetooth devices from using the BlipNet. You can create this filter based upon the client device's address or the device's class (i.e., laptop, cell phone, headset), or based upon the available services on the device. The security administration feature allows Taybolue toof aCsosnigtennPtIsNs for individual nodes, or for the entire BlipNet. Using the node administration features of BtluheetoBolitphMfoarnJaagvear, you can administer an individual node or create a group of nodes and administer them Inctorolleducctitvieolny. The node administration features also give you the ability to activate and deactivate the Cphraopftielers1on-yIonutrrondoudciensg. BUlsuientgooththis feature, it is very easy to configure multiple enterprise Bluetooth Cahpapptliecra2tion-sBolunetthoeotsha1m.1e BlipNet network. For instance, in a grade school environment, all the BlipNodes Cahtapthteere3ntra- nBceefooref tYhoeusGcehtoSotlacratendbe configured to use only the Object Push Profile so that parents and Cvhiaspittoerrs4are- gUrnedeetersdtawnidthinsgotmheeJianvfoarBmluaetitoonotahbAoPuIt the school. However, in the teacher's lounge, the CBhalipptNeor d5es-cBalnuebteooctohnwniethctJe2dMtEoMthIeDPsame network, but have only the LAN Access Profile activated so that Ctheaapctherer6s c-anCrgeeattinwgirealeBsluseItnotoetrhnPertianct cSeesrvse. r with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars BlipNet APIBlOuevtoeorthvifeorwJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The BlipNet 1.1 AAPpIrecsosn©si2s0ts03o(3f 562 ppaagceks)ages and 40 classes and interfaces that allow you to create enterprise BluetoTohthe aaputphliocrastioofntsh.isHteerxet'sdeaslcisritboefhtohwe BtolipdNeveetloppacwkiaregleesss: Java applications using Bluetooth for a variety of platforms. This com.ericssinocnlu.dbeslianpnAePtI .ovaeprivi.ebwloifptnheodJaeva library, development of Bluetooth-based services, highlights of security concerns, and com.ericssmoonre..blipnet.api.blipserver com.ericsson.blipnet.api.bluetooth Table of Contents Bluetocoothm.foerrJiavcasson.blipnet.api.event Introdcuoctmio.nericsson.blipnet.api.obex.pushobjects Chapter 1 - Introducing Bluetooth Chaptcero2m.e- rBilucestosootnh .1b.1lipnet.api.util Chapter 3 - Before You Get Started Thecom.ericsson.blipnet.api.blipnode package contains classes that deal directly with Chapter 4 - Understanding the Java Bluetooth API individual BlipNodes, like BlipNodeHandle. Conversely, the package Chapter 5 - Bluetooth with J2ME MIDP com.ericsson.blipnet.api.blipserver contains classes that deal with the BlipServer such as CBhalpitperSe6rv-eCrreaantidngBlaiBpluSeetorovtehrPCrionnt nSeercvteir ownit.hIfJPySouAaPIre looking for classes that pertain to BluetoothCshpaeptceifric7thi-nJgasvlaikaenBdlOuBeEtXoothAddress and ClassOfDevice, then they are found in the package Cchaopmt.erer8ic-sUssoinng.ablBilupentoeotth.aSpimiu.lbatlour etooth. Chapter 9 - Bluetooth Security CAhalmptoesrt1e0ve-rWy iarpelpelsicsaEtimonbewddilleudsSeyostneemosrwmitohrethoefMthiceroinBtelurefaTcaergsect ontained in the Cchaopmt.erer11ic-sEsnotenr.pbrisleiBplnueetto.oathpiA.ppelviceatniotnps awcikthagthee. TEhriicssspoanckBaligpNeectontains all the interfaces for listeners Cahnapdteerve1n2ts- wBliutheitnooththe aBnlidpNJienit. For instance, if you implement the BlipServerEventListener interface, AtphpeenndyioxuAc-anjarveacxe.bivlueectoaolltbhacks from the JVM when BlipNodeEvents,ConnectionEvents, and AOppbeenxdEixvBen-tjasvaarxe.oobcecxurring. The com.ericsson.blipnet.api.event package also includes the AOppbeenxdPixrCog-rJeavsasLBliusettoeontherDeinvteelorfpamceen, twohnicthheyoPualcmaOnSuPsleattfoordmetermine the progress of an OBEX object Atprpaennsdfeixr.D - BlipNet 1.1 API InWdehxen dealing with clients that support the Object Push Profile, the classes that form the Licstoomf.Feigruircess son.blipnet.api.obex.pushobjects package come in handy. This package contains LicsltaosfseTasbsleusch as ObexFile and ObexGenericObject that help you when you're sending or receiving LiOstBoEf XLisotbinjegcsts. For obvious reasons the com.ericsson.blipnet.api.util was designed to be a LiusttiloitfySpiadecbkargse, but at the moment it only contains a single class for icons: BlipNetIcons. CROSSREFERENCE See Appendix D for a complete list (with descriptions) of all the classes and interfaces of the BlipNet 1.1 API. Now that you have a good understanding of the BlipNet architecture and its APIs, let's look at an example demonstrating how to create an enterprise Bluetooth application using the Ericsson BlipNet. The BluetooBltuhetoDotehvfiocr eJavTaracker by Bruce Hopkins and Ranjith Antony ISBN:1590590783 A Bluetooth devicAeptrreascsk©e2r 0is03a(3n52epxtargeesm) ely useful enterprise Bluetooth application, but it's really an invaluable tool to anyone in the rTehtaeilabuuthsoinrsesosf.thWishtye?xtHdaevsecryiboeu heovwertboedeenvetloopa wgirroecleesrsy Jsatovare where the peanut butter is in aisle two, but the jelly iasplpolcicaatteiodnisnuasiisnleg Btwlueelvtoeo?thOfroer vaevnawrieotryseo,f tphleatcfoorfmfese. Tahnids the cream are eight aisles apart. includes an API overview of the Java library, development of In the near futureB, laulemtooostthe-bvaesreydmsoerbviliecepsh, ohnigehlwigihlltbseofBslueceutoriotythceonncaebrlnesd,,asnoda Bluetooth device tracker will help a grocery store mamnaogree.r to answer the following questions: Are customers wandering around aimlessly? Table of Contents BluetoDotohcfoonr sJiasvteant buying patterns exist? Introduction Which are the frequently traveled aisles? Chapter 1 - Introducing Bluetooth ChaptAerre2 th-eBaliuseletosoathrra1n.1ged properly? Chapter 3 - Before You Get Started ChaptHero4w lo-nUgndaerersctaunsdtoinmg ethrse inJatvhaeBslutoerteo?oth API Chapter 5 - Bluetooth with J2ME MIDP All these factors impact customer satisfaction and directly affect whether or not if the customer will return. Chapter 6 - Creating a Bluetooth Print Server with JPS API CTharpatcerki7ng-.Jjavaavaanids OaBsEimXple enterprise Bluetooth application that allows you to track Bluetooth devices using the CEharipctsesro8n B-lipUNsinegt. aOBf cluoeutorsoeth, bSeimfourelatyooru run Tracking.java, you have to have at least two BlipNodes connected Cthoapyoteurr9Blip-SBelurveteoro(tohthSeercwurisitey, it would be pointless to track devices with only a single node). Another prerequisite is Cthhaapttaeru1s0er-nWaimreeleassndEmpbaesdsdweodrdSytosttehmesBwliiptSh ethrveeMr imcruosBt laulerTeaardgyetbe created. In this example, the user name is CTharpatcerki11ng- aEnntderthperispeaBslsuwetoorodthisATprpaliccayt.ioYnosuwaitlhsothneeEerdictsosoanssBiglipnNtehte BlipNodes that you want to perform device Cthraapctkeinr g12to-aBglureotuopo.thInatnhdisJeinxiample the group is called First_Floor. Appendix A - javax.bluetooth Note Of course, you can create user names, passwords, and groups using the BlipManager application. Appendix B - javax.obex AIpnpeonrddeixr Cto-ruJanvtahBeluaeptpoloicthatDioenve(alonpdmtoenttraocnktheevePraylmdiOscSoPvleartafobrlme Bluetooth device), just execute the following AsptpaetnedmixeDnt,-aBtlitphNeect o1m.1mAaPnI d line: Index LijstaovfaFigTurraecs king First_Floor List of Tables List of Listings LiIsf tyoofuSwidaenbtatros track specific Bluetooth clients, then you need to provide their Bluetooth address at the command line, separated by spaces: java Tracking First_Floor 001122334455 007e3ba4780f 0065ca98bd2e This application starts off by calling the method initBlipServerConnection()in the constructor. In turn, initBlipServerConnection() obtains a BlipServerConnection object by calling the static method getConnection() from the BlipServer class. The parameters to this method include the user name and password that you've created, as well as the hostname of the BlipServer: BlipServer.getConnection("Tracking", "Tracy", "localhost"); Afterwards, a BlipServerEventFilter is created by calling the getEventFilter() method: BlipServerEventFilter blipServerEventFilter = getEventFilter(discoverBlipNodeGroup, terminalsToTrack); Finally, we're going to add an event listener to the BlipServerConnectioninstance by calling its addEventListener() method. blipServerConBnlueecttoioothn.foardJdaEvvaentListener(new TrackingEventListener(), by Bruce Hopkins and Ranjith Antony blipISSeBNr:v15e9r05E9v07e8n3tFilter); Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java TheaddEventLiasptpleicnaetiron(s)umsientghBoldueretoqoutihrefsoraaBvlairipeStyeorfvpelartEfovremnst. LThiisstener and (optionally) a BlipServerEveinnctluFdiels taenrA.PAI totvheisrvpieowinot,fwtheeaJlarevaadliybrhaarvye, daenveinlosptamnecnet ooff a BlipServerEventFilter on hand, so we creaBteluaetnoeotwh-inbasstaendcseerovficoeusr, ihningehrligchlatsssofTsreaccurkitiyncgoEnvceernnts,Lainsdtener.TrackingEventListener is more. a subclass of BlipServerEventAdapter, which, in turn, is an implementation of BlipServerEventListener. Table of Contents BWluehteoontBh lfuoertoJaovtah devices are detected, the events are passed to the inner class, and the inner class then prints out on the command line what's going on. The code for Tracking.java is shown in Listing 11-1. Introduction CLhaispttienrg111--1In: tTroradcukciinnggB.jlauveatooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started package com.ericsson.blipnet.samples; Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP import com.ericsson.blipnet.api.event.*; Chapter 6 - Creating a Bluetooth Print Server with JPS API import com.ericsson.blipnet.api.blipserver.*; Cihampptoerrt7 c-oJmav.aeranidcsOsBoEXn.blipnet.api.bluetooth.BluetoothAddress; Cihampptoerrt8 c-oUms.inegraicBsluseotono.thblSiimpunleatto.r api.blipserver.BlipNode; Chapter 9 - Bluetooth Security Cihampptoerrt10 j-aWviare.leustsiElm.bHeadsdhedtaSbylstee;ms with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Cphaupbtleric12 c-lBalusestooTtrhaacnkdiJningi { AppendpixrAiv-ajatveaxB.blluieptSooetrhverConnection blipServerConnection; AppendpixrBiv-ajtaveaxH.oabsehxtable terminalLastSeenOnThisBlipNode = new Hashtable(); Appendix C - Java Bluetooth Development on the PalmOS Platform AppendpixuDbl-iBclipTNreta1c.k1iAnPgI(String discoverBlipNodeGroup, Index BluetoothAddress[] terminalsToTrack) { List of Figures List of Tables// Get a connection to the server List of ListingisnitBlipServerConnection(); List of Sidebars BlipServerEventFilter blipServerEventFilter = getEventFilter(discoverBlipNodeGroup, terminalsToTrack); try { // Register the event Listener with the generated filter blipServerConnection.addEventListener(new TrackingEventListener(), blipServerEventFilter); } catch (BlipServerConnectionException e) { System.out.println("Error attaching listener"); e.printStackTrace(); System.exit(-1); } } private void initBlipServerConnection() { try { blipServerConnection = BlipServer.getConnection("Tracking", "Tracy", "localhost"); } catch (BlipServerConnectionException e) { System.out.println("Error connecting to server"); e.printStackTrace(); SBylusetteomo.thexfoirtJ(a-v1a); } catbcyhBru(cBelHioppSkeinrsvaenrdARcacnejisthsEAnxtcoenpytion e)IS{BN:1590590783 eA.pprersis n©t2S00t3a(c35k2Tpragaecs)e(); STyhse taeutmh.oorsuotf.tphrisitnetxtldne(s"crEibrerohorwrtoegdievsetloeprwinirgeleusssJearva- Have You created "+ application"sausuinsgeBrlnuaetmoeo/thpafosrsawvoarridetyfoofrplatthfoirsmsa. pThpilsication in BlipManager?"); SiBnylcusleuttdoeeomsth.a-enbxaAisPetId(os-vee1rr)vvi;iceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and } more. } Table opf rCiovnatetnetsBlipServerEventFilter getEventFilter(String discoverBlipNodeGroup, Bluetooth for Java BluetoothAddress[] terminals) { Introduction // List of BlipNodeIds used for tracking - is built from input Chapter 1 -/I/ntriodnu-clinignBelupetaoroathmeters entered at start up of Tracking application. Chapter 2 -BBlluueettoootoht1h.1Address[] blipNodeAddressList = null; Chapter 3 - Before You Get Started Chapter 4 -BUlnidperNsotadned[in]g tihneqJuaivaryBOluneltoyoBthliApPINodes = null; Chapter 5 -tBrluyet{ooth with J2ME MIDP Chapter 6 - CreatiinngqauiBrluyeOtonolthyBPrlinitpSNeordveerswi=th bJPlSipAPSIerverConnection.getBlipNodes (discoverBlipNodeGroup, "Discover Devices", false, false); Chapter 7 - Java and OBEX } catch (BlipServerConnectionException e) { Chapter 8 - Using a Bluetooth Simulator System.out.println("Could not get BlipNode handles "+ Chapter 9 - Bluetooth Security "for the BlipNode Group: "+ discoverBlipNodeGroup + "\n" + e); Chapter 10 - WireleSsyssEtmebme.dedxeid tS(y-st1e)m;s with the Micro BlueTarget Chapter 11 -}Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A -/ja/vaAxr.beluetthooetrhe any BlipNodes in the specified group ? Appendix B -ijafva(xi.onbqeuxiryOnlyBlipNodes.length > 1) { Appendix C - Java bBlluieptoNoothdeDAevdedlorpemsesnLtiosntth=e PalmOS Platform Appendix D - BlipNet 1.1 API new BluetoothAddress[inquiryOnlyBlipNodes.length]; Index for (int i = 0; i < blipNodeAddressList.length; i++) { List of Figures blipNodeAddressList[i] = List of Tables inquiryOnlyBlipNodes[i].getBlipNodeID(); List of Listings } List of Sideba}rs else { System.out.println("Have You inserted at least 2 BlipNodes " + "in the group (" + discoverBlipNodeGroup + ") ?"); usage(); } System.out.println("BlipNodes used for tracking (from group '"+ discoverBlipNodeGroup + "'):"); for (int i=0; i 0) { tBrluaectkoTohthesfoerTJearvmainals = new BluetoothAddress[numberOfTerminals]; fboyrBru(cienHtopikninpsuatnPdaRraanmjiethteArntCoonuynt=0; iInSpBNu:t15P9a05r9a07m8e3terCount < Apress © 2003 (352 pages) numberOfTerminals; inputParameterCount++) { The atutrhyors{of this text describe how to develop wireless Java applications/u/sinMgaBkleuetsouorthefoirta viasrieaty ovfapllaitdforTmesr. mThiinsalID (BluetoothAddress) iBnlculeutdoeostha-nbtaArsPeaIdcoskveeTrrhvvieiceeswse,oThfeigtrhhmeliigJhnavtasalolsifb[sriaercnyup,ruidtytevPceoalonrpcaemmrenenst,teaornf Cdount] = more. new BluetoothAddress(args[inputParameterCount+1]); } catch (IllegalArgumentException iae) { Table of Contents Bluetooth for Java System.out.println("TerminalId: " + args[inputParameterCount] + " is invalid. A valid id, e.g. " + Introduction "112233445566\n" + iae); Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter}6 - Introducing Bluetuosoathge(); - Bluetooth 1}.1 - Befor}e You Get Started -}Understanding the Java Bluetooth API -rBeluteutroonthtwriathcJk2TMhEeMseIDTPerminals; - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX private static void usage() { Chapter 8 - Using a Bluetooth Simulator System.out.println("The tracking application requires at least 2 " + Chapter 9 - Bluetooth Security "BlipNodes, please use BlipManager to specify the " + Chapter 10 - Wireless Embedded Systems wi"thBlthiepMNiocrdoeBIlduseTairngetthe group."); Chapter 11 - ESnytesrtperimse.oBluute.toporthinAtppllnic(at"ioSnpsewciithfythetEhreicsgsornoBulpipNneat me as first input parameter:"); Chapter 12 - BSluyesttooetmh.aonudtJ.inpi rintln("> Tracking MyGroup"); Appendix A - jaSvyasxt.belume.toooutth.println("Thereby the BlipNodes (specified in the " + Appendix B - javax.obex "BlipManager) in the group 'MyGroup' will be used. " + Appendix C - Java Bluetooth Development on"tThheePsaelmOBSliPplaNtfoodrmes must be"); Appendix D - BSliypsNtete1m..1oAuPtI.println("configured as 'Inquiry Only' BlipNodes. Use at " + Index "least two BlipNodes in the group."); List of Figures System.out.println("When no Terminal Ids are specified all " + List of Tables "discoverable devices will be tracked."); List of ListingsSystem.out.println("-------------------"); List of SidebarsSystem.out.println("If only specific terminal is to be tracked, the " + "Terminal Ids can be specified after the group " + "name, e.g.:"); System.out.println("> Tracking MyGroup 001122334455 000102030405"); System.out.println("Thereby the same BlipNodes as above be used " + "for tracking,"); System.out.println("and only the terminals with Ids 001122334455 " + "000102030405 will be tracked (terminal list can " + "be continued)."); System.out.println("-------------------"); System.out.println("In BlipManager a username/password pair must be " + "defined for the Tracking-application. Under " + "'BlipServer Properties',"); System.out.println("'Applications'; Create a new user with "+ "username/password: Tracking/Tracking."); System.exit(-1); } public static void main(String[] args) { // Must specify at least a BlipNode Group if (args.length<1) { usage(); } Bluetooth for Java BluetboyoBtruhcAedHdorpeksinss[a]ndtRraancjikthThAentsoenTyerminalIsSBN=:15p9a05r9s07e8T3erminalList(args); Apress © 2003 (352 pages) SysteTmh.e oautth.oprsroifntthlisnt(e"xt*d*esScrtibaerthoiwngto TdrevaeclokpiwngirelaepsspJlaivcaation **"); Systeampp.loicuattio.npsruisnintglBnl(u"et-o-o-th--fo-r-a-v-a-ri-e-ty-o-f-p-la-t-fo"r)m;s. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Trackmionrge. tracker = new Tracking(args[0], trackTheseTerminals); System.out.println("Tracking application started"); Table of Contents Bluetoo}th for Java Introduction C}hapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Note Please see the Tracker.java example in the "examples" directory of the BlipNet SDK for a more detailed Chapter 6 - Creating a Bluetooth Print Server with JPS API code explanation of the Tracker example. Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This chapter gaveApyroeussa©n 2in00tr3o(d35u2cptiaognes)to the concept of enterprise Bluetooth applications. At this point, you should understanTdhethaeusthcoernsaorifotshiws hteexret deenstcerripberisheowBlutoetdoeovtehloappwpliircealetisosnJsaavare best suited and the components thataaprpelincaeteiodnesdutsoincgreBaluteettohoetmh .foArsayvoaurihetayvoefspelaetnfo, remnste. rTphriisse Bluetooth applications cannot be built with just ainscilnugdeles BanluAePtoIootvhedrveiveiwceoaf nthdeaJnavAaPliIb. rary, development of Bluetooth-based services, highlights of security concerns, and Using the EricssomnoBrelip. Net, developers have the API, tools, and infrastructure in place in order to create scalable and robust enterprise Bluetooth applications. In the final chapter of this book, we'll examine how to network Bluetooth devices in a decentralized manner and create a Jini federations among Bluetooth Table of Contents devices. Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Chapter B1lu2e:tooBthlfuoreJatvoa oth and Jini by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Overview The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Well, you've madienciltutdoetsheanlaAsPtIcohvaeprtveier wofotfhteheboJaovka. Blibyrnaoryw,,dyeovuelsohpmouelndtboef fully aware of the capabilities of Bluetooth technoBlolugeytwooitthh-rbeasspeedcst etorvJicaevsa, .hAigshwligehtsstaotfesdeicnurCithyacpotnecre4r,ntsh,eanbdasics of any Bluetooth application consismt oorfe. Stack initialization Table of Contents BluetoDotehvifcoer mJavaanagement Introduction ChaptDere1vice- Idnistrcoodvuecriyng Bluetooth ChaptSere2rvic-eBdluisectoovoethry1.1 Chapter 3 - Before You Get Started ChaptSere4rvic-eUrendgeisrtsrtaatniodning the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP ChaptCero6mm-uCnriecaattiinogna Bluetooth Print Server with JPS API ChaptCerR7OS-SJ-ava and OBEX SeeChapter 4 for more details on the basics of a Bluetooth application. ChaptRerE8FER- UEsNinCgEa Bluetooth Simulator Chapter 9 - Bluetooth Security CNhaopwtepre1r0ha-pWs iyreolue'svseEhmebaerdddoefdJSinyisatesmwsewll.itIhf ythoeu MhaicvreonB'tluuesTeadrgitetbefore, then you should be at least aware Cthhaapttiet'rs1a1n-eEtwntoerrkpinrigseteBcluhentoolootghyA. pJpinliicaaltsioonhsawpipthenthsetoErbicessaosneBrvlipicNee-toriented technology like Bluetooth (i.e., Cahfatpetreyro1u2jo-inBltuheetonoethtwaonrdk,Jyinoiu are able to consume or provide services). ASppoe,nifdyixouA w- ajanvtatxo.bklnuoewtoohtohw to use Bluetooth and Jini together, then this is the chapter for you! Before we AgppoeanndyixfuBrt-hjearv,alex.to'sbfeirxst clearly define the following: Appendix C - Java Bluetooth Development on the PalmOS Platform AppenWdixhaDt -isBJliinpNi?et 1.1 API Index List ofHFoigwurdeoses Jini work? LiAstftoefr Twaeblaensswer those two questions, we can look at what it'll take to combine Jini and Bluetooth together. LiWsteo'fllLaislstionglosok at a device that already integrates Bluetooth and Jini together: the PsiNaptic PsiNode. List of Sidebars What Is JinBilNueetotowthoforrkJaTvea chnology? by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Jini network technAoplroegssy ©w2a0s03c(r3e5a2tpeadgebs)y Sun Microsystems to enable networked devices to communicate and share serviceTshewaithutlhitotlres oorf nthoishtuemxtadnesinctreibrveehnotwionto. Idnepvaerlot,pthwisirewleasssinJarveasponse to their (correct) perception that thaeppralipcaidtiloynins curseiangsinBglucetoomotphlefxoirtyaovfatrhieetyneotfwpolartkfoernmvsir.oTnhmisent would cause current practices in netwoinrcklumdeasnangeAmPIenovt etorvfiaeiwl coofmthpeleJtaevlay.lJibirnairsye,tdoeuvteltoopsmoelvnet tohfe following problems with distributed compuBtliunegt:ooth-based services, highlights of security concerns, and more. Networks are unreliable. Connections to other computers may disappear unexpectedly. Table oTfhCeolantteennctys of a network is variable. Delays in sending and receiving information are dependent on Bluetofoatchtoforsr sJauvcah as the physical medium, traffic on the network, and information routing algorithms. Introduction ChaptBera1ndw-idInthtroisdnucoitncgoBnlsuteatnoto.tLhike latency, there is often no guarantee of transmission capacity. Chapter 2 - Bluetooth 1.1 Networks are insecure. This is especially true of heterogeneous networks where the devices Chapteerxc3ha-ngBienfgorienfYoorumGaetiot nStcaartnendot control the path that the information takes. Chapter 4 - Understanding the Java Bluetooth API ChaptNere5two-rkBltuoeptoolootghiewsitahrJe2vMaEriaMbIDleP. This is most obvious in mobile networks when devices move between Chaptneret6wo-rkCarecacteinsgs apoBinlutest.oNotohwParindt Sinertvheer nweiathr fJuPSturAeP,Imultimode devices will move between network Chaptteyrp7es -(eJ.agv.,afraonmd OaBcEeXllular network to a wireless local area network to a wired desktop network). Chapter 8 - Using a Bluetooth Simulator ChaptAerd9min-isBtrluaetitoonotohf Sneectuwroitryks is not uniform. Multiple networks provide their own sets of rules, protocols, access, authorization, and security protocols, all controlled by different organizations and individuals. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Accessing and securing resources across these networks will be complicated because of inconsistent Chaptaerdm11in-isEtrnatteiorpnripsreaBcltuiceetso.oth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AppenAdicxcAes-sjaanvadxt.rbalunestpooortthation costs are variable. Appendix B - javax.obex AppenMdiaxnCy -diJfafevraeBnltudeetovoictehsDwevitehlodpifmfeernetnot ncotnhfeigPuarlamtiOoSnsP,lactafoprambilities, and operating systems will participate AppenidnixthDe -neBtlwipoNrekt.1.1 API InJdineixfederations are agnostic to the type of connection between the devices participating in the network. It Lidsot eosf nF'itgmuraetster if the participants are connected physically or wirelessly; the only requirement is that the Licsot nonf eTcatbiolenss are TCP/IP based. List of Listings List ofNSoidteebJainrsi also supports members in a federation with non-TCP/IP-based connections through surrogates. The functionality of members in a Jini federation can be summarized in six mechanisms: Lookup Discovery Join Leasing Transactions Events Lookup Lookup is a Jini service that acts much like a directory. For instance, if a printer wants to provide printer services to a Jini federation, then it must register that service with a Lookup Service. Conversely, if you are participating in a Jini federation, and you want to print, you must check the Lookup Service to see if any printer services are available. Note As you Bclaunetsoeoet,hfinfodrinJgasvearvices in Jini has a centralized approach by going through a Lookup Serviceb. yBBlureutcoeoHthophkaisnsaadnedcReanntrjaitlhizAendtoanpyproach to fIiSnBdNin:1g59s0e59rv07ic8e3s since you need to perform a search Aopnreesasc©h2d0e03vi(c3e52inpaygeosu) r piconet to find what services are available. The authors of this text describe how to develop wireless Java Discovery applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and The process of finmdoinreg. a suitable Lookup Service in a Jini federation is referred to as discovery. Note The concept of discovery in Jini is radically different compared to that in Bluetooth. In Jini, Table of Condtisecnotvsery is simply finding a Lookup Service. In Bluetooth, discovery allows you to find Bluetooth Bluetooth fodreJvaivcaes as well as the services that they offer. Introduction Join Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 COhanpcteera3Lo-okBuepforSeeYrvoiuceGehtaSstbaerteend found, a service may join that Lookup Service by providing one or more CJhaavpateor b4jec-tsU.nTdheerstJaonindinpgrotthoecoJal vdaefBinlueestothoethmAPeIchanism to accomplish this. Chapter 5 - Bluetooth with J2ME MIDP Leasing Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CThahpeteurse8 of- aUsreinsgoua rBcleueintoaotJhinSiifmeduelartaotrion is granted for a specific amount of time. This concept is known Cahsapateler a9se-. TBhlueetdouortahtiSoencuorfittyhe lease may be fixed by the grantor or negotiated. To maintain the use of a Cshearpvtiecre1(0inc- lWudirinelgessseErvmicbeesddjoeindeSdystoteLmosowkuitph StheervMicicerso),BtlhueeTlaeragseet must be renewed periodically. This allows Cfhoarpttheer 1e1xp-irEantitoenrparnisde cBlleuaentouopthofAspeprlivciacteiosntshawtitahrethneoElroicnsgseornrBelqipuNireetd, or whose owners have left the federation. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ATppreandnixsBa-cjatvioaxn.osbex Appendix C - Java Bluetooth Development on the PalmOS Platform Atransaction allows a set of operations to be grouped in such a way that they either all succeed or all fail. Appendix D - BlipNet 1.1 API To the members of the federation, the group of operations in the transaction appear to function as a single Index unit. List of Figures List of Tables LiEstvoef Lnisttisngs List of Sidebars An object residing on a device may register an interest in an event occurring in another object residing on a different device in the federation and receive notification when the event occurs. Thus, events provide a mechanism for maintaining consistency of state information in the federation. How Jini WBolurektosoth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 So, let's first definAepraesJsin©i S20e0r3 v(3i52cpeaIgetse) m. A ServiceItem is comprised of a service object and some attributes. The only real restriction on ServiceItem objects is that they be serializable. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This There are typicalliynctlhurdeees eanntiAtiPeIsoinvveorvlvieewd oinf athJeinJai vfeadleibrraatrioy,n:development of Bluetooth-based services, highlights of security concerns, and Service Provmidoerres. are the entities that provide a Java-based software service. The service can be pretty much anything and doesn't necessarily have anything to do with the device that hosts the provider. For instance, a Jini-enabled printer can provide a printer service in a Jini federation, but Table othfeCreo'nstneontthsing stopping it from providing a random number generator service to the federation as Bluetowoethll.for Java Introduction ChaptSere1rvic-eICntorondsuucminegrsBlaureetocoletharly the entities that have an interest in using the services that are available Chaptienr t2he -JiBnliufeetdoeortahti1o.n1. ChaptLeroo3ku-pBSeeforrveicYeosu(LGUetSS)taarretetdhe Jini services that act on behalf of Service Providers to host their Chaptseer r4vice- sU.nTdheirsstisanadlisnogththee"JdairveacBtolurye"totohtaht ASPeIrvice Consumers use in order to find services in the Chaptfeerd5era-tiBolnu.etooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API CBhaepfoterre7the-feJadvearaatniodnOiBsEfoXrmed, these entities must exist (see Figure 12-1). Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List ofFLigisutinregs12-1: These three entities must exist before a Jini federation is established. The federation List ofitSseidlfebhaarssn't been formed because the entities don't know anything about each other yet. Discovering a Lookup Service In order to get the ball rolling, the clients (Service Providers or Service Consumers) must discover a Lookup Service. Note A Jini federation can have more than one Lookup Service. Jini defines three discovery mechanisms: Multicast announcement from a Lookup Service Multicast request from a client Unicast request from a client A Lookup Service can use multicast announcements periodically to advertise its presence on the network. Interested clients, Service Providers or Service Consumers in particular, can use the information provided in an announcement to communicate with the Lookup Service. Clients use multicast requests to discover a Lookup Service. A Lookup Service receiving a request responds directly to that client. Once the address of a Lookup Service is known, a client sends a unicast request directly to the Lookup Service. Bluetooth for Java The LifecyclebyoBfrauceSHeorpvkiicnseaPndroRvanidjitehrAntony Apress © 2003 (352 pages) ISBN:1590590783 Now, let's assumTehtehaatuathLoorsookfutphiSsetrevxict edeisscmribaekihnogwpetoriodedvicelmopulwticiraesletsasnJnaovuancements. A Service Provider hears an announacpepmliecantti,oanns dusriencgeBivleusetforootmh ftohreaLvoaorkieutpy oSfeprvlaictfeoritmssS.eTrhvisiceRegistrar. A ServiceRegistinrcalurdeiss aanJaAvPaI oovbejervcitetwhaotfisthseimJapvlay ltihberapryu,bdliecvienltoeprmfaecnettoof the Lookup Service. It allows a client to register sBelurveitcoeost,hl-oboakseudpsseervrivcicees,sh, iagnhdligrhetqsuoefsstencoutriifticyactoionnceorfncsh, aanndges in the Lookup Service. This more. interaction is shown in Figure 12-2. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator ChaptFerig9ure- 1B2lu-e2t:oTothheSSeecurvriictye Provider discovers the Lookup Service and receives its ChaptSerer10vi-cWeiRreelgesissEtmrbaerddoebdjeScyt.sTtehmesSweitrhvtihceeMRiecrgoiBsltuerTaarrgiestused to interact with the Lookup Service Chaptveira1it1s -puEbntliecrpmriestehoBdluse.tooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AIpnpethnedifxinAal-sjtaevpaxo.fbtlhueetdooistchovery process, the Service Provider receives the ServiceRegistrar object, Awppheicnhdixit cBa-njuavseaxt.oobreexgister its ServiceItem with the Lookup Service. ALppeeansdinixgCa-SJeavrvaicBeluIetetomotahnDdevJeolionpimngenat FonedtheeraPtaiolmnOS Platform Appendix D - BlipNet 1.1 API InWdehxen a Service Provider registers its ServiceItem as shown in Figure 12-3, it also specifies a lease Lidsut roaftiFoignufroersthe service. If the registration is successful, the Lookup Service will keep the service registered LifsotroaftTlaebalsetsthat length of the lease requested, or provide a duration of its own. It's up to the Service LiPstroovfidLiesrtintogsrenew the lease as required. After the ServiceItem is registered with the Lookup Service, the LiSsteorvficSeidPebroarvsider has joined the federation. Figure 12-3: The Service Provider registers its ServiceItem with the Lookup Service. Note The leasing mechanism is an important part of Jini technology because it allows devices to clean up unused resources. If a lease expires (or if it can't be renewed because the lease grantor or holder has left the federation), the associated resource can be released. Now that we have a federation with a Service Provider in it, it's time to look at things from the Service Consumer's perspective. The Lifecycle of a Service Consumer Bluetooth for Java The Service ConsbuymBreurcaelsHoopstkainrtssaitnsdliRfeancjyitchleAbnytodniyscovering aISLBNo:o1k59u0p59S07e8r3vice. It uses the same discovery mechanApisrmessst©ha20t 0a3 S(3e52rvpiacgeesP) rovider uses. The Service Consumer can use any of the three discovery mechanThisemasu,thbourtsinofththisisscteexntadreios,clreibt'es hsoawy tthoadt ethveeloSpewrviirceeleCssoJnasvuamer is using a multicast request to find a LapopolkicuaptioSnesrvuicsien.gTBhliuseitsooilltuhsftorar taedvainrieFtiyguorfepl1a2tf-o4r.ms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Figure 12-4: The Lookup Service receives a multicast request from the Service Consumer and Chapter 7 - Java and OBEX responds with a unicast message containing the ServiceRegistrar object. Chapter 8 - Using a Bluetooth Simulator CThahpeteSre9rvic-eBCluoentosoutmh eSredcuerviticye makes a number of periodic multicast requests. When a Lookup Service Crheacpeteivre1s0a-reWqirueelesst,sitErmebspedodnedds SwyisthteamssimwipthlethmeeMssicargoeBtluheaTt acrognettains its ServiceRegistrar object. At Cthhaisptpeor i1n1t t-heEnSteerrvpirciseeCBolunestuomotehrAisppplaicrattoiofntshewiftehdtehreatEiorinc.sson BlipNet Chapter 12 - Bluetooth and Jini AWppiethndthixeAS-erjavviaxc.ebRlueegtoiosthtrar in hand, the Service Consumer can use its lookupmethods to look for AuppseenfudlixseBrv-icjaevsa. x.obex ATppheenldoixokCu-pJamvaetBhloudestooofththDeeSveelrovpmiceentRoengithsetPraalmr OoSbjPelcattfroerqmuire a ServiceTemplate object as an AaprpgeunmdixenDt.-TBhliipsNteemt 1p.l1atAePmI ay contain nothing more than an array of class types. It's that simple! You get Inbdaecxk either the service object itself, or a special object (ServiceMatches) containing all the services that Limstaotcf hFeigduryeosur template. This process is illustrated in Figures 12-5 and 12-6. List of Tables List of Listings List of Sidebars Figure 12-5: The Service Consumer uses the local ServiceRegistrar object to look up services that are registered in the Lookup Service. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents BluetoFoitghufroer 1Ja2v-a6: The ServiceItem requested is returned to the Service Consumer and can be used Introdloucctaiollny. Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 ChaptNero3te T-hBoeufogrhe nYootucGruect iSatlatroteudnderstanding how the Service Consumer gets a service, it's useful to Chapter 4 k-nUonwdethrsattaandrienqgutehseteJadvsaeBrvluiceetoiostmh AaPrsIhalled on the Lookup Service before being passed to the Chapter 5 S- eBrlvuiecteooCtohnwsiuthmJe2rM. BE aMsIicDaPlly, the service object is flattened and serialized, and then served as a file to the Service Consumer. Once received, the Service Consumer's JVM unmarshalls the Chapter 6 - Creating a Bluetooth Print Server with JPS API object into an instantiation of the service object. Chapter 7 - Java and OBEX COhanpcteerth8e S- eUrsviincge aCBolnuseutomoethr hSaimsuthlaetodresired ServiceItem, it can use the service locally. "Under the Cchoavpeterrs"9the- Bselurevticoeotmh aSeyccuorimtymunicate back to the Service Provider as shown in Figure 12-7. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 12-7: Once activated on the Service Consumer, the Service Provider's service may communicate directly with the Service Provider device as part of the service offered. IntegratingBJluinetoi oathnfdorBJalvuaetooth by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Now that you havAeparecslse©ar20u0n3d(3e5r2sptaagnedsi)ng of the basics of a Jini federation, let's examine the possible scenarios of whatT'sheinavuotlhvoerds wofhtehnisintetexgtrdaetsincgribJeinhi oawndtoBdlueevteoloopthwtoirgeeletshseJra. va applications using Bluetooth for a variety of platforms. This All-Bluetooth Jini Federation includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. As the name implies, in an all-Bluetooth Jini federation, all the devices participating in the federation are Bluetooth enabled. For such a scenario to take place, the Bluetooth devices must discover each other and Tafbolremoaf Cpoicnotneent.tsSince a requirement of a Jini federation is that the connections between the devices be BTluCetPo/oIPthbfaorseJadv, athe Bluetooth devices in an all-Bluetooth Jini federation would be connecting with either of Inthtreodfoulclotiwoning TCP/IP-based Bluetooth profiles: Chapter 1 - Introducing Bluetooth Dial-Up Networking Profile Chapter 2 - Bluetooth 1.1 ChaptLerA3N A-cBceefsosrePYroofuileGet Started Chapter 4 - Understanding the Java Bluetooth API ChaptPere5rson- aBlluAerteoaotNh ewtwithorJk2inMgE PMrIoDfiPle Chapter 6 - Creating a Bluetooth Print Server with JPS API Note Invariably, a manufacturer could make an all-Bluetooth Jini device without providing any of the Chapter 7 p-rJeacveadainngd BOlBuEeXtooth profiles in its product. For instance, the manufacturer can satisfy the TCP/IP Chapter 8 r-eUqusiinregmaeBnlut ebtyoostimh pSliymiumlaptloermenting the BNEP protocol. The major drawback, however, is that Chapter 9 t-hoBslueetdoeovtihceSsecwuirllitbye totally incompatible with devices from other manufacturers. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CAhaftpetretrh1e1p-icEonnteetrphraissebBeleuenteoostthabAlipsphleicdataionnds twhiethIPthaedEdrriecssssoens BhlaipvNeebt een assigned, the Jini federation can Cbheapftoerrm1e2d-. ABltutehtisoopthoinant,dthJiisnifederation is just like any other Jini federation. If other Bluetooth devices want AtpopejonidnixthAe -fejdavearax.tibolnue, ttohoetyhmust first join the piconet, obtain an IP, and then join the Jini federation. Since AtphpeenIPdixneBtw-ojarkvaisx.roubnenxing over Bluetooth, this federation is wireless. An example of an all-Bluetooth Jini AfpepdeenrdaixtioCn-isJasvhaowBlnueintoFoitghuDreev1e2lo-8p.ment on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure 12-8: In an all-Bluetooth Jini federation, all the devices participating in the federation must be Bluetooth enabled. This federation is wireless. Hybrid Bluetooth Jini Federation In a hybrid Bluetooth Jini federation, one or more devices are Bluetooth enabled. Note however that all the devices are physically connected by traditional TCP/IP connections, and the federation is not wireless (unless the TCP/IP network is WLAN). There are no special precautions that need to be taken care of, so this federation is formed in the usual manner. Any of the devices in the federation can be Bluetooth enabled, but it makes sense that either the Service Provider or the Service Consumer have Bluetooth capability so it can act as a bridge between the Jini federation and an outside Bluetooth piconet elsewhere. A hybrid Bluetooth Jini federation is shown in Figure 12-9. Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started ChaptFerig4ure- 1U2n-d9e:rsIntaandhinybgrtidheBJluaveatoBoltuhetJoinoithfeAdPeIration, at least one of the devices participating in the Chaptfeerd5era-tioBnluemtouostthbweitBhluJe2tMoEotMhIeDnPabled. This federation is not (necessarily) wireless, and the JiniChaptBerlu6eto-oCthr-eeantianbgleadBdlueevtiocoethacPtrsinatsSaerbvreirdgweithbeJtPwSeAePnI the Jini federation and an external Bluetooth Chaptpeirc7one-t.Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars A Jini-BluetBoluoettoho-thEfnoraJbavlaed Device: The PsiNaptic PsiNode by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Dallas SemicondAupcrtoesrsh©as20a03p(r3o52dpuacgtelsin) e of sensors that can be connected to a two-wire bus (power and ground) called 1-TWheirea.uTthhoerys hoaf vtheisatJeaxtvadedsecvriebleophmowentot pdleavtefolormp wainredlersesfeJraevnace design called Tiny Internet Interface (TINI) thaaptpilniccaltuiodnessuasi1n-gWBirlueeitnotoetrhfafcoer .aPvsaiNrieatpytiocfInpcla.tfhoarms cs.oTmhbisined the TINI chipset with an Ericsson BluetootinhcmludoedsulaeninAPaI roevfeerrveienwceodf ethseigJnapvalaltifborramry,thdaetvtehloepymheanvet onfamed, PsiNode. The PsiNode platform is capabBleluoeftoaocthtin-bgaasesdasJeirnviicLeoso, khuigphSligehrvtsicoef hsoecsut raitnydciosnaceprenrsf,eacnt dsolution for creating a low-cost, small-footprint, remmoorete. 1-Wire sensor/controller. A picture of the PsiNode is shown in Figure 12-10. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptFerig7ure- 1Ja2v-a10a:nTdhOeBPEXsiNode development platform. The Ericsson Bluetooth module is covered by two Chaptmere8tal -plUastiensg, aanBdluiestocootnhnSeicmteudlattoorthe Dallas Semiconductor TINI microcontroller. Chapter 9 - Bluetooth Security ChaptNero1te0 A- nWyiroerldeisnsaErymTbIeNdIddedevSicyest(eim.es., waitnhotnh-eBMluiectroooBthlu-eeTnaarbgleetd TINI) can function as a Jini Lookup Chapter 11 S- eErnvticerepirnisae BJilnuiefteodoethraAtpiopnli.cPatsioiNnas pwtiicthatlhseo mEriacksesosnsBoflitpwNaerte for this purpose (called JMatos), and Chapter 12 y-oBuluceatnoogthetaint dfroJmini their Web site (http://www.psinaptic.com). Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars The BenefitBsluoetofoBthlufoer tJaovoa th and Jini by Bruce Hopkins and Ranjith Antony ISBN:1590590783 So what are the aAdpvraenssta©g2e0s03o(f3i5n2tepaggreas)ting Bluetooth and Jini into devices? In the case of mobile devices, an all-Bluetooth JTihnei feaudtehroartsioonf athllioswtesxdtedveicscersibteohfoowrmto"sdmevaerltoepr"wnieretwleossrkJsa.vAa Jini federation allows Bluetooth devicesaptopliincatetiroonpseurasitnegwBitlhuemtooorteh ffloerxiabivliatyr,iewtyithoof uptlabtfeoinrmgsc.oTnhsistrained by the limits of Bluetooth profiles. More impinocrltuadnetslya, na AJPinIiofevedrevriaetwioonfbtrhinegJsavtoa ltihberatrayb,ldeetvheelocpomnecnetpotsf of events, transactions, and leasing, which allBolwuestfooorthm-boaresefdauseltr-vtoicleersa, nhtigahnlidghrtosboufsst eBcluureittyooctohnaceprpnlsic,aatniodns. more. In a hybrid Bluetooth Jini federation, Bluetooth devices that are not capable of joining the federation and using its services can interact with the bridge device and consume the services of the federation. Table of Contents Conversely, the bridge device can provide wireless services to the Jini federation by interacting with an Beluxetteorontahl fBolruJeatovaoth piconet. Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Summary Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 In this chapter, wAepgraesvse©yo20u03an(35o2vpeargveise)w of the principles and concepts of Jini network technology. We also presented anThoeveaurvthieowrsooffththeis"hteoxwtsd"eascnrdib"ewhhoyws"tfoodr einvteelgoprawtinirgeleBslus eJatovoath and Jini together in order to create some realalyppcolicoaltwioinres luessisngapBpluliectaotoiothnsf.orBoa tvhaJriinetiyaonfdpBlalutfeotromost.hTchoismplement each other for creating networked appliciantciolundse.sJainni bArPiIngosvetrovitehwe toafbtlheeaJdavanlicberdarny,edtwevoerkloinpgmceanpt aofbilities such as leasing and distributed eventsB,lwuehtioleotBhl-ubeatsoeodthsearlvliocwess, thhieghmligehmtsboefrsseocfutrhitey nceotnwcoerrknst,oabned small, power efficient, and wireless. more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars AppendixBluAeto:otjhafovr aJaxva.bluetooth by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This appendix conAptariensssa©ll20th0e3 (f3i5e2ldpsagaesn)d method signatures of the classes, interfaces, and exceptions that comprise the javTahxe.abulthuoerstofotthhis pteaxctkdaegsecroibf ethheoJwStRo-d8e2vAelPopI. wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Class BluetBolueotothothC-boasnednseercvticieos,nhEigxhlicghetspotfisoecnurity concerns, and more. // fields Tasbtleatoif cCoinntetntFsAILED_NOINFO Bsluteatotoithc foirnJtavaNO_RESOURCES Insttroadtuicctionint SECURITY_BLOCK Cshatpatteric1 i-nItntrTodIuMcEinOgUBTluetooth Cshatpatteric2 i-nBtlueUtNooAtChC1E.1PTABLE_PARAMS static int UNKNOWN_PSM Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API // constructors Chapter 5 - Bluetooth with J2ME MIDP BluetoothConnectionException(int error) CBhalputeerto6ot-hCCroeantninegcatiBoluneEtoxocthepPrtinitoSne(rivenrtwiethrrJPoSr,APIjava.lang.String msg) Chapter 7 - Java and OBEX C/ha/ptmeret8ho-dUssing a Bluetooth Simulator Cihanptterge9tS-tBaluteutsoo(t)h Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BluetBoluoettohoSthtfaotreJaEvxa ception by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpsress © 2003 (352 pages) BluetoothStatTehEe xacutehpotrsioofnt(h)is text describe how to develop wireless Java BluetoothStataeppElxiccaetiopntsiuosnin(gjBalvuaet.oloathngfo.rSatvrairinegty omfspgla)tforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class DataEBllueemtooethnftor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int BOTOhLe authors of this text describe how to develop wireless Java static int DAaTppAlLicTations using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of static int DABTluSeEtoQoth-based services, highlights of security concerns, and static int INmTo_re1. static int INT_16 static int INT_2 Tasbtleatoif cCoinntetntIsNT_4 Bsluteatotoithc foirnJtavaINT_8 Insttroadtuicctionint NULL Cshatpatteric1 i-nItntrSodTuRcIinNgGBluetooth Cshatpatteric2 i-nBtlueUt_ooItNhT1_.11 Cshatpatteric3 i-nBtefoUr_eIYNoTu_G1e6t Started Cshatpatteric4 i-nUtndUe_rsItaNnTd_in2g the Java Bluetooth API Cshatpatteric5 i-nBtlueUt_ooItNhTw_i4th J2ME MIDP Cshatpatteric6 i-nCtreaUt_inIgNaT_B8luetooth Print Server with JPS API Cshatpatteric7 i-nJtavaURanLd OBEX Cshatpatteric8 i-nUtsinUgUaIDBluetooth Simulator Chapter 9 - Bluetooth Security // constructors Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget DataElement(boolean bool) Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet DataElement(int valueType) CDhaapttaerEl12em-eBnlute(tioontth avnadlJuinei Type, long value) ADppaetnadEixlAem-ejanvta(xi.bnlutetvooatlhueType, java.lang.Object value) Appendix B - javax.obex A/pp/enmdeixtCho-dJsava Bluetooth Development on the PalmOS Platform AvppoeinddixaDdd-EBlliepmNeetn1t.(1DAaPtI aElement elem) Inbdoeoxlean getBoolean() Liistnotf FgigeutrDeas taType() LilstoonfgTagbeletsLong() Liistnotf LgisettinSgisze() LijstaovfaS.ildeabnagrs.Object getValue() void insertElementAt(DataElement elem, int index) boolean removeElement(DataElement elem) Class DevicBeluCetloaotshsfor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpsress © 2003 (352 pages) DeviceClass(iTnhte arutehcoorsrodf)this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of // methods Bluetooth-based services, highlights of security concerns, and int getMajorDmeovrie.ceClass() int getMinorDeviceClass() int getServiceClasses() Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class DiscoBlvueetroyotAhgfoernJatva by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int CATCheHEaDuthors of this text describe how to develop wireless Java static int GIaAppClications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of static int LIBAluCetooth-based services, highlights of security concerns, and static int NOmTo_reD.ISCOVERABLE static int PREKNOWN Ta/b/le moef tChoondtesnts BbluoeotoloethanforcJaanvacelInquiry(DiscoveryListener listener) Inbtoroodluectaionn cancelServiceSearch(int transID) CRhaepmtoerte1De-vIintcreod[u]cinrgeBtlruieteovoethDevices(int option) Cihanptterse2ar-cBhluSeetroovtihc1e.1s(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, Chapter 3 - Before You Get StarteDdiscoveryListener discListener) Cjhaapvtaer.l4an-gU.nSdterrsitanngdinsgeltheecJtaSvaerBvluiectoeo(thUUAIPID uuid, int security, boolean master) Cbhaopotlerea5n -sBtluaerttooItnhqwuiithrJy2(MiEnMtIDaPccessCode, DiscoveryListener listener) Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface DBisluceotovotehrfyorLJiasvtaener by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int INTQheUIaRutYh_oCrsOoMfPtLhEisTtEeDxt describe how to develop wireless Java static int INaQppUlIicRaYtio_nEsRuRsOinRg Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of static int INBQluUeItoRoYth_-TbEaRseMdIsNeArTviEceDs, highlights of security concerns, and static int SEmRoVrIe.CE_SEARCH_COMPLETED static int SERVICE_SEARCH_DEVICE_NOT_REACHABLE static int SERVICE_SEARCH_ERROR Tasbtleatoif cCoinntetntSsERVICE_SEARCH_NO_RECORDS Bsluteatotoithc foirnJtavaSERVICE_SEARCH_TERMINATED In/t/rodmuecttiohnods Cvhaopitder d1ev-iIcnterDodiusccinogvBelrueetdo(oRthemoteDevice btDevice, DeviceClass cod) Cvhaopitder i2nq-uBilureytCoootmhp1l.1eted(int discType) Cvhaopitder s3er-vBiecfoerseDYiosucGoevt eSrtaerdte(dint transID, ServiceRecord[] servRecord) Cvhaopitder s4er-vUincdeeSrsetaanrdcinhgCothmepJlaevateBdlu(eitonotth tArPIansID, int respCode) Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface L2BClueAtoPotChofonr nJaevaction by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int DETFheAUaLutTh_oMrsToUf this text describe how to develop wireless Java static int MIaNppIlMicUaMtio_nMsTuUsing Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and // methods more. int getReceiveMTU() int getTransmitMTU() Tabboleoloef aCnonrteenatdsy() BilunettoorthecfoeriJvaeva(byte[] inBuf) Invtoroidductsioennd(byte[] data) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface L2BClueAtoPotChofonr nJaevactionNotifier by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // method Apress © 2003 (352 pages) L2CAPConnectiTohen aautchcoerspotfAtnhdisOtpexetnd(e)scribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class LocaBlDlueetvooicthefor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // methods Apress © 2003 (352 pages) java.lang.StrTihengautgheotrsBolfutehtisotoetxthdAedsdcrribeeshso(w) to develop wireless Java DeviceClass gaepptlDiceavtioincseuCslinagsBsl(u)etooth for a variety of platforms. This includes an API overview of the Java library, development of int getDiscovBelureatobolthe-(b)ased services, highlights of security concerns, and DiscoveryAgenmtoreg.etDiscoveryAgent() java.lang.String getFriendlyName() static LocalDevice getLocalDevice() Tasbtleatoif cCojnatevnat.slang.String getProperty(java.lang.String property) BSlueertovoithcefoRreJcaovard getRecord(javax.microedition.io.Connection notifier) Inbtoroodluectaionn setDiscoverable(int mode) Cvhaopitder u1pd-aItnterRodeuccoinrgdB(lSueetrovoithceRecord srvRecord) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class RemoBltueeDtooetvhifcoreJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpress © 2003 (352 pages) protected RemToheteaDutehvoirscoef(tjhaisvtae.xtldaensgcr.ibSethroiwngto adedvderloepsws)ireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of // methods Bluetooth-based services, highlights of security concerns, and boolean authemnotrei.cate() boolean authorize(javax.microedition.io.Connection conn) boolean encrypt(javax.microedition.io.Connection conn, boolean on) Tabboleoloef aCnoneteqnutasls(java.lang.Object obj) Bjluaevtoao.thlafonrgJ.aSvatring getBluetoothAddress() Injtarovdau.cltioanng.String getFriendlyName(boolean alwaysAsk) Cshatpatteric1 R-eImntortodeuDceinvgiBcleuetgoeotthRemoteDevice(javax.microedition.io.Connection conn) Cihanptterha2sh-CBoludeet(oo)th 1.1 Cbhaopotlerea3n -iBseAfourtehYeonutGiect aSttaerdte(d) Cbhaopotlerea4n -iUsnAduetrshtaonrdiinzgedth(ejJaavvaaxB.lumeitocorthoeAdPIition.io.Connection conn) Cbhaopotlerea5n -iBsluTertuoostthewdiDtheJv2iMcEeM()IDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface SeBlruveitcooethRfeorcJoavrad by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int AUTTheHEaNutThIoCrsAoTfEt_hEisNtCexRtYdPeTscribe how to develop wireless Java static int AUaTppHlEicNaTtioInCsAuTsEin_gNBOlEuNetCoRoYthPTfor a variety of platforms. This includes an API overview of the Java library, development of static int NOBAluUeTtoHoEthN-TbIaCseAdTsEe_rNviOceEsN,ChRigYhPliTghts of security concerns, and more. // methods int[] getAttributeIDs() TaDbaletaoEf lCeomnteennttsgetAttributeValue(int attrID) Bjluaevtoao.thlafonrgJ.aSvatring getConnectionURL(int requiredSecurity, boolean mustBeMaster) InRteromdoutcteioDnevice getHostDevice() Cbhaopotlerea1n -pIontpruodluactinegRBelcuoetrodo(thint[] attrIDs) Cbhaopotlerea2n -sBeluteAttoottrhi1b.1uteValue(int attrID, DataElement attrValue) Cvhaopitder s3et-DBeevfoirceeYSoeurGveit cSetaCrlteadsses(int classes) Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class ServiBclueeRtoeotghifsortrJaavtaionException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpsress © 2003 (352 pages) ServiceRegistTrheataiutohnoErsxocfetphtisitoenxt(d)escribe how to develop wireless Java ServiceRegistarppalticiaotionnEsxucseinpgtBilounet(ojoathvafo.rlaavnagri.eStytorfipnlagtfomrsmgs). This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class UUIDBluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpsress © 2003 (352 pages) UUID(long uuiTdheVaalutuheo)rs of this text describe how to develop wireless Java UUID(java.lanagpp.lSictartioinnsgusuinugiBdlVuaetlouoeth,fobroaovlaeriaenty osfhpolarttfoUrUmIsD. )This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and // methods more. boolean equals(java.lang.Object value) int hashCode() Tajbalevao.f lCaonntge.nSttsring toString() Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars AppendixBluBeto:otjhafovr aJaxva.obex by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This appendix conAptariensssa©ll20th0e3 (f3i5e2ldpsagaesn)d method signatures of the classes, interfaces, and exceptions that comprise the javTahxe.aoubtheoxrspoafctkhaisgeteoxtf dtheescJrSibRe -h8o2wAtPoId. evelop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Interface AuBluthetoeontht-ibcasaetdoserrvices, highlights of security concerns, and more. // methods TaPbalessowf oCrodnAteuntthsentication onAuthenticationChallenge(java.lang.String description, Bluetooth for Java boolean isUserIdRequired, boolean isFullAccess) Inbtyrotdeu[ct]iononAuthenticationResponse(byte[] userName) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface CBlileuenttooSteh sfosr iJoavna by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // methods Apress © 2003 (352 pages) HeaderSet conTnheecatut(hHoersaodfetrhSisettexthdeeasdcreibresh)ow to develop wireless Java HeaderSet creaapptleicHaetioandseursSinegtB(l)uetooth for a variety of platforms. This includes an API overview of the Java library, development of HeaderSet delBeluteeto(oHthe-abdaeserdSseetrvihceesa,dheigrhsli)ghts of security concerns, and HeaderSet dismcoorne.nect(HeaderSet headers) Operation get(HeaderSet headers) long getConnectionID() TaObpleeroaf tCioonntenptust(HeaderSet headers) BvluoeitodothsefotrAJuavtahenticator(Authenticator auth) InvtoroidducstioentConnectionID(long id) CHhaepatderer1Se-tIntsreodtuPcaintghB(lHueetaodoethrSet headers, boolean backup, boolean create) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface HBelauedtoeortSh efotr Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int APTPheLIaCutAhToIrsOoNf_tPhAisRtAeMxtEdTeEsRcribe how to develop wireless Java static int COaUppNlTications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of static int DEBSluCeRtoIoPthT-IbOaNsed services, highlights of security concerns, and static int HTmToPre. static int LENGTH static int NAME Tasbtleatoif cCoinntetntOsBJECT_CLASS Bsluteatotoithc foirnJtavaTARGET Insttroadtuictcionint TIME_4_BYTE Cshatpatteric1 i-nItntrTodIuMcEin_gIBSlOu_et8o6o0th1 Cshatpatteric2 i-nBtlueTtYooPtEh 1.1 Cshatpatteric3 i-nBtefoWrHeOYou Get Started Chapter 4 - Understanding the Java Bluetooth API C/ha/ptmeret5ho-dBsluetooth with J2ME MIDP Cvhaopitder c6re-aCtreeaAtuintghaenBtluiectoaotthioPrninCthSaelrlveernwgieth(jJPaSvaAP.Ilang.String realm, boolean userID, Chapter 7 - Java and OBEX boolean access) Cjhaapvtaer.l8an-gU.sOinbgjaecBtluegtoeotthHeSaimduelrat(oir nt headerID) Cihanptt[er]9 ge-tBHlueeatodoetrhLSiescutr(it)y int getResponseCode() Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget void setHeader(int headerID, java.lang.Object headerValue) Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface OBpleuertaoottihofnor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // methods Apress © 2003 (352 pages) void abort() The authors of this text describe how to develop wireless Java HeaderSet getaRppelciceaitiovnesduHseinagdBelruset(o)oth for a variety of platforms. This includes an API overview of the Java library, development of int getResponBslueeCtooodthe-(b)ased services, highlights of security concerns, and int getResponmsoereC.ode() Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class PassBwluoetrodotAhufotrhJeavnatication by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpress © 2003 (352 pages) PasswordAutheTnhte iacutahtoirsoonf(tbhyisttee[xt]deusscreibreNahomwe,to bdyevteelo[p]wpiraelsessswJoarvda) applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of // methods Bluetooth-based services, highlights of security concerns, and byte[] getPasmsowreo.rd() byte[] getUserName() Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class RespBolunestoeotCh ofodr Jeasva by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // fields Apress © 2003 (352 pages) static int OBTEhXe _aDutAhToArsBoAfStEh_isFtUeLxtLdescribe how to develop wireless Java static int OBaEppXl_icDaAtioTnAsBuAsSinEg_BLlOuCetKoEoDth for a variety of platforms. This includes an API overview of the Java library, development of static int OBBEluXe_toHoTthT-Pb_aAseCdCsEePrTviEceDs, highlights of security concerns, and static int OBmEoXre_.HTTP_BAD_GATEWAY static int OBEX_HTTP_BAD_METHOD static int OBEX_HTTP_BAD_REQUEST Tasbtleatoif cCoinntetntOsBEX_HTTP_CONFLICT Bsluteatotoithc foirnJtavaOBEX_HTTP_CREATED Insttroadtuictcionint OBEX_HTTP_ENTITY_TOO_LARGE Cshatpatteric1 i-nItntrOodBuEcXin_gHBTlTuPet_oFoOthRBIDDEN Cshatpatteric2 i-nBtlueOtBooEtXh_1H.1TTP_GATEWAY_TIMEOUT Cshatpatteric3 i-nBtefoOrBeEYXo_uHGTeTt PS_taGrOteNdE Cshatpatteric4 i-nUtndOeBrsEtaXn_dHinTgTtPh_eIJNaTvaERBNluAeLto_oEthRRAOPIR Cshatpatteric5 i-nBtlueOtBooEtXh_wHiTthTJP2_MLEEMNGIDTPH_REQUIRED Cshatpatteric6 i-nCtreaOtBinEgXa_HBlTuTePto_oMthOVPrEinDt_SPeErRveMr with JPS API Cshatpatteric7 i-nJtavaOBanEdXO_HBETXTP_MOVED_TEMP Cshatpatteric8 i-nUtsinOgBaEXB_luHeTtoToPth_MSUimLuTl_atCoHr OICE Cshatpatteric9 i-nBtlueOtoBoEtXh_SHeTcuTrPit_yNO_CONTENT static int OBEX_HTTP_NOT_ACCEPTABLE Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget static int OBEX_HTTP_NOT_AUTHORITATIVE Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet static int OBEX_HTTP_NOT_FOUND Cshatpatteric12 i-nBtlueOtBooEtXh_aHnTdTJPin_i NOT_IMPLEMENTED AsppteantdiixcA i-njatvaOxB.bEluXe_tHooTtThP_NOT_MODIFIED AsppteantdiixcB i-njtavaOxB.oEbXe_xHTTP_OK AsppteantdiixcC i-nJtavaOBBlEuXe_toHoTthTPD_evPeAloRpTmIeAnLt on the PalmOS Platform AsppteantdiixcDi-nBtlipONBetE1X._1HATPTI P_PAYMENT_REQUIRED Insdteaxtic int OBEX_HTTP_PRECON_FAILED LissttoaftFiigcuriens t OBEX_HTTP_PROXY_AUTH LissttoaftTiacbleisnt OBEX_HTTP_REQ_TOO_LARGE LissttoaftLiisctinignst OBEX_HTTP_RESET LissttoaftSiicdebianrst OBEX_HTTP_SEE_OTHER static int OBEX_HTTP_TIMEOUT static int OBEX_HTTP_UNAUTHORIZED static int OBEX_HTTP_UNAVAILABLE static int OBEX_HTTP_UNSUPPORTED_TYPE static int OBEX_HTTP_USE_PROXY static int OBEX_HTTP_VERSION Class ServeBlruReteooqtuh efosr tJaHvaandler by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // constructoArpress © 2003 (352 pages) protected SerTvheeraRutehqourseosfttHhaisntdelxtedre(s)cribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of // methods Bluetooth-based services, highlights of security concerns, and HeaderSet cremaotree.HeaderSet() long getConnectionID() void onAuthenticationFailure(byte[] userName) Taibnletoof nCCoonntennetcst(HeaderSet request, HeaderSet reply) BilunettooothnDfoerlJeatvae(HeaderSet request, HeaderSet reply) InvtoroidducotionnDisconnect(HeaderSet request, HeaderSet reply) Cihanptteron1 Ge-tI(ntOrpodeurcaintgiBolnuetoopo)th Cihanptteron2Pu-tB(luOepteoortaht1i.1on op) Cihanptteron3Se-tBPeafotrhe(YHoeuaGdeet rSStaerttedrequest, HeaderSet reply, boolean backup, boolean create) Cvhaopitder s4et-CUonndneersctatnidoinngIDth(elJoanvag Bilude)tooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface SeBlsuestiooonthNfoor tJiafviaer by Bruce Hopkins and Ranjith Antony ISBN:1590590783 // methods Apress © 2003 (352 pages) javax.microedTihte iaoutnh.oirsoo.fCtohnisnteecxttdieosncribaecchoewpttoAnddevOeploepnw(SireelrevsseJraRveaquestHandler handler) javax.microedaipptliicoantio.nisou.sCinognBnleucettoioothnfoarcacveapriteAtynodfOpplaetnfo(rSmesr. vTheirsRequestHandler handler, includes an API overview of the Java library, development of Bluetooth-based services, highlights of security conceArnust,haenndticator auth) more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars AppendixBluCeto:otJh aforvJaavaBluetooth Development on the by Bruce Hopkins and Ranjith Antony ISBN:1590590783 PalmOS Platform Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java The purpose of thaipspalipcapteionndsixuissintog dBelumetoonosthtrafoter ahovwartieotygeotf sptlaarttfeodrmuss.inTghisthe Impronto Developer Kit 1.0 for PalmOS (the PalimnclDuKde).s an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Note For momreourep.dated information, please consult the Palm DK user guides. TaSblue pofpCoonrtteendts Bluetooth Protocols Bluetooth for Java InTthroedPucatlimonDK supports the following Bluetooth protocols: Chapter 1 - Introducing Bluetooth RFCOMM Chapter 2 - Bluetooth 1.1 ChaptLer2C3 AP- Before You Get Started Chapter 4 - Understanding the Java Bluetooth API ChaptSerD5P - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API OBEX Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars System ReqBluueirtoeomthefonr tJasva by Bruce Hopkins and Ranjith Antony Here are the systAepmrersesq©ui2r0e0m3 (e3n52tspafgoers)the Palm DK: ISBN:1590590783 Pentium-basTehdePaCutwhoitrhs aotf ltehaisstte6x4tMdBesocrfibReAhMow to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Microsoft WinBdluoewtoso2th0-0b0asseedrvsiecrevipcaecs,kh1ig(holrighhitgshoefr)security concerns, and more. Minimum 35MB of free disk space Table oJDf CKo1n.3te.1nts BluetoPoathlmfoOr SJadveavice with PalmOS 4.0 (or higher) Introduction ChaptPera1lm B- lIunetrtoodouthcinSgDBIOluectaorodth(or) Sony Bluetooth Memory Stick Chapter 2 - Bluetooth 1.1 CNhaopwte, rd3eve-loBpeinfogreoYrdoiunaGreyt, Ssttaanrtde-dalone Java applications on the PalmOS can be a little cumbersome Cbheapctaeurs4e y-ouUnndeeerdstatondcirnegatteheyoJauvraaBplpuleictaootiothn,AcPoI mpile it, build a PRC, and deploy (i.e., HotSync) it on the PDA. It gets even more cumbersome if you develop wireless Java applications because you'll need to Chapter 5 - Bluetooth with J2ME MIDP create two applications (client and server code) and deploy to two PDAs. Because of this, it is highly Chapter 6 - Creating a Bluetooth Print Server with JPS API recommended that you also get the following: Chapter 7 - Java and OBEX ChaptPera8lmO- SUseinmgualaBtolure3to.5o,thwiSthimPualalmtoOr S 4.0 ROM (or higher) and Palm's Bluetooth stack Chapter 9 - Bluetooth Security ChaptTerD1K0B-luWeirtoeloetshsPEamlmbedDdeevdeSloypsetersmKs iwt (itinhctlhuedeMsicTroDBKluBelTuaertgoeotth hardware). CThahpistecro1n1fig-uErnattieornpriisseshBoluwentoionthFiAgpuprelicCat-i1o.ns with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure C-1: With the TDK Bluetooth Developer's Kit and the PalmOS emulator, you can develop, deploy, and test your Java Bluetooth applications all within the environment of your development m achine. Included SoBlfutewtoaorthefor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 The following itemApsraesres ©in2c0lu03d(e3d52ipnatghees) Impronto Developer Kit 1.0 for PalmOS: IBM WebSphTehreeaMuitchroorsEonfvtirhoisnmteexnt tdfeosrcrPibaelmhoOwSt(othdeevJe9loKpVwMir)eless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Apache ANTBbluueiltdoototho-lbased services, highlights of security concerns, and more. Java Bluetooth APIs Table oDfeCmoontaepnptlsications Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars InstallationBluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Installation is pretAtyprseimssp©le2.00In3 (o3r5d2epragteos)run the installer, just execute devkit.exe, and follow the on- screen instructionTsh.eTahuethinosrstaollfatthioisn toefxtthdeesImcrpibreonhtoowDteovdeelovepleorpKwitirweliellsaslsJaovianstall WebSphere Micro Environment. applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of To complete yourBlinuesttaololtahti-obna,seindstsaelrlvtihceesn, ehcigehslsigahrtys.pofrcseficleusritoyncyoonucerrPnDs,Aa.nTdhe Impronto Developer Kit files are more. idev_midp_j9.prc Table of Contents Bluetoiodthevfo_rrJaavcas.prc Introduction idev_utils.prc Chapter 1 - Introducing Bluetooth Chaptierd2ev_- wBrluaepto.optrh c1.1 Chapter 3 - Before You Get Started CThahpeteJr94VM- .Upnrcdserasrtaenndainmgetdhe Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP cdlc15.prc Chapter 6 - Creating a Bluetooth Print Server with JPS API Chaptjer97_vm- _JbavuanadnldeO.BpErXc Chapter 8 - Using a Bluetooth Simulator Chaptjer99pre-fB.lupertocoth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget midp15.prc Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CAhaftpetreyro1u2 h-aBvleuectoomotphleatneddJyinoiur installation, verify that everything is correct by running the sample AappepnlidciaxtiAon-:MjaIvDaPx.-bCluheatoto.tAh screenshot of this application is shown in Figure C-2. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Figure C-2: The MIDP-Chat application Appendix D: BlipN Bluetooth for Javaet 1.1 API by Bruce Hopkins and Ranjith Antony ISBN:1590590783 This appendix, prAepsreenstse©d 2h0e0r3e(3w52itphagpees)rmission from Ericsson, contains descriptions of all the fields and method signatureTsheofatuhtehocrlas sosfetsh,isintteexrtfadceescsr,ibaendhoewxcteopdtieovneslotphawticreolmespsrJisaevathe BlipNet 1.1 API.[1] applications using Bluetooth for a variety of platforms. This Note For moirnecliundfoersmaantiAoPnIaobvoeurvtieBwlipoNf etht,esJeaevahtltipbr:/a/wryw, dwe.veerilcospsmoenn.ct oomf /blipnet. Bluetooth-based services, highlights of security concerns, and more. Class BlipNetIcons Table of Contents BpluuebtoloithcfocrlJaasvas BlipNetIcons extends java.lang.Object Introduction //Package Chapter 1 - Introducing Bluetooth com.ericsson.blipnet.api.util Chapter 2 - Bluetooth 1.1 C/ha/pFtierel3ds- Before You Get Started Cshatpatteric4 i-nUtndBeLrsItaPnMdAinNgAtGhEeRJ_aIvaCOBNluetooth API Cshatpatteric5 i-nBtlueBtLooItPhNwOiDthEJ_2AMLEAMRMID_PICON Cshatpatteric6 i-nCtreaBtLinIgPaNOBDluEe_toIoCthONPrint Server with JPS API Cshatpatteric7 i-nJtavaBLanIdPONOBEDXE_LOCKED_ICON Cshatpatteric8 i-nUtsinBgLaIPBNluOeDtoEo_thNOSTim_uWlOatRoKr ING_ICON Cshatpatteric9 i-nBtlueBtLooItPhNSOeDcuEr_itSyWUPGRADE_ICON Cshatpatteric10 i-nWtireBleLsIsPESmEbReVdEdRe_d ISCyOstNems with the Micro BlueTarget Cshatpatteric11 i-nEtnteCrOpMrisPeUTBlEuRet_oDoEthSKATppOlPic_atIioCnOsNwith the Ericsson BlipNet Cshatpatteric12 i-nBtlueCtoOoMtPhUaTnEdRJ_inLi APTOP_ICON AsppteantdiixcA i-njatvaCxO.bMluPeUtTooEtRh_PDA_ICON AsppteantdiixcB i-njatvaCxO.oMbPeUxTER_SERVER_ICON static int LAN_ACCESS_AVAIL_ICON Appendix C - Java Bluetooth Development on the PalmOS Platform static int PHONE_CELLULAR_ICON Appendix D - BlipNet 1.1 API static int PHONE_SMARTPHONE_ICON Index static int SESSION_LAP_ICON LissttoaftFiigcuriens t SESSION_OPP_ICON LissttoaftTiacbleisnt UNKNOWN_DEVICE_ICON List of Listings Li/st/oMfeStihdeobdasrs static getIcon(ClassOfDevice classOfDevice, boolean javax.swing.ImageIcon largeIcon) Returns an ImageIcon illustrating the specified Class of Device. static javax.swing.ImageIcon getIcon(int iconId, boolean largeIcon) Returns a ImageIcon. [1]Copyright © L.M. Ericsson A/S, Bluetooth Networks Interface BBlilpueNtoootdhefor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessB©l2i00p3N(o35d2epageexs)tends java.io.Serializable The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This ABlipNode objeincct lcuodnestaainnsAinPIfoorvmearvtiioenw aobf othuet aJaBvalipliNboradrey., development of Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.blipserver Table of Contents B/lu/eMtoeotthhofodrsJava Injtarovdau.ctlioanng.String getBlipNodeFriendlyName() Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 th-eBfreifeonredlYyonuaGmeet oStfathrteedBlipNode. Chapter 4 - Understanding the Java Bluetooth API Cjhaapvtaer.l5 an-gB.luSettrooitnhgwigtheJt2BMlEiMpNIDoPdeGroupConfigurationName() Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Returns the Configuration group of the BlipNode. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Cjhaapvtaer.l10an-gW.iSretlresisnEgmbgeedtdBeld iSpyNstoedmesGwriothupthNeaMmiecr(o)BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaeptuterrns12th-eBgluroeutoponthamaned oJfintihe BlipNode. Appendix A - javax.bluetooth Appendix B - javax.obex BluetoothAddress getBlipNodeID() Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InRdeetxurns the Bluetooth device address of the BlipNode. List of Figures LijstaovfaT.albalensg.String getBlipNodeIP() List of Listings List of Sidebars Returns the IP address of the BlipNode. java.lang.String getUser() Returns the user of the BlipNode if it was reserved at the time this BlipNode object was created. boolean isBlipNodeConnected() Checks whether the BlipNode is connected to the server at the time this BlipNode object was created. Interface BBlilpueNtooodthefoCr aJauvase by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreess B©l2i00p3N(o35d2epCagaeus)se The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This This interface defiinncelusdtehseacnaAuPsIeovvaelurveieswreotuf rtnheedJainvaBlliibprNaroyd,edeevveelnotpsm. ent of Bluetooth-based services, highlights of security concerns, and more. //package com.ericsson.blipnet.api.blipnode Table of Contents B/lu/eFtoioethldfosr Java Insttroadtuictcionint CAUSE_BASEBAND_ERROR Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CBhaapsteebr a3nd-eBrreofor rine YBoliupNGoetdeS.tarted Chapter 4 - Understanding the Java Bluetooth API Cshatpatteric5 i-nBtlueCtAooUtShEw_iBthLJI2PMNEOMDEID_PBLIPSERVER_PROTOCOL_ERROR Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX BlipNode-BlipServer protocol error. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Cshatpatteric10 i-nWtireCleAsUsSEEm_bDeHdCdPed_ESRyRstOeRm_sLwAiPth the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CDhaHpCtePr 1e2rro-rB(lLuAetNooPthroafinled).Jini Appendix A - javax.bluetooth Appendix B - javax.obex static int CAUSE_HOST_STACK_ERROR Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InHdoesxt stack error. List of Figures LissttoaftTiacbleisnt CAUSE_HOST_TIMEOUT List of Listings List of Sidebars Host timeout. static int CAUSE_INSUFFICIENT_TERMINAL_CAPABILITIES Insufficient terminal capabilities. static int CAUSE_INTERNAL_ERROR Signifies an internal error in the BlipNode which causes a reboot. static int CAUSE_LOSS_OF_SIGNAL Loss of signal. static int CAUSE_MAX_CONNECTIONS_REACHED Max connections reached. static java.lBalunegt.oSotthrifonrgJ[a]vaCAUSE_NAMES by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Friendly names foThr ethaeucthaoursseovfathluiseste. xt describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of static int CABUluSeEto_oPthA-GbEa_seTdIsMeErOviUceTs, highlights of security concerns, and more. Page timeout. Table of Contents Bsluteatotoithc foirnJtavaCAUSE_RELAY_AGENT_TO_DHCP_CLIENT_SWITCH Introduction Chapter 1 - Introducing Bluetooth CRhaeplateyrA2ge-ntB/DluHetCooPthC1lie.1nt switch (rebooting). Chapter 3 - Before You Get Started Cshatpatteric4 i-nUtndCeArsUtaSnEd_inSgEtShSeIJOaNva_NBOluTe_toCoRthEAATPIED Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API CShaepstseior n7 no-tJcarveaaatendd.OBEX Chapter 8 - Using a Bluetooth Simulator Cshatpatteric9 i-nBtlueCtAooUtShES_eScuYrSitTyEM_ENDED_CONNECTION Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet System ended connection. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth AsppteantdiixcB i-njtavaCxA.oUbSeEx_UNEXPECTED_TERMINAL_BEHAVIOR Appendix C - Java Bluetooth Development on the PalmOS Platform AUppneenxdpixecDte-dBtleiprNmeitna1l.1beAhPaI vior. Index List of Figures static int CAUSE_USER_ENDED_CONNECTION List of Tables List of Listings LiUstsoefr Seinddeebadrsconnection. Interface BBlilpueNtoootdhefoEr vJaevna t by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessB©l2i00p3N(o35d2epEagvees)nt extends Event The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This An event which inindcicluadteess tahnaAt PaIBolvipeNrvoiedwe-oref ltahteedJaavcatiloibnraorcyc, udrerveedloinpmtheentseofrver. Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.event Table of Contents B/lu/eMtoeotthhofodrsJava Inbtoroodluectaionn equals(java.lang.Object obj) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 tru-eBeiffocorentYeonut Goef toSbtjeacrtteids equal to this. Chapter 4 - Understanding the Java Bluetooth API Cjhaapvtaer.l5 an-gB.luSettoroitnhgwigtheJt2AMpEpMliIDcPationName() Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Returns the name of the user/application which has (un)locked the BlipNodeHandle for the BlipNode Chapter 8 - Using a Bluetooth Simulator specified in this event. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cjhaapvtaer.l11an-gE.nStetrrpirisnegBlgueettoBolthipANppoldiceatFiornisewnidthlythNeaEmreic(s)son BlipNet Chapter 12 - Bluetooth and Jini ARppeetundrnixsAth-ejfarvieanxd.blyluneatomotehof the BlipNode which initiated this event. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform java.lang.String getBlipNodeIP() Appendix D - BlipNet 1.1 API Index LiRsteotuf rFnigsuthreesIP address of the BlipNode which initiated this event. List of Tables LijstaovfaL.isltainnggs.String getBlipNodeSoftwareVersion() List of Sidebars Returns the software version of the BlipNode which initiated this event. int getCause() Returns the cause of the event. Interface BBlilpueNtoootdhefoHr aJanvadle by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreess B©l2i00p3N(3o5d2epHagaesn)dle The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This ABlipNodeHandinlceludperos vaidneAsPaI novaeprpvileicwatoiof nthaecJcaevsaslitboraarpy,hdyseivcealol pBmlipeNntoodfe. A BlipNodeHandle is obtained throughBmaluoBreelt.oiopthS-ebrasveedrsCeorvninceesc, thiigohnlig. hts of security concerns, and When an application has acquired a BlipNodeHandle, that application has exclusive access to the TapbhleysoicfaCl oBnlitpeNnotsde until the handle is released by calling release(). Bluetooth for Java If the BlipNode disconnects from the server, the handle will be released by the server causing a InBtlroidpuNctoiodneHandleReleasedException to be thrown when an application tries to use the handle. Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 //Package Chapter 3 - Before You Get Started com.ericsson.blipnet.api.blipnode Chapter 4 - Understanding the Java Bluetooth API C/ha/pMteerth5od-sBluetooth with J2ME MIDP Cvhaopitder a6dd-TCorBealtiinpgNaodBeluDeetonoythLiPrsintt(SBelruveertwoioththJPASddAPrIess terminalID) Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CAhadpdtserth9e s-pBelcuifeiteodotdheSviecceurIDityto the local deny list on this BlipNode. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cvhaopitder a11dd-TEonItenrqpuriiseryBlFuieltotoethr(ABpplluiceattioonostwhiAthddthreeEsrsicstsoenrBmliipnNaelt ID, int timeout) Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth AAppdednsdtixheBs-pjeacviafixe.dobteerxminal to the inquiry filter in this BlipNode. Appendix C - Java Bluetooth Development on the PalmOS Platform AvppoeinddixcDha-nBgliepINnetq1u.i1rAyPLI ength(int inquiryLength) Index List of Figures Dynamically configures the length of time (in units of 1.28 s) in which the BlipNode performs inquiry before Lirsetsotaf rTtainbgleisnquiry or switching to Scan. List of Listings List of Sidebars void changeLinkEstablishmentMode(boolean automaticLinkEstablishmentOn, boolean nameLookupOn) Dynamically switch the BlipNode in and out of automatic link establishment mode. void changeScanLength(int scanLength) Dynamically configures the length of time (in units of 1.28 s) in which terminals are able to detect the BlipNode during inquiry or paging. void changeScanMode(ScanMode scanMode) Dynamically changes the Scan mode on the BlipNode. void clearBlipNodeDenyList() Clears the local deny list on this BlipNode. void disconneBcluteLtionokth(BfolruJeatvoaothAddress terminalID, int inquiryFilterTime) by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Disconnects the specified terminal from this BlipNode if it is connected. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This void establisinhcLluidneks (aBnlAuPeI tooveortvhieAwdodfrtehsesJavtaelribmriarnya, ldIevDe,lopCmleanstsoOf fDevice terminalCOD) Bluetooth-based services, highlights of security concerns, and more. Attempts to establish a link to the specified terminal. Table of Contents BvluoeitodothesfotraJbalvaishLink(PageData p) Introduction CAhattpetmerp1ts to- Ienstrtaobdluischinga Blinlukettoootthhe terminal specified in the paging data. Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started void exchangeBusinessCards(BluetoothAddress terminalID) Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP CIhnaitpiateter s6a b- uCsrienaetsinsgcaarBdlueextcohotahngPreinbteStwereveenr wthitehsJpPeScAifPieId terminal and the BlipNode if the terminal is Cchoanptneerc7te d- toJatvhaeaBnldipONBoEdXe. Chapter 8 - Using a Bluetooth Simulator CLhaipntker[]9 g-eBtluAecttooitvheSLeicnurkitsy() Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaeptuterrns12a -lisBtluoef tloinokths tahnadt Jainrei currently active on the BlipNode. Appendix A - javax.bluetooth ABppleunedtixoBot-hjaAvdadxr.oebsesx[] getBlipNodeDenyList() Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InRdeetxrieves a list of terminals in this BlipNode's deny list. List of Figures LiBstloufeTtaoboletshAddress getBlipNodeID() List of Listings LiRsteotuf rSnisdethbearBs luetooth device address of the BlipNode connected to this handle. void pullBusinessCard(BluetoothAddress terminalID) Attempts to pull the business card from the specified terminal. void push(ObexPushObject pushObject, BluetoothAddress terminalID) Pushes the specified object to the specified terminal if it is connected to the BlipNode. void push(ObexPushObject pushObject, BluetoothAddress terminalID, ObexProgressListener listener) Pushes the specified object to the specified terminal if it is connected to the BlipNode. void pushBusinessCard(BluetoothAddress terminalID) Pushes this BlipNBolduee'tsobouthsinfoerssJacvaard to the specified terminal if the terminal is connected to the BlipNode. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 void release(A)press © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Releases the BliinpcNluoddees HaannAdPlI eovfeorrvuieswe obfytohtehJearvaaplpiblircaaryti,ondesv. elopment of Bluetooth-based services, highlights of security concerns, and more. void removeFromBlipNodeDenyList(BluetoothAddress terminalID) Table of Contents BRlueetmoootvhesfotrhJeavsapecified device from the local deny list on this BlipNode. Introduction Cvhaopitder r1em-oIvnterSodeuscsinigoBnl(uBetlouoethtoothAddress terminalID, Session sessionType) Chapter 2 - Bluetooth 1.1 CRhaepmteorv3es t-hBeesfopreecYifoieudGseetsSstioanrtefrdom this BlipNode if the session exists. Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP void setBlipNodeDenyList(BluetoothAddress[] terminalIDs) Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CShaeptstetrhe8 lo-cUalsidnegnayBlisluteotonotthhisSBimlipuNlaotodre to the specified list. Chapter 9 - Bluetooth Security Cvhaopitder s10et-BWuisreilnesessEsmCbaerddd(ejdaSvyast.elmasnwgi.thStthreiMnigcrobBulsuieTnaersgestCard) Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ACppoennfdigixurAes- tjhaevabxu.bsliuneetsosotchard of this BlipNode. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipNBoludeteooHthafnordJlaevIanUseException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35N2opdageeHs)andleInUseException extends BlipServerException The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Thrown by BlipSinecrluvdeesrCanonAnPeI covteirovinewwhoef nthaenJaavpaplliibcraatrioyn, daetvteemloppmtsetnotgoeft a handle for a BlipNode which Bluetooth-based services, highlights of security concerns, and is already used bmy aorneo.ther application. //Package Tacbolem.oef rCiocntsesnotns.blipnet.api.blipnode Bluetooth for Java In/t/roCdouncstiotnructors CBhalpitperNo1 de-HIantnrdodluecIinngUBsleuEetxocoethption() CBhalpitperNo2de-HBalunedtlooetIhn1U.1seException(java.lang.String s) CBhalpitperNo3de-HBaenfodrleeYIonuUGseet ESxtacretepdtion(java.lang.String s, Cjhaapvtaer.l4an-gU.nTdherrsotawnadbinlgethee)Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipNBoludeteooHthafnordJlaevRa eleasedException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35N2opdageeHs)andleReleasedException extends BlipServerExcTehpe taiutohnors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Thrown by BlipNBmoluodreeet.oHoathn-dblaseewd hseernviacnesa, phpiglihclaigtihotns aotftesemcuprtsitytocoenxececruntse, aanmdethod on a released BlipNodeHandle. TaTbhlee ohfaCnodlnetemnatys have been released either by the application itself or by the server (due to a reboot of the BBluleiptoNoothdef)o.r Java Introduction C/ha/pPtaerck1ag-eIntroducing Bluetooth Cchaopmt.erer2 ic-sBsluoento.obtlhi1p.1net.api.blipnode Chapter 3 - Before You Get Started C/ha/pCtoerns4tr-uUcntdoerrsstanding the Java Bluetooth API CBhalpitperNo5 de-HBalunedtlooetRhewliethaJs2eMdEEMxcIDePption() BlipNodeHandleReleasedException(java.lang.String s) Chapter 6 - Creating a Bluetooth Print Server with JPS API BlipNodeHandleReleasedException(java.lang.String s, Chapter 7 - Java and OBEX java.lang.Throwable e) Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipNBoludeteooNthoftoCr JoavnanectedException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35N2opdageeNs)otConnectedException extends BlipServerExcTehpe taiutohnors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Thrown by a Bluetooth-based services, BlimpSoreer. verConnection whhigehnligahntsapopf slicecautiroitny tcr ioenscteorngse, taandBlipNodeHandle for a BlipNode which is not connected to the server. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsavoan.blipnet.api.blipnode Introduction C/ha/pCtoerns1tr-uIcnttroodruscing Bluetooth CBhalpitperNo2 de-NBoluteCtooontnhe1c.1tedException() CBhalpitperNo3de-NBoetfoCroenYnoeucGteet dSEtaxrcteedption(java.lang.String s) CBhalpitperNo4de-NUontdCeorsntannedcintgetdhEexJcaevaptBiluoento(ojthavAaPI.lang.String s, Cjhaapvtaer.l5an-gB.luTehtroootwhawbiltheJ2eM)E MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeorth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35S2epragvees)r extends java.lang.Object The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Factory class for ignecltutidnegsBalniApPSIeorvverevrieCwonofntehcetJiavoanslib. rary, development of Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.blipserver Table of Contents B/lu/eCtooonthstforruJcatvaors InBtlroidpuScetiornver() Chapter 1 - Introducing Bluetooth C/ha/pMteerth2od-sBluetooth 1.1 Cshatpatteric3 g-eBteCfoornenYeocutGieot nS(tajratevda.lang.String username, BlipServerConnection Cjhaapvtaer.l4an-gU.nSdterrsitanngdinpgasthsewJoarvad,Blujeatovoath.lAaPIng.String serverHost) Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Returns a BlipServerConnection to the specified server using default values for port number and Chapter 7 - Java and OBEX service name. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Cshatpatteric10 g-eWtiCreolnesnseEcmtbieodnd(ejdaSvyast.elmasnwgi.thStthreiMnigcrouBsleureTnaarmgeet, BlipServerConnection java.lang.String password, java.lang.String serverHost, int serverPort, Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet java.lang.String serverServiceName) Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ARppeetundrnixsBa -BljaivpaxS.eorbevxerConnection to the specified server. Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeortAh fcocr JeasvasException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class ABplreispsS©e2r00v3e(r35A2cpcageess)sException extends BlipServerException The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Thrown by a BliipncSleudrevsearnCAoPnInoevcetrviieown owfhtehne aJanvaaplipblriacrayt,iodnevtreielosptmoeanctcoefss the server with invalid Bluetooth-based services, highlights of security concerns, and username or pasmswoorer.d. The reason for denying access can be wrong username/password or access from a host other than the host associated with this account. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsaovan.blipnet.api.blipserver Introduction C/ha/pCtoerns1tr-uIcnttroodruscing Bluetooth CBhalpitperSe2rv-eBrluAectcooetshs1E.1xception(java.lang.String s) CBhalpitperSe3rv-eBreAfocrceeYsosuEGxect eSptatriteodn(java.lang.String s, java.lang.Throwable e) Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface BBlilpueStoeorthveforrCJaovna nection by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreess B©l2i00p3S(3e5r2vpeagresC)onnection The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This ABlipServerCoinncnluedcestianonAPisI uosveerdviteowaottfacthheBJlaipvaNolibdreareyv,ednetvleislotepnmeernsttoofthe server, and to get handles Bluetooth-based services, highlights of security concerns, and for connected BlipmNoored.es. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.blipserver Bluetooth for Java In/t/roMdeutchtioonds Cvhaopitder a1dd-EIvnternodtuLciinsgtBelnueetro(oBthlipServerEventListener listener) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CAhadpdtserth4e s-pUencdifieerdstlaisntdeinnegrthtoetJhaevaBlBipluSeetorvoethr. API Chapter 5 - Bluetooth with J2ME MIDP Cvhaopitder a6dd-ECvreeanttinLgiastBeluneetoro(thBlPriinptSSeerrvveerrwEivthenJPtSLiAPsItener listener, CBhalpitperSe7rv-eJravEaveanndtFOiBlEXter filter) Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Adds the specified listener to the BlipServer. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet java.lang.String[] getBlipNodeConfigurationGroupNames() Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ARppeetundrnixsBa -lisjat voafxt.hoebecxonfiguration names which are currently defined in the server. Appendix C - Java Bluetooth Development on the PalmOS Platform Ajppaevnad.ixlDan-gB.liSptNreti1n.g1[A]PI getBlipNodeGroupNames() Index List of Figures LiRsteotuf rTnasbaleslist of BlipNode group names which are currently defined in the server. List of Listings LiBstloifpSNiodedbeaHrsandle getBlipNodeHandle(BluetoothAddress blipNodeID) Returns a handle to the BlipNode with the specified ID if it is connected to the server, or null if the BlipNode is not connected or the handle is already in use by another application. BlipNodeHandle getBlipNodeHandleFromGroup(java.lang.String blipNodeGroupName) Returns a handle to the first available BlipNode from the specified BlipNode group. BlipNode[] getBlipNodes(java.lang.String groupName,java.lang.String blipNodeGroupConfigurationName,boolean includeReservedBlipNodes, boolean includeDisconnectedBlipNodes) Returns a list of BlipNodes which match the specified criteria. BluetoothAddress getConnectedBlipNode(BluetoothAddress terminalID) Returns the Bluetooth device address of the BlipNode to which the specified terminal is connected. BluetoothAddrBelusest[o]othgefotrCJoanvnaectedTerminals() by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java Returns a list of teaprmpliincaatlisoncsururseinntglyBcluoentnooetchtefdortoa tvhaeriesteyrvoefrp. latforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and byte[] getObemxoOrbe.ject(java.io.File file) TaRbeletuornf sCothnetecnotnstents of the specified file if the file is found on the server. Bluetooth for Java InvtoroidducrtioenleaseBlipNodeHandle(BluetoothAddress blipNodeID) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaepletears3es t-hBeehfoarnedYleoutoGtehteSstapretcedified BlipNode if the handle was reserved by this user. Chapter 4 - Understanding the Java Bluetooth API Cvhaopitder r5em-oBvlueeEtvooetnhtwLiithsJt2eMnEeMr(IDBPlipServerEventListener listener) Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CRhaepmteorv8es t-hUessinpgecaifBieludeltiosotethneSrimfroumlatothre server. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeortCh foornJnaveactionException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35S2epragvees)rConnectionException extends BlipServerExcTehpe taiutohnors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Thrown by a Bluetooth-based services, BlimpSoreer. verConnection ifhtihgehlicgohntsneocf tsioecnutroitythceonsecervrnesr,isanlodst. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.blipserver Bluetooth for Java In/t/roCdouncstiotnructors CBhalpitperSe1rv-eIrntCroodnunceincgtBilounetEoxoctheption(java.lang.String s, java.lang.Throwable e) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeortEh fvoer nJatvAa dapter by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public abstraAcptrescsl©a2s00s3 (B35l2ippagSees)rverEventAdapter extends java.lang.Object implements BlTihepSaeutrhvoersroEfvtehnisttLeixtsdteesncreibre how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and An abstract adapmteorrcel.ass for receiving events from the BlipServer. The methods in this class are empty. The class exists as convenience for creating listener objects which only listens to a certain class of events. Ta/b/le poaf cCkoangteents Bcluoemto.oethrifocrsJsaovan.blipnet.api.event In/t/roCdouncstiotnructors CBhalpitperSe1 rv-eIrntErvodeunctinAgdBalputeteoro(th) Chapter 2 - Bluetooth 1.1 C/ha/pMterth3od-sBefore You Get Started Cvhaopitder h4an-dUlnedBelrsitapnNdoindgetEhveeJnatva(BlluieptoNoothdeAEPIvent e) Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Called by the BlipServer event dispatcher when a BlipNodeEvent occurs. Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Cvhaopitder h9an-dBllueeCtooontnheScetciuroitnyEvent(ConnectionEvent e) Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CChaapllteedr 1b1y t-hEenBtelirppSrieservBelrueevtoeontthdAispppalitccahtieornws hweitnh athCeoEnrnicesscotniBolnipENveet nt occurs. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth void handleObexEvent(ObexEvent e) Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform ACppaellneddixbDy t-hBeliBpNlipeSt 1e.r1veArPeIvent dispatcher when an ObexEvent occurs. Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeortEh fvoer nJatvFa ilter by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3i(p35S2epragvees)rEventFilter extends java.lang.Object implements jaTvhea.aiutoh.oSrseorfitahlisitzexatbdleescribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and This class is usedmtoorefi.lter notification of events for client applications which implement BlipServerEventListener. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsaovan.blipnet.api.event Introduction C/ha/pCtoerns1tr-uIcnttroodruscing Bluetooth CBhalpitperSe2rv-eBrluEevteoontthF1i.1lter(int[] eventClasses, int[] eventIDs, CBhalputerto3ot-hBAedfodrreeYsosu[G]et bSltairpteNdodeIDs, BluetoothAddress[] terminalIDs) Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Constructs a BlipServerEventFilter. Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX C/ha/pMteerth8od-sUsing a Bluetooth Simulator Cbhaopotlerea9n -cBolunettaooitnhsS(eEcvureitnyt event) Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CChahpetcekr s11wh-eEtnhteerrpthrieselisBteluneetoroatthtaAcphpelidcatotiothnsiswfiilttherthsehoEurilcdsbsoennBoltipifiNeedt of the specified event. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth boolean containsBlipNodeID(BluetoothAddress blipNodeID) Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform ACppheencdkixs Dwh-eBthlipeNr etht e1.s1pAePcIified BlipNode ID is included in this filter. Index LibstoooflFeigaunrecs ontainsEventClass(int eventClass) LibstoooflTeaabnlescontainsEventID(int eventID) LibstoooflLeisatningcsontainsTerminalID(BluetoothAddress terminalID) List of Sidebars Checks whether the specified terminal ID is included in this filter. BluetoothAddress[] getBlipNodeIDs() Returns a copy of the blipNodeIDs of the BlipServerEventFilter. int[] getEventClasses() Returns a copy of the eventClasses of the BlipServerEventFilter. int[] getEventIDs() Returns a copy of the eventTypes of the BlipServerEventFilter. BluetoothAddress[] getTerminalIDs() Returns a copy of the terminalIDs of the BlipServerEventFilter. Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface BBlilpueStoeorthveforrEJavveantListener by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessB©l2i00p3S(e35r2vpeagreEs)ventListener The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This This interface shoinuclldudbeesimanpAlePmI oevnetervdiebwy ocfliethnet cJalavsasleibsrawriys,hdinegvetlooplismteennttoofevents generated by the Bluetooth-based services, highlights of security concerns, and BlipServer. more. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roMdeutchtioonds Cvhaopitder h1an-dIlnterBodluicpinNgoBdleuEetvoeontht(BlipNodeEvent e) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CChaapllteedr 4by t-hUenBdleiprsStaenrvdeinrgevtheentJadvisapBaltucehteorotwhhAePnI a BlipNodeEvent occurs. Chapter 5 - Bluetooth with J2ME MIDP Cvhaopitder h6an-dClreeaCtoinngnaecBtluieotonoEthvePrnintt(SCeornvenrewcitthioJPnSEvAPeInt e) Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Called by the BlipServer event dispatcher when a ConnectionEvent occurs. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cvhaopitder h11an-dElneteOrbpreisxeEBvleunetto(oOthbeApxpElviceatniotnsew)ith the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ACppaellneddixbAy t-hjeavBalxip.bSleurevtoeor tehvent dispatcher when an ObexEvent occurs. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BlipSBelurevtoeortEh fxocr Jeapvation by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class ABplreispsS©e2r00v3e(r35E2xpcageeps)tion extends java.lang.Exception The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Superclass for alilnecxlucdeepstioannsAwPIhoicvhercvaienwboef tthhreowJanvabylibthraeryB,lidpeSveerlvoeprm. ent of Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.blipserver Table of Contents B/lu/eCtooonthstforruJcatvaors InBtlroidpuScteiornverException() CBhalpitperSe1rv-eIrntErxodcuecpintgiBolnu(etjoaovtha.lang.String s) CBhalpitperSe2rv-eBrluEextcooetpht1i.1on(java.lang.String s, java.lang.Throwable e) Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class BluetBoluoettohoAthdfodrrJeavsas by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2B00l3u(e35t2opoagtehs)Address extends java.lang.Object implements java.io.SeriaTlheizaautbhloers of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheBluetoothABmdluodreret.oeostsh-cblaassesdmseordveiclessa, hBigluhelitgohotsthoDf seevcicueritAydcdornecsesrn(Bs,Da_nAdDDR). This is a 48 bit unsigned integer, often written in hexadecimal. TaObblejeocftsCoofnttheentBsluetoothAddress class are immutable—once created they cannot change. BTluheitsooctlahsfsorpJraovvaides the equals and hashCode methods for use in connection with the Collection Inctlraosdsuecst.ion Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 //Package Chapter 3 - Before You Get Started com.ericsson.blipnet.api.Bluetooth Chapter 4 - Understanding the Java Bluetooth API C/ha/pCtoerns5tr-uBcluteotroosth with J2ME MIDP CBhalputeerto6 ot-hCArdeadtrinegsas(Blbuyettoeo[t h]PrbinltuSeetroveortwhiAthddJPrSeAsPsI) Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CChaopntsetrru9cts- aBlBuletuoeotthoSoetchuAridtydress object from a byte[]. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CBhalputeerto11ot-hEAndtedrrperisses(Bljuaevtoao.thlaAnppgl.icSattiornisnwgithblthueeEtroicostsohnABdldiprNeest s) Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ACppoennsdtirxucBts- ajaBvalxu.eobteoxothAddress object from a String. Appendix C - Java Bluetooth Development on the PalmOS Platform A/pp/eMnedtixhDod-sBlipNet 1.1 API Inbdoeoxlean equals(java.lang.Object obj) List of Figures LiCstoomf pTaarbelessthis BluetoothAddress with an Object and returns true if they are equal. List of Listings List of Sidebars byte[] getBytes() int hashCode() Returns a hashCode for this BluetoothAddress. java.lang.String toString() Returns a String representation of this BluetoothAddress. Class ClassBOlueftDooethvfiocreJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2C00l3a(s35s2OpfagDees)vice extends java.lang.Object implements java.io.SeriaTlheizaautbhloers of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheClassOfDevBmiluocreeet.ocoltahs-sbamseoddeselsrvaiccelsa,shsigohfldigehvtsiceo.f sTehciusriistyac2o4ncbeirtnusn,saignnded integer, often written in hexadecimal. TaObblejeocftsCoofnttheentCslassOfDevice class are immutable—once created they cannot change. BTluheitsooctlahsfsorpJraovvaides the equals and hashCode methods for use in connection with the Collection Inctlraosdsuecst.ion Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 //Package Chapter 3 - Before You Get Started com.ericsson.blipnet.api.Bluetooth Chapter 4 - Understanding the Java Bluetooth API C/ha/pFtierel5ds- Bluetooth with J2ME MIDP Cshatpatteric6 j-aCvraea.tlinagnag.BSlutertoionthgPrAinVt Server with JPS API Cshatpatteric7 j-aJvavaa.lanadngO.BSEXtring AV_CAMCORDER Cshatpatteric8 j-aUvsain.glaanBglu.eStotorthinSgimuAlVat_oCr AR_AUDIO Cshatpatteric9 j-aBvluae.toloatnhgS.eScutrritiyng AV_GAMING_TOY Cshatpatteric10 j-aWviare.lelsasnEgm.bSetdrdiedngSyAstVe_mHsAwNiDthSt_hFeRMEiEcro BlueTarget Cshatpatteric11 j-aEvnate.rlpraisnegB.lSutetroionthgApApVl_icHatEioAnDsPwHiOthNEthSe Ericsson BlipNet Cshatpatteric12 j-aBvluae.tlooatnhga.nSdtJrinii ng AV_HEADSET AsppteantdiixcA j-ajavvaa.xl.balunegt.ooStthring AV_HIFI AsppteantdiixcB j-ajavvaa.xl.oabnegx.String AV_LOUDSPEAKER AsppteantdiixcC j-aJvavaa.lBlaunetgo.oSthtrDievneglopAmVe_nMtIoCnRtOhPeHPOaNlmEOS Platform AsppteantdiixcDj-aBvliap.Nleta1n.g1.ASPtI ring AV_PORTABLE_AUDIO Insdteaxtic java.lang.String AV_SET_TOP_BOX static java.lang.String AV_SHORT List of Figures static java.lang.String AV_VCR List of Tables static java.lang.String AV_VIDEO_CAMERA List of Listings static java.lang.String AV_VIDEO_CONF LissttoaftSiicdebjaarsva.lang.String AV_VIDEO_DISPLAY static java.lang.String AV_VIDEO_MONITOR static java.lang.String BLIPNODE_CLASS_OF_DEVICE static java.lang.String COMPUTER static java.lang.String COMPUTER_DESKTOP static java.lang.String COMPUTER_HANDHELD static java.lang.String COMPUTER_LAPTOP static java.lang.String COMPUTER_PALM_SIZED static java.lang.String COMPUTER_SERVER_CLASS static java.lang.String COMPUTER_SHORT static java.lang.String COMPUTER_WEARABLE static java.lang.String IMAGING static java.lang.String IMAGING_CAMERA static java.lang.String IMAGING_DISPLAY static java.lang.String IMAGING_PRINTER static java.lang.String IMAGING_SCANNER static java.lang.String IMAGING_SHORT static java.lang.String LAN_ACCESS_POINT static java.lang.String LAN_ACCESS_POINT_FIFTH static java.lang.String LAN_ACCESS_POINT_FIRST static java.lang.String LAN_ACCESS_POINT_FOURTH static java.lang.String LAN_ACCESS_POINT_FULLY static java.lBalunegt.oSotthrifonrgJaLvAaN_ACCESS_POINT_NO_SERVICE static java.lbaynBgru.cSetHroipnkginsLaAnNd_RAaCnCjiEthSSAn_tPoOnIyNT_SECOINSDBN:1590590783 static java.lAapnregs.sS©t2r00i3n(g352LpAagNe_s)ACCESS_POINT_SHORT static java.lTahenga.utShtorrsionfgthLisAtNe_xtAdCeCsEcrSibSe_PhoOwINtoT_deSvIeXloTpHwireless Java static java.laappnlgic.aStiotnrsiunsgingLBAlNu_etAoCoCthESfoSr_aPvOaIriNeTty_oTfHpIlaRtDforms. This static java.liBnalcunleugtdo.eoSsthta-rnbiaAnsPegIdosPveeErrRvviIiceePwsH,oEhfRigtAhhLeligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and static java.lmaonreg..String PERIPHERAL_COMBO static java.lang.String PERIPHERAL_DIGITIZER static java.lang.String PERIPHERAL_GAMEPAD Tasbtleatoif cCojntaevnat.slang.String PERIPHERAL_JOYSTICK BsluteatotoithcfojraJvavaa.lang.String PERIPHERAL_KEYBOARD Insttroadtuictcionjava.lang.String PERIPHERAL_POINTING_DEV Cshatpatteric1 j-aIvntar.odluacningg.BSlturetionogth PERIPHERAL_REMOTE Cshatpatteric2 j-aBvluae.tlooatnhg1..1String PERIPHERAL_SENSING_DEV Cshatpatteric3 j-aBveafo.rleaYnogu.GSett rSitanrgtedPERIPHERAL_SHORT Cshatpatteric4 j-aUvnad.elrsatanngd.inSgtrthienJgavaPHBOluNeEtooth API Cshatpatteric5 j-aBvluae.tlooatnhgw.iSthtJr2iMnEgMPIDHPONE_CELLULAR Cshatpatteric6 j-aCvraea.tlinagnag.BSlutertoionthgPrPinHtOSNeEr_veCrOwRiDthLEJPSSSAPI static java.lang.String PHONE_ISDN Chapter 7 - Java and OBEX static java.lang.String PHONE_SHORT Chapter 8 - Using a Bluetooth Simulator static java.lang.String PHONE_SIMCARD Chapter 9 - Bluetooth Security static java.lang.String PHONE_SMART_PHONE Cshatpatteric10 j-aWviare.llesasnEgm.bSetdrdiendgSyPstHeOmNsEw_iWthIRthEeDMicro BlueTarget Cshatpatteric11 j-aEvnate.rlparisnegB.lSutetroionthgApUpNlKicNatOioWnNs with the Ericsson BlipNet Cshatpatteric12 j-aBvluae.toloatnhga.nSdtJrinii ng UNKNOWN_SHORT Appendix A - javax.bluetooth A/pp/eCnodnixsBtr-ujacvtaoxr.osbex ACppleansdsixOCfD-eJvaviaceBl(ubeotoooltheaDnevelloipmmietnetdoDnitshce,PablmoOoSlePalantfoprmositioning, boolean networking, AbppoeonldeixaDn -rBelinpdNetr1i.n1gA,PIboolean capturing, boolean objectTransfer, boolean audio, Inbdoeoxlean telephony, boolean information, java.lang.String majorClass, LijstaovfaF.igluarnegs .String minorClass) List of Tables List of Listings Constructs a ClassOfDevice object. List of Sidebars ClassOfDevice(byte[] classOfDevice) Constructs a ClassOfDevice object from a byte[]. ClassOfDevice(java.lang.String classOfDevice) Constructs a ClassOfDevice object from a string. //Methods boolean equals(java.lang.Object obj) Compares this ClassOfDevice with an Object and returns true if they are equal. byte[] getBytes() Returns the byte representation of this ClassOfDevice object. int getIconIdB(lu)etooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Returns the Icon Id for the Class of Device. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This java.lang.Strinicnlugdegs eatnMAaPjI oorveTryvpieewToefxtth(e)Java library, development of Bluetooth-based services, highlights of security concerns, and more. Returns the Class of Device Major type as a Long text description. Table of Contents Bjluaevtoao.thlafonrgJ.aSvatring getMajorTypeText(boolean longText) Introduction Chapter 1 - Introducing Bluetooth Returns the Class of Device Major type as a text description. Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Cjhaapvtaer.l4 an-gU.nSdterrsitanngdinggetthMeiJnaovarTBylupeet oToethxtA(PI) Chapter 5 - Bluetooth with J2ME MIDP CRhaeptuterrns6 th-eCCrelaastisngofaDBeluveicteooMtihnPorirnttySpeervaesr waittehxJtPdSeAscPrIiption. Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator int hashCode() Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CRhaeptuterrns11a -hEanstheCrpordisee Bfolur ethtoisotChlaAspsplOicaf tDioenvsicwei.th the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AbppoeonldeixaAn -ijasvAauxd.biluoeSteoott(h) Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform AEppxeanmdiinxeDs -thBelipANuedtio1.b1itAoPfIthe Class Of Device. Index LibstoooflFeigaunreis sCapturingSet() List of Tables List of Listings LiEstxaomf Sinideesbtahres Capturing bit of the Class Of Device. boolean isInformationSet() Examines the Information bit of the Class Of Device. boolean isLimitedDiscoverableSet() Examines the Limited Discoverable bit of the Class Of Device. boolean isNetworkingSet() Examines the Networking bit of the Class Of Device. boolean isObjectTransferSet() Examines the Object Transfer bit of the Class Of Device. boolean isPositioningSet() Bluetooth for Java by Bruce Hopkins and Ranjith Antony Examines the PoAsiptiroensisn©g 2b0i0t 3o(f3t5h2epaCgelas)ss Of Device. ISBN:1590590783 The authors of this text describe how to develop wireless Java boolean isRenadppelriciantiognSseuts(in)g Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Examines the Rendering bit of the Class Of Device. Tabboleoloef aCnonitesnTteslephonySet() Bluetooth for Java Introduction CEhaxpatmerin1es -thIentTroedleupcihnognBylubeittooof tthhe Class Of Device. Chapter 2 - Bluetooth 1.1 Cjhaapvtaer.l3an-gB.eSfotrreiYnogu Gteot SSttarritendg() Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Returns a String representation of this Class Of Device. Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface CBolnuentoeocthtifoornJaEvvaent by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessC©o2n00n3e(c35t2ipoagneEs)vent extends Event The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This An event indicatiningctlhudaet saacnonAPnIecotvioenrv-ireewlaotef dthaecJtiaovnahliabsraoryc,cuderrveedloipnmtheentsoefrver. Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.event Table of Contents B/lu/eMtoeotthhofodrsJava Inbtoroodluectaionn equals(java.lang.Object obj) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 tru-eBeiffocorentYeonut Goef toSbtjeacrtteids equal to this. Chapter 4 - Understanding the Java Bluetooth API Cihanptterge5tC-aBuluseet(oo)th with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Returns the cause of this event. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Cihanptterge10tS-eWsisreileosnsTEympbee(d)ded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaeptuterrns12th-eBtylupeetooofthseasnsdioJnintihat this event is related to. Appendix A - javax.bluetooth Appendix B - javax.obex ShortUuid[] getShortUUIDs() Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InRdeetxurns an array of short UUIDs representing the services supported by the terminal to which this event is LirsetlaotfeFdig. ures List of Tables LijstaovfaL.isltainnggs.String getTerminalClassOfDevice() List of Sidebars Returns the class of device of the terminal to which this event is related. java.lang.String getTerminalFriendlyName() Returns the friendly name of the terminal to which this event is related. BluetoothAddress getTerminalID() Returns the Bluetooth device address of the terminal to which this event is related. java.lang.String getTerminalIP() Returns the IP address of the terminal to which this event is related. Class EricsBsluoentoMothefloordJayva by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2E00r3i(c35s2spoagneMs)elody extends java.lang.Object implements ObexPushObjecTthe authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of AnObexPushObjBmeluocreett.oiomthp-lbeamseedntsaetriovniceosf,ahnigEhrliigchstssonofMseeclourdiyty. Tcohniscecrlanss,sawnrdaps the given melody string in a format understandable by an Ericsson Mobile Phone. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsavoan.blipnet.api.obex.pushobjects Introduction C/ha/pCtoerns1tr-uIcnttroodruscing Bluetooth CEharpitcerss2on-MBeluleotdooyt(hj1a.1va.lang.String melody) Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API CChaopntsetrru5cts- aBnluEetroicostshownitMheJl2oMdEy pMuIDshP object with a default name (NONAME.EMY). Chapter 6 - Creating a Bluetooth Print Server with JPS API CEharpitcerss7on-MJeavlaodanyd(jOaBvEXa.lang.String melody, java.lang.String name) Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Constructs an Ericsson Melody push object with the name specified. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet //Methods Chapter 12 - Bluetooth and Jini byte[] getObexBody() Appendix A - javax.bluetooth Appendix B - javax.obex ARppeetundrnixsCth-eJbaovdayBolufetthoiostOhbDeexvPeluospmhOebntjoenctth.e PalmOS Platform Appendix D - BlipNet 1.1 API Injdaevxa.lang.String getObexName() List of Figures List of Tables LiRsteotuf rLnisstitnhgesname of this ObexPushObject. List of Sidebars java.lang.String getObexType() Returns the mime-type of this ObexPushObject. Interface EvBleunettooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessE©v2e00n3t(35e2xptageens)ds java.io.Serializable The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This The superclass oifnacllul deevsenants.ATPIhiosvienrtveirefwacoef dtheefinJaevsacloibmramryo,ndeevveelnopt mmeentht oodf s and contains event ID Bluetooth-based services, highlights of security concerns, and definitions for all emvoernet.s. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roFdiuecltiodns Cshatpatteric1 i-nItntrBodLuIcPinNgOBDlEu_etAoLoAthRM Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CIhnadpictearte4s t-haUtnadecrrsittiacnadl icnogntdhietioJnavhaaBsluoectcouortrhedAPinI a BlipNode connected to the server. Chapter 5 - Bluetooth with J2ME MIDP Cshatpatteric6 i-nCtreaBtLinIgPaNOBDluEe_toDoEthREPrGinItSSTeErRveErDwith JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Indicates that a BlipNode has disconnected from the server. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cshatpatteric11 i-nEtnteBrLpIriPseNOBlDuEe_toEoVthENATpplications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AEppveenndt icxlaAs-s joafvaBxli.pbNluoedtoeo-trhelated events. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform static int BLIPNODE_LOCKED Appendix D - BlipNet 1.1 API Index LiIsntdoicfaFtiegsurtehsat an application has acquired the lock on a BlipNode. List of Tables LissttoaftLiisctinignst BLIPNODE_REGISTERED List of Sidebars Indicates that a BlipNode has connected to the server. static int BLIPNODE_RELEASED Indicates that an application has released its lock on a BlipNode. static int BLIPNODE_STARTUP_FAILED Indicates that a BlipNode attempted to connect to the server, but the startup failed for some reason. static int BLIPNODE_SW_UPGRADE_COMPLETE Indicates that a BlipNode software upgrade has been completed successfully. static int BLIPNODE_SW_UPGRADE_FAILED Indicates that a BlipNode software update failed. Bluetooth for Java by Bruce Hopkins and Ranjith Antony static int BLIPNODE_SW_UPGRADE_STARTED Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java Indicates that a BalipppNliocadteiosnosftuwsainrgeBulpugetroaodteh hfoarsabveaernieitnyitoiaftepdla.tforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and static int BLmIoPrNe.ODE_WAITING_FOR_CONFIGURATION TaIbnldeicoafteCsotnhtaetnatsBlipNode has registered with the server, but no configuration exists for that BlipNode. Bluetooth for Java Introduction static java.lang.String[] CLASS_NAMES Cshatpatteric1 i-nItntrCodOuNcNinEgCBTlIuOetNo_oEthVENT Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CEhavpetnetrc4las-s Uonf dCeorsntnaencdtiinogn-threelaJtaevda eBvlueenttoso.th API Chapter 5 - Bluetooth with J2ME MIDP Cshatpatteric6 j-aCvraea.tlinagnag.BSlutertoionthg[Pr]intFSReIrEveNrDwLiYth_NJPASMEAPSI Cshatpatteric7 i-nJtavaOBanEdX_OBBUEXSINESS_CARD_EXCHANGE_COMPLETED Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security CIhnadpictearte1s0 s-uWccireeslessfusl Ecmo bmepdldeetido nSyosfteambsu swiintehstshecaMridcreoxBclhuaenTgareg.et Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Cshatpatteric12 i-nBtlueOtBooEtXh_aBnUdSJIinNi ESS_CARD_EXCHANGE_FAILED Appendix A - javax.bluetooth Appendix B - javax.obex Indicates a failed attempt to exchange business cards with a terminal. Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API static int OBEX_BUSINESS_CARD_PULL_COMPLETED Index List of Figures LiIsntdoicfaTtaebslessuccessful completion of a business card pull. List of Listings LissttoaftSiicdebianrst OBEX_BUSINESS_CARD_PULL_FAILED Indicates a failed attempt to pull business card from a terminal. static int OBEX_EVENT Event class of OBEX-related events. static int OBEX_OBJECT_RECEIVED Indicates that an OBEX object has been received and stored by the server. static int OBEX_PUSH_COMPLETED Indicates successful completion of an OBEX push. static int OBEX_PUSH_FAILED Indicates a failedBaltuteemtopottthofpoursJhavaan OBEX object to a terminal. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) static int OBEX_PUSH_PROGRESS The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Indicates progresBsluinetaonotohn-bgaosinegd sOeBrvEicXesp,uhsihg.hlights of security concerns, and more. static int TERMINAL_DETECTED Table of Contents BIlnuedticoaottehsfothr aJat vaaterminal was detected in inquiry. Introduction Chapter 1 - Introducing Bluetooth static int TERMINAL_LINK_ESTABLISH_FAILED Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CIhnadpictearte4s a- fUanildeedrsattatenmdinpgt ttoheesJtaavbalisBhlueatBooluthetAoPoIth link to a terminal. Chapter 5 - Bluetooth with J2ME MIDP Cshatpatteric6 i-nCtreaTtEinRgMaINBAluLe_toLoIthNKPr_inEtSSTeArBveLrIwSiHthEDJPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CIhnadpictearte9s t-haBtluaetBoloutehtoSoetchurliintyk to a terminal has been established. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cshatpatteric11 i-nEtnteTrEpRriMseINBlAuLe_toLoIthNKA_ppLlOicSatTions with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth AIpnpdeincdaitxesBt-hajatvaaxB.loubeetxooth link to a terminal has been disconnected. Appendix C - Java Bluetooth Development on the PalmOS Platform AsppteantdiixcDi-nBtlipTNEetR1M.I1NAAPLI _SESSION_CREATE_FAILED Index LiIsntdoicfaFtiegsuraesfailed attempt to create a session with a terminal. List of Tables List of Listings static int TERMINAL_SESSION_CREATED List of Sidebars Indicates that a session has been created with a terminal. static int TERMINAL_SESSION_REMOVED Indicates that a session with a terminal has been removed. //Methods boolean equals(java.lang.Object obj) Returns true if content of object is equal to this. BluetoothAddress getBlipNodeID() Returns the Bluetooth device address of the BlipNode to which this event is related. int getEventClass() Bluetooth for Java Returns the event class of this event. by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) int getEventID() The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Returns the ID ofBtlhuiesteoovethn-tb. ased services, highlights of security concerns, and more. java.lang.String getMessage() Table of Contents Bluetooth for Java Returns the message associated with this event if any. Introduction Chapter 1 - Introducing Bluetooth int hashCode() Chapter 2 - Bluetooth 1.1 java.lang.String toString() Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API CRhaeptuterrns5 a -StBlruientogotrhepwriethseJn2MtaEtioMnIDoPf this event. Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface InBqluueitroyotRh efosr uJalvtaEvent by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessI©n2q00u3i(r35y2Rpeagseus)ltEvent extends ConnectionEvent The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This An event indicatiningctlhudaet saatnerAmPiInoavl ehravsiebweoefnthdeetJeacvtaedlibbryaray,BdliepvNeolodpemiennItnoqfuiry Only Mode. Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.event Table of Contents B/lu/eMtoeotthhofodrsJava InPtarogdeuDctaiotna getPageData() Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 th-eBPeafogriengYoduatGaent eSetadretdedfor direct paging of this terminal. Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface LiBnluketooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessL©i2n00k3 (3e5x2tpeagneds)s java.io.Serializable The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This TheLink interfacinecplurdoevsidaens AmPeI tohvoedrsviteowreoftrtiehveeJasvnaaplibshraortyi,ndfoervmelaoptiomnenatboofut a specific BlipNode-Terminal Bluetooth-based services, highlights of security concerns, and link. more. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.Bluetooth Bluetooth for Java In/t/roMdeutchtioonds Cbhaopotlerea1n -eIqnturaodlusc(injgaBvlau.etloaonthg.Object obj) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CChaopmtepra4res-thUinsdLeirsntaknIdminpglthweithJaavna OBblujeetocotthaAnPdI returns true if they are equal. Chapter 5 - Bluetooth with J2ME MIDP CBhalputeerto6ot-hCArdeadtrinegsasBglueettoBolthipPrNinotdSee(r)ver with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Returns the BluetoothAddress of the BlipNode using this session. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cihanptt[er]11ge-tECnuterrrperisnetBSleusetsoioothnsA(pp)lications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ARppeetundrnixsAan- ajarvraaxy.obfluaectotiovethsessions on this link. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform BluetoothAddress getTerminal() Appendix D - BlipNet 1.1 API Index LiRsteotuf rFnigsuthreesBluetoothAddress of the terminal using this session. List of Tables LibstoooflLeisatningissSessionActive(long sessionType) List of Sidebars Tells whether the indicated session type is active. java.lang.String toString() Implements the toString method. Class NoSuBcluhetSooetsh fsoiroJnavEa xception by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class ANporeSsusc©h2S00e3s(s35i2opnagEexs)ception extends java.lang.RuntimeException The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Thrown by a BliipncNlouddeesHaannAdPlIeotvoerinvdieiwcaotef tthheatJaavnaaltibteramrpy,t wdeavselmopamdeenttoocflose a non-existing session. Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.blipnode Table of Contents B/lu/eCtooonthstforruJcatvaors InNtoroSduuccthioSnessionException() CNhaopStuerch1Se-sIsntiroodnuEcxincgeBpltuietoono(thjava.lang.String message) CNhaopStuerch2Se-sBsluieotnooEtxhc1e.1ption(java.lang.String message, Cjhaapvtaer.l3an-gB.eTfohrreoYwoaubGleet Sctaarutesde) CNhaopStuerch4Se-sUsnidoenrsEtaxncdeinpgttihoenJ(ajvaavBalu.eltoaonthg.ATPIhrowable cause) Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface OBbleuextoEovthefnortJava by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessO©b2e00x3E(v35e2nptagees)xtends Event The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This An event indicatiningctlhudaet sananOABPEI Xov-reerlvaietewd oafctthioenJahvaas loibcrcauryrr,eddevineltohpemBelniptSoef rver. Bluetooth-based services, highlights of security concerns, and more. //Package com.ericsson.blipnet.api.event Table of Contents B/lu/eMtoeotthhofodrsJava Inbtoroodluectaionn equals(java.lang.Object obj) Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 tru-eBeiffocorentYeonut Goef toSbtjeacrtteids equal to this. Chapter 4 - Understanding the Java Bluetooth API Cjhaapvtaer.l5 an-gB.luSettrooitnhgwigtheJt2MMiEmMeTIDyPpe() Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Returns the mime-type of the OBEX object to which this event is related. Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Cihanptterge10tO-bWeixreRleessspEomnbseedCdoeddeS(y)stems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaeptuterrns12th-eBOluBeEtoXotRheasnpdoJnisnei Code associated with this event (if any). Appendix A - javax.bluetooth Appendix B - javax.obex java.io.File getPath() Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InRdeetxurns the path of the file to which this event is related. List of Figures LiBstloufeTtaoboletshAddress getTerminalID() List of Listings List of Sidebars Returns the Bluetooth device address of the terminal to which this event is related. Class ObexBFluielteooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2O00b3e(x35F2iplagees)extends java.lang.Object implements ObexPushObjecTthe authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Implements an OmBoErXe.push object containing a file. //Package Tacbolem.oef rCiocntsesnotns.blipnet.api.obex.pushobjects Bluetooth for Java In/t/roCdouncstiotnructors COhabpetxerFi1 le-(Ijntarvodau.ciinog.BFliuleteoofthile) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CChaopntsetrru4cts- aUnndOeBrsEtaXnpdiunsghthoebjJeacvtareBplureetsoeonthtinAgPIthe specified file. Chapter 5 - Bluetooth with J2ME MIDP COhabpetxerFi6le-(Cjraeavtain.giao.BlFuietloeothfiPrlinet,Sebryvetrew[i]th bJP)S API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Constructs an OBEX push object containing the bytes of the specified byte[] and with the specified Chapter 9 - Bluetooth Security fil ena me . Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet //Methods Chapter 12 - Bluetooth and Jini java.lang.String getAbsoluteFileName() Appendix A - javax.bluetooth byte[] getObexBody() Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform ARppeetundrnixs Dth-e BbliopdNyetof1.th1 isAPOIbexPushObject. Index LijstaovfaF.igluarnegs .String getObexName() List of Tables List of Listings LiRsteotuf rSnisdethbearns ame of this ObexPushObject. java.lang.String getObexType() Returns the mime-type of this ObexPushObject. void setObexType(java.lang.String mimeType) Class ObexBGlueetnooetrhifcoOr Jbavjaect by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class AOpbreesxsG©e2n00e3r(i35c2Opbagjees)ct extends java.lang.Object implements ObexPushObjecTthe authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and Implements a genmeorriec.OBEX push object. //Package Tacbolem.oef rCiocntsesnotns.blipnet.api.obex.pushobjects Bluetooth for Java In/t/roCdouncstiotnructors COhabpetxerGe1ne-rIintcrOodbujceincgtB(lbuyettoeo[th] bytes) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CChaopntsetrru4cts- aUnndOeBrsEtaXnpdiunsghthoebjJeacvtareBplureetsoeonthtinAgPIthe specified file. Chapter 5 - Bluetooth with J2ME MIDP COhabpetxerGe6ne-rCirceaOtbinjgeactB(lubeytotoeth[]PrinbtySteersve,r wjiathvaJP.SlaAPnIg.String obexType) Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Constructs an OBEX push object containing the bytes of the specified byte[] and with the specified Chapter 9 - Bluetooth Security fil ena me . Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ObexGenericObject(java.lang.String obexName, byte[] bytes) Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth ACppoennsdtirxucBts- ajanvOaxB.oEbXexpush object containing the bytes of the specified byte[] and with the specified AfpilpeennadmixeC. - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InOdbeexxGenericObject(java.lang.String obexName, byte[] bytes, LijstaovfaF.igluarnegs .String obexType) List of Tables List of Listings LiCstoonfsStriudcetbsaarsn OBEX push object containing the bytes of the specified byte[] and with the specified fil ena me . //Methods byte[] getObexBody() Returns the body of this ObexPushObject. java.lang.String getObexName() Returns the name of this ObexPushObject. java.lang.String getObexType() Returns the mime-type of this ObexPushObject. void setObexType(java.lang.String mimeType) Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface OBblueextoPorthofgorrJeasvasEvent by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreess O©b2e00x3P(3r5o2gprageess)sEvent extends Event The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This An event indicatiningcplurdoegsreasnsAoPfIaonveornvgieowinogf OthBeEJXavpaulsibhr.aTryh,isdetyvpeelopomf eevnet notf is only sent to ObexProgressLBmiluosreett.oeonthe-rbsa.sed services, highlights of security concerns, and //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roMdeutchtioonds Cbhaopotlerea1n -eIqnturaodlusc(injgaBvlau.etloaonthg.Object obj) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CRhaeptuterrns4 tru-eUinf dceornsttaenndt ionfgotbhjeecJat visa eBqluueatlotooththAisP.I Chapter 5 - Bluetooth with J2ME MIDP Cihanptterge6tB-yCtreeastCinogmaplBeluteetodo(th)Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Returns the number of bytes received so far. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cjhaapvtaer.l11an-gE.nStetrrpirisnegBlgueettoOobthexANppalmiceat(io)ns with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ARppeetundrnixsAth-ejnavaamx.ebolufetthoeotOh BEX object to which this event is related. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform int getObjectSize() Appendix D - BlipNet 1.1 API Index LiRsteotuf rFnigsuthreestotal size of the object to which this event is related. List of Tables LiBstloufeLtisotointghsAddress getTerminalID() List of Sidebars Returns the Bluetooth device address of the terminal to which this event is related. int hashCode() Interface OBbleuextoPorthofgorreJasvsa Listener by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreess O©b2e00x3P(3r5o2gprageess)sListener The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This This abstract clasinscsluhdoeusldanbeAPeIxotevnedrveidewtoocf rtehaeteJaavna leibvreanrty,lisdteevneelorpfomrelnistteonf ing to ObexProgressEvents Bluetooth-based services, highlights of security concerns, and while pushing conmteonret.to a terminal. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roMdeutchtioonds Cvhaopitder n1ew-PIrntorgodruecsinsg(BOlbueetxoPorthogressEvent e) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CThahpistemr e4tho-dUinsdcearsllteadndbinygthteheBJliapvSaeBrvlueertowohtehnAePvIer new push progress information is available. Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface OBbleuextoPouthsfohrOJabvaject by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessO©b2e00x3P(u35s2hpOagbejs)ect extends java.io.Serializable The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This TheObexPushObinjcelucdtesclaanssAPdIeofivneersviaewcoomf tmheonJaivnatelribfaracrey,fodreOveBloEpXmoebnjteocfts which are going to be pushed Bluetooth-based services, highlights of security concerns, and to a terminal. more. //Package Tacbolem.oef rCiocntsesnotns.blipnet.api.obex.pushobjects Bluetooth for Java In/t/roMdeutchtioonds Cbhayptteer[]1 g-eItntOrbodeuxcBinogdByl(u)etooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CRhaeptuterrns4 th-eUbnoddeyrsotfanthdisingObtheexPJauvsahBOlubejteooctth.API Chapter 5 - Bluetooth with J2ME MIDP Cjhaapvtaer.l6an-gC.rSeattrinignagBglueettoOobthexPrNinatmSee(r)ver with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Returns the name of this ObexPushObject. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cjhaapvtaer.l11an-gE.nStetrrpirisnegBlgueettoOobthexATppylpiceat(io)ns with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ARppeetundrnixsAth-ejmaviamxe.b-ltuypeteoootfhthis ObexPushObject. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class ObexBSlueetrovoethrHforoJsavtaedFile by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2O00b3e(x35S2epragvees)rHostedFile extends java.lang.Object implements ObTehxe PauutshhoOrsbojfetchtis text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of AnObexServerHBmoluosreett.oeodthF-iblaeseids saenrvOicBeEs,Xhpiguhslihghotbsjeocf tsewchuircihtywciollnbceerrnesa, danfrdom the server's local storage when the object is pushed to a terminal. The advantage of a server hosted file compared to a regular ObexFile is that the contents of the file are not transferred across the network when pushing the file. This TamblaeyobfeCdoenstieranbtsle when pushing very large objects. Bluetooth for Java In/t/roPdauccktioange Cchaopmt.erer1 ic-sIsntornod.ubclinigpBnleutet.oaopthi.obex.pushobjects Chapter 2 - Bluetooth 1.1 C/ha/pCtoerns3tr-uBcetfoorresYou Get Started COhabpetxerSe4 rv-eUrnHdoesrsttaenddFinigleth(ejJaavaa.Biluoe.t oFoithleAPIfile) COhabpetxerSe5rv-eBrluHeotsoottehdwFiithlJe2(MjEaMvaID.Pio.File file, java.lang.String obexType) Chapter 6 - Creating a Bluetooth Print Server with JPS API C/ha/pMteerth7od-sJava and OBEX Cbhaopotlerea8n -fUislinegEaxiBslutesto(o)th Simulator Cjhaapvtaer.i9 o.-FBiluleetoogtehtSFeiclureitDyescriptor() Cbhayptteer[]10 g-eWtiOrebleesxsBEomdbye(d)ded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaeptuterrns12th-eBbluoedtyoootfhthainsdOJbineixPushObject. Appendix A - javax.bluetooth Ajppaevnad.ixlBan-gja.vSatxr.oibnegx getObexName() Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API InRdeetxurns the name of this ObexPushObject. List of Figures LijstaovfaT.albalensg.String getObexType() List of Listings List of Sidebars Returns the mime-type of this ObexPushObject. Interface PaBlgueetDooathtafor Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessP©a2g00e3D(a35t2apageexs)tends java.io.Serializable The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This APageData objeincct lcuodnestaainnsAaPlIl doavetarvnieewedoef dthteo Jdaovaa llibinrkareys,tdaebvlieslhompmeennt taoftfer an inquiry. Using the data in Bluetooth-based services, highlights of security concerns, and this object, link esmtaobreli.shment time will be shortened. Used when BlipNode is in INQUIRY RESULT mode and the application does the link establishment via the BlipServer API. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsaovan.blipnet.api.bluetooth Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface RBelmuetoootethBfolirpJaSvea rverEventListener by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessR©e2m00o3t(e35B2lpiagpeSs)erverEventListener extends java.rmi.Remote The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Defines the handilnecEluvdeenstamneAtPhIoodvfeorrvineowtifoyfinthgeeJvaevnat lliibsrtearnye,rdseovfeBlolpipmSeenrtveorf events. The interface is used Bluetooth-based services, highlights of security concerns, and internally by the Bml ioprSee. rver API, and should never be im plemented by cl ient applications. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roMdeutchtioonds Cvhaopitder h1an-dIlnterEodvuecnintg(BElvueetnotothevent) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Interface RBelmueotootethOfobreJaxvPa rogressListener by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public interfAapcreessR©e2m00o3t(e35O2bpeagxePs)rogressListener extends java.rmi.Remote The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Defines the newPinrcolugdreessasn mAPeIthoovedrfvoierwnootfifythinegJaevvaenlitblriasrtey,ndeersveolof pPmusenhtporfogress events. The interface is Bluetooth-based services, highlights of security concerns, and used internally bymthoree.BlipServer API, and should never be implemented by client applications. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.event Bluetooth for Java In/t/roMdeutchtioonds Cvhaopitder n1ew-PIrntorgodruecsinsg(BOlbueetxoPorthogressEvent e) Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class ScanBMluoetdooeth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2S00c3a(n35M2opdagees)extends java.lang.Object implements java.io.SeriaTlheizaautbhloers of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheScanMode clBmalsuosreete.onoctha-pbsausleadtessertvhiecedsi,ffheirgehnlitgShtcsaonfMseocdueristysucopnpcoerrtensd, bayndthe BlipNode. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.Bluetooth Bluetooth for Java In/t/roFdiuecltiodns Cshatpatteric1 j-aIvntar.odluacningg.BSlturetionogth[] FRIENDLY_NAMES Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CFharipetnedr ly4 na-mUendseorfsttahneddinegfintheedJSavcaanBlMueotdooetsh. API Chapter 5 - Bluetooth with J2ME MIDP Cshatpatteric6 i-nCtreaItNinQgUaIRBlYu_eAtoNoDth_PPrAinGtES_eSrCveArNw_iDthISJPASBALPEID Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Inquiry Scan: Disabled, Page Scan: Disabled. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cshatpatteric11 i-nEtnteIrNpQrisUeIBRlYu_etAoNoDth_PAAppGlEic_atSioCnAsNw_iEthNAthBeLEErDicsson BlipNet Chapter 12 - Bluetooth and Jini AIpnpqeunidryixSAca-nja: vEanxa.bbllueedt,oPotahge Scan: Enabled. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform static int INQUIRY_SCAN_ENABLED Appendix D - BlipNet 1.1 API Index LiIsntqoufirFyigSucraesn: Enabled, Page Scan: Disabled. List of Tables LissttoaftLiisctinignst PAGE_SCAN_ENABLED List of Sidebars Inquiry Scan: Disabled, Page Scan: Enabled. //Constructors ScanMode(int value) Constructs a ScanMode object representing a valid Scan Mode. //Methods boolean equals(java.lang.Object obj) int getScanMode() Returns the scan mode represented by this object. int hashCode() java.lang.String toString() Bluetooth for Java by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class SessBiolunetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2S00e3s(s35i2opnagees)xtends java.lang.Object implements java.io.SeriaTlheizaautbhloers of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheSession claBmslsuoreeetn.ocoathp-sbualsaetedsstehrevicseess,shioignhtlyigphetss osuf spepcourrtietyd cboyntcheernBsl,ipaSnedrver. //Package Tacbolem.oef rCiocnstesnotns.blipnet.api.Bluetooth Bluetooth for Java In/t/roFdiuecltiodns Cshatpatteric1 j-aIvntar.odluacningg.BSlturetionogth[] FRIENDLY_NAMES Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started CFharipetnedr ly4 na-mUendseorfsttahneddinegfintheedJsaevsasBiolunettyopoeths.API Chapter 5 - Bluetooth with J2ME MIDP Cshatpatteric6 l-oCnrgeatLinAgPa_CBLluIeEtoNoTth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator LAN Access Profile (LAP) Client session type. Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cshatpatteric11 l-oEnngterLpArisPe_BSlEuReVtoEoRth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ALpApeNndAixccAes-sjaPvraoxf.iblelu(eLtAooPt)hServer session type. Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform static long OPP_CLIENT Appendix D - BlipNet 1.1 API Index LiOstbojef cFtigPuursehs Profile (OPP) Client session type. List of Tables LissttoaftLiisctinlgosng OPP_SERVER List of Sidebars Object Push Profile (OPP) Server session type. //Constructors Session(long sessionType) Constructs a Session object representing the specified session type. //Methods boolean equals(java.lang.Object obj) long getSessionType() Returns the type of this Session object. int hashCode() java.lang.String toString() Class ShorBtUlueutiodoth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2S00h3o(r35t2Upuagieds) extends java.lang.Object implements java.io.SeriaTlheizaautbhloers of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheShortUuid Bmcllauoresets.omotho-dbealssead Bselurveitcoeost,hhuignhivlieghrstsaloufnsieqcuueriitdyecnotnifcieerr.nTs,haisnids a 16 bit unsigned integer, often written in hexadecimal. TaObblejeocftsCoofnttheentSshortUuid class are immutable—once created they cannot change. BTluheitsooctlahsfsorpJraovvaides the equals and hashCode methods for use in connection with the Collection classes. Introduction Chapter 1 - Introducing Bluetooth //Package Chapter 2 - Bluetooth 1.1 com.ericsson.blipnet.api.bluetooth Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API //Fields Cshatpatteric5 i-nBtlueDtIooAtLhUwPi_thNJE2TMWEOMRKIDIPNG_SERVICE_CLASS_ID Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CShahpotretrU8UID- Ufosirntghea DBliuaelutopoNthetSwimoruklaintogrProfile. Chapter 9 - Bluetooth Security Cshatpatteric10 i-nWtireLleAsNs_EAmCbCeEdSdSe_d USSyIstNeGm_sPwPiPth_tShEeRMViIcrCoEB_lCueLTAaSrgSe_tID Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ASppheonrdt iUxUAID- jfaovratxh.eblLueAtNooAthccess Using PPP Profile. Appendix B - javax.obex AsppteantdiixcC i-nJtavaOBBlEuXe_toOoBthJEDCevTe_loPpUmSeHn_tSoEnRtVhIeCPEa_lmCOLSASPSla_tfIoDrm Appendix D - BlipNet 1.1 API Index Short UUID for the OPP Profile. List of Figures List of Tables LissttoaftLiisctinignst SERIAL_PORT_SERVICE_CLASS_ID List of Sidebars Short UUID for the Serial Port Profile. static int SERVICE_DISCOVERY_SERVER_SERVICE_CLASS_ID Short UUID for the Service Discovery Server Profile. static int WAP_OVER_BLUETOOTH_CLIENT_SERVICE_CLASS_ID Short UUID for the WAP over Bluetooth Client. static int WAP_OVER_BLUETOOTH_SERVER_SERVICE_CLASS_ID Short UUID for the WAP over Bluetooth Server. //Constructors ShortUuid(byte[] shortUuid) Constructs a ShortUuid object from a byte[]. Bluetooth for Java by Bruce Hopkins and Ranjith Antony ShortUuid(intApsrehsos r©t2U00u3i(d35)2 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Constructs a ShoirnctluUdueisdanobAjePIctofvreormvieawn oinftt.he Java library, development of Bluetooth-based services, highlights of security concerns, and more. ShortUuid(java.lang.String shortUuid) Table of Contents Constructs a ShortUuid object from a String. Bluetooth for Java Introduction C/ha/pMteerth1od-sIntroducing Bluetooth Cbhaopotlerea2n -eBqluueatloost(hj1a.1va.lang.Object obj) Chapter 3 - Before You Get Started CChaopmtepra4res-thUinsdSehrsotarntdUinugitdhewiJtahvaanBOlubejtoeoctht AaPnId returns true if they are equal. Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API byte[] getBytes() Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator CRhaeptuterrns9 th-eBbluyteetoroetphreSseecunrtaittyion of this ShortUuid object. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cihanptterge11tI-nEtn(te)rprise Bluetooth Applications with the Ericsson BlipNet Cihanptterha12sh-CBoludeet(oo)th and Jini Appendix A - javax.bluetooth Appendix B - javax.obex ARppeetundrnixsCa -hJaasvhaCBoludeetofootrhthDisevSehlooprmteUnut iodn.the PalmOS Platform Appendix D - BlipNet 1.1 API Injdaevxa.lang.String toString() List of Figures List of Tables Returns a String representation of this ShortUuid. List of Listings List of Sidebars java.lang.String toString4MalSignal() Class TermBilnuaetloNotohtfCoroJanvna ectedException by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public class ATperersmsi©n2a00l3N(3o5t2Cpoagnens)ectedException extends java.lang.RunTtheimaeutEhxocrseopfttihoisntext describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Thrown by a Bluetooth-based BlimpNoroed. eHandle swehrevinceas,rehqiguhelisgthftosroafcsteiocnuriistymcaodnecetronws,aardnsd a term in al which is not connected. Ta/b/lePaocf kCaognetents Bcluoemto.oethrifocrsJsavoan.blipnet.api.blipnode Introduction C/ha/pCtoerns1tr-uIcnttroodruscing Bluetooth CThaeprtmerin2 al-NBoluteCtooontnhe1c.1tedException() CThaeprtmerin3al-NBoetfoCroenYnoeucGteet dSEtaxrcteedption(java.lang.String message) CThaeprtmerin4al-NUontdCeorsntannedcintgedthEexJcaevaptBiluoento(ojthavAaPI.lang.String message, Cjhaapvtaer.l5 an-gB.luTehtroootwhawbiltheJ2cMaEuMseID)P CThaeprtmerin6al-NCorteaCtoinngnaecBtlueedtoEoxthcePrpinttiSoenr(vejrawviath.lJPaSngAP.IThrowable cause) Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Class WapSBleuertvoiocthefIonrdJaivcaation by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2W00a3p(S35e2rpvagiecs)eIndication extends java.lang.Object implements ObexPushObjecTthe, ajutahvoars.oifot.hSisetreixtadleiszcraibbelheow to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheWapServiceBmIluonredet.oioctah-tbiaosendcslaersvsicmeso,dheiglshtlhigehtWs oAfPseSceurrviticyecoInndciecrantsio, na.nTdhis service provides the ability to send notifications to end-users in an asynchronous manner. Such notifications may, for example, be about new e-mails, changes in stock prices, news headlines, advertising, reminders of, for example, low TapbrleepoafidCboanltaennctes, and so forth. Bluetooth for Java InTthroedWucAtioPnService Indication contains a short message and a URI indicating a service. The message is Cphraepsteernt1ed-toIntthreodeuncdin-gusBelrueutpooonthreception, and the user is given the choice to either start the service indicated by the URI immediately, or postpone the Service Indication for later handling. If the Service Chapter 2 - Bluetooth 1.1 Indication is postponed, the client stores it and the end-user is given the possibility to act upon it at a later Chapter 3 - Before You Get Started point of time. Chapter 4 - Understanding the Java Bluetooth API COhabpjteecrts5of-thBeluWetaopoSthewrvithicJ2eMIEndMiIcDaPtion class are immutable—once created they cannot change. Chapter 6 - Creating a Bluetooth Print Server with JPS API C/ha/pPtaerck7ag-eJava and OBEX Cchaopmt.erer8ic-sUssoinng.ablBliupentoeotth.aSpimiu.laotboer x.pushobjects C/ha/pFtierel9ds- Bluetooth Security Cshatpatteric10 b-yWtiereleDsEsLEEmTbEedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ATppheenWdixAAP -Sjearvvaicxe.bIlnudeticoaottihon(s) received on the terminal with a given ID must be deleted. Appendix B - javax.obex AsppteantdiixcC b-yJtavea SBlIuGeNtoAoLth_HDIevGeHlopment on the PalmOS Platform Appendix D - BlipNet 1.1 API Index Indicates that the WAP Service Indication must be presented as soon as the implementation (of the LitsetrmofinFiaglu) raelslows that to be carried out in a non-user-intrusive manner, or earlier if considered appropriate Li(swt hoifchTamblaesy result in a user-intrusive behavior). List of Listings List of Sidebars static byte SIGNAL_LOW Indicates that the WAP Service Indication must be postponed without user intervention. static byte SIGNAL_MEDIUM Indicates that WAP Service Indication must be presented as soon as the implementation allows that to be carried out in a non-user-intrusive manner. static java.lang.String TOKENIZED_MEDIA_TYPE Defines the tokenized form of the WAP Service Indication Media Type. //Constructors WapServiceIndication (java.lang.String uri, java.lang.String id, byte action, java.lang.String contents) Constructs a WapServiceIndication. Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 WapServiceIndication(java.lang.String uri, java.lang.String id, Apress © 2003 (352 pages) java.lang.String contents) The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Constructs a WapiBnSlcueleurtdvoeoistchae-nbIaAnsPdeIidocsvaeertrvviiiceoewns,.ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more. WapServiceIndication(java.lang.String uri, java.lang.String id, java.lang.String expires, byte action, java.lang.String contents) Table of Contents Bluetooth for Java InCtroondsutrcuticotns a WapServiceIndication. Chapter 1 - Introducing Bluetooth CWhaapptSerer2vi-cBeluIentdooitcha1t.1ion(java.lang.String uri, java.lang.String id, Cjhaapvtaer.l3an-gB.eSfotrreiYnogu Geext pSitarretesd, java.lang.String contents) Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP CChaopntsetrru6cts- aCrWeaaptinSgeravBiluceetoIontdhiPcriantt iSoernv.er with JPS API Chapter 7 - Java and OBEX C/ha/pMterth8od-sUsing a Bluetooth Simulator Cbhaopotlerea9n -eBqluueatloost(hjSaevcuar.itlyang.Object obj) Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Compares this WapServiceIndication with an Object and returns true if they are equal. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Abppyetned[ix]B g-ejatvOabxe.oxbBeoxdy() Appendix C - Java Bluetooth Development on the PalmOS Platform ARppeetundrnixs Dth-e BbliopdNyetof1.th1 isAPOIbexPushObject. Index List of Figures java.lang.String getObexName() List of Tables List of Listings LiRsteotuf rSnisdethbearns ame of this ObexPushObject. java.lang.String getObexType() Returns the mime-type of this ObexPushObject. int hashCode() Returns a hashCode for this WapServiceIndication. java.lang.String toString() Returns a String representation of this WapServiceIndication. Class WapSBleuertvoiocthefLoroJaavdaing by Bruce Hopkins and Ranjith Antony ISBN:1590590783 public final Acplreassss© 2W00a3p(S35e2rpvagiecs)eLoading extends java.lang.Object implements ObexPushObjecTthe, ajutahvoars.oifot.hSisetreixtadleiszcraibbelheow to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of TheWapServiceBmLluooreaet.odoitnh-gbacslaesdssmerovidceelss, thhigehWligAhPts Soef rsveiccueriLtyoacdoinncge.rnTsh,isansdervice provides the ability to cause a user agent on a terminal to load and execute a service, that, for example, can be in the form of a WML deck. The Service Loading contains an URI indicating the service to be loaded by the user agent TawbiltehoouftCuosnetreinnttesrvention when appropriate. Bluetooth for Java InOtrbojdeucctstioonf the WapServiceLoading class are immutable—once created they cannot change. Chapter 1 - Introducing Bluetooth C/ha/pPtaerck2ag-eBluetooth 1.1 Cchaopmt.erer3ic-sBseofonr.ebYloiupGneet tS.taarpteid.obex.pushobjects Chapter 4 - Understanding the Java Bluetooth API C/ha/pFtierel5ds- Bluetooth with J2ME MIDP static byte CACHE Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CIhnadpictearte8s t-haUtstihnge Wa BAluPestoeorvthicSeimcounlatetonrt is loaded in the same way as for EXECUTE-LOW, but instead of Cehxaepcteurti9ng -thBeluseetrovoicthe Sinecthueritsyame way as for EXECUTE-LOW it is placed in the cache of the client. Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Cshatpatteric11 b-yEtneterEpXrisEeCUBlTuEet_oHoIthGHApplications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth AIpnpdeincdaitxesBt-hajatvthaxe.oWbAexP service content is loaded and executed in the same way as for EXECUTE-LOW Abpupet nmdaixyCre-sJualtvainBaluneutosoetrh-inDteruvseilvoepmbeenhtavoinort.he PalmOS Platform Appendix D - BlipNet 1.1 API Insdteaxtic byte EXECUTE_LOW List of Figures List of Tables LiIsntdoicfaLtiestsintghsat the WAP service content is fetched from either an origin server or from the client's cache, if Liasvt aoifl aSbidlee.bars static java.lang.String TOKENIZED_MEDIA_TYPE Defines the tokenized form of the WAP Service Loading Media Type. //Constructors WapServiceLoading(java.lang.String uri) Constructs a WapServiceLoading. WapServiceLoading(java.lang.String uri, byte action) Constructs a WapServiceLoading. //Methods boolean equals(java.lang.Object obj) Compares this WapServiceLoading with an Object and returns true if they are equal. Bluetooth for Java by Bruce Hopkins and Ranjith Antony byte[] getObexBody() Apress © 2003 (352 pages) ISBN:1590590783 The authors of this text describe how to develop wireless Java Returns the bodyaopfptlhiciastiOobnes xuPsiunsghBOlubejtoeoctth.for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and java.lang.Strmionreg. getObexName() TaRbeletuornf sCothnetennatms e of this ObexPushObject. Bluetooth for Java Introduction java.lang.String getObexType() Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 CRhaeptuterrns3 th-eBmefimore-YtyopueGoefttShtisarOtebdexPushObject. Chapter 4 - Understanding the Java Bluetooth API Cihanptterha5sh-CBoludeet(oo)th with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX CRhaeptuterrns8 a -hUassihngCoadBelufeotrotohtihs SWiampuSlaetrorviceLoading. Chapter 9 - Bluetooth Security Cjhaapvtaer.l10an-gW.iSretlersisnEgmbteodSdtedriSnygst(e)ms with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Returns a String representation of this WapServiceLoading. Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Numbers The authors of this text describe how to develop wireless Java 1-Wire (Dallas Seamppilcicoantdiouncstours)i,n2g5B4l–u2et5o5oth for a variety of platforms. This includes an API overview of the Java library, development of 1-Wire interface, B2l5u4etooth-based services, highlights of security concerns, and 1-Wire sensor/comntororell.er, 255 2.4 GHz frequency band, 1 Ta3bCleomof UCoSnBteBnlutsetooth module, 14 Bluetooth for Java In3tCroodmucWtioinreless Bluetooth Printer Adapter, 97 C8h0ap2t.e1r1b1, v-s.InBtlruoedtuocointhg, B1l–u3etooth C1h0ap2t4e-rb2it en- cBrlyupettiooonthke1y.,1160–161 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) A The authors of this text describe how to develop wireless Java AcceptAndOpen(a)pmpleictahtoiodn,s1u2s7ing Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Add New Slave dBialuloegtoboothx-,b1a7s7ed services, highlights of security concerns, and AddEventListenerm()omre.ethod, 234–235 Adopted protocols, explained, 20 TaAbilrepoorftsC,2o2n6tents Bluetooth for Java InAtrllo-Bdulucetitoonoth Jini federation, 252–254 CAhanptetenrn1ae -onInHtrPodiPucAinQg 5B4lu0e0tosoetrhies Pocket PC, 4 CAhappatcehr e2An-tBbluueiltdooutthilit1y.,1141 CAhappptleicra3tion- dBeevfoerleopYmoueGnet twSittharMteicdro BlueTarget, 187–224 Chapter 4 - Understanding the Java Bluetooth API Application manager, 78 Chapter 5 - Bluetooth with J2ME MIDP CAharcpatedre6, in-reCsretaautirnagntaloBblubeyt,oo9th Print Server with JPS API CAhaspytmerm7etr-icJaalveanacnrydpOtioBnE,X159 CAhaspytnecrh8ron-oUussinegveanBt lhuaentodolethr,S1im87ulator Chapter 9 - Bluetooth Security Atinav Bluetooth SDK, 47,83,105 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CAhatipntaevr S11DK- EsntatecrkpirnisiteiaBlizluaettiooonthcoAdpep,li4ca7tions with the Ericsson BlipNet CAhattpritbeur t1e2s,-oBf lsueertvoioctehraencdorJdinsi, 59–60 AAppuethndeinxtiAca-tejapvaarxa.bmlueetteoroothf connection URL, 156–157,162 Appendix B - javax.obex Authentication,156–158,173 Appewndithix LCA-NJaavcaceBsluseptooointht, D1e9v2elopment on the PalmOS Platform Appeonvdeixr DL2-CBAliPpNceotn1n.1ecAtiPoIn, 163 Index Authentication request (client), 157 List of Figures LiAstuothfeTnatbicleastion request (server), 156 LiAstuothfeLnistticinagtos r interface (javax.obex), 265 LiAstuothfoSriidzeabtiaorns (Bluetooth server), 158–159,163 Authorization over L2CAP connection,163 Authorize parameter of connection URL String, 158 Authorize() method of RemoteDevice class, 158 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) B The authors of this text describe how to develop wireless Java Bank account infoaprmplaictaiotinon(lsisutisnigng), B1l6u0etooth for a variety of platforms. This includes an API overview of the Java library, development of Bank account infoBrlumeatotiootnh-ebnacsreydpsteedrv(icliestsi,nhgi)g, h1l6ig1hts of security concerns, and Baseband contromlleorre(B. luetooth), 183 Basic Imaging Profile, 28 TaBbalesicofPCrionntitnegnPtsrofile, 28 Bluetooth for Java InBtrCoCdu(cBtliounetooth Control Center), 46,191 CBhaepatmerT1sk.-jaIvnatrloisdtuincgin, g87B–lu8e8tooth CBhalapttaenr d2, K-inBgluHeatoroatldh o1.f1Denmark, 11 CBhalipptMeran3ag-eBr eafpoprelicYaotuioGne, t2S3t1a–r2te3d2 Chapter 4 - Understanding the Java Bluetooth API BlipNet,226–232 Chapter 5 - Bluetooth with J2ME MIDP accessing external resources, 228 Chapter 6 - Creating a Bluetooth Print Server with JPS API architecture,227–232 Chapatercr h7itec-tJuarveadaiangdraOmBE,X227 ChapBtelirp8Man- aUgseinrgaappBlliuceattoioonth, 2S3im1–u2la3t2or ChapBtelirp9No d- eBslu,2e2to9o–t2h3S0ecurity ChapBtelirp1S0er-veWri,r2e2le7s–s2E2m8bedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet BlipNet API overview, 232–233 Chapter 12 - Bluetooth and Jini ABppliepnNdeixt pAa-ckjaavgaexs.b, l2u3e2to–o2t3h3 ABppliepnNdeixtIcBo-nsjacvlaaxs.so,b2e3x 3 ABppliepnNdoixdeC i-nsJtaavlalaBtiloune,to2o3t0h Development on the PalmOS Platform ABppliepnNdoixdeD u-nBitl,ip2N3e0t 1.1 API Index LiBstlipoNf Foidgeusre(sBlipNet), 229–230 LiBstlipoSf eTarvbelers(BlipNet), 227–228 LiBstlipoSf LeirsvteinrgCsonnection class, 234 LiBstlipoSf SeirdveebrEarvsentAdapter class, 235 BlipServerEventFilter class, 234–235 BlipServerEventListener class, 235 BlueCore 01b (CSR), 183 Bluetooth vs. 802.11b, 1–3 as cable replacement technology, 2 as a low-power wireless technology, 2 as a wireless communication protocol, 1 basic components of, 45–72,241 client-server architecture, 1 deployment locations, 226 history of, 11–12 vs. infrared, 1 integrating with Java, 33–43 integrating with Jini, 252–256 integrating with JPS, 104–112 with J2ME MIDP, 75–96 nominal range, 1 omnidirectional transmissions, 1 on PalmOS platform, 269–272 in small officeBolruehtoomoethoffoficr eJ,a6va for voice applibcyatBiornucse, 6H–o7pkins and Ranjith Antony when not to usAeprwesitsh©Ja20v0a3, (33532–p3a4ges) ISBN:1590590783 for wireless gaTmheinagu,t7hors of this text describe how to develop wireless Java in your car, 7–a8pplications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth AssigneBdlueNtuoomthb-ebrassdeodcsuemrveicnets,,5h2ighlights of security concerns, and Bluetooth-certifiemd oprreo.duct, explained, 31 Bluetooth compliance, explained, 22 TaBbllueeotofoCthondteevnictse tracker, 233–240 Bluetooth for Java InBtrluoedtuocotitohndevices, 13–15,40–41 authentication of, 156 Chapter 1 - Introducing Bluetooth classes of, 225 Chapter 2 - Bluetooth 1.1 connection capabilities of, 15–16 Chapcterer a3ting- BinefIomreprYoonutoGSetimSutalartteodr, 142 Chapotef rth4e f-utUunred,e8rs–ta9nding the Java Bluetooth API Chapotenr t5he -mBalrukeettootothdawyi,th3–J27ME MIDP Chappteorw6er c-laCrsesaetsin, g16a–B1l7uetooth Print Server with JPS API ChapTteDr K7 US- BJa,v8a3a–n8d4OBEX Chaptthear t8be-epUsuinngtilafoBulnuedt,o8oth Simulator CBhalupetetor o9th d- eBvluiceetosoinththSeecaurreitay, browsing, 90 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Bluetooth discovery modes, 52 Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CBhalupetetor o1t2h h- oBslut,e4to1oth and Jini ABpplueentdoixotAh P- rjainvtaSx.ebrlvueert,ocortehating with JPS API, 97–113 ABpplueendtoixotBh p- rjianvteaxr.aodbaexpter, 97 Appendix C - Java Bluetooth Development on the PalmOS Platform Bluetooth profiles, 23–28 Appendix D - BlipNet 1.1 API vs. J2 IndexME profiles, 29–30 List oOf BFiEguXretos implement, 116 List oTfCTaPb/IlPes-based,253 List oUf ULiIsDtinvgaslues for, 62 List of Sidebars Bluetooth Protocol Analyzer, 163,173–178 Bluetooth protocol stack, 17–23 Bluetooth protocol stack layers, 18–20,23 Bluetooth protocols to send and receive data, 115 Bluetooth Qualification Body, 31 Bluetooth qualification process, 31–32 Bluetooth Qualification Web site, 32 Bluetooth radios, 13.See also Bluetooth devices Bluetooth security. SeeSecurity Bluetooth server authentication,156–157 authorization,158–159 connections with Serial Port Profile, 68–69 encryption,161–162 Bluetooth Service, explained, 191 Bluetooth SIG promoter companies, 12 Bluetooth (network) simulator, 137–153 Bluetooth Special Interest Group (SIG), 11–12 Bluetooth for Java Bluetooth specifications page, 23 by Bruce Hopkins and Ranjith Antony Bluetooth stack, 4A1p,r4e7ss–©512003 (352 pages) ISBN:1590590783 Bluetooth stack inTihtiealaizuatthioonrs, 4of7t–h5is1 text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Bluetooth versionin1c.l1u,d1es1–a3n2API overview of the Java library, development of BluetoothConnecBtilouneEtoxocteh-pbtiaosnedclsaesrsv,ic1e5s6, ,h1i5gh8l,i1g6ht2s,2o5f 9security concerns, and more. BluetoothSetup1.java listing, 47–48 BluetoothStateException class, 259 Table of Contents BBluNetEoPoth(BfloureJtaovoath Network Encapsulation Protocol), 22,252 InBtrooodtluocatidoenr section (ROM), 188 CBhaTpAteUrT1OL-AINn.tCroFdGucfinileg, B1l9ue2tooth CBhatgpoteerp2pro-tBocluoelt,o1o2th8 1.1 Chapter 3 - Before You Get Started Building, tracking employees in, 229 Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) C The authors of this text describe how to develop wireless Java C/Cbased BluetoaopthplSicaDtKio,n3s9using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Cable replacemeBnltueptroootothc-obla(sReFdCseOrMvicMe)s,, 2h1ig,2h5lig,6h7ts–o7f0s,7ec2urity concerns, and Cable replacememntorteec. hnology, Bluetooth as, 2,5 CACHED device, explained, 56–57 TaCbaler,oBfluCeotnotoetnhtisn, 7–8 Bluetooth for Java InCtrAoSdTucatilognorithm, 160–161 CChaDpCter(c1onn- eInctteroddduecivnigceBcluoentofigotuhration), 75 CChaepllteprh2one-sBluetooth 1.1 Chapcteornf3igu-riBnegfoinreImYopuroGnetot SStiamrtueldator, 143 Chapatenrd4lap-toUpndceornsntaencdtionng sthhearJianvga, 5Bluetooth API Chapltimerit5atio-nBsluoeft,o3oth with J2ME MIDP Chapatenrd6PD-ACdreaatatintgraansBfleure,t3o–ot4h Print Server with JPS API CChaepntterral7ize-dJcaovma manudnOicBaEtiXon, 226 CChahpatleler n8ge-/reUssipnognaseBlmueetcohoathniSsimm,u1la5to6r Chapter 9 - Bluetooth Security CChahpatteer x1a0m-pWlei,re1l4es5s–1Em52bedded Systems with the Micro BlueTarget CChahpatteCr l1ie1nt-.jaEnvtaelripsrtiinseg,B1lu4e6t–o1o5th0Applications with the Ericsson BlipNet CChahpatteSre1r2ve-r BBlluueettooooththadnedvJicinei, 151 ACppheantdSiexrAve-r jcaovnavxe.brlsuaettiooont,h152 Appendix B - javax.obex ChatServer interacting with ChatClient, 151 Appendix C - Java Bluetooth Development on the PalmOS Platform ACppheantdSiexrDve-r.BjalivpaNelitst1in.1g,A1P4I 5–146 InCdiepxher (encryption algorithm), 159 LiCstlaosfsF1iguBrleusetooth devices, 17,225 List of Tables Class 2 or Class 3 Bluetooth devices, 17,225 List of Listings LiCstLoDfCSi(dceobnanrsected limited device configuration), 75–76,186 CLDC packages for small device Java applications, 76 CLDC Technology Compatibility Kit (TCK), 186 Client authentication, 157 Client authentication request, 157 Client connections with Serial Port Profile, 69–70 Client encryption, 162–163 Client-server architecture (Bluetooth), 1 ClientApp.java listing, 165–170 ClientSession interface (javax.obex),122,265 ClientSession object connect() method, 131 createHeaderSet() method, 122 disconnect() method, 132 setPath() method, 135 Com.ericsson.blipnet.api packages, 232–233 Comm un icatio n,67 –72 m ultip oin t,16 point-to-point,15 Bluetooth for Java CONNECT operation (OBEX), 121,131 by Bruce Hopkins and Ranjith Antony Connect() methoAdporfesCsli©en20tS03e(s3s52iopnagoebs)ject, 131 ISBN:1590590783 Connection classT(hjaevaauxt.hmoircsroef dthitiisonte.ixot),d1es2c2ribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Connection shariningc,luladepstoapntoAPpIhoovneerv, i5ew of the Java library, development of Connection URL BSlutreintogo, t1h2-b8ased services, highlights of security concerns, and authenticate pmaorarem. eter, 156–157,162 authorize parameter, 158 TableeonfcrCyopnt tpeanrtasmeter, 161–162,174,177 Bluetaonodththfoer SJaDvDa B, 130 InCtroondnuecctitoionns ChapBtelur e1too-thIndtreovdicueci,n1g5B–l1u6etooth Chapdteerfin2ed-,6B8luetooth 1.1 Chapatenrd3ses-sBioenfosr,e6Y8ou Get Started CChaopntnerec4tor-cUlansdse,rs6t6anding the Java Bluetooth API CChaopntnerec5tor-oBblujeectot ootphewn(it)hmJ2eMthEodM,ID64P,69,80,130 Chapter 6 - Creating a Bluetooth Print Server with JPS API ConnectToClientAndPrint() method, 105 Chapter 7 - Java and OBEX CChaOpNteTr I8NU-EUrseisnpgoanBselucetoodoeth(OSiBmEuXla)t,o1r21,125 CChaopntterrol9lers-.BSleueeBtoloutehtoSoetchudrietyvices CChaoprtdelres1s0 p-hWonireele(BssluEemtoboetdhd),ed21S,y2s7tems with the Micro BlueTarget CChaoprtdelres1s1 T-eElenptehropnriysePBrolufieleto,o2t7h Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ACppPeUndgixatAe -cojauvnatx,.1b8lu3etooth ACppReEndAiTx EB-E- MjaPvaTxY.oobpeexration (OBEX), 123 ACppreenadteixHCea-dJearvSaeBt(lu) emtoeotthhodD,e1ve2l2opment on the PalmOS Platform ACppreenadteixPDrin-tJBolibp(N)emt 1e.t1hoAdP,I 101 Index CSR baseband controller, 187 List of Figures LiCstSoRf TBalubleeCs ore 1 radio, 14 List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) D The authors of this text describe how to develop wireless Java Data format, idenatpifypilnicgatwioitnhs JuPsiSn,g1B0l0uetooth for a variety of platforms. This includes an API overview of the Java library, development of Data security. SeBelSueetcouortithy-based services, highlights of security concerns, and Data terminal autmheonreti.cation, 192 DataElement class (javax.bluetooth), 59–60,65,260 TaDbelebuogf gCiongn,tewnitths Bluetooth simulator, 137–153 Bluetooth for Java InDtreocdruypcttiioonn,177–178 CDhaepptleory1me-ntInlotrcoadtiuocninsgfoBrluBeltuoeottohoth applications, 226 CDhaepvteelro2pm-enBtlueentvoiorothnm1.1ent setup checklist, 81 CDhaepvtiecre3cla-ssBeesfo, rBeluYeoutoGoteht mStaajroterdand minor, 54–55 Chapter 4 - Understanding the Java Bluetooth API Device communication types Chapter 5 - Bluetooth with J2ME MIDP m ultip oin t,16 Chapter 6 - Creating a Bluetooth Print Server with JPS API point-to-point,15 Chapter 7 - Java and OBEX CDhaepvtiecre8dis-coUvseinrgy,a55B–lu5e7tooth Simulator CDhaepvtiecre9driv-eBrl,u1e7tooth Security CDhaepvtiecre1m0a-nWagireemlesesnEt,m2b5e,5d1de–d55Systems with the Micro BlueTarget CDhaepvtiecre1M1a-nEangteerrp(WrisiendBoluwesto2o0th00A)p,p2l5ications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini ADppeevnicdeixCAla-ssjacvlaaxs.sbl(ujaetvoaoxt.hbluetooth), 53,57–58,261 ADppeevnicdeixDBisc-ojavevarex.do(b) emx ethod, 57 ADppeevnicdeixPCro-peJartvieasB.jlauveatoloisthtinDge,v4e8lo–p5m1ent on the PalmOS Platform ADppeevnicdeixsD(B-luBelitpoNoetht )1..S1 eAePBI luetooth devices Index Dial-up networking, wireless, 5 List of Figures LiDstiaolf-UTapbNleestworking Profile, 26 LiDstISoCf LOisNtiNngEsCT operation (OBEX), 132 LiDstisocfoSnindeebcat(r)smethod of ClientSession object, 132 Discovery modes (Bluetooth), 52 Discovery Service (Jini), 244 DiscoveryAgent class, 52,56–57,63–64,261 DiscoveryListener interface, 57,64,261–262 Distance measuring, 34 Distributed computing, problems of, 242 Doc interface, 100 DocFlavor object, 100 DocPrintJob object, 101 Documents, in JSP, 99–101 Dynamic OS loader, 189 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) E The authors of this text describe how to develop wireless Java E-mail stations inaapphloictaetli,o2n2s 9using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Echo service, 193B–lu2e0t7ooth-based services, highlights of security concerns, and Embedded Linux,m1o8re5. Embedded Windows, 185 TaEbmlepolofyCeoenst,etrnatcsking in a building, 229 Bluetooth for Java InEtrmoudulacttoior,nvs. simulator, 138 CEhanpctreyrp1t pa-raInmtreotdeurciinngcoBnluneetcotoiothn URL, 161–162,174,177 CEhanpctreyrp2t() m- eBltuheotdoootfhR1e.1moteDevice class, 162 CEhanpctreyrp3ted-dBaetafo,rdeeYcoruypGtientgS, t1a7rt6e–d178 Chapter 4 - Understanding the Java Bluetooth API Encryption,159–163 Chapter 5 - Bluetooth with J2ME MIDP CEhanpctreyrp6tion-aClrgeoartitinhgma(cBilpuheetoro),th15P9rint Server with JPS API CEhanpctreyrp7tion- kJeayv,a1a5n9d–O1B61EX CEhanpteterpr r8ise-BUlusientgooathBlaupetpoloictahtiSoinmsu, l2a2to5r–240 Chapcterer a9ting- BulsuientgooJtahvaS,e2cu2r6ity Chapqteura1lif0ic-atWioinresleosfs, 2E2m5bedded Systems with the Micro BlueTarget CEharipctsesro1n1,1-1–En1t2erprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AEppriecnsdsioxnAB-lipjaNvaext..bSlueeetBoloipthNet AEppveenndtsix(BJin-i)j,a2va4x5.obex AEppveenndtsix(JCP-SJ)a,v9a9Bluetooth Development on the PalmOS Platform AEppxeanmdpixleDc-oBdleipiNnetth1is.1boAoPkI , working with, 81 Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) F The authors of this text describe how to develop wireless Java FAILURE responaspepcliocadteio(nOsBuEsiXn)g, B1l2u1e,t1o2ot5h for a variety of platforms. This includes an API overview of the Java library, development of FAX Profile, 26 Bluetooth-based services, highlights of security concerns, and File transfer clienmt, o1r3e1. –134 File transfer example (JSR-82 OBEX API), 127–136 TaFbillee TofraCnosnfeter nPtrsofile, 27 Bluetooth for Java InFtirloedturactnisonfer server, 127–131 CFhaixpetde-rw1ire-leIsnstrcoodmucminegrcBilaulestoyosttehm, 182 CFhaixpetde-rw2ire-leBslsuectoonosthum1.e1r system, 181 CFhaixpetde-rw3ire-leBsesfodreeviYcoeu, eGxeptlaStinaertde,d181 Chapter 4 - Understanding the Java Bluetooth API Fixed-wireless system, creating, 207–223 Chapter 5 - Bluetooth with J2ME MIDP CFhalapstherd6isk,- 1C8re8ating a Bluetooth Print Server with JPS API CFhalapstherm7em- oJaryv,a1a8n7d–1O8B9EX CFhalapttefirle8sys-tUemsin, gRaMBSluaest,oo7t9h Simulator Chapter 9 - Bluetooth Security Fossil Wrist PDA with Palm OS 4.1, 9 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CFhaTpCteliren1t1.ja-vEanltiesrtipnrgis,e1B3l2u–e1to3o4th Applications with the Ericsson BlipNet CFhaTpSterrv1e2r.j-aBvaluelitsotiontgh, a1n2d8–Ji1n3i 0 AFppuetunrdeixBAlu-etjaovoathx.dbeluveictoeost,h8–9 Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) G The authors of this text describe how to develop wireless Java Gaming (wirelessa)pplications using Bluetooth for a variety of platforms. This Bluetooth for , iBn7lculeutdoeostha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and playing in restmauorraen. t lobby, 9 Gate count (CPU), 183 TaGbCleFo(fGCeonnetreicntCsonnection Framework), 42,80,105 BGlueetnoeortihc fAocrcJeasvsa Profile, 24,28,51,229 InGtreondeurcictioOnbject Exchange Profile, 27 Chapter 1 - Introducing Bluetooth GET operation (OBEX), 121,123,131 Chapter 2 - Bluetooth 1.1 CGhaepttAepr p3Pro-pBeerftoyr(e) mYoeuthGoedt oStfaMrtIeDdlet, 144 CGhaepttBelrue4too- tUhnAddedrrsetasnsd()inmg etthheoJda,v5a1B,5lu3etooth API CGhaepttCeor n5ne-ctBiolune()tomotehthwoitdh, JB2lMipESeMrIvDePr object, 234 Chapter 6 - Creating a Bluetooth Print Server with JPS API GetDiscoverable() method, 53 Chapter 7 - Java and OBEX CGhaepttDeirsc8ov-erUysAinggenat(B)lumeetothoothd,S5im6ulator CGhaepttEevre9ntF-ilBtelur(e)tmooeththSoedc,u2r3it4y CGhaepttFerrie1n0dl-yNWairmelees(s) mEmebtheoddd,e5d3Systems with the Micro BlueTarget CGhaepttLeorc1a1lD-eEvnicteer()prmiseethBolude,to5o1th Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini AGppeetnMdaixjoArD-ejvaivcaexC.blalusest(o)omthethod, 53 AGppeetnMdiinxoBrD-ejvaivcaexC.olabsesx() method, 53 AGppreanddeixscCh-ooJalveanBvilruoentomoethntD, e2v3e2lopment on the PalmOS Platform AGppreoncdeirxyDst-orBelipBNlueet t1o.o1thAPdIevice tracker, 233–240 Index Grocery store environment, 226,233–240 List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) H The authors of this text describe how to develop wireless Java Hands Free Profialep,p2li8cations using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Hardcopy Cable RBleupetlaocotehm-beanstePdrsoefrilveic, e2s8,,h9i7ghlights of security concerns, and HCI (Host ContromlleorreIn. terface), 20,187 HeaderSet interface (javax.obex), 117–118,122–123,265–266 TaHbeleadoef rCSoenttoebnjtesct, 131,135 Bluetooth for Java InHtreoadduscetitoPnrofile, 26 CHhaIDpte(Hr u1ma- nInItnrtoedrufaccinegDBeluveictoeo)tphrotocol, 22 CHhaigphte-lre2vel-ABPluI e(MtoIoDthP)1,.719 CHhaopmteer,3Blu-eBtoeofothreinY,o8u Get Started Chapter 4 - Understanding the Java Bluetooth API Home office, Bluetooth in, 6 Chapter 5 - Bluetooth with J2ME MIDP CHhaopstte(rB6lue-toCorteha)t,in4g1 a Bluetooth Print Server with JPS API CHhaopstteCr o7ntr-oJllaevraInatnedrfOaBceE,X41 CHhaoptetelrb8usin- eUsssincgeantBelru,eBtoluoethtoSoitmh-uelantaobrled, 156 Chapter 9 - Bluetooth Security Hotel e-mail stations, 229 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CHhaPptiPerA1Q15-4E0n0tesreprriiesse PBolucekteoot tPhCApapnltiecantnioanes, w4ith the Ericsson BlipNet CHhaTpTtePr p1r2ot-oBcolulestotaoctkh,a1n7d Jini AHppuemndainx AInt-erjafavcaex.DbleuveitcoeotPhrofile, 28 Appendix B - javax.obex Human Interface Device (HID) protocol, 22 Appendix C - Java Bluetooth Development on the PalmOS Platform AHppyebnrdidixBDlu-etBoloiptNheJtin1i.1feAdPeIration, 253–255 InHdYexFLASH utility (HyNetOS), 189 LiHstYoLfOFAigDuruestility (HyNetOS), 189 LiHstYoMf OTaNbluetsility (HyNetOS), 189–190 List of Listings LiHstyoNfeStOidSeb(afrosr Micro BlueTarget), 185–191 Bluetooth implementation, 186–187 operating environment components, 185 protocol manager, 187 structural overview, 186 tools,189–190 Hyperstone AG microprocessor, 183 Hyperstone RISC/DSP CPU architecture, 185 HYTRACE utility (HyNetOS), 190 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) I The authors of this text describe how to develop wireless Java I/O, performing waitphptlhiceatGioCnsFu, s8i0ng Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Import statementB, l9u5etooth-based services, highlights of security concerns, and Impronto DevelopmeorrKe.it 1.0 for PalmOS, 269–272 Impronto Simulator (Rococo), 139–152 TableCoofnCsoonlet,e1n4t1s–143 BluetdoeovthiceforlisJta,v1a51 Introfdeuacttuiorens of, 139 Chapitnesrta1ll a-tioInntroof,du1c4in0g–1B4lu1etooth Chaprtuenr n2ing- aBnluaetpopolticha1ti.o1n in, 144 Chapvt.e1r.13 in-stBaellfaotrieonYosucrGeeetnS, t1a4rt0ed CIhnafpraterer d4, vs-.UBnldueertsotoatnhd,in1g the Java Bluetooth API CIhnaitpBtleipr S5erv-eBrlCueotnonoethctwiointh()Jc2oMnEsMtruIDcPtor, 234 Chapter 6 - Creating a Bluetooth Print Server with JPS API In putStre am ,13 1,19 3 Chapter 7 - Java and OBEX CIhnateptrecrom8 m- PUrsoinfiglea, 2B7luetooth Simulator CIhnateptreorp9era-biBliltuy,eatonoythdeSveiccuerittoy any device, 6 CIhraDpAte(rIn1f0ra-reWdirDealetsasAEsmsboecdiadteiodnS),y2st1e,m11s 5with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet IsAuthenticated() method of RemoteDevice, 157 Chapter 12 - Bluetooth and Jini AIpspEenncdrixypAte-dj(a)vmaxe.tbhloudetooof tRhemoteDevice class, 162 AIpspTernudsitxeBdD-ejvaivcaex(.)ombeexthod of RemoteDevice class, 158 Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) J The authors of this text describe how to develop wireless Java J2ME (Java 2 MicarpopElicdaittiioonns) pulsaintfgorBmlu,e4to2o,1th86for a variety of platforms. This MIDP,75–96 includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and overview of, 7m5 ore. J2ME Profiles, 75 vs. Bluetooth profiles, 29–30 Table of Contents diagram of, 76 Bluetooth for Java InJt2roMdEucWtioirneless Toolkit, 78 CJh2aSptEerp1latf-orImnt,ro4d2ucing Bluetooth Chapwteitrh2Bli-pNBleuteAtoPoIthto1a.1ccess external resources, 228 ChapJtearva3 Bl-uBeetofoorteh YdoeuveGleotpSmtaerntet dkits for, 105 CJhAapDte(rJa4va-AUpnpdleicrasttaionndiDngestchreipJtaovr)a fBilleu,e1to4o4th API CJhaavpater 5 - Bluetooth with J2ME MIDP Chapftoerr c6rea-tiCnrgeaetnintegraprBislueeBtoluoethtoPortihntaSpeprlviceartwioinths,JP2S26API Chapitnetreg7rat-inJgavBaluanedtoOotBhEwX ith, 33–43 Chapatenrd8OB-EUXs,in1g1a5–B1lu3e6tooth Simulator Chapwtehre9n n-oBt ltuoeutosoethBlSueectuoroittyh with, 33–34 CJhaavpate2r 1M0ic-roWEirdelietisosn E(Jm2bMedEd)e, d42S,y7s5te–m96s,w18it6h the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Java Bluetooth APIs, 45–73 Chapter 12 - Bluetooth and Jini AJpapevandBixluAet-oojatvhadx.ebvleuleotopomthent kits for J2SE, 105 AJpapevandBixluBet-oojatvhaSx.DoKbevxendors, 42–43 AJpapveandimix pCle-mJaevnataBtliouentooof tMh icDreoveBlloupemTeanrtgeont, 1th8e6P–a1l8m7OS Platform Appendix D - BlipNet 1.1 API Java OBEX API, 115–136 Index LiJsat voaf FRigeuarle-Ts ime Technology, 34 LiJsat voaf TSapbelecsification Request, 35 LiJsat voaf .Lioisptinagcskage, 80 LiJsat voaf .Suitdile.sbtaarcsk,19 Javax.bluetooth package, 36–37,259–264 Data El em ent,59 –60 ,65 ,26 0 DeviceClass,53,57–58,261 DiscoveryAgent,52,56–57,63–64,261 DiscoveryListener,57,64,261–262 L2CAPConnection,71–72,262 LocalDevice,51–53,56,262 RemoteDevice,53,57,157–158,162,263 ServiceRecord,58–59,64,263 UUID,61–63,264 Javax.microedition.io package, 80,122 Javax.microedition.io.Connection class, 122 Javax.microedition.rms.RecordListener,80 Javax.microedition.rms.RecordStore,80 Javax.obex package, 36,116,121–122,265–268 classes in, 38 ClientSession class, 122 HeaderSet interface, 117,122–123 Operation class, 122–123 ResponseCodes class, 120,123–126 ServerRequesBtHluaentodoletrhcfloarssJ,a1v2a6–127 SessionNotifiebrycBlarsusce, 1H2o7pkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Javax.print package, 99–101. See also JPS The authors of this text describe how to develop wireless Java Javax.print.attribuatpep,9li9cations using Bluetooth for a variety of platforms. This Java x.pr in t.attribuiBntelcu.lesuttdoaeonstdhaa-nbrdaA,sP9eI9dosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and Javax.print.Doc inmteorrfea.ce, 100 Javax.print.DocFlavor,100 TaJbalveaoxf.pCroinnt.teevnetnst package, 99 BJluaevtaoox.tphrifnotr.PJarivnatService object, 100 Introduction Javax.print.PrintServiceLookup object, 101 Chapter 1 - Introducing Bluetooth CJhaavpatexr.p2rin-t.SBilmueptloeoDthoc1.o1bject, 100–101 CJhCapPte(rJa3va-CBoemfomreuYnoiutyGPertoScteasrste),d34–38 CJhianpi,t2e4r 14–2-58Understanding the Java Bluetooth API ChapDteisr c5ove-rByluSeetrovoicthe,w2i4th4J2ME MIDP Chapetevren6ts,-2C4r5eating a Bluetooth Print Server with JPS API Chaphteorw7it w-oJrakvsa, a2n4d5–O2B5E3X Chapitnetreg8rat-inUgsiwngitha BBlluuetooth,S2i5m1u–la2t5o5r ChapJteorin9pro- tBolcuoelt,o2o4th4Security ChapLteera1si0ng- SWeirrevliecses, E2m44bedded Systems with the Micro BlueTarget ChapLteoro1k1up- SEentrevricperi,s2e4B3l–u2et4o7oth Applications with the Ericsson BlipNet ChapLteoro1k2up- SBelurevticoeotdhisacnodvJeinryi, 245–247 AppeSndeirxviAce- Cjaovnasxu.bmlueertoliofethcycle, 249–251 AppeSndeirxviBce- Pjarvoavxid.oebrelixfecycle, 245–249 ServiceItem object, 245,248–249,252–253 Appendix C - Java Bluetooth Development on the PalmOS Platform ServiceRegistrar object, 247–248,249–250 Appendix D - BlipNet 1.1 API ServiceTemplate object, 249 Indexsolving distributed computing problems, 242 List otfraFnigsuarcetsions,245 List of Tables LiJsitnoi-fBLluisetitnogosth-enabled device, 256–257 LiJsitnoi ffeSdideerabtairosn, 243,255 entities in, 245 functionality of members in, 243 joining,247–249 Jini network technology, 242–245 JMatos (PsiNaptic), 254 Join protocol (Jini), 244 JPS (Java Print Service), 97–113 architecture,99 attributes,99 creating a Bluetooth Print Server with, 97–113 creating a document, 100–101 creating a print job and printing, 101–102 documents,99–101 event model, 99 identifying the data format, 100 integrating with Bluetooth, 104–112 listening for print status updates, 102 overview,98–99 relationship between printer and client, 98 searching for a print service, 101 JPS API packages, 99 Bluetooth for Java JPS application example (JPSPrint), 102–104 by Bruce Hopkins and Ranjith Antony JPSBluetoothPrinAtpCrleiesnst©.ja20v0a3 l(i3s5t2inpga,ge1s0) 9–112 ISBN:1590590783 JPSBluetoothPrinTth.jeavaautlhisotirnsgo,f1t0h5is–t1e0x9t describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This JPSPrint applicatiinocnlu, d1e0s2–an10A4PI overview of the Java library, development of JPSPrint.java listiBnlgu,et1o0o2th–-1b0a4sed services, highlights of security concerns, and more. JSR-82 API, 35,42,45–73 application simulation, 152 TableaosfoCnolyntsetanntdsardized Bluetooth API, 39–40 Bluetboeontheffiotsr oJaf,va38–40 Introcdoumctipoantible code, 96 Chapitnedre1pen- dInetnrtoodfucsitnagckBlaunedtoroatdhio, 38–39 ChapOteBr E2X A- PBlIuseitno,o1t2h11–.1136 Chaprtoelre3of,-3B5e–f3o6re You Get Started CJhSapRt-e8r 24-co-mUpnldiaenrst tBanludeintogotthheaJpapvlaicBaltuioentoso, t1h3A9PI CJhSapRt-e8r25-co-mBplulieatnotoBthluweittohoJt2hMsEtaMckIDlPayers, 39 Chapter 6 - Creating a Bluetooth Print Server with JPS API JSR-82 Expert Group, companies in, 35–36 Chapter 7 - Java and OBEX CJhSapRt-e8r28OB- EUXsinAgPaI fBilleuetrtaonotshfeSrimexualamtoprle, 127–136 CJhSapTtAerR9TU-P.BINluIeftioleo,th18S8e–cu1r9it0y CJhVapMte(rJ1a0va-VWiritruealelsMs aEcmhbineedd),e1d8S6ystems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet JVM for Micro BlueTarget, 186–187 Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) K The authors of this text describe how to develop wireless Java Keyboard (Bluetoaoptphl)icsaetirovnicseuss,i6n0g Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and more. Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) L The authors of this text describe how to develop wireless Java L2CAP (Logical LaipnpkliCcaotniotrnosl uasnindgABdluaepttoaotitohnfPorroatovcaroile)t,y2o0f platforms. This clie nt c on nec tiBinolcunleust,do7eos1tha-nbaAsPeIdosveerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and connection aumthoerne.tication and authorization, 163 connections,70–72,163 vs. RFCOMM, 72 TablesoefrvCeornctoennntesctions, 70 BLlu2eCtoAoPthlafoyreJras,va70 Introduction CLh2apCtAerP1Con- nInetcrtoiodnucinintgerBfaluceet,o2o6th2 CLh2apCtAerP2Con- nBelucetitoonotmh e1t.h1ods, 71–72 CLh2apCtAerP3Con- nBeecfotiroenYoobujeGcett, S71ta–r7te2d CLh2apCtAerP4Con- nUencdteiornstNanodtifiniegr tinheteJrfaavcaeB,l2u6et2ooth API Chapter 5 - Bluetooth with J2ME MIDP L2CAPEcho Service example, 192–207 Chapter 6 - Creating a Bluetooth Print Server with JPS API CLh2apCtAerP7Ech-oJCavliaenatn.jdavOaBlEisXting, 196–207 CLh2apCtAerP8Ech-oUSseinrgvear.BjaluvaetolisottihngS,im19u3la–t1or96 CLhAapNteAr c9ces-sBPlureotfoiloet,h2S6e,2cu3r2ity Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Laptop to phone connection sharing, 5 Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CLhaapyteerrs1(B2 lu- eBtlouoetthoopthroatoncdoJli)n, iUUID values for, 61 ALpapeynedrsixoAf t-hjeavparox.tbolcuoeltosotathck, 18–20,23,61 ALpepeansdinixg Bse-rvjaicveax(.Joinbei)x, 244 Appendix C - Java Bluetooth Development on the PalmOS Platform Light waves, 34 Appendix D - BlipNet 1.1 API InLdineex-of-site issues of infrared, 1 LiLsitsotinf gFisgures List o1f0T2a4b-lbesit encryption key, 160–161 List obfaLnisktiangccsount information, 160 List obfaSnidkeabcacrsount information encrypted, 161 Beam Tsk.java ,87 –88 BluetoothSetup1.java,47–48 C hatCl ie nt.ja va,14 6–1 50 ChatServer.java,145–146 C lie ntAp p.j ava,16 5–1 70 DeviceProperties.java,48–51 FTC lient.j ava,13 2–1 34 FTServer.java,128–130 JPSBlue too th Pr in tC lient.j ava,10 9–1 12 JPSBluetoothPrint.java,105–109 JPSPrint.java,102–104 L2CAPEchoClient.java,196–207 L2CAPEchoServer.java,193–196 m ydevice.xm l,14 3 opening connections on Bluetooth Server, 68–69 Picon etMID let.j ava,91 –95 ServerApp.java,163–165 service registration process, 66–67 SPP2COMM.java,208–223 stack initiation code for Atinav SDK, 47 Ste alth.j ava,84 –87 Tr ackin g.j ava,23 5–2 40 Bluetooth for Java LocalDevice class, 51–53,56,262 by Bruce Hopkins and Ranjith Antony Lookup Service dAispcroesvse©ry2(0J0i3n(i)3,5224pa5g–es2)47 ISBN:1590590783 Lookup Services T(hLeUSau),thJoinrsi, o2f4t3h–is24te7x,t2d4e9scribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This LookupPrintServiicnecslu(d) ems eatnhoAdP,I 1o0ve1rview of the Java library, development of Low-level API (MBIDluPe)t,o7o9th-based services, highlights of security concerns, and more. Low-power wireless technology,Bluetooth as, 2 LUS (Lookup Services), Jini, 245–247,249 Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) M The authors of this text describe how to develop wireless Java MAME (Multiple AarpcpalidcaetMionaschuisniengEBmluueltaotootrh) pforrojaecvta,r1ie3ty8 of platforms. This includes an API overview of the Java library, development of Manufacturing facBilluiteyt,oBoltuhe-btoaostehdinse,r1v8ic2es, highlights of security concerns, and Master and slavemcoornec.ept, 1,30–31 Micro BlueTarget (Smart Network Devices), 179–224 TableaopfpClicoanttioenntdsevelopment on, 187–224 BluetBoolutehtofoorthJaivmaplementation of, 187 Introcdoumctimonunication between devices, 192–207 Chapcterer a1ting- Iantfirxoeddu-cwinirgelBelsusetsoyostthem, 207–223 Chapftoerr e2xte-rnBalulesteoroiathl c1o.1mmunication, 184 Chaphtearrd3wa-reBecfoomrepYoonueGnetst bSltoacrtkeddiagram, 183 Chaphtearrd4wa-reUncdoenrfsigtaunrdaitniognt,h1e8J2a–v1a8B4luetooth API Chaphtearrd5wa-reBldueettaooilsth, 1w8it4h J2ME MIDP ChapHteyrN6etO-SC,r1e8a5ti–n1g9a1Bluetooth Print Server with JPS API Java implementation, 186–187 Chapter 7 - Java and OBEX JVM for, 186–187 Chapter 8 - Using a Bluetooth Simulator libraries,186–187 Chapmteer m9 or-yBmluaeptoooft,h1S8e8curity Chapotepre1ra0tin- gWeirnevleirsosnEmmebnetdcdoemd Spoysnteenmtss,w1i8th5 the Micro BlueTarget Chapotepre1ra1tin- gEnstyesrtpermisefoBrl,u1et8o5o–th19A1pplications with the Ericsson BlipNet Chapotepre1ra2tin- gBlsuyesttoeomth taonodlsJ,in1i89–190 AppepnrdoixgrAam- jmavinagx.,1b9lu0e–to2o2t4h AppesnodfixtwBar-ejacvoanxfi.goubreaxtion, 185–187 AppesntdainxdCar-dJavvearsBiolune, t1o8o0th Development on the PalmOS Platform AppeSndtaixrtDer-KBitl,ip1N8e0t,18.14API Indexwhat it is, 179–182 List oWf Firiegluersess Network Access Point, 191–192 LiMstIDofleTtasbuleitse, 78 LiMstIDofl eLtisstings List odfeSfiindeebda,7rs8 developing,78–80 JAD (Java Application Descriptor) file, 144 skeletal structure of, 78–79 MIDP (Mobile Information Device Profile), 75–96 high-level API and low-level API, 79 packages for mobile devices, 77 user interface components, 79 MIDP 1.0 device, qualifications for, 77 MIDP 2.0 specification, 77 MIDP 2.0 wireless application functionality, 77–78 MIDP-Chat application, 272 Mobile phone configuring in Impronto Simulator,143 and laptop connection sharing, 5 limitations of, 3 and PDA data transfer, 3–4 Mobiwave BPA-D10 Bluetooth Protocol Analyzer, 163,173–178 data captured by, 174–175 data transmission sniffing, 173 Motorola,35 Bluetooth for Java by Bruce Hopkins and Ranjith Antony MTUs (MaximumATprraensssm© i2s0s0i3o(n35U2 npaitgse)s,) 70–71 ISBN:1590590783 Multicast announTcheemaeuntthso(rLsUoSf t)h, i2s4t7ext describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Multicast requestisnc(LluUdSes),a2n4A7P,2I5o0verview of the Java library, development of Multipoint device Bcloumetmoouthn-icbaatsioedn,s1e6rvices, highlights of security concerns, and more. Museum environment, 226 Mydevice.xml listing, 143 Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) N The authors of this text describe how to develop wireless Java NAME headers (OapBpEliXca)t,io1n2s2using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Node administratBiolune(tBoloipthM-baansaegdesre),rv2i3ce1s–,2h3ig2hlights of security concerns, and Nokia N-Gage gammoirneg. system, Bluetooth-enabled, 7 Nondiscoverable mode (stealth mode), 81–83 Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) O The authors of this text describe how to develop wireless Java OBEX (Object Exacphpalincgateio),n2s1u,s1i1ng5–B1lu3e6tooth for a variety of platforms. This called IrO BEXiBnilnculeuItrdDoeoAsthap-nrboaAtsPoeIcdooslveesrtrvavicicekew,s,1oh1f i6gthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and what it is, 115–m1o2re1. OBEX API file transfer example, 127–136 TaObBleEoXf ACPonIsteinntJsSR-82, 121–127 BOluBetEooXthclfieonr tJsaavand servers, message flow between, 120 InOtrBoEduXcdtieofninition, explained, 117 Chapter 1 - Introducing Bluetooth OBEX headers, 117 Chapter 2 - Bluetooth 1.1 creating,119 Chapitnerja3va.-obBeefxo.HreeYaoduerGSeettSintatertrefadce, 118 Chapter 4 - Understanding the Java Bluetooth API COhaBpEteXr l5ibra-rBielus,et1o1o6th with J2ME MIDP COhaBpEteXr O6 bj-ecCtreMaotidnegl,a1B1lu7e–t1o1o9th Print Server with JPS API COhaBpEteXr o7pe-raJativoansa,n1d1O9B,1E3X4–136 COhaBpEteXr p8rot-oUcosilncgliaenBtl/useetrovoetrhaSrcimhiutelactoturre, 117 Chapter 9 - Bluetooth Security COhaBpEteXr p1r0ot-oWcoirletloesismEpmlebmeeddnet dBSluyesttoeomths pwriothfiltehse, M11ic6ro–1B1lu7eTarget COhaBpEteXr s1e1rv-eErnrteesrpproisneseBlcuoedtoeost,h1A2p3p–l1ic2a6tions with the Ericsson BlipNet COhaBpEteXr s1e2rv-eBrlureestopootnhsaensd, 1Ji2n0i ,123–126 AOppBeEndXixSAes-sjioanvaPx.rboltuoectoolo,t1h17,119–121 Appendix B - javax.obex Object Model (OBEX), 117–119 Appendix C - Java Bluetooth Development on the PalmOS Platform AOppbejnedcitxPDus-hBPliproNfeilte1,.217A,2P2I 9–230,232–233 InOdfefxices, Bluetooth in, 6,226 LiOstmonf iFdiigreucretisonal transmissions, 1 List of Tables OnConnect() method, 128 List of Listings LiOstnoGf eSti(d)embaertshod, 128 Opening connections on Bluetooth Server (listing), 68–69 Operation interface (javax.obex), 123,266 Operation object (javax.obex), 122,126 Operations (OBEX), 119,134–136 OutputStream,193 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) P The authors of this text describe how to develop wireless Java Packet data, hanadplipnlgicawtiitohnLs 2uCsiAnPg ,B7lu2etooth for a variety of platforms. This includes an API overview of the Java library, development of Palm DK (ImpronBtolueDteovoethlo-bpaesreKditse1r.v0icfeosr,PhaiglmhlOighSt)s, 2o6f s9ecurity concerns, and included softwmaorere, .271 install ation ,27 2 sample application, 272 Table of Contents supported Bluetooth protocols, 269 BluetsoyostthemforreJaqvuairements, 270 Introduction CPhaaplmterS1D B-luInettrooodtuhcicnagrdBlfuoertoPoatlhmOS 4 devices, 15 CPhaaplmteOr 2S 4-dBeluviecteoso,thPa1l.m1 SD Bluetooth card for, 15 CPhaaplmteOr 3S 4-.1B,eFfoorsesiYl oWu rGisettPSDtaArtwedith, 9 CPhaaplmteOr 4S e-mUunldaetorsr,ta1n4d0in,2g7t1he Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP PalmOS platform Chapter 6 - Creating a Bluetooth Print Server with JPS API Bluetooth development on, 269–272 Chapter 7 - Java and OBEX running versions of, 138 Chapter 8 - Using a Bluetooth Simulator CPhaaplmteSr o9urc-eBleumetuoloatthorS,e1c3u8rity CPhaApNte(rP1e0rs-oWnairleAlersesaENmebtewdodrekdinSgy)sPteromfsilew, i2th6 the Micro BlueTarget CPhaapstsewr o1r1dA- uEtnhteenrptirciasetioBnluceltaososth(jAavpapxli.coabtieoxn)s, w26it6h the Ericsson BlipNet CPhaCpttoerp1e2rip-hBeluraetlso,ortehpalandcinJignicable between, 5 Appendix A - javax.bluetooth APppCesn,dcixonBn-ecjativnagx.towboe,x5 APppDeAndtoix pCh-onJaevdaaBtaluetrtaonosthfeDr,e3v–el4opment on the PalmOS Platform APppDeAnsdix D - BlipNet 1.1 API IndexBluetooth-enabled,4 List osfeFrivgicueredsiscovery process for, 60 LiPsteorifphTaebralelss connected wirelessly, 5–6 List of Listings Persistent storage, RMS for, 79–80 List of Sidebars Personal area networks, 30–31 Personal networks, PC to PC, 5 PIC family microcontrollers, 184 Piconet Browser example application, 88–96 displaying Bluetooth devices in the area, 90 displaying remote device services, 91 initial screen for, 89 PiconetMIDlet.java listing, 91–95 Piconets (Bluetooth), 30–31 PIN (personal identification number) codes, 156 PLC (Programmable Logic Controller), 207 Point-to-point device communication, 15 POSE (PalmOS emulator), 140 Power classes of Bluetooth devices, 16–17 Power user, 6 PPP protocol, 192 PREKNOWN device, explained, 56–57 Print attributes (JPS), 99 Bluetooth for Java Print job, creating in JPS, 101–102 by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Print server Apress © 2003 (352 pages) client submittinThgeaafuiltehotors, 1o0f 9this text describe how to develop wireless Java creating with JaPpSpliAcaPtIi,on9s7–u1si1n3g Bluetooth for a variety of platforms. This Print services includes an API overview of the Java library, development of Bluetooth-based services, highlights of security concerns, and expl ained ,10 0more. searching for in JPS, 101 Print status updates, in JPS, 102 Table of Contents BPlureintot(o)thmfeotrhJoadv,a101 InPtrriondteurctaiodnapter (Bluetooth), 97 CPharipntteerrs1 ( B-l uIenttoroodthu)c,in2g0 ,B1lu0e0tooth CPharipntteFrile2() -mBelutheotodo,t1h015.1 Chapter 3 - Before You Get Started CPharipntteinrg4 - Understanding the Java Bluetooth API in JPS, 101–102 Chapter 5 - Bluetooth with J2ME MIDP wireless,5–6 Chapter 6 - Creating a Bluetooth Print Server with JPS API CPharipntteJro7bLis-teJanvear ainntderOfaBcEeX, 102 CPharipntteSre8rvic-eUosbinjegcat,B1l0ue0t–o1o0th1 Simulator CPharipntteSre9rvic-eBLlouoetkouopthclSaescsu,r1it0y1 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget PrintStatus class, 102 Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CPharopftieler 1in2te-rdBelupeetnoodtehnacnieds,Ji2n8i –30 APpproefnidleixs A(B-lujeatvoaoxt.hb)lu, e2t3o–o2th8 Appevnsd.ixJ2BM-Ejapvraoxf.iloebse,x29–30 AppeOndBixEXC t-oJiamvaplBelmueetnoot,th11D6evelopment on the PalmOS Platform AppeTndCixP/DIP--bBalispeNde,t215.21 API IndexUUID values for, 62 LiPstrooffileFisgu(Jre2sME), 75 LiPstrooffileTasb(lJeSs R-82-compliant required), 39 LiPstRoOf JLEisCtinTg.Hs EX file, 187 List of Sidebars Protocol Analyzer (Mobiwave BPA-D10),163,173–178 data captured by, 174–175 data transmission sniffing, 173 Protocol layers (Bluetooth), UUID values for, 61 Protocol multiplexing, 20 Protocol stack (Bluetooth), 17–23 Protocol stack (Bluetooth) layers, 18–20,23 Protocol De scriptorL ist,13 0 Protocols (Bluetooth), Palm DK supported, 269 Proximity measurement, 34 PsiNode development platform, 254–255 PUT operation (OBEX), 121,123,135–136 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) R The authors of this text describe how to develop wireless Java Radio frequencieasp, p1l3ications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Radio signals, 12B,3lu4etooth-based services, highlights of security concerns, and Radio spectrum, m12o–re1.7 Radios (Bluetooth), 13. See also Bluetooth devices TaRbelecoorfdCLoisntetennetrsobject, 80 Bluetooth for Java InRtreocdourcdtSiotnore object, 80 CRhaepmteorte1De-vIicnetrocdlauscsin(gjaBvlauxe.tboloutehtooth), 53,57,263 Chapateurth2oriz- eB(l)uemtoeoththod1,.1158 Chapetenrcr3ypt-()BmefoertehoYdo,u1G6e2t Started ChapitseAr u4the-nUticnadetersdt(a)nmdientghothde, 1Ja5v7a Bluetooth API ChapitseEr n5cry-pBtelude()tomotehthwoidth, 1J26M2E MIDP isTrustedDevice() method, 158 Chapter 6 - Creating a Bluetooth Print Server with JPS API CRhaepqtueres7t p-acJakveat (aOndBEOXB)E,X121 CRhaepstpeor n8se-cUosdiengs (aOBBluEeXtosoethrvSeirm),u1la2t3o–r126 CRhaepstpeor n9se-pBalcukeetot o(tOhBSEeXcu),ri1ty21 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ResponseCodes class (javax.obex), 123–126,267 Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CRhaepsttearu1ra2n-t lBolbuebtyooatrhcaadned, J9ini ARppeetandilixstAore- ,jaBvlauxe.tboloutehtodoethvice tracker for, 233–240 ARppeetrnideivxeBDe-vjiacveasx(.)ombeexthod, 56–57 Appendix C - Java Bluetooth Development on the PalmOS Platform RFCOMM (wireless serial port), 21 AppecnodnixnDec-tioBnlipsN,6e7t –17.10 API Indexvs. L2CAP, 72 List of Figures RFCOMM layer, 25 List of Tables LiRstI o(Rf Leifsetirnegnsce Implementation), 36 LiRstISoCf S/DidSePba3rs2-bit CPU (Hyperstone), 183,185 RMS (Record Management System), 79 logical representation of, 80 for persistent storage, 79–80 Rococo Impronto Simulator, 139–152 Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) S The authors of this text describe how to develop wireless Java Scatternets (Blueatoppoltihca),ti3o1ns using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of SDDB (Service DBisluceotvoeortyh-Dbaatsaebdasseer)v,ic5e8s–, 6h0ighlights of security concerns, and connection URmLosrea.nd, 130 registering and storing services in, 66 service records in, 59 Table of Contents service registration in, 127 Bluetooth for Java InStrDoPdu(cSteiornvice Discovery Protocol), 20 CShaDpPtelra1yer,- 2In4t,r5o8ducing Bluetooth CShaepatrecrh2Ser-viBcleuse(t)oomthet1h.o1d, 63–64 CShaepctuerrit3y,15-5B–e1fo7r8e You Get Started Chapateurth4ent-icUantdioenr,s1ta5n6d–i1ng58the Java Bluetooth API Chapetenrcr5ypt-ioBnlu,1e5to9o–t1h6w3ith J2ME MIDP Chapsteerrv6er a- uCtrheoartiiznagtiaonB,lu1e5t8o–ot1h5P9rint Server with JPS API Chapter 7 - Java and OBEX Security administration (BlipManager), 231 Chapter 8 - Using a Bluetooth Simulator CShaepctuerrit9y cl-ieBnltuaetttoeomthpStinecgutroityconnect to server, 171 CShaepctuerrit1y0ex-aWmirpellee,s1s6E3m–b1e7d8ded Systems with the Micro BlueTarget CShaepctuerrit1y1m-eEanstuerrepsr,is1e5B5l–u1et6o3oth Applications with the Ericsson BlipNet CShaepctuerrit1y2se-rBveluretooth and Jini AppepnrdoixmApt-injgavuasxe.brlfuoertoPoINth, 172 AppewndaiixtinBg-fojarvcalxie.onbt etox connect, 170 Appendix C - Java Bluetooth Development on the PalmOS Platform SelectService() method, 63–64 Appendix D - BlipNet 1.1 API InSdeerxial Port Profile, 25,67,145,208,224 List ocfliFeingtucreosnnections with, 69–70 List osfeTraveblrecsonnections with, 68–69 LiSsteorvfeLrisatiuntghsentication, 156–157 LiSsteorvfeSridaeubtharosrization, 158–159 Server connections with Serial Port Profile, 68–69 Server encryption, 161–162 ServerApp.java listing, 163–165 ServerRequestHandler class, 126–128,268 ServerRequestHandler methods, 126 Service Consumer lifecycle (Jini), 249–253 Service Consumers (Jini), 245,249–253 Service discovery, 58–65,88,91 Service Discovery Application Profile, 24,58 Service discovery process for a PDA, 60 Service Providers (Jini), 245 lifecycl e,24 7–2 49 and Service Consumer, 253 Service record attributes, 59–60 Service records in the SDDB, 59 Service registration, 65–67 defined,65 process listingB,l6u6e–to6o7th for Java in the SDDB, b1y27Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) ServiceClassIDList,130 The authors of this text describe how to develop wireless Java ServiceDatabaseaSptpaltieca,1t3io1ns using Bluetooth for a variety of platforms. This ServiceItem l easiiBnnlgcul,eu2tdo4eo7st–ha2-nb4aA9sPeIdosveerrvviiceews,ohfigthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and ServiceItem objecmt o(rJein. i), 245,247–249,250–252 ServiceName object, 69,131 TaSbelervoicfeCRoenctoerndtsclass, 58–59,64,263 BSlueertvoioctehRfeorcoJardvHa andle,130 Introduction ServiceRecordState,130 Chapter 1 - Introducing Bluetooth CShaeprvteicre2Re-giBslturaetrooobthje1c.t1(Jini), 247–248,250–251 CShaeprvteicre3Re-giBsetrfaotrieonYEouxcGeepttiSotnarctleadss, 263 CShaeprvteicre4s, r-egUinsdteerrisntganadnindgstthoerinJgavian BthlueeStoDotDhBA,P6I6 Chapter 5 - Bluetooth with J2ME MIDP ServicesDiscovered() method, 64 Chapter 6 - Creating a Bluetooth Print Server with JPS API CShaeprvteicre7Tem- JpalvaateanodbjOecBtE(XJini), 250 CShaepstseior n8 m-aUnasignegmaeBnlut,e2to2o6th Simulator CShaepstseior n9 Pr-oBtoluceotlo(oOthBSEeXc)u,r1it1y7,119–121 CShaepstseior n1N0 o-tiWfieirreilnetsesrfEamcebe(djadveadx.Soybsetexm),s1w27it,h26th8e Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CShaepstseior n1s2, -deBfliuneetdoo, t6h8and Jini ASppeetDndisixcoAve- rjaabvalex(.)bmlueettohootdh, 52 ASppeetEndnivxVBar-sjascvarixp.to, b1e4x0–141 ASppEeTnPdAixTCH-oJpaevraaBtilounet(oOoBthEDXe)v, e1l2op1m,1e3n5t on the PalmOS Platform Appendix D - BlipNet 1.1 API SetPath() method, 135 Index LiSsthoafreFdigluinrekskey, 156 LiSsthoofpTpainbglems alls, 226 LiSstigonfaLlissttirnegnsgth indicator, 33 List of Sidebars SimpleDoc object, 100–101 Simulator (Bluetooth), 137–153 vs. emulator, 138 pros and cons of using, 138–139 Sim ula to r.bin ,14 0 Sim ula to r.exe,14 0 Slave list dialog box, 176 Slaves and master concept, 1,30–31 Small office, Bluetooth in, 6 Smart Network Devices, 183,185 SmartDecrypt (Mobiwave Protocol Analyzer), 176–178 SND operating system (HyNetOS), 185 SoC (System-on-Chip) architecture, 183,185 Sound applications, Bluetooth for, 6–7 SPP.SeeSerial Port Profile SPP2COMM.java listing, 208–223 Stack (Bluetooth), 41 Stack initialization, 47–51,95 Bluetooth for Java Stack initialization code for Atinav SDK, 47 by Bruce Hopkins and Ranjith Antony Stack layers (JSRA-p8r2es-cso©m20p0li3a(n3t52Bpluageetso) oth), 39 ISBN:1590590783 StartInquiry() metThhoeda, uDthisocrosvoefrythAigs etenxt todbejesccrti,b5e6h–o5w7 to develop wireless Java applications using Bluetooth for a variety of platforms. This Stealth mode (noinndcliusdceosvearnaAblPeI movoedrvei)e,w81o–f 8th8e Java library, development of Stealth Mode exaBmlupelteo,o8th1-–b8a8sed services, highlights of security concerns, and more. Stealth.java listing, 84–87 StreamConnectionNotifier object, 66 Table of Contents BSluUetCooCtEhSfoSr rJeasvpaonse code (OBEX), 121,125 InSturondMucitciroonsystems Java 2 Micro Edition. SeeJ2ME platform CShaupnteMr ic1ros-yIsnttermodsucJiinngi. BSleueeJtoinoith CShaypmtemr e2tric-aBl leunectoryopthtio1n.1, 159,161 Chapter 3 - Before You Get Started Synchronization Profile, 27 Chapter 4 - Understanding the Java Bluetooth API CShaypstteerm5mo- nBiltuoertcooonthsowleith(MJ2icMrEo MBlIuDePTarget), 189 CShaypstteerm6tra-cCerweaintidnogwa (BMluicertoooBthluPerTinatrgSeetr)v,e1r9w0ith JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) T The authors of this text describe how to develop wireless Java TCK (TechnologyapCpolimcaptiaotnibsiluitsyinKgit)B,lu3e6tooth for a variety of platforms. This includes an API overview of the Java library, development of TCP/IP-based BluBeluteotootohthp-rboafisleesd,s2e5rv2ices, highlights of security concerns, and TCS (Telephony mCoornet.rol Protocol Specification), 21 TCS-BIN,21 TaTbCleSoBf iCnoarnyt,e2n1ts Bluetooth for Java InTtDroKduBcltuioentooth Developer's Kit, 271 CThaDpKteUr S1B -BIluntertoodouthcindgevBilcuee,to8o3t–h84 CThaepstteinrg2, us-inBgluBetluooetthoo1t.h1 simulator for, 137–153 CThaepxttemr e3ss-agBeefsoerexaYmoupGlee,t1S4t5a–rt1e5d2 Chapter 4 - Understanding the Java Bluetooth API Thread scheduler, 187 Chapter 5 - Bluetooth with J2ME MIDP CThaINptIe(rT6iny -InCterernaetint gInateBrflauceeto)o, t2h5P4r–in2t5S5erver with JPS API CThaINptIecrh7ipse- tJ,a2v5a4and OBEX CThaINptIedre8vice-sU,s2in5g5a Bluetooth Simulator Chapter 9 - Bluetooth Security TINI microcontroller, 255 Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget CTharapctekrin1g1e-mEpnltoeyrepreisseinBaluebtuoioldthingA,p2p2lic9ations with the Ericsson BlipNet CTharapctekrin1g2E-veBnlutLeitsotoetnhearncdlaJsinsi, 235 ATppr aecnkdiinx gA.j a- vjaa,v2a3x4.b–l2ue4t0ooth Appendix B - javax.obex Tracking.java listing, 235–240 Appendix C - Java Bluetooth Development on the PalmOS Platform ATppr aenndsiaxcDtio-nBsli(pJNinei)t ,12.41 5API InTdreiaxngulation,34 LiTstruosfteFidgudreevsices, 158 LiTstYoPfETahbelaesders (OBEX), 122 List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) U The authors of this text describe how to develop wireless Java UART device, 18a3pplications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Unicast request (BLlUueSt)o,o2t4h-7b,2as5e0d services, highlights of security concerns, and UUID (Universal Umnoirqeu. e Identifier), 61 UUID class (javax.bluetooth), 61–63,264 TaUbUleIDo(f)Cmoenttheondtss, 62–63 Bluetooth for Java InUtrUoIdDucvtaiolunes for Bluetooth profiles, 62 Chapter 1 - Introducing Bluetooth for Bluetooth protocol layers, 61 Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) V The authors of this text describe how to develop wireless Java Vending machinea,pBplluiceattoioonths -uesninagblBeldu,e1to8o1th for a variety of platforms. This includes an API overview of the Java library, development of Virtual serial portBclouemtomouthn-ibcaastieodnsperrovtiocecso,l.hSigeheliRghFtCs OofMsMecurity concerns, and Voice applicationms,o6r–e.7,33–34 Table of Contents Bluetooth for Java Introduction Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Index Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) W The authors of this text describe how to develop wireless Java WAP (Wireless AacpcpeliscsatPiornostoucsoinl)g, 2B1lu,2et2o9oth for a variety of platforms. This includes an API overview of the Java library, development of WAP over BluetoBoltuhe,t2o2ot9h-based services, highlights of security concerns, and Windows 2000 Dmevoicree. Manager, 25 Windows CE.NET, 185 TaWbliereolefsCsocnotmenmtsunication protocol, Bluetooth as, 1 Bluetooth for Java InWtrioredluecstsiodnial-up networking, 5 CWhaipreteler s1s e-mInbterdoddeucdinsgysBtelumetso,o1th79–224 CWhaipreteler s2s L-ABNlu(e8t0o2ot.1hb1).1vs. Bluetooth, 1–3 CWhaipreteler s3s N-eBtwefoorrke AYocuceGsest PSotainrtt,ed191–192 Chapter 4 - Understanding the Java Bluetooth API Wireless serial port. SeeRFCOMM Chapter 5 - Bluetooth with J2ME MIDP CWhaipreteler s6s S-yCstreematinMgoaniBtolureetxoaomthpPleri,n2t 0S7e–rv2e2r3with JPS API Chapctelier n7t o-ptJiaovnas,a2n2d3O–B2E2X4 Chapsteerrv8er s-eUtsuipn,g2a0B8–lu2e2to3oth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars List of Figures Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Chapter 1: TInhetrauothdoruscofinthgis tBexltudeestcoriboe thhow to develop wireless Java applications using Bluetooth for a variety of platforms. This Figure 1-1: TihneclushdeosrtaannAtePnInoaveerovniewHPofiPthAeQJa5v4a0l0ibsraerryie,sdePvoeclokpemt PeCnt aolflows it to communicate via Bluetooth andBlu8e0t2o.o1t1hb-b. aFsoerdasdedrveidcesse, chuigrihtyli,gthhtiss omf osedceulraitlysocoinnccleurdnes,saandfingerprint reader. more. Figure 1-2: The Bluetooth-enabled Nokia N-Gage wireless gaming system Table FoifgCuorent1e-3nt: sAlthough the Fossil Wrist PDA doesn't contain any Bluetooth hardware, it does come BluetoportehlofoardeJadvawith a Bluetooth-enabled OS— the Palm OS 4.1. Palm OS is a registered trademark of IntrodPuactlmion, Inc. Chapter 1 - Introducing Bluetooth CChaphtaerp2te-rBl2ue:toBotlhu1e.1tooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Figure 2-1: The 3COM USB Bluetooth module Chapter 5 - Bluetooth with J2ME MIDP ChaptFerig6ure-2C-r2e:aTtihneg Ca SBRlueBtoluoethCPorreint1S. eTrhviesrswinigthleJ-PcShiApPsIolution includes a microprocessor, RAM, I/O Chaptceor n7tro-lleJar,vaanadndBlOuBeEtoXoth implementation in a single package! This is most likely the smallest radio Chapttehra8t yo-uU'vseinegvaerBslueeetno.oth Simulator Chapter 9 - Bluetooth Security ChaptFerig1u0re-2W-3ir:eTlehses PEmalbmedSdDedBSluyestteomotshwciathrdthfoerMPicarlomBOluSeT4ardgeevtices. Palm OS is a registered trademark of ChaptPeral1m1,-InEcn.terprise Bluetooth Applications with the Ericsson BlipNet ChaptFerig1u2re-2B-l4u:eYtooouthcaanndoJninlyi connect to one Bluetooth device at a time if you have hardware that only AppensduixppAo-rtsjapvaoxin.bt-ltuoe-tpoooitnht communication. Appendix B - javax.obex AppenFdiigxuCre-2J-a5v:aYBoluuectaoonthcoDnenveeclotptomuenpttoonsethveenPaBlmluOeStoPoltahtfdoermvices at a time if you have multipoint-capable AppenhdaixrdDw-arBeli.pNet 1.1 API Index Figure 2-6: A) The computer may be attached to its peripherals, but it can't control them without a List ofdFriivgeurr.eBs ) The computer may be attached to a Bluetooth device, but it can't control it without a stack. List of Tables List ofFLigisutirneg2s-7: The Bluetooth protocol stack List of Sidebars Figure 2-8: As you can see in Windows 2000, the operating system thinks that COMM10 and COMM11 are actual serial ports! Figure 2-9: Bluetooth profile interdependencies Figure 2-10: In a piconet, the slaves can only communicate to the master. Figure 2.11: A scatternet is formed when a slave in one piconet is the master in another piconet. Chapter 4: Understanding the Java Bluetooth API Figure 4-1: Service records in the SDDB Figure 4-2: An individual attribute of a service record Figure 4-3: An illustration of a service record attribute Figure 4-4: DataElements Figure 4-5: The service discovery process for a PDA that wants to use the services of a Bluetooth keyboard Chapter 5: BBluleutoeottohofotrhJawvaith J2ME MIDP by Bruce Hopkins and Ranjith Antony Figure 5-1: J2AMprEesPs r©o2fi0le03s (a35n2dpcagoens)figurations ISBN:1590590783 Figure 5-2: ATlhoegiacuatlhroerpsroefsethnistatteioxnt doef sacnribReMhSowretcoodrdevsetloorpewireless Java applications using Bluetooth for a variety of platforms. This Figure 5-3: TiBhnleculeuatdpoeposltihca-anbtaiAosPneIdsotsvaeerrtrvsvi,iceaewns,dohfisigthnheoligJwhavtlsoaoolikfbisnraegrcyufo,rridtyreevcmeolonopcteemrBennslu,teaotnfodoth devices. more. Figure 5-4: After a remote device is found, we now go into stealth mode (i.e., nondiscoverable). Table FoifgCuorent5e-5nt: sThe TDK USB Bluetooth device using a CSR Bluetooth radio BluetoFoitghurfoer5J-a6v:aThe initial screen for the Piconet Browser application Introduction ChaptFerig1ure-5I-n7tr: oTdhueciPngicoBnlueettoBortohwser displays a list of Bluetooth devices in the area. Chapter 2 - Bluetooth 1.1 ChaptFerig3ure-5B-e8f:oTreheYoPuicGoenteSt tBarrtoewdser now displays the services offered by the remote device. Chapter 4 - Understanding the Java Bluetooth API CChaphtaerp5te-rBl6ue:toCotrhewaithtiJn2MgE aMIDBPluetooth Print Server with JPS API Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptFerig7ure-6J-a1v:aYaonudcOaBnEuXse the 3Com Wireless Bluetooth Printer Adapter in order to make a traditional Chapt(ei.re8., n-onU-sBinlugeatoBoluthe)toportinhteSrimBululaettooroth enabled. Chapter 9 - Bluetooth Security Figure 6-2: Using the handy utility provided in this chapter, you can turn your desktop into a Bluetooth Chaptperrin1t0se- rWveirre.less Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet CACphpaephntaedripx1tA2e--rBjal7vuae:xto.JboltauhevatoanodtahJinni d OBEX Appendix B - javax.obex AppenFdiigxuCre-7J-a1v:aOBBluEeXtoiosthcaDlleevdelIorOpmBeEnXt oinnththeeIrPDalAmpOrSotPolcatofol srmtack. AppenFdiigxuDre-7B-l2ip:NAent O1.B1EAXPIheader Index List ofFFigiguurrees7-3: A sample message flow between OBEX clients and servers List of Tables LiCst hofaLipsttinegrs 8: Using a Bluetooth Simulator List of Sidebars Figure 8-1: The Rococo Impronto Simulator version 1.1 installation screen Figure 8-2: The Rococo Impronto Simulator Console Figure 8-3: Creating a new Bluetooth device in the Simulator Console is pretty simple. Figure 8-4: Configuring a cell phone in the Simulator environment Figure 8-5: The ChatServer Bluetooth device in the Impronto Simulator device list Figure 8-6: The ChatServer interacting with the ChatClient in the Impronto Simulator environment Figure 8-7: The server has sent a message and the client responds. Figure 8-8: The client receives a message and sends a reply. Chapter 9: Bluetooth Security Figure 9-1: The Mobiwave BPA-D10 Bluetooth Protocol Analyzer Figure 9-2: The security server is waiting for the client to connect. Figure 9-3: The security client is attempting to connect to the server. Bluetooth for Java Figure 9-4: Tbhye BsreuccueriHtyopsekirnvseranpdroRmapnjtsiththAenutosneyr to enter aISPBINN:15fo90r5t9h0e78a3pplication. Apress © 2003 (352 pages) Figure 9-5: The authentication process has succeeded. The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Figure 9-6: Yionuclundeeesdatno AbPeIvoevreyrcviaerwefoufl tifhyeoJua'vrea lsibernadriyn,gdseevenlsoiptimveendtaotaf unencrypted between Bluetooth devBilcueestoboethc-abuasseeditscearnvicbees,chaipgthulrigehdtsbyofastehciurdritpyacrotynucesrinngs,aanBdluetooth Protocol Analyzer. more. Figure 9-7: With encryption enabled, the Protocol Analyzer is still able to capture the data transmission; however, the data is corrupted. Table of Contents BCluehtoaotph tfoerrJa1va0: Wireless Embedded Systems with the Micro BlueTarget Introduction Chapter 1 - Introducing Bluetooth Figure 10-1: The Micro BlueTarget standard version is a small form factor embedded system with a Chaptbeor a2rd-oBultulineteoootfhju1s.t13.25.9 cm! This is a great solution for OEMs that want to make their devices ChaptBerlu3eto-oBthefeonreabYloeud.Get Started Chapter 4 - Understanding the Java Bluetooth API ChaptFerig5ure-1B0lu-2e:toTohthe wMiitchroJ2BMluEeMTIaDrPget Starter Kit uses a standard Micro BlueTarget and adds RS-232 Chaptaenr d6 Et-hCerrenaettinpgoratsB,luwehtiocohthisPidrienat lSfeorrvderevweitlohpJePrSsAwPhIo need to create quick prototypes and proofs of Chaptceor n7ce-ptJsa.va and OBEX Chapter 8 - Using a Bluetooth Simulator Figure 10-3: A Bluetooth phone utilizing the services of a fixed-wireless consumer system— a Chapter 9 - Bluetooth Security Bluetooth-enabled vending machine Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaptFerig1u1re-1E0n-t4e:rpAriBseluBeltuoeottohotPhDAAppreliccaetiivoinnsgwthitehstthaetuEsrifcrsosmonaBfliixpeNde-twireless commercial system— a ChaptBerlu1e2to-oBthlu-eentoaobthledanmd aJicnhi ine in a manufacturing facility Appendix A - javax.bluetooth AppenFdiigxuBre-1ja0v-5a:x.Aobbelox ck diagram of the Micro BlueTarget hardware components AppenFdiigxuCre-1J0a-v6a: BAlusettrouoctthurDael voevleorpvmieewntoof nthteheHPyaNlmetOOSSPfloartftohremMicro BlueTarget Appendix D - BlipNet 1.1 API IndexFigure 10-7: The memory map of the Micro BlueTarget. End user applications have about 1.5MB of List ofspFiagcuereosn the flash disk. List of Tables List ofFLigisutirneg1s0-8: Using the built-in functionality of the Micro BlueTarget, you can have any Bluetooth device with the LAN Access Profile access the Internet (or any other Ethernet-based network). List of Sidebars Figure 10-9: The L2CAPEcho Service Figure 10-10: Using the Micro BlueTarget to create a fixed-wireless system Chapter 11: Enterprise Bluetooth Applications with the Ericsson BlipNet Figure 11-1: An architecture diagram of the Ericsson BlipNet Figure 11-2: You can use the BlipNet API and custom J2SE code to access external resources like databases, directories, and e-mail servers. Figure 11-3: A single BlipNode Figure 11-4: The BlipManager application Chapter 12: Bluetooth and Jini Figure 12-1: These three entities must exist before a Jini federation is established. The federation itself hasn't been formed because the entities don't know anything about each other yet. Figure 12-2: The Service Provider discovers the Lookup Service and receives its ServiceRegBilusettroaorthofbojer cJta. vTahe ServiceRegistrar is used to interact with the Lookup Service via its public bmyeBthroucdes.Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Figure 12-3: TThheeaSuethrvoircseoPf rtohvisidteerxtredgeisscterirbseithsoSwetrovdiecveelIotpewmirewleitshsthJaevaLookup Service. applications using Bluetooth for a variety of platforms. This Figure 12-4: iTnhcleudLeosoaknupAPSIeorvveicrevireewceoifvethseaJamvaulltiibcraasrtyr,edqeuveeslotpfmroemntthoef Service Consumer and responds withBlaueutnooictahs-bt amseedsssaegrveicceosn, thaiignhinligghtthseoSf eservciucreitRyecgoinsctrearrnos,bajencdt. more. Figure 12-5: The Service Consumer uses the local ServiceRegistrar object to look up services that are Table roefgCisotenrteedntins the Lookup Service. BluetoFoitghurfoer1J2a-v6a: The ServiceItem requested is returned to the Service Consumer and can be used locally. Introduction ChaptFerig1ure-1I2n-tr7o:dOucnicneg aBclutievtaotoetdhon the Service Consumer, the Service Provider's service may Chaptceor m2 m-unBlicuaetteoodthire1c.t1ly with the Service Provider device as part of the service offered. Chapter 3 - Before You Get Started Figure 12-8: In an all-Bluetooth Jini federation, all the devices participating in the federation must be Chapter 4 - Understanding the Java Bluetooth API Bluetooth enabled. This federation is wireless. Chapter 5 - Bluetooth with J2ME MIDP ChaptFerig6ure-1C2r-e9a:tiInngaahBylbureidtoBotlhuePtroinotthSJerinviefrewdeitrhaJtiPoSn,AaPtI least one of the devices participating in the Chaptfeerd7era-tioJanvamaunsdt bOeBEBXluetooth enabled. This federation is not (necessarily) wireless, and the JiniChaptBerlu8eto-oUths-iengnaabBleludedtoeovticheSaimctuslaatosra bridge between the Jini federation and an external Bluetooth Chaptpeirc9one-t.Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaptFerig1u1re-1E2n-t1e0rp: rTisheeBPluseiNtooodthe Adpepvleicloatpiomnesnwt ipthlatthfoermEr.icTshsoenEBrliicpsNseotn Bluetooth module is covered by two metal plates, and is connected to the Dallas Semiconductor TINI microcontroller. Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth AApppenpdiex Bnd- jiaxvaCx.o:beJxava Bluetooth Development on the PalmOS Platform Appendix C - Java Bluetooth Development on the PalmOS Platform AppenFdiigxuDre-CB-li1p:NWetit1h.1thAePTI DK Bluetooth Developer's Kit and the PalmOS emulator, you can develop, Indexdeploy, and test your Java Bluetooth applications all within the environment of your development List ofmFaigcuhriense. List ofFTigaubrleesC-2: The MIDP-Chat application List of Listings List of Sidebars List of Tables Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Chapter 2: TBheluauethtoorsootfhthi1s.t1ext describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Table 2-1: Coinmclmudoens RanadAiPoI Forveeqrvuieenwcoiefsthe Java library, development of Bluetooth-based services, highlights of security concerns, and Table 2-2: Blmueotroeo. th Device Power Classes Table 2-3: Layers of the Bluetooth Protocol Stack Table of Contents BInClutreohtdoauoctphtitofonerrJa3va: Before You Get Started Chapter 1 - Introducing Bluetooth ChaptTerab2le -3-B1lu: eCtolaosthse1s.1in the javax.bluetooth Package ChaptTerab3le -3-B2e:foCrelaYsoseusGienttShtearjatevdax.obex Package Chapter 4 - Understanding the Java Bluetooth API ChaptTerab5le -3-B3lu: eJtaovoathBwluitehtoJo2tMhESMDIKDPVendors Chapter 6 - Creating a Bluetooth Print Server with JPS API CChaphtaerp7te-rJa4va: aUndnOdBEeXrstanding the Java Bluetooth API Chapter 8 - Using a Bluetooth Simulator ChaptTerab9le -4-B1lu: eBtlouoethtoSoethcuDriitsycovery Modes Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget ChaptTerab1l1e -4-E2n:teBrlpureisteooBtlhueMtoaojothr aAnpdpliMcaintioornsDwevitihcethCelaEsriscessson BlipNet Chapter 12 - Bluetooth and Jini Table 4-3: Common UUID Values for Bluetooth Protocol Layers Appendix A - javax.bluetooth AppenTdaixbBle -4-ja4v: aCxo.ombemxon UUID Values for Bluetooth Profiles Appendix C - Java Bluetooth Development on the PalmOS Platform ACppehnadipx tDe-rBl7ip:NeJt a1.v1 aAPaI nd OBEX Index List ofTFaigbulere7s-1: OBEX Headers in the java.obex.HeaderSet Interface List of Tables List of Listings List of Sidebars List of Listings Bluetooth for Java by Bruce Hopkins and Ranjith Antony ISBN:1590590783 Apress © 2003 (352 pages) Chapter 4: TUhenadutehrorsstoaf nthids itenxgt detshcreibeJhaovwatoBdelvueleoptowioretlehssAJaPvaI applications using Bluetooth for a variety of platforms. This Listing 4-1: SitnacclukdIensitiaanlizAaPtiIoonvCerovdieewfoorf tthhee AJatvinaalvibSraDryK, development of Bluetooth-based services, highlights of security concerns, and Listing 4-2: Bmluoerteo.othSetup1.java Listing 4-3: DeviceProperties.java Table of Contents BluetoLoisthtinfogr4J-a4v:aThe Service Registration Process Introduction ChaptLeirst1ing-4I-n5t:roOdpuecinnigngBlCueotnonoethctions on a Bluetooth Server Chapter 2 - Bluetooth 1.1 CChaphtaerp3te-rBe5fo:reBYlouu eGetot Sotatrhtedwith J2ME MIDP Chapter 4 - Understanding the Java Bluetooth API ChaptLeirst5ing-5B-l1u:eStotoetahlthw.ijtahvJa2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API ChaptLeirst7in g- 5J-a2v:aBaenadmOTBsEkX.j ava ChaptLeirst8in g- 5U-3si:nPgicaoBnleuetMtoIoDtlhetS.jiamvual.ator Chapter 9 - Bluetooth Security CChaphtaerp1t0e-rW6ir:eleCssrEemabtedindegd SaysBtemlus ewittoh tohethMicProriBnluteTSaregertver with JPS API Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Listing 6-1: JPSPrint.java Appendix A - javax.bluetooth AppenLdiisxtinBg- 6ja-2v:aJxP.oSbBexlu etoothPrint.ja va Appendix C - Java Bluetooth Development on the PalmOS Platform AppenLdiisxtinDg-6B-l3ip:NJePtS1B.1luAePtoI othPrintClient.java Index LiCst hofaFpigutreers 7: Java and OBEX List of Tables List ofLLisistitningg7s-1: FTServer.java List of Sidebars Listing 7-2: FTClient.java Chapter 8: Using a Bluetooth Simulator Listing 8-1: mydevice.xml Listing 8-2: ChatServer.java Listing 8-3: ChatClient.java Chapter 9: Bluetooth Security Listing 9-1: Bank Account Information Listing 9-2: A 1024-Bit Encryption Key Listing 9-3: Bank Account Information Encrypted with the CAST Algorithm Listing 9-4: ServerApp.java Listing 9-5: ClientApp.java Chapter 10B:lWuetioroetlhefosrsJaEvambedded Systems with the Micro BlueTarget by Bruce Hopkins and Ranjith Antony Listing 10-1: ALp2rCeAssP©E2c0h0o3S(3e5r2vpearg.ejas)va ISBN:1590590783 Listing 10-2: TLh2eCaAuPthEocrhsooCf ltiheinst.tjeaxvtadescribe how to develop wireless Java applications using Bluetooth for a variety of platforms. This Listing 10-3: iBSnlPculePutd2oeCostOha-MnbMaAsP.ejIadovsvaeerrvviiceews,ohf igthheligJhavtsa olifbsraercyu,ridtyevceolonpcemrenns,t of and more. Chapter 11: Enterprise Bluetooth Applications with the Ericsson TaBblelipofNCeonttents Bluetooth for Java IntrodLuiscttinong 11-1: Tracking.java Chapter 1 - Introducing Bluetooth Chapter 2 - Bluetooth 1.1 Chapter 3 - Before You Get Started Chapter 4 - Understanding the Java Bluetooth API Chapter 5 - Bluetooth with J2ME MIDP Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security Chapter 10 - Wireless Embedded Systems with the Micro BlueTarget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet Chapter 12 - Bluetooth and Jini Appendix A - javax.bluetooth Appendix B - javax.obex Appendix C - Java Bluetooth Development on the PalmOS Platform Appendix D - BlipNet 1.1 API Index List of Figures List of Tables List of Listings List of Sidebars Bluetooth for Java List of Sidebars by Bruce Hopkins and Ranjith Antony Apress © 2003 (352 pages) ISBN:1590590783 Chapter 2: Bluetooth 1.1 The authors of this text describe how to develop wireless Java applications using Bluetooth for a variety of platforms. This includes an API overview of the Java library, development of Bluetooth ProBfliuleestovost.hJ-b2aMseEdPsreorfviliecess, highlights of security concerns, and more. Chapter 5: Bluetooth with J2ME MIDP Table of Contents BluetoWotohrkfoinrgJawviath the Example Code Introduction CChaphtaerp1te-rIn6tr:odCucrinegaBtluientogotha Bluetooth Print Server with JPS API Chapter 2 - Bluetooth 1.1 ChaptPerrin3ter-sBaenfodrePrYionut SGeertvSicteasrted Chapter 4 - Understanding the Java Bluetooth API CChaphtaerp5te-rBl7ue:toJotahvwaithaJn2MdE MOIDBPEX Chapter 6 - Creating a Bluetooth Print Server with JPS API Chapter 7 - Java and OBEX More on Connection URLs and the SDDB Chapter 8 - Using a Bluetooth Simulator Chapter 9 - Bluetooth Security CChaphtaerp1t0e-rW8ir:eleUsssEimnbgeddaedBSlyusteemtsowoitthhthSe MimicrouBlaluteToarrget Chapter 11 - Enterprise Bluetooth Applications with the Ericsson BlipNet ChaptDeriff1e2re-nBcleueBtoeotwtheeanndaJSiniimulator and an Emulator Appendix A - javax.bluetooth ACppehnadipx tBe-rja9va:x.Bobleux etooth Security Appendix C - Java Bluetooth Development on the PalmOS Platform AppenMdioxreD o-nBlMipoNbeitw1a.v1eABPPI A-D10 Index List of Figures List of Tables List of Listings List of Sidebars

    Top_arrow
    回到顶部
    EEWORLD下载中心所有资源均来自网友分享,如有侵权,请发送举报邮件到客服邮箱bbs_service@eeworld.com.cn 或通过站内短信息或QQ:273568022联系管理员 高进,我们会尽快处理。