NodeEepromHelper
NodeEepromHelper

A helper class for reading and writing to a Wireless Node's Eeprom.  This class provides eeprom specific parsing so that high-level objects can be converted to their low-level eeprom value equivelent and vice-versa.

Constants
Eeprom Limits
TIME_BETWEEN_BURSTS_MAX_SECS

32767 - The max number of seconds before we have to switch to saving as minutes (Note: this is because we use the most significant bit to signify seconds or minutes)

BYTES_PER_DATALOG_PAGE

264  - The number of bytes for a single datalogging page on a Wireless Node.

MIN_SLEEP_INTERVAL_EEVAL

512  - The minimum sleep interval eeprom value.

MAX_SLEEP_INTERVAL_EEVAL

7680  - The maximum sleep interval eeprom value.

MIN_LOST_BEACON_TIMEOUT

2  - The minimum lost beacon timeout in minutes.

MAX_LOST_BEACON_TIMEOUT

600  - The maximum lost beacon timeout in minutes.

LOST_BEACON_TIMEOUT_DISABLED

0  - The value to use for disabling the lost beacon timeout.

Functions
NodeEepromHelper
NodeEepromHelper(
WirelessNode_Impl *node
)

Creates a NodeEepromHelper object with a WirelessNode_Impl.

Parameters
node

The WirelessNode_Impl that will be read from and written to.

Variables
m_node
WirelessNode_Impl* m_node

The WirelessNode_Impl used by this eeprom helper.

Functions
read
Value read(
const EepromLocation &location
) const

Reads an EepromLocation from the Node and returns a Value with the result.

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

Writes a Value to a given EepromLocation on the Node.

Exceptions
nodeAddress
uint16 nodeAddress() const

Gets the node address for this Node.

Returns

The node address of the Node.

applyEepromChanges
void applyEepromChanges()

Resets the radio/power on the Node to apply eeprom changes that have been made.

read_frequency
WirelessTypes::Frequency read_frequency() const

Reads the frequency from the Node.

Returns The WirelessTypes::Frequency of the Node.

Exceptions
read_regionCode
WirelessTypes::RegionCode read_regionCode() const

Reads the region code from the Node.

Returns

The WirelessTypes::RegionCode set on the Node.

Exceptions
read_fwVersion
Version read_fwVersion() const

Gets the firmware version of the Node.

Returns

A Version representing the firmware version of the Node.

Exceptions
read_model
WirelessModels::NodeModel read_model() const

Gets the model of the Node.

Returns

A WirelessModels::NodeModel representing the model of the Node.

Exceptions
read_serial
std::string read_serial() const

Gets the serial number of the Node.

Returns

A string representing the serial number of the Node.

Exceptions
read_microcontroller
WirelessTypes::MicroControllerType read_microcontroller() const

Gets the microcontroller of the Node.

Returns

A WirelessTypes::MicroControllerType representing the microcontroller of the Node.

Exceptions
read_radioFeatures
RadioFeatures read_radioFeatures() const

Gets the RadioFeatures of the Node.

Returns

The RadioFeatures of the Node.

Exceptions
read_dataStorageSize
uint64 read_dataStorageSize() const

Gets the total number of bytes available for data storage on the Node.  This is an overall count and does not take into account data that is already stored on the Node.

Returns

The total number of bytes available for data storage on the Node.

Exceptions
read_filter1
WirelessTypes::SettlingTime read_filter1() const

Reads the specific filter 1 eeprom location.  Note: this should be used by the SyncSamplingNetwork only, as it bypasses the ChannelMask logic.

read_filter2
WirelessTypes::SettlingTime read_filter2() const

Reads the specific filter 2 eeprom location.  Note: this should be used by the SyncSamplingNetwork only, as it bypasses the ChannelMask logic.

write_channelMask
void write_channelMask(
const ChannelMask &channels
)

Writes the channel mask to the Node, representing which channels are active or not.

Parameters
channels

The ChannelMask representing which channels are active and which are not.

Exceptions
read_channelMask
ChannelMask read_channelMask() const

Reads the current channel mask from the Node, representing which channels are active or not.

Returns

A ChannelMask object representing which channels are active or not.

Exceptions
write_numSweeps
void write_numSweeps(
uint32 sweeps
)

