de.unikassel.android.sdcframework.devices
Class SampleFactory

Package class diagram package SampleFactory
java.lang.Object
  extended by de.unikassel.android.sdcframework.devices.SampleFactory

public class SampleFactory
extends Object

A factory to create samples from Android specific types ( implemented as singleton ).


Field Summary
private static SampleFactory instance
          The global singleton instance
private  LocationTracker locationTracker
          The location tracker
 
Constructor Summary
private SampleFactory()
          Constructor
 
Method Summary
 String bluetoothClassToHumanReadableInformation(BluetoothClass bluetoothClass)
          Does translate Android BluetoothClass in a human readable form
 BluetoothSampleData createBluetoothSampleData(BluetoothDevice bluetoothDevice, Short rssi)
          Method to create an bluetooth sample from an BluetoothDevice
 Sample createSample(TimeInformation timeInfo, SensorDeviceIdentifier id, int priority, SampleData data)
          Method to create a sample from available information
 WifiSampleData createWifiSampleData(ScanResult scanResult, boolean isConnected)
          Method to create a wifi sample from a ScanResult
 void enableLocationTracking(boolean enable)
          Method to enable location tracking
static SampleFactory getInstance()
          Getter for the global singleton instance
 LocationTracker getLocationTracker()
          Getter for the locationTracker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locationTracker

private final LocationTracker locationTracker
The location tracker


instance

private static SampleFactory instance
The global singleton instance

Constructor Detail

SampleFactory

private SampleFactory()
Constructor

Method Detail

getLocationTracker

public LocationTracker getLocationTracker()
Getter for the locationTracker

Returns:
the locationTracker

getInstance

public static SampleFactory getInstance()
Getter for the global singleton instance

Returns:
the global singleton instance

enableLocationTracking

public void enableLocationTracking(boolean enable)
Method to enable location tracking

Parameters:
enable - flag for enabled state of location tracking

createSample

public Sample createSample(TimeInformation timeInfo,
                           SensorDeviceIdentifier id,
                           int priority,
                           SampleData data)
Method to create a sample from available information

Parameters:
timeInfo - the sample time stamp and NTP sync state
id - the sensor device identifier
priority - the priority
data - the sensor specific data
Returns:
the created sample

createWifiSampleData

public WifiSampleData createWifiSampleData(ScanResult scanResult,
                                           boolean isConnected)
Method to create a wifi sample from a ScanResult

Parameters:
scanResult - the Wifi scan result to create the sample from
isConnected - flag if it is the current Wifi connection
Returns:
a Wifi sample

createBluetoothSampleData

public BluetoothSampleData createBluetoothSampleData(BluetoothDevice bluetoothDevice,
                                                     Short rssi)
Method to create an bluetooth sample from an BluetoothDevice

Parameters:
bluetoothDevice - the bluetooth device
rssi - the received signal strength indicator
Returns:
a bluetooth sample

bluetoothClassToHumanReadableInformation

public String bluetoothClassToHumanReadableInformation(BluetoothClass bluetoothClass)
Does translate Android BluetoothClass in a human readable form

Parameters:
bluetoothClass - the buetooth class
Returns:
a human readable class representation