Philips Bluetooth QuickStart Kit GPS Receiver User Manual


 
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 72
Copyright 2004-2005 © Embedded Artists AB
C.2.4 Registry
This sample application illustrates how to use the Registry, that is, persistent storage in the
eeprom.
The example will start by trying to read a specified key from the registry. If the key is found
the value associated with this key will be printed onto the console. If the key isn’t found a
new default value will be written to the registry.
The example also illustrates how to iterate through all keys that are stored in the registry.
Files
sample_registry/sample.c – this file contains the code for the sample
application.
C.2.5 TCP Client
This sample application illustrates how to create a TCP client, that is, a client that will try to
connect to a TCP server. The example also illustrates how to create and start OS processes.
The client will try to connect to the server until it succeeds. In the console it will print the
following information:
Trying to connect...error – if an error occurred while trying to connect.
The error could, for example, be that there is no established Bluetooth connection.
Trying to connect...refused – if there is no server listening on the IP
address specified by the client.
Trying to connect...connected – when the connection is established.
How-To
In order to test the client functionality a TCP server is needed. The file TCPServer.jar
contains a TCP server implemented in Java. Start the server by typing java –jar
TCPServer.jar <port> in a command prompt, where <port> is the port number
the server should listen to (the default port used by the client is 2020).
Files
sample_tcpclient/sample.c – this file contains the code for the sample
application.
sample_tcpclient/TCPServer.jar – this file contains a TCP server
implemented in Java.
C.2.6 TCP Server
This sample application illustrates how to create a TCP server. The server listens to the port
2020 and will print received data onto the console.
How-To