Writes the number of sweeps which affects the duration of sampling. In the case of Burst sampling, this is the number of sweeps per burst This function assumes the number of sweeps has already been normalized (multiple of 100 and within min/max).

Parameters
sweeps
uint32

The number of sweeps to write to the Node.

Exceptions
read_numSweeps
uint32 read_numSweeps() const

Reads the current number of sweeps which affects the duration of sampling.

Returns

The number of sweeps currently set on the Node.

Exceptions
write_unlimitedDuration
void write_unlimitedDuration(
bool unlimitedDuration,
WirelessTypes::SamplingMode samplingMode
)

Writes the unlimited duration flag. This is a different eeprom location depending on the sampling mode.

Parameters
unlimitedDuration
bool

Whether unlimited duration should be enabled (true) or disabled (false).

samplingMode

The WirelessTypes::SamplingMode to set unlimited duration for.

Exceptions
read_unlimitedDuration
bool read_unlimitedDuration(
WirelessTypes::SamplingMode samplingMode
) const

Reads the current unlimited duration flag set on the Node. This is a different eeprom location depending on the sampling mode.

Parameters
samplingMode

The WirelessTypes::SamplingMode to get the unlimited duration flag for.

Returns

true if the Node is set to unlimited duration, false otherwise

Exceptions
write_sampleRate
void write_sampleRate(
WirelessTypes::WirelessSampleRate rate,
WirelessTypes::SamplingMode samplingMode
)

Writes the sample rate. This is a different eeprom location depending on the sampling mode.

Parameters
rate

The WirelessTypes::WirelessSampleRate to set.

samplingMode

The WirelessTypes::SamplingMode to set unlimited duration for.

Exceptions
read_sampleRate
WirelessTypes::WirelessSampleRate read_sampleRate(
WirelessTypes::SamplingMode samplingMode
) const

Reads the current sample rate set on the Node. This is a different eeprom location depending on the sampling mode.

Parameters
samplingMode

The WirelessTypes::SamplingMode to get the unlimited duration flag for.

Returns

A WirelessTypes::WirelessSampleRate representing the sample rate that is currently set on the Node.

Exceptions
write_dataFormat
void write_dataFormat(
WirelessTypes::DataFormat dataFormat
)

Writes the data format to the Node.

Parameters
dataFormat

The WirelessTypes::DataFormat to set.

Exceptions
read_dataFormat
WirelessTypes::DataFormat read_dataFormat() const

Reads the current data format set on the Node.

Returns

The WirelessTypes::DataFormat that is currently set on the Node.

Exceptions
write_collectionMode
void write_collectionMode(
WirelessTypes::DataCollectionMethod collectionMode
)

Writes the data collection mode to the Node.

Parameters
collectionMode

The WirelessTypes::DataCollectionMethod to set.

Exceptions
read_collectionMode
WirelessTypes::DataCollectionMethod read_collectionMode() const

Reads the current data collection mode set on the Node.

Returns

The WirelessTypes::DataCollectionMethod that is currently set on the Node.

Exceptions
write_syncSamplingMode
void write_syncSamplingMode(
WirelessTypes::SyncSamplingMode syncMode
)

Writes the sync sampling mode to the Node.

Parameters
syncMode

The WirelessTypes::SyncSamplingMode to set.

Exceptions
read_syncSamplingMode
WirelessTypes::SyncSamplingMode read_syncSamplingMode() const

Reads the current sync sampling mode set on the Node.

Returns

The WirelessTypes::SyncSamplingMode that is currently set on the Node.

Exceptions
write_samplingDelay
void write_samplingDelay(
TimeSpan delay
)

Writes the sampling delay to the Node.

Parameters
delay

The TimeSpan representing the sampling delay to write to the Node.

Exceptions
read_samplingDelay
TimeSpan read_samplingDelay() const

Reads the current sampling delay set on the Node.

Returns

A TimeSpan representing the sampling delay that is currently set on the Node.

Exceptions
write_retransmission
void write_retransmission(
WirelessTypes::NodeRetransmission reTx
)

Writes the retransmission option to the Node.

Parameters
reTx

The WirelessTypes::NodeRetransmission to write to the Node.

Exceptions
read_retransmission
WirelessTypes::NodeRetransmission read_retransmission() const

Reads the current retransmission option set on the Node.

Returns

The WirelessTypes::NodeRetransmission representing the retransmission option that is currently set on the Node.

Exceptions
write_settlingTime
void write_settlingTime(
const ChannelMask &mask,
WirelessTypes::SettlingTime settlingTime
)

Writes the settling time to the Node for the given ChannelMask.

Parameters
mask

The ChannelMask to set the filter setting time for.

settlingTime

The WirelessTypes::SettlingTime to write to the Node.

Exceptions
read_settlingTime
WirelessTypes::SettlingTime read_settlingTime(
const ChannelMask &mask
) const

Reads the current filter settling time on the Node for the given ChannelMask.

Parameters
mask

The ChannelMask to read the filter settling time for.

Returns

The WirelessTypes::SettlingTime representing the settling time that is currently set on the Node.

Exceptions
write_timeBetweenBursts
void write_timeBetweenBursts(
const TimeSpan &timespan
)

Writes the time between each burst to the Node.  This function assumes the time between bursts value has been normalized.

Parameters
timespan
const TimeSpan&

The TimeSpan representing the time between each burst. This can be in the range of 1 second to 24 hours.

Exceptions
read_timeBetweenBursts
TimeSpan read_timeBetweenBursts() const

Reads the time between each burst from the Node.

Returns

The TimeSpan representing the time between each burst.

Exceptions
write_samplingMode
void write_samplingMode(
WirelessTypes::SamplingMode samplingMode
)

Writes the WirelessTypes::SamplingMode to the Node.

Parameters
samplingMode

The WirelessTypes::SamplingMode to write to the Node.

Exceptions
read_samplingMode
WirelessTypes::SamplingMode read_samplingMode() const

Reads the current WirelessTypes::SamplingMode from the Node.

Returns

A WirelessTypes::SamplingMode object representing the sampling mode.

Exceptions
write_channelLinearEquation
void write_channelLinearEquation(
const ChannelMask &mask,
const LinearEquation &equation
)

Writes the slope and offset for the specified ChannelMask on the Node.

Parameters
mask

The ChannelMask to write the linear equation for.

equation

The LinearEquation containing the slope and offset to write.

Exceptions
read_channelLinearEquation()
void read_channelLinearEquation(
const ChannelMask &mask,
LinearEquation &result
)

Reads the slope and offset for the specified ChannelMask from the Node.

Parameters
mask

The ChannelMask to read the linear equation for.

result

The LinearEquation that will hold the result.

Exceptions
write_channelUnit
void write_channelUnit(
const ChannelMask &mask,
WirelessTypes::CalCoef_Unit unit
)

Writes the unit for the specified ChannelMask to the Node.

Parameters
mask

The ChannelMask to write the unit for.

unit

The WirelessTypes::CalCoef_Unit to write to the Node.

Exceptions
write_channelEquation
void write_channelEquation(
const ChannelMask &mask,
WirelessTypes::CalCoef_EquationType equation
)

Writes the equation id for the specified ChannelMask to the Node.

Parameters
mask

The ChannelMask to write the equation id for.

equation

The WirelessTypes::CalCoef_EquationType to write to the Node.

Exceptions
write_channelUnitAndEquation
void write_channelUnitAndEquation(
const ChannelMask &mask,
WirelessTypes::CalCoef_Unit unit,
WirelessTypes::CalCoef_EquationType equation
)

Writes the unit and equation for the specified ChannelMask to the Node.

Parameters
channelNumber

The channel number to save the configuration to (channel 1 = 1, channel 8 = 8).

unit

The WirelessTypes::CalCoef_Unit to write to the Node.

equation

The WirelessTypes::CalCoef_EquationType to write to the Node.

Exceptions
read_channelUnit
WirelessTypes::CalCoef_Unit read_channelUnit(
const ChannelMask &mask
) const

Reads the WirelessTypes::CalCoef_Unit for the specified ChannelMask from the Node.

Parameters
mask

The ChannelMask to read the unit for.

Returns

The WirelessTypes::CalCoef_Unit for the given channel.

Exceptions
read_channelEquation
WirelessTypes::CalCoef_EquationType read_channelEquation(
const ChannelMask &mask
) const

Reads the WirelessTypes::CalCoef_EquationType for the specified channel from the Node.  This assumes the channel is supported by the Node.

Parameters
mask

The ChannelMask to read the equation id for.

Returns

The WirelessTypes::CalCoef_EquationType for the given channel.

Exceptions
read_transmitPower
WirelessTypes::TransmitPower read_transmitPower() const

Reads the WirelessTypes::TransmitPower that is currently set on the Node.

Returns

The WirelessTypes::TransmitPower that is currently set on the Node.

Exceptions
write_transmitPower
void write_transmitPower(
WirelessTypes::TransmitPower power
)

Writes the WirelessTypes::TransmitPower to the Node.

Parameters
power

The WirelessTypes::TransmitPower to write to the Node.

Exceptions
read_inactivityTimeout
uint16 read_inactivityTimeout() const

Reads the user inactivity timeout that is currently set on the Node.  This controls how many seconds before the Node goes to sleep when idle.

Returns

The user inactivity timeout (in seconds) that is currently set on the Node.  Note: A value of 65535 (0xFFFF) disables the inactivity timeout so that the Node never goes to sleep.

Exceptions
write_inactivityTimeout
void write_inactivityTimeout(
uint16 timeout
)

Writes the user inactivity timeout to the Node.  This function assumes the inactivity timeout has already been set to be above the minimum.

Parameters
timeout
uint16

The user inactivity timeout (in seconds) to write to the Node.  Note: A value of 65535 (0xFFFF) disables the inactivity timeout so that the Node never goes to sleep.

Exceptions
read_checkRadioInterval
uint8 read_checkRadioInterval() const

Reads the check radio interval that is currently set on the Node.  This controls how often the node wakes up from sleep to check for commands.

Returns

The interval (in seconds) that is currently set on the Node.

Exceptions
write_checkRadioInterval
void write_checkRadioInterval(
uint8 interval
)

Writes the check radio interval to the Node.  This controls how often the node wakes up from sleep to check for commands.  This function assumes the interval is within the acceptable range.

Parameters
interval
uint8

The check radio interval (in seconds) to write to the Node.

Exceptions
read_defaultMode
WirelessTypes::DefaultMode read_defaultMode() const

Reads the WirelessTypes::DefaultMode that is currently set on the Node.

Returns

The default mode that is currently set on the Node.

Exceptions
write_defaultMode
void write_defaultMode(
WirelessTypes::DefaultMode mode
)

Writes the given WirelessTypes::DefaultMode to the Node.

Parameters
mode

The WirelessTypes::DefaultMode to write to the Node.

Exceptions
read_logPage
uint16 read_logPage() const

Reads the next flash page that to be used for datalogging.

Returns

The next flash page that to be used for datalogging.

Exceptions
read_logPageOffset
uint16 read_logPageOffset() const

Reads the byte offset into the log page for the next datalogging session.

Returns

The byte offset into the log page for the next datalogging session.

Exceptions
read_numDatalogSessions
uint16 read_numDatalogSessions() const

Reads the number of datalog sessions that are currently stored on the Node.

Returns

The number of datalog sessions that are stored on the Node.

Exceptions
write_txPerGroup
void write_txPerGroup(
uint16 txPerGroup
)

Writes the transmissions per group to the Node.

Parameters
txPerGroup
uint16

The number of transmissions per group to write.

Exceptions
write_groupSize
void write_groupSize(
uint16 groupSize
)

Writes the group size to the Node.

Parameters
groupSize
uint16

The group size to write.

Exceptions
write_tdmaAddress
void write_tdmaAddress(
uint16 address
)

Writes the TDMA address to the Node.

Parameters
address
uint16

The TDMA address to write.

Exceptions
write_maxRetransPerBurst
void write_maxRetransPerBurst(
uint16 maxReTxPerBurst
)

Writes the max retransmissions per burst to the Node.

Parameters
maxReTxPerBurst
uint16

The value to write.

Exceptions
read_hardwareGain
double read_hardwareGain(
const ChannelMask &mask
) const

Reads the hardware gain for the specified ChannelMask from the Node.

Parameters
mask

The ChannelMask to read the hardware gain for.

Returns

The hardware gain for the given ChannelMask.

Exceptions
read_hardwareOffset
uint16 read_hardwareOffset(
const ChannelMask &mask
) const

Reads the hardware offset for the specified ChannelMask from the Node.

Parameters
mask

The ChannelMask to read the hardware offset for.

