Class SPPServer

java.lang.Object
  extended byjava.lang.Thread
      extended bySPPServer
All Implemented Interfaces:
java.lang.Runnable

public class SPPServer
extends java.lang.Thread

Copyright (c) 2003 Sony Ericsson Mobile Communications AB
All Rights Reserved.

SPPServer is a Serial Port Profile server. The server will define a Serial Port Profile service and then wait for client to connect. When a client connect to the server a connection to the car will be created and the CarAPI will be passed to the CarConnection object.

Version:
2.1
Author:
Christopher Wong, Åke Rydgren

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SPPServer(CarAPI carAPI, BluetoothCar bluetoothCar)
          Constructs a new SPPServer object, which will create the CarConnection object, define the service for the serial port (SPP) and then start running itself.
 
Method Summary
 void closeAll()
          Closes the connection and the SPP service.
 boolean connectionOpen()
           
 void run()
          This is called by the constructor of the class.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SPPServer

public SPPServer(CarAPI carAPI,
                 BluetoothCar bluetoothCar)
Constructs a new SPPServer object, which will create the CarConnection object, define the service for the serial port (SPP) and then start running itself.

Parameters:
carAPI - the interface to control car and check car status. This will be passed to the CarConnection object when it is created.
Method Detail

run

public void run()
This is called by the constructor of the class. It will wait for a client to connect and then start looping the event handler that takes care of any user events or AT-commands from the car. This thread will only terminate when the program exit, but as long as there are no connection open, the only activity in this thread is the blocking call to StreamConnectionNotifier.acceptAndOpen().


connectionOpen

public boolean connectionOpen()

closeAll

public void closeAll()
Closes the connection and the SPP service.