All Classes Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
Glympse::IBatteryManager Struct Referenceabstract

Provides basic facilities for battery management in Glympse API. More...

#include <IBatteryManager.h>

Inheritance diagram for Glympse::IBatteryManager:
Inheritance graph
[legend]

Public Member Functions

virtual bool setBatteryLevels (int32 lowBatteryLevel, int32 goodBatteryLevel)=0
 Sets the battery levels that the Glympse API should use when detecting low and good battery states. More...
 
virtual bool isBatteryLevelGood ()=0
 Checks if the Glympse API can run with the current battery level and power state. More...
 
virtual bool isBatteryOk ()=0
 Return true if the battery is good or the user has approved us to run with a low battery.
 
virtual bool isBatteryForce ()=0
 Return true if the user has approved us to run with a low battery.
 
virtual void setBatteryForce ()=0
 Provides a chance to override battery state, if it turns into bad state. More...
 
virtual bool isWakeLockEnabled ()=0
 Returns true if it is currently ok for the system to acquire a wake lock.
 
virtual void enableWakeLock (bool wakeLockEnabled)=0
 Sets whether or not the system should be able to acquire a wake lock. More...
 
- Public Member Functions inherited from Glympse::IEventSink
virtual bool addListener (const GEventListener &eventListener)=0
 Registeres event listener on the sink. More...
 
virtual bool removeListener (const GEventListener &eventListener)=0
 Unsubscribes listener from events coming from this sink.
 
virtual GArray< GEventListener >
::ptr 
getListeners ()=0
 Provides access to the collection of current listeners. More...
 
virtual bool hasContext (int64 key)=0
 Checks, where user context identified by key is already associated with the object.
 
virtual void associateContext (int64 key, const GCommonObj &value)=0
 Associates specific context (user data) with the sink. More...
 
virtual GCommonObj getContext (int64 key)=0
 Returns context associated with the sink, or NULL, if it is not found.
 
virtual void clearContext (int64 key)=0
 Clears context identified by key argument.
 
virtual GEnumeration< GLong >::ptr getContextKeys ()=0
 Gets enumeration of all context keys associated with the sink.
 
virtual void deriveContext (const GEventSink &sink)=0
 Derives context from another sink object.
 
- Public Member Functions inherited from Glympse::IEventListener
virtual void eventsOccurred (const GGlympse &glympse, int32 listener, int32 events, const GCommonObj &obj)=0
 This method is invoked each time, when sink object notifies subscriber on an event. More...
 
- Public Member Functions inherited from Glympse::ICommon
virtual int32 retain ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 release ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hold ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 unhold ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hashCode ()=0
 Returns an integer hash code for this object.
 
virtual bool equals (const GCommonObj &o)=0
 Compares this instance with the specified object and indicates if they are equal. More...
 
virtual GString toString ()=0
 Returns a string containing a concise, human-readable description of this object. More...
 
virtual void attachObject (const GCommon &obj)=0
 Asociates arbitrary object with the instance.
 
virtual GCommon extractObject ()=0
 Extracts associated object or NULL if no association is established.
 

Additional Inherited Members

- Protected Member Functions inherited from Glympse::ICommon
virtual ~ICommon ()
 Destructor is protected to deny explicit object deallocation. More...
 

Detailed Description

Provides basic facilities for battery management in Glympse API.

Member Function Documentation

virtual void Glympse::IBatteryManager::enableWakeLock ( bool  wakeLockEnabled)
pure virtual

Sets whether or not the system should be able to acquire a wake lock.

Since this method may be called at any time, it also checks the system state and acquires or releases an existing wake lock when appropriate.

virtual bool Glympse::IBatteryManager::isBatteryLevelGood ( )
pure virtual

Checks if the Glympse API can run with the current battery level and power state.

The Glympse API monitors the device's battery level and external power state. If the device is not on external power and drops below the 'low battery' level, then the Glympse API will automatically suspend all location and network activity in order to preserve power. The good/low battery levels can be set by calling the setBatteryLevels method.

If you register a IEventListener with the IBatteryManager, you can listen for the GC::BATTERY_STATE_CHANGED event to be notified when the battery state changes.

Returns
true, if the battery level is above the 'low battery" level or the device is connected to external power.
virtual void Glympse::IBatteryManager::setBatteryForce ( )
pure virtual

Provides a chance to override battery state, if it turns into bad state.

It is required, if you want to continue transmitting and receiving location updates even in bad battery state.

virtual bool Glympse::IBatteryManager::setBatteryLevels ( int32  lowBatteryLevel,
int32  goodBatteryLevel 
)
pure virtual

Sets the battery levels that the Glympse API should use when detecting low and good battery states.

The Glympse API monitors the device's battery level and external power state. If the device is not on external power and drops below the 'low battery' level, then the Glympse API will automatically suspend all location and network activity in order to preserve power.

The Glympse API will suspend location and network activity when not on external power and the battery level is less than or equal to lowBatteryLevel. Glympse will resume these location and network activity (if needed) when on external power or the battery level is greater than or equal to goodBatteryLevel. The default values are 0 for lowBatteryLevel and 100 for goodBatteryLevel. This means that battery monitoring feature is disabled by default.

Parameters
lowBatteryLevelThe low battery level. 0 to disable battery monitoring. Valid values are (0 <= lowBatteryLevel <= goodBatteryLevel)
goodBatteryLevelThe good battery level. Valid values are (lowBatteryLevel <= goodBatteryLevel <= 100)
Returns
true, if the parameters passed in are valid.

The documentation for this struct was generated from the following file: