|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.devices.AbstractSensorDevice
de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice
de.unikassel.android.sdcframework.devices.GSMDevice
public final class GSMDevice
Implementation of the GSM sensor device as active device providing sensor data for the scanner.
Nested Class Summary | |
---|---|
private class |
GSMDevice.GSMPhoneStateListener
Private class implementing a phone state listener for GSM devices. |
Field Summary | |
---|---|
private Context |
context
The context |
private GSMSampleData |
currentSampleData
The GSM sample holding the current device state |
private static int |
eventsDisabled
The events to listen for in enabled state |
private static int |
eventsEnabled
The events to listen for in enabled state |
private AtomicInteger |
lastServiceState
The last signaled service state |
private PhoneStateListener |
phoneStateListener
The phone state listener to tack cell or signal strength changes |
private TelephonyManager |
telephoyManager
The telephony manager reference |
Constructor Summary | |
---|---|
GSMDevice(Context context)
Constructor |
Method Summary | |
---|---|
private void |
doReactOnStateChange(ServiceState serviceState)
Handler for service state changes |
void |
doSignalDeviceNotEnabledInSystem(Context applicationContext)
Method to signal the user that the device is disabled in the system and needed by this service. |
private Context |
getContext()
Getter for the context |
int |
getLastServiceState()
Getter for the last service state |
Sample |
getSample()
Getter for a device sample |
boolean |
hasSample()
Test method for a sample available |
boolean |
isDeviceInSystemEnabled(Context context)
Test method for the system wide enabled state of the device |
void |
onCreate(Context context)
Is called when this device is created |
void |
onDestroy(Context context)
Is called when the owner destroys this device |
protected void |
onScannerRunningStateChange(boolean isRunning,
Context context)
Handler to react on scanner state changes. |
private boolean |
registerListener(int events)
Registration of listener for the given events |
private static String |
serviceStateToString(int serviceState)
Does create a human readable string representation of the service state |
private void |
setContext(Context context)
Setter for the context |
private void |
setLastServiceState(int lastServiceState)
Setter for the last service state |
void |
updateCellLocation(int cellId,
int locationAreaCode)
Updater for the current cell location |
private void |
updateNeighborCells()
Method to update neighbor cell information |
void |
updateOperatorName(String operatorName)
Updater for the operator name |
void |
updateSignalStrength(int signalStrength)
Updater for the current signal strength |
Methods inherited from class de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice |
---|
enableDeviceScanning, onConfigurationChanged |
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDevice |
---|
accept, doHandleDeviceDisabledBySystem, doHandleDeviceEnabledBySystem, getConfiguration, getDeviceIdentifier, getScanner, isAirplaneModeOn, isDeviceScanningEnabled, setDeviceIdentifier, setScanner, updateConfiguration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int eventsEnabled
private static final int eventsDisabled
private Context context
private final AtomicInteger lastServiceState
private final TelephonyManager telephoyManager
private final PhoneStateListener phoneStateListener
private final GSMSampleData currentSampleData
Constructor Detail |
---|
public GSMDevice(Context context)
context
- the contextMethod Detail |
---|
public final int getLastServiceState()
private final void setLastServiceState(int lastServiceState)
lastServiceState
- the last service state to setprivate final void setContext(Context context)
context
- the context to setprivate final Context getContext()
private final boolean registerListener(int events)
public final void doSignalDeviceNotEnabledInSystem(Context applicationContext)
AbstractSensorDevice
doSignalDeviceNotEnabledInSystem
in class AbstractSensorDevice
applicationContext
- the application contextpublic final boolean isDeviceInSystemEnabled(Context context)
SensorDevice
isDeviceInSystemEnabled
in interface SensorDevice
context
- the application context
public final void updateSignalStrength(int signalStrength)
signalStrength
- the current signal strengtpublic final void updateCellLocation(int cellId, int locationAreaCode)
cellId
- the cell idlocationAreaCode
- the location area codeprivate final void updateNeighborCells()
public final void updateOperatorName(String operatorName)
operatorName
- the operator nameprivate final void doReactOnStateChange(ServiceState serviceState)
serviceState
- the current service stateprotected final void onScannerRunningStateChange(boolean isRunning, Context context)
ScannerStateAwareSensorDevice
onScannerRunningStateChange
in class ScannerStateAwareSensorDevice
isRunning
- the current scanner state after state changecontext
- the contextprivate static final String serviceStateToString(int serviceState)
serviceState
- the service state
public final void onDestroy(Context context)
SensorDevice
onDestroy
in interface SensorDevice
onDestroy
in class AbstractSensorDevice
context
- the application contextpublic final Sample getSample()
SampleProvidingSensorDevice
getSample
in interface SampleProvidingSensorDevice
public final void onCreate(Context context)
SensorDevice
onCreate
in interface SensorDevice
onCreate
in class AbstractSensorDevice
context
- the application contextpublic boolean hasSample()
SampleProvidingSensorDevice
hasSample
in interface SampleProvidingSensorDevice
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |