NodeMemory
NodeMemory

Provides easy access to the datalogging memory on a WirelessNode.

Functions
NodeMemory
NodeMemory(
WirelessNode &node,
uint16 logPage,
uint16 pageOffset
)

Creates a NodeMemory object.

Parameters
node

The WirelessNode to access the memory of.

logPage
uint16

The last log page that contains datalogging data.

pageOffset
uint16

The byte offset into the last log page containing datalogging data.

Exceptions
Constants
Node Memory Constants
PAGE_SIZE

264  - The size of a single datalogging page (in bytes).

START_PAGE

2  - The first page on the Node that has actual datalogging data.

Variables
m_node
WirelessNode& m_node

The WirelessNode to access the memory of.

m_logPage
uint16 m_logPage

The last log page that contains datalogging data.

m_pageOffset
uint16 m_pageOffset

The byte offset into the last log page containing datalogging data.

m_totalBytes
uint64 m_totalBytes

The total number of bytes that can be downloaded.

m_currentPageNumber
uint16 m_currentPageNumber

Holds the page number of the data that is stored in m_currentPageData

m_previousPageNumbers

Holds the page number of the data that is stored in m_previousPageData

m_currentPageData
ByteStream m_currentPageData

Contains data for the current page that has been downloaded.

m_previousPageData
ByteStream m_previousPageData

Contains data for the previous page that was downloaded.  This allows us to grab data from a page, and then look back at previous data (to piece a packet together) without redownloading it.

Functions
findPageAndOffset
void findPageAndOffset(
uint64 bytePosition,
uint16 &page,
uint16 &offset
) const

Gets the page and offset from the memory position.

Parameters
bytePosition
uint64

The byte position in the Node's datalogging memory.

page
uint16&

Holds the page index result.

offset
uint16&

Holds the offset position result;

getByteStream
ByteStream* getByteStream(
uint16 page
)

Gets a pointer to the ByteStream containing the data for the requested page.  If the data does not exist in a current ByteStream, it will be downloaded from the Node.

Parameters
page
uint16

The page index to request data for.

Returns

A ByteStream pointer containing the data for the requested page.

Exceptions
findData
void findData(
uint64 bytePosition,
ByteStream **data,
uint16 &offset
)

Gets the data ByteStream, and offset into the ByteStream to read from, given the byte position.

Parameters
bytePosition
uint64

The byte position requested in the Node's datalogging memory.

data

Holds the ByteStream result containing the data to read.

offset
uint16&

Holds the offset result, which is the offset into the data to read from.

Exceptions
at
uint8 at(
uint64 bytePosition
)

Reads a 1-byte unsigned integer from the datalogging data.

Parameters
bytePosition
uint64

The 0-based position into the Node's memory to read from.

Returns

The 1-byte uint8 at the requested position.

Exceptions
bytesRemaining
uint64 bytesRemaining(
uint64 currentByte
)

Calculates how many bytes are remaining in the Node's datalogging memory, based on the given byte position.

Parameters
currentByte
uint64

The byte position to check against the total bytes to calculate the number of bytes remaining.

Returns

The number of bytes remaining before the end of the Node's datalogging memory.