ist.palcom.mal
Class BluetoothMediaManager

java.lang.Object
  extended by ist.palcom.mal.MediaManager
      extended by ist.palcom.mal.BluetoothMediaManager

public class BluetoothMediaManager
extends MediaManager

This class implements ist.palcom.mal.BluetoothMediaManager

See Also:
MediaManager

Nested Class Summary
 
Nested classes/interfaces inherited from class ist.palcom.mal.MediaManager
MediaManager.BroadcastDistributor, MediaManager.DistributorThread, MediaManager.UnicastDistributor
 
Field Summary
 
Fields inherited from class ist.palcom.mal.MediaManager
distributorThread, PALCOM_URL_PREFIX, scheduler
 
Constructor Summary
BluetoothMediaManager(PalcomScheduler scheduler)
          Deprecated. See superclass
BluetoothMediaManager(PalcomScheduler scheduler, PalcomThread errorHandler)
           
 
Method Summary
 URL[] getDefaultGroupAddresses()
          We use the address 00:00:00:00:00:00 as the default group address, as no such thing exists in Bluetooth.
 URL getDefaultUnicastURL()
          If the exists a connection to a device with this url, then subscribe to these messages.
protected  CommunicationThread getReceivingThread(URL url)
           
protected  CommunicationThread getSendingThread(URL url)
           
protected  boolean isBroadcast(URL url)
          This does not make sense in a bluetooth world, as there is only point to point connections.
protected  void removeReceivingThread(URL url)
          Stop receiving at url, and remove the receiving thread.
 void stop()
          Stop the manager.
 
Methods inherited from class ist.palcom.mal.MediaManager
addErrorHandler, getHost, getPort, getProtocol, getProtocolSpecificUrl, getSelector, messageReceived, raiseErrorEvent, registerDeviceURL, send, send, sendBroadcast, startReceiving, startReceiving, startReceiving2, startReceivingBroadcast, stopReceiving, stopReceiving, stopReceiving, stopReceiving
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, println, toString
 

Constructor Detail

BluetoothMediaManager

public BluetoothMediaManager(PalcomScheduler scheduler)
Deprecated. See superclass


BluetoothMediaManager

public BluetoothMediaManager(PalcomScheduler scheduler,
                             PalcomThread errorHandler)
Method Detail

stop

public void stop()
Description copied from class: MediaManager
Stop the manager. This will stop all listening for messages.

Overrides:
stop in class MediaManager

getDefaultUnicastURL

public URL getDefaultUnicastURL()
If the exists a connection to a device with this url, then subscribe to these messages. If no connection exists open a new one and start receiving chunks of data from the new connection. The later will offend be used in connections to 3th party devices eg. gps. public String startReceiving(String url, PalcomThread receiver) { // getReceivingThread(url). return ""; }

Specified by:
getDefaultUnicastURL in class MediaManager
Returns:
The default URL. This URL is listened on unless another URL is specified in a call to startReceiving(String, PalcomThread).

getSendingThread

protected CommunicationThread getSendingThread(URL url)
Specified by:
getSendingThread in class MediaManager
Returns:
A CommunicationThread that can be used for sending a message to the given URL.

isBroadcast

protected boolean isBroadcast(URL url)
This does not make sense in a bluetooth world, as there is only point to point connections. We have to create routing on top of that and this is not in this layer

Specified by:
isBroadcast in class MediaManager
Returns:
true if the URL is a broadcast address (or multicast, depending on the protocol), false if not.

getDefaultGroupAddresses

public URL[] getDefaultGroupAddresses()
We use the address 00:00:00:00:00:00 as the default group address, as no such thing exists in Bluetooth. A call to receive(00:00:00:00:00:00,palcomThread) will result in the thread receiving all bluetooth messages send to this node

Specified by:
getDefaultGroupAddresses in class MediaManager
Returns:
The default broadcast addresses for group communication.

getReceivingThread

protected CommunicationThread getReceivingThread(URL url)
Specified by:
getReceivingThread in class MediaManager
Returns:
CommunicationThread for receiving at url. If it does not exist, a new one is created and returned.

removeReceivingThread

protected void removeReceivingThread(URL url)
Description copied from class: MediaManager
Stop receiving at url, and remove the receiving thread.

Specified by:
removeReceivingThread in class MediaManager