Returns

The hardware offset for the given ChannelMask.

Exceptions
write_hardwareGain
void write_hardwareGain(
const ChannelMask &mask,
double gain
)

Writes the hardware gain value for the specified ChannelMask to the Node.

Parameters
mask

The ChannelMask to write the hardware gain for.

gain
double

The hardware gain value to write to the Node.

Exceptions
write_hardwareOffset
void write_hardwareOffset(
const ChannelMask &mask,
uint16 offset
)

Writes the hardware offset value for the specified ChannelMask to the Node.

Parameters
mask

The ChannelMask to write the hardware offset for.

gain

The hardware offset value to write to the Node.

Exceptions
read_gaugeFactor
float read_gaugeFactor(
const ChannelMask &mask
) const

Reads the gauge factor for the specified ChannelMask from the Node.

Parameters
mask

The ChannelMask to read the gauge factor for.

Returns

The gauge factor for the given ChannelMask.

Exceptions
write_gaugeFactor
void write_gaugeFactor(
const ChannelMask &mask,
float gaugeFactor
)

Writes the gauge factor value for the specified ChannelMask to the Node.

Parameters
mask

The ChannelMask to write the gauge factor for.

gaugeFactor
float

The gauge factor value to write to the Node.

Exceptions
read_thermoType
WirelessTypes::ThermocoupleType read_thermoType(
const ChannelMask &mask
) const

Reads the WirelessTypes::ThermocoupleType from the Node.

Parameters
mask

The ChannelMask to read the thermocouple type for.

Returns

The WirelessTypes::ThermocoupleType for the given ChannelMask.

Exceptions
write_thermoType
void write_thermoType(
const ChannelMask &mask,
WirelessTypes::ThermocoupleType thermocouple
)

Writes the WirelessTypes::ThermocoupleType to the Node.  This assumes thermocouple type is supported.

Parameters
mask

The ChannelMask to write the thermocouple type for.

thermocouple

The WirelessTypes::ThermocoupleType to write to the Node.

Exceptions
read_activitySense
void read_activitySense(
ActivitySense &result
) const

Reads the ActivitySense options from the Node.  This assumes activity sense configuration is supported by the Node.

Parameters
result

Will hold the result of the ActivitySense options read from the Node.

Exceptions
write_activitySense
void write_activitySense(
const ActivitySense &options
)

Writes the ActivitySense options to the Node.  This assumes fatigue options configuration is supported by the Node.

Parameters
options

The ActivitySense to write to the Node.

Exceptions
read_fatigueOptions
void read_fatigueOptions(
FatigueOptions &result
) const

Reads the FatigueOptions from the Node.  This assumes fatigue options configuration is supported by the Node.

Parameters
result

Will hold the result of the FatigueOptions read from the Node.

Exceptions
write_fatigueOptions
void write_fatigueOptions(
const FatigueOptions &options
)

Writes the FatigueOptions to the Node.  This assumes fatigue options configuration is supported by the Node.

Parameters
options

The FatigueOptions to write to the Node.

Exceptions
read_histogramOptions
void read_histogramOptions(
HistogramOptions &result
) const

Reads the HistogramOptions from the Node.  This assumes histogram options configuration is supported by the Node.

Parameters
result

Will hold the result of the HistogramOptions read from the Node.

Exceptions
write_histogramOptions
void write_histogramOptions(
const HistogramOptions &options
)

Writes the HistogramOptions to the Node.  This assumes histogram options configuration is supported by the Node and all options are valid.

Parameters
options

The HistogramOptions to write to the Node.

Exceptions
clearHistogram
void clearHistogram()

Clears the Histogram on the Node.  This assumes histogram options configuration is supported by the Node.

Exceptions
read_lostBeaconTimeout
uint16 read_lostBeaconTimeout() const

Reads the lost beacon timeout value from the Node.  A value of 0 means the timeout is disabled.  This assumes lost beacon timeout is supported by the Node.

Returns

The lost beacon timeout in minutes.

Exceptions
write_lostBeaconTimeout
void write_lostBeaconTimeout(
uint16 minutes
)

Writes the lost beacon timeout value, in minutes, to the Node.  This assumes the value is within range of a valid value.

Parameters
minutes
uint16

The lost beacon timeout value in minutes.

Exceptions