Basic communication APIs for Series 60
Communication is central to a Series 60 phone. Of course, voice communication is the core feature of all phones, but a Series 60 device offers you far more ways to communicate than just making a call. Series 60 can enable services as diverse as browsing and downloading from the Web, playing a game over Bluetooth between two phones, sending a document to your office printer over infrared, receiving the latest score of a football match by text message or connecting to your bank to get a secure update of your bank balance.
Each of these actions involves forming some kind of connection between your Series 60 phone and another device. The "other device" may be anything from a phone in the same room to a network server on the other side of the world. Series 60 provides support for a range of communication technologies to enable communication with different types of devices, at different distances and for different purposes.
This chapter introduces some of the more basic-level communications APIs provided by Series 60. Many of these APIs operate at a relatively low level ”you may often need to implement extra layers of code on top of them in order to achieve the kind of communication your application requires. Chapter 10 covers some higher-level APIs, which often provide all you need to establish communication with another device.
The main topics of this chapter are as follows :
Serial Communication ” Serial communication is a simple, low-level communication between two devices at close range. Series 60 enables this type of communication over infrared or Bluetooth. This section discusses the techniques involved in creating a serial connection.
Sockets ” This section covers sockets in Series 60. The Sockets API offers a higher-level point-to-point communication between two participants . It can be implemented over a range of physical and logical network types including infrared, Bluetooth and TCP/IP.
TCP/IP ” TCP/IP makes use of the Sockets APIs for accessing standard Internet services. In this section, Series 60 support for TCP/IP is demonstrated with a simple application. Series 60 2.x adds support for multihoming, which allows multiple network connections to be open concurrently.
Infrared ” Infrared (or IR) is a simple, point-to-point communication between two devices at close range with a direct "line of sight" between them. This section discusses the various IR protocols supported in Series 60.
Bluetooth ” Often used for similar purposes as infrared, Bluetooth is a radio technology used for close-range communication between two or more devices. This section introduces the Bluetooth capabilities of Series 60, and the APIs provided to make use of them.
The last three sections ” TCP/IP, Infrared and Bluetooth ”all build on information given earlier in the chapter. It is therefore recommended that you read the sections on Serial Communication and Sockets before moving on to the latter parts of the chapter.
The following example applications illustrate these technologies and provide the source code used throughout this chapter:
IrSerial ” Illustrates serial communication in a simple application that sends data to an IR-capable printer.
IrSockets ” Demonstrates sending small text-based chat messages between two Series 60 devices using an infrared sockets interface.
TcpipMultihomingEx ” Performs simple transactions with a Daytime server, demonstrating the multihoming APIs present in Series 60 2.x.
TcpIpImpEx ” Demonstrates how developers who wish to avoid the added complexity of multihoming APIs can use TCP/IP via an implicit connection. This example also works on Series 60 1.x.
BluetoothChat ” Implements a simple instant chat messaging application, sending text messages between two Series 60 devices using Bluetooth sockets.
Details of how to download the full buildable source of these example applications are given in the Preface.