Eeprom
Eeprom
BaseStationEeprom
NodeEeprom

The abstract base class for reading and writing to Wireless devices' eeproms.

Types
EepromMap

typedef for a map of eeprom locations to eeprom values

Functions
Eeprom
explicit Eeprom(
bool useCache,
uint8 numRetries
)

Creates an Eeprom object.

Parameters
useCache
bool

Whether or not to use the eeprom cache.

numRetries
uint8

The number of retries to use for reads and writes.

Variables
m_eepromCache
EepromMap m_eepromCache

The EepromMap contianing all cached values that have previously been read from a device.

m_useCache
bool m_useCache

Whether or not the cache should be used.

m_numRetries
uint8 m_numRetries

The number of retries to use when reading and writing eeproms.

Functions
useCache
void useCache(
bool enable
)

Enables or disables use of the eeprom cache. Once disabled, all eeprom reads will go to the Node.

Parameters
enable
bool

Whether to enable (true) or disable (false) the eeprom cache.

clearCache
void clearCache()

Clears the entire eeprom cache.

clearCacheLocation
void clearCacheLocation(
uint16 location
)

Clears a specific location from the eeprom cache, if it exists.

Parameters
location
uint16

The location to clear from the cache.

setNumRetries
void setNumRetries(
uint8 retries
)

Sets the number of retries to use when reading and writing eeproms.  By default, this configuration is set to 0, meaning no retries are performed.

Parameters
retries
uint8

The number of retries to use.

getNumRetries
uint8 getNumRetries()

Gets the number of retries currently set for reading and writing eeproms.

Returns

The number of retries currently set.

readCache
bool readCache(
uint16 location,
uint16 &result
)

Attempts to read a value from the eeprom cache.

Parameters
location
uint16

The eeprom location to get the value for.

result
uint16&

Holds the result value read from the cache if successful.

Returns

true if the value was read from the cache, false if the value was not found in the cache.

updateCache
void updateCache(
uint16 location,
uint16 value
)

Adds a value to the eeprom cache at the given location, or updates it if a value for that location already exists.

Parameters
location
uint16

The location to store the value for in the cache.

value
uint16

The eeprom value to store in the cache.

updateCacheFromDevice
virtual bool updateCacheFromDevice(
uint16 location
) = 0

Attempts to update the cache by reading the value from a device.  Any values that are read from the device will be updated in the cache.

Parameters
location
uint16

The eeprom location to read from the device and update in the cache.

Returns

true if the value was read from the device and the cache has been updated, false otherwise.

readEeprom
virtual uint16 readEeprom(
uint16 location
) = 0

Attempts to read an eeprom value from a device.  If caching is enabled and there is a previously cached value available, this will just return the value from the cache and will not communicate with the device.

Parameters
location
uint16

The eeprom location to read from the device and update in the cache.

Returns

The eeprom value for the requested location.

Exceptions
writeEeprom
virtual void writeEeprom(
uint16 location,
uint16 value
) = 0

Attempts to write an eeprom value to a device.  If successful, the cache will be updated with the changed value as well.  If caching is enabled and the value in the cache is the same as that attempting to be written, nothing will be written to the device and this function will have no affect.

Parameters
location
uint16

The eeprom location to write to on the device and update in the cache.

value
uint16

The value to write to the eeprom on the device and update in the cache.

Exceptions
readEeprom
Value readEeprom(
const EepromLocation &location
)

Attempts to read an eeprom value from a device.  If caching is enabled and there is a previously cached value available, this will just return the value from the cache and will not communicate with the device.

Parameters
location

The EepromLocation to read from the device and update in the cache.

Returns

A Value object containing the eeprom value for the requested location.

Exceptions
writeEeprom
void writeEeprom(
const EepromLocation &location,
const Value &val
)

Attempts to write an eeprom value to a device.  If successful, the cache will be updated with the changed value as well.  If caching is enabled and the value in the cache is the same as that attempting to be written, nothing will be written to the device and this function will have no affect.

Parameters
location

The EepromLocation to write to on the device and update in the cache.

value

The Value to write to the eeprom on the device and update in the cache.

Exceptions
readEeprom_float
virtual float readEeprom_float(
uint16 location
)

Attempts to read 2 eeprom values from a device and build them into a float.  If caching is enabled and there is a previously cached value available, this will just return the value from the cache and will not communicate with the device.

Parameters
location
uint16

The eeprom location to read from the device and update in the cache.

Returns

The eeprom value for the requested location.

Exceptions
readEeprom_uint32
virtual uint32 readEeprom_uint32(
uint16 location
)

Attempts to read 2 eeprom values from a device and build them into a uint32.  If caching is enabled and there is a previously cached value available, this will just return the value from the cache and will not communicate with the device.

Parameters
location
uint16

The eeprom location to read from the device and update in the cache.

Returns

The eeprom value for the requested location.

Exceptions
readEeprom_int16
virtual int16 readEeprom_int16(
uint16 location
)

Attempts to read an eeprom value from a device as a signed int16.  If caching is enabled and there is a previously cached value available, this will just return the value from the cache and will not communicate with the device.

Parameters
location
uint16

The eeprom location to read from the device and update in the cache.

Returns

The eeprom value for the requested location.

Exceptions
writeEeprom_float
virtual void writeEeprom_float(
uint16 location,
float value
)

Attempts to write 2 eeprom values to a device as a float.  If successful, the cache will be updated with the changed value as well.  If caching is enabled and the value in the cache is the same as that attempting to be written, nothing will be written to the device and this function will have no affect.

Parameters
location
uint16

The eeprom location to write to on the device and update in the cache.

value
float

The value to write to the eeprom on the device and update in the cache.

Exceptions
writeEeprom_uint32
virtual void writeEeprom_uint32(
uint16 location,
uint32 value
)

Attempts to write 2 eeprom values to a device as a uint32.  If successful, the cache will be updated with the changed value as well.  If caching is enabled and the value in the cache is the same as that attempting to be written, nothing will be written to the device and this function will have no affect.

Parameters
location
uint16

The EepromLocation to write to on the device and update in the cache.

value
uint32

The value to write to the eeprom on the device and update in the cache.

Exceptions
writeEeprom_int16
virtual void writeEeprom_int16(
uint16 location,
int16 value
)

Attempts to write an eeprom value to a device from a signed int16.  If successful, the cache will be updated with the changed value as well.  If caching is enabled and the value in the cache is the same as that attempting to be written, nothing will be written to the device and this function will have no affect.

Parameters
location
uint16

The eeprom location to write to on the device and update in the cache.

value
int16

The value to write to the eeprom on the device and update in the cache.

Exceptions