Represents a data reader/writer to a caller. More...


Public Types | |
| enum | MemoryBlockNumber { Memory_Block_0 = 0 , Memory_Block_1 = 1 , Memory_Block_2 = 2 } |
| Represents the memory blocks that can be accessed. Hides how memory blocks are actually identified. More... | |
Public Member Functions | |
| DataReaderWriter (MemoryBlockNumber blockNumber) | |
| Constructor for a data reader/writer. | |
| byte[] | Read (int byteOffset, uint maxBytes) |
| Read a specified number of bytes. | |
| void | Write (int byteOffset, byte[] data, uint maxBytes) |
| Write a specified number of bytes. | |
| string | BufferToString (byte[] data, uint maxBytes, int indent) |
| Convert the specified data up to the specified number of bytes into a string by performing a "hex dump" on the data. | |
| void | Dispose () |
| Shut down the data reader/writer and dispose of resources. | |
Properties | |
| uint | MemoryBlockByteSize [get] |
| Retrieve the size of the memory block in bytes. | |
Private Member Functions | |
| string | _GetBlockNameForBlockNumber (MemoryBlockNumber blockNumber) |
| Helper function to convert a value from the MemoryBlockNumber enumeration, which specifies the number of a memory block, into the name of the block as required by the low-level Adapter_BackEnd DLL. | |
| string | _GetErrorMessage (DDR_ErrorCode errorCode) |
| Convert the given error code to a string message. | |
| string | _ConstructErrorMessage (DDR_ErrorCode errorCode, string operation) |
| Creates a formatted error message from the given operation, using the error code from the Adapter_BackEnd library. | |
Private Attributes | |
| bool | _disposed |
| bool | _initialized |
| int | _dataHandle |
| uint | _memoryBlockByteSize |
Represents a data reader/writer to a caller.
Wraps the DataReaderWriterFunctions.
Definition at line 43 of file Adapter_FrontEndClass.cs.
| enum MemoryBlockNumber |
Represents the memory blocks that can be accessed. Hides how memory blocks are actually identified.
| Enumerator | |
|---|---|
| Memory_Block_0 | First block. |
| Memory_Block_1 | Second block. |
| Memory_Block_2 | Third block. |
Definition at line 49 of file Adapter_FrontEndClass.cs.
|
inline |
Constructor for a data reader/writer.
| blockNumber | A value from the MemoryBlockNumber enumeration indicating the block of memory to open. |
| DataReaderWriterInitException | Failed to initialize the data reader/writer. |
Definition at line 171 of file Adapter_FrontEndClass.cs.
References DataReaderWriter._ConstructErrorMessage(), DataReaderWriter._dataHandle, DataReaderWriter._GetBlockNameForBlockNumber(), DataReaderWriter._initialized, DataReaderWriter._memoryBlockByteSize, DataReadWriteFunctions.DDR_GetMemorySize(), and DataReadWriteFunctions.DDR_OpenMemoryBlock().
|
inlineprivate |
Creates a formatted error message from the given operation, using the error code from the Adapter_BackEnd library.
| errorCode | The error code from the underlying library to be converted to a string. |
| operation | The operation that was in process when the error occurred. |
Definition at line 158 of file Adapter_FrontEndClass.cs.
References DataReaderWriter._GetErrorMessage().
Referenced by DataReaderWriter.__enter__(), DataReaderWriter.DataReaderWriter(), DataReaderWriter.Dispose(), DataReaderWriter.MemoryBlockByteSize(), DataReaderWriter.Read(), and DataReaderWriter.Write().
|
inlineprivate |
Helper function to convert a value from the MemoryBlockNumber enumeration, which specifies the number of a memory block, into the name of the block as required by the low-level Adapter_BackEnd DLL.
| blockNumber | Value from the MemoryBlockNumber enumeration for which to get the block name. |
Definition at line 77 of file Adapter_FrontEndClass.cs.
References BLOCK_NAME_0, BLOCK_NAME_1, and BLOCK_NAME_2.
Referenced by DataReaderWriter.__enter__(), and DataReaderWriter.DataReaderWriter().
|
inlineprivate |
Convert the given error code to a string message.
| errorCode | A value from the DDR_ErrorCode enumeration. |
Definition at line 107 of file Adapter_FrontEndClass.cs.
Referenced by DataReaderWriter._ConstructErrorMessage().
|
inline |
Convert the specified data up to the specified number of bytes into a string by performing a "hex dump" on the data.
| data | The data to process. |
| maxBytes | The number of bytes from the data to process. |
| indent | Number of spaces to indent each line. |
Definition at line 352 of file Adapter_FrontEndClass.cs.
|
inline |
Shut down the data reader/writer and dispose of resources.
| DataReaderWriterInitException | Data reader/writer not initialized. |
Definition at line 389 of file Adapter_FrontEndClass.cs.
References DataReaderWriter._ConstructErrorMessage(), DataReaderWriter._dataHandle, DataReaderWriter._disposed, DataReaderWriter._initialized, and DataReadWriteFunctions.DDR_CloseMemoryBlock().
|
inline |
Read a specified number of bytes.
| byteOffset | Byte offset into the memory block from which to start reading. |
| maxBytes | Number of bytes to read |
| DataReaderWriterInitException | Data reader/writer not initialized. |
| DataReaderWriterException | Failed to read data. |
Definition at line 211 of file Adapter_FrontEndClass.cs.
References DataReaderWriter._ConstructErrorMessage(), DataReaderWriter._dataHandle, DataReaderWriter._initialized, DDR_GetDataChunk(), and DataReadWriteFunctions.DDR_MAX_OFFSET.
|
inline |
Write a specified number of bytes.
| byteOffset | Byte offset into the memory block to which to start writing. |
| data | Array of bytes to write. Must be at least 'maxBytes' in length. |
| maxBytes | Number of bytes to write |
| DataReaderWriterInitException | Data reader/writer not initialized. |
| DataReaderWriterException | Failed to write data. |
Definition at line 272 of file Adapter_FrontEndClass.cs.
References DataReaderWriter._ConstructErrorMessage(), DataReaderWriter._dataHandle, DataReaderWriter._initialized, DDR_GetDataChunk(), DDR_MAX_OFFSET, and DDR_SetDataChunk().
|
private |
Definition at line 58 of file Adapter_FrontEndClass.cs.
Referenced by DataReaderWriter.__enter__(), DataReaderWriter.__exit__(), DataReaderWriter.DataReaderWriter(), DataReaderWriter.Dispose(), DataReaderWriter.Read(), and DataReaderWriter.Write().
|
private |
Definition at line 56 of file Adapter_FrontEndClass.cs.
Referenced by DataReaderWriter.Dispose().
|
private |
Definition at line 57 of file Adapter_FrontEndClass.cs.
Referenced by DataReaderWriter.__enter__(), DataReaderWriter.__exit__(), DataReaderWriter.DataReaderWriter(), DataReaderWriter.Dispose(), DataReaderWriter.MemoryBlockByteSize(), DataReaderWriter.Read(), and DataReaderWriter.Write().
|
private |
Definition at line 59 of file Adapter_FrontEndClass.cs.
Referenced by DataReaderWriter.__enter__(), DataReaderWriter.DataReaderWriter(), and DataReaderWriter.MemoryBlockByteSize().
|
get |
Retrieve the size of the memory block in bytes.
Definition at line 64 of file Adapter_FrontEndClass.cs.