Design Pattern Examples
Overview of object-oriented design patterns
Adapter_Functions.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __ADAPTER_FUNCTIONS_H__
8#define __ADAPTER_FUNCTIONS_H__
9
10#include <stdbool.h>
11#include <stdint.h>
12
17typedef enum
18{
23
32bool Adapter_OpenMemory(MemoryBlockNumber blockNumber, int* dataHandle);
33
41bool Adapter_CloseMemory(int dataHandle);
42
52bool Adapter_GetMemorySize(int dataHandle, int* sizeInBytes);
53
68bool Adapter_ReadMemory(int dataHandle, int byteOffset, uint8_t* buffer, int maxBytes, int* bytesRead);
69
84bool Adapter_WriteMemory(int dataHandle, int byteOffset, const uint8_t* buffer, int maxBytes, int* bytesWritten);
85
91const char* Adapter_GetLastErrorMessage(void);
92
102const char* Adapter_BufferToString(const uint8_t* data, uint32_t maxBytes, int indent);
103
104#endif // __ADAPTER_FUNCTIONS_H__
bool Adapter_CloseMemory(int dataHandle)
Closes a memory block from access.
bool Adapter_ReadMemory(int dataHandle, int byteOffset, uint8_t *buffer, int maxBytes, int *bytesRead)
Read a requested number of bytes from the memory block associated with the given handle.
bool Adapter_OpenMemory(MemoryBlockNumber blockNumber, int *dataHandle)
Open a memory block for access.
bool Adapter_WriteMemory(int dataHandle, int byteOffset, const uint8_t *buffer, int maxBytes, int *bytesWritten)
Write a requested number of bytes to the memory block associated with the given handle.
bool Adapter_GetMemorySize(int dataHandle, int *sizeInBytes)
Retrieve the number of bytes in the memory block associated with the specified data handle.
const char * Adapter_BufferToString(const uint8_t *data, uint32_t maxBytes, int indent)
Convert the specified data up to the specified number of bytes into a string by performing a "hex dum...
const char * Adapter_GetLastErrorMessage(void)
Retrieve a string describing the last error that occurred in the Adapter.
MemoryBlockNumber
Represents the memory blocks that can be accessed. Hides how memory blocks are actually identified.
@ Memory_Block_0
First block.
@ Memory_Block_1
Second block.
@ Memory_Block_2
Third block.