[operations] [attributes] [fields] [template] [definition]
[implementation] [documentation]
To use the search tool you need to use a browser which supports JAVA (c)

[next] [prev] [superclass] [next peer] [prev peer] [subclass] [index] [hierarchy]

BatteryServer

abstract
inherits from Server

Object <- Server <- BatteryServer



Operations

Get list of all operations

BatteryInstalled
BatteryLow
CalculateLevel
InitAtoDChannel
InitializeBatteryFields
ReadAtoDChannel
ResetBatteryInformation
UpdateBatteryLevel
UpdateBatteryType
Validate


Attributes

Get list of all attributes

AlwaysReportBatteryFull
BatteryLevelRemaining
BatteryLevelVariance
BatteryType
Chargeable
Charging
FullToHalfThreshold
HalfToLowThreshold
LowToVeryLowThreshold
MonitorPeriod
NumberOfCells
VeryLowToEmptyThreshold


Fields

Field Type
Server: enabled: Boolean
BatteryServer: monitorPeriod: Unsigned
batteryType: Signed
chargeable: Boolean
numberOfCells: Unsigned
atodChannel: Unsigned
batteryLevelRemaining: Fixed
batteryLevelVariance: Fixed
rawLevelAtLastMeterChange: Fixed
fullToHalfThreshold: Fixed
halfToLowThreshold: Fixed
lowToVeryLowThreshold: Fixed
veryLowToEmptyThreshold: Fixed
atodFullReading: Unsigned
atodEmptyReading: Unsigned
atodInstalledReading: Unsigned
lastBatteryAtoDReading: Unsigned
lastBatteryAtoDReadingTime: Unsigned
alwaysReportBatteryFull: Boolean


Instance template

Class BatteryServer cannot be instantiated.


Class definition

Define Class BatteryServer;
    abstract;
    inherits from Server;

    field monitorPeriod: Unsigned, getter, setter;
        // number of mS between each sample of the battery level

    field batteryType: Signed, getter;    
        // battery type, full list: Interfaces/Utilities.h 
    field chargeable: Boolean, getter;
        // can the battery be charged?
    field numberOfCells: Unsigned, getter; 
        // number of cells which make up the battery
    field atodChannel: Unsigned;
        // channel number for reading AtoD voltage value for this battery

    field batteryLevelRemaining: Fixed, getter, setter;
        // the most recent battery level that this server wishes to publish
        // value is a fixed whole percentage, [0.0 - 100.0]
        // will increase as battery is charged, decrease as it is used
    field batteryLevelVariance: Fixed, getter;
        // used to tell how often the battery level is updated
        // (100/batteryLevelVariance) tells how many segments are in the battery meter
    field rawLevelAtLastMeterChange: Fixed;
        // true battery level when rounded batteryLevelRemaining was last published

    // Fixed percentages that determine when the system will transition
    // into new battery level states.  Used to determine what, if any,
    // special message should be given to the user.
    field fullToHalfThreshold: Fixed, getter;
        // when the battery has half of it capacity
    field halfToLowThreshold: Fixed, getter;
        // when the battery is low
    field lowToVeryLowThreshold: Fixed, getter;
        // when the battery is nearly out
    field veryLowToEmptyThreshold: Fixed, getter;
        // when the battery is out (before high powered ICs turn on!)

    // Raw values of the AtoD channel that correspond to a full
    // battery, and empty battery, and the value below which that battery
    // should be assumed missing.
    field atodFullReading: Unsigned;
        // used to scale initial battery reading
        // (AtoD value when battery is fully charged)
    field atodEmptyReading: Unsigned;
        // approximate reading when battery is empty
    field atodInstalledReading: Unsigned;
        // approximate reading below which battery is (assumed) to be missing

    field lastBatteryAtoDReading: Unsigned;
        // last voltage reading from the AtoD
    field lastBatteryAtoDReadingTime: Unsigned;
        // time at which the last voltage reading was taken from the AtoD

    field alwaysReportBatteryFull: Boolean, getter, setter;
        // When true, battery will always read full, regardless of true level.
        // Used for testing only; not functional in shipping devices.

    attribute MonitorPeriod: Unsigned;
    attribute BatteryType: Signed, readOnly;
    attribute NumberOfCells: Unsigned, readOnly;
    attribute Chargeable: Boolean, readOnly;
    attribute Charging: Signed, readOnly;
    attribute FullToHalfThreshold: Fixed, readOnly;
    attribute HalfToLowThreshold: Fixed, readOnly;
    attribute LowToVeryLowThreshold: Fixed, readOnly;
    attribute VeryLowToEmptyThreshold: Fixed, readOnly;
    attribute BatteryLevelRemaining: Fixed;
    attribute BatteryLevelVariance: Fixed, readOnly;
        // used to tell how often the battery level is updated
        // (100/batteryLevelVariance) tells how many segments are in the battery meter
    attribute AlwaysReportBatteryFull: Boolean;

    operation BatteryInstalled(): Boolean;
        // is there a battery present?
        // it may be so low that it is assumed missing
    operation BatteryLow(): Boolean;
        // has the battery reached the low threshold?

    operation UpdateBatteryLevel(microampLoad: Signed): Fixed;
        // read all variables and compute percentage of full (0-100)
    operation UpdateBatteryType(): Signed;
        // check for existence and type of battery
    operation ResetBatteryInformation();
        // power conditions changed, reset battery server with new information
        // called from Power::BatteryStateChanged, ACAdapterChanged

    operation CalculateLevel(atodReading: Unsigned): Fixed;
        // what percentage of the battery life does this atodReading represent?

#ifdef VALIDATE
    overrides Validate;
#endif

    // The following operations are not a part of the functional interface.
    // They help inplement the hardware-abstraction.

    operation InitAtoDChannel();
        // system-specific method that sets up the AtoD channel (if necessary)
        // and initializes the atodChannel field for this battery
    operation ReadAtoDChannel(): Unsigned;
        // system-specific method that gets a raw a/d reading from this
        // battery's AtoD channel
    operation InitializeBatteryFields();
        // battery- and system-specific method that fills in battery
        // fields based on type of newly installed battery
end class;