net.sourceforge.atunes.kernel.handlers
Class DeviceHandler

java.lang.Object
  extended by net.sourceforge.atunes.kernel.handlers.DeviceHandler
All Implemented Interfaces:
ApplicationFinishListener, DeviceConnectionListener, DeviceCopyFinishListener, DeviceDisconnectionListener, LoaderListener

public class DeviceHandler
extends java.lang.Object
implements LoaderListener, DeviceCopyFinishListener, DeviceConnectionListener, DeviceDisconnectionListener, ApplicationFinishListener

The Class DeviceHandler.


Method Summary
 void applicationFinish()
          Called when closing application
 void connectDevice()
          Connect device.
 void copyFilesToDevice(java.util.List<AudioFile> files)
          Copy files to mp3 device.
 void deviceConnected(java.lang.String location)
          Called when a device monitor detects a device connected.
 void deviceDisconnected(java.lang.String location)
          Called when a device monitor detects a device disconnection.
 void disconnectDevice()
          Disconnect device.
 void fillWithRandomSongs(long leaveFreeLong)
          Fills the device with songs until the specified memory is left.
 java.util.Map<java.lang.String,Artist> getDeviceArtistAndAlbumStructure()
          Gets the device artist and album structure.
 java.util.Map<java.lang.String,Folder> getDeviceFolderStructure()
          Gets the device folder structure.
 java.util.Map<java.lang.String,Genre> getDeviceGenreStructure()
          Gets the device's genre structure
 Repository getDeviceRepository()
          Gets the device repository.
 java.util.List<AudioFile> getDeviceSongs()
          Gets the device songs.
 AudioFile getFileIfLoaded(java.lang.String fileName)
          Gets the file if is in device
static DeviceHandler getInstance()
          Gets the single instance of DeviceHandler.
 boolean isDeviceConnected()
          Checks if is device connected.
 boolean isDevicePath(java.lang.String path)
          Checks if given file is in the device path.
 void notifyCopyFinish()
          Called when finish copy to device.
 void notifyCurrentPath(java.lang.String path)
          Notify current path.
 void notifyFileLoaded()
          Notify file loaded.
 void notifyFilesInRepository(int files)
          Notify files in repository.
 void notifyFinishRead(RepositoryLoader loader)
          Notify finish read.
 void notifyFinishRefresh(RepositoryLoader loader)
          Notify finish refresh.
 void notifyRemainingTime(long time)
          Notify remaining time.
 void refreshDevice()
          Refresh device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DeviceHandler getInstance()
Gets the single instance of DeviceHandler.

Returns:
single instance of DeviceHandler

fillWithRandomSongs

public void fillWithRandomSongs(long leaveFreeLong)
Fills the device with songs until the specified memory is left.

Parameters:
leaveFreeLong - Memory to leave free

connectDevice

public void connectDevice()
Connect device.


copyFilesToDevice

public void copyFilesToDevice(java.util.List<AudioFile> files)
Copy files to mp3 device.

Parameters:
files - Files to be written to a mp3 device

deviceConnected

public void deviceConnected(java.lang.String location)
Called when a device monitor detects a device connected.

Specified by:
deviceConnected in interface DeviceConnectionListener
Parameters:
location - the location

deviceDisconnected

public void deviceDisconnected(java.lang.String location)
Called when a device monitor detects a device disconnection.

Specified by:
deviceDisconnected in interface DeviceDisconnectionListener
Parameters:
location - the location

disconnectDevice

public void disconnectDevice()
Disconnect device.


applicationFinish

public void applicationFinish()
Called when closing application

Specified by:
applicationFinish in interface ApplicationFinishListener

getDeviceArtistAndAlbumStructure

public java.util.Map<java.lang.String,Artist> getDeviceArtistAndAlbumStructure()
Gets the device artist and album structure.

Returns:
the device artist and album structure

getDeviceGenreStructure

public java.util.Map<java.lang.String,Genre> getDeviceGenreStructure()
Gets the device's genre structure

Returns:

getDeviceFolderStructure

public java.util.Map<java.lang.String,Folder> getDeviceFolderStructure()
Gets the device folder structure.

Returns:
the device folder structure

getDeviceRepository

public Repository getDeviceRepository()
Gets the device repository.

Returns:
the device repository

getDeviceSongs

public java.util.List<AudioFile> getDeviceSongs()
Gets the device songs.

Returns:
the device songs

isDeviceConnected

public boolean isDeviceConnected()
Checks if is device connected.

Returns:
true, if is device connected

isDevicePath

public boolean isDevicePath(java.lang.String path)
Checks if given file is in the device path.

Parameters:
path - Absolute path of the file
Returns:
true if file is in device, false otherwise

notifyCopyFinish

public void notifyCopyFinish()
Called when finish copy to device.

Specified by:
notifyCopyFinish in interface DeviceCopyFinishListener

notifyCurrentPath

public void notifyCurrentPath(java.lang.String path)
Description copied from interface: LoaderListener
Notify current path.

Specified by:
notifyCurrentPath in interface LoaderListener
Parameters:
path - the path

notifyFileLoaded

public void notifyFileLoaded()
Description copied from interface: LoaderListener
Notify file loaded.

Specified by:
notifyFileLoaded in interface LoaderListener

notifyFilesInRepository

public void notifyFilesInRepository(int files)
Description copied from interface: LoaderListener
Notify files in repository.

Specified by:
notifyFilesInRepository in interface LoaderListener
Parameters:
files - the files

notifyFinishRead

public void notifyFinishRead(RepositoryLoader loader)
Description copied from interface: LoaderListener
Notify finish read.

Specified by:
notifyFinishRead in interface LoaderListener
Parameters:
loader - the loader

notifyFinishRefresh

public void notifyFinishRefresh(RepositoryLoader loader)
Description copied from interface: LoaderListener
Notify finish refresh.

Specified by:
notifyFinishRefresh in interface LoaderListener
Parameters:
loader - the loader

notifyRemainingTime

public void notifyRemainingTime(long time)
Description copied from interface: LoaderListener
Notify remaining time.

Specified by:
notifyRemainingTime in interface LoaderListener
Parameters:
time - the time

refreshDevice

public void refreshDevice()
Refresh device.


getFileIfLoaded

public AudioFile getFileIfLoaded(java.lang.String fileName)
Gets the file if is in device

Parameters:
fileName - the file name
Returns:
the file if loaded


Copyright © 2006-2008 The aTunes Team. All Rights Reserved.