Functions for retrieving and setting data in the MCS.
More...
#include <stdint.h>
Go to the source code of this file.
|
int | MCS_CreateFolder (const char *folder, uint8_t *folderIndex) |
|
int | MCS_GetVariable (const char *folder, const char *name, uint8_t *variableType, char **name2, void **data, uint32_t *size) |
|
int | MCS_List_Create (const char *folder, const char *name, uint32_t size, uint16_t length, uint8_t variableType) |
|
int | MCS_List_Set (const char *folder, const char *name, uint32_t size, int index, uint8_t variableType, void *data) |
|
int | MCS_SetVariable (const char *folder, const char *name, uint8_t variableType, uint32_t size, void *data) |
|
Functions for retrieving and setting data in the MCS.
◆ GET_BCD_DIGIT
#define GET_BCD_DIGIT |
( |
|
n, |
|
|
|
i |
|
) |
| (((n) >> ((i) * 4)) & 0xF) |
Retrieves the BCD digit at position i
(0 representing the least significant place) from a BCD encoded number n
.
- Parameters
-
n | The number to retrieve a digit from. |
i | The index of the digit to retrieve. |
◆ MCS_CreateFolder()
int MCS_CreateFolder |
( |
const char * |
folder, |
|
|
uint8_t * |
folderIndex |
|
) |
| |
Creates a folder in the MCS.
If the folder name is greater than the 8 character max, it is truncated to a valid length.
The folderIndex
parameter is still populated if the folder already exists. However, its purpose is currently unknown.
- Parameters
-
[in] | folder | The name of the folder to create. |
[out] | folderIndex | An unknown index for the folder. |
- Returns
- 0 if the folder was created successfully, or
MCS_FOLDER_EXISTS
if the folder already exists.
◆ MCS_GetVariable()
int MCS_GetVariable |
( |
const char * |
folder, |
|
|
const char * |
name, |
|
|
uint8_t * |
variableType, |
|
|
char ** |
name2, |
|
|
void ** |
data, |
|
|
uint32_t * |
size |
|
) |
| |
Retrieves information about a variable stored in the MCS.
- Parameters
-
[in] | folder | The folder the requested MCS variable is located in. |
[in] | name | The name of the requested MCS variable. |
[out] | variableType | The variable's type. |
[out] | name2 | The variable's name. |
[out] | data | A pointer to the variable's data. |
[out] | size | The length of the variable's data. |
- Returns
- 0 if the variable exists,
MCS_NO_VARIABLE
if the variable does not exist, or MCS_NO_FOLDER
if the folder does not exist.
◆ MCS_List_Create()
int MCS_List_Create |
( |
const char * |
folder, |
|
|
const char * |
name, |
|
|
uint32_t |
size, |
|
|
uint16_t |
length, |
|
|
uint8_t |
variableType |
|
) |
| |
Creates a list variable in the MCS.
The list is initially populated with the default value of the variable type specified. If the variable already exists, it is overwritten (even if it's not a list).
- Parameters
-
[in] | folder | The folder to create the list in. |
[in] | name | The desired name of the variable. |
| size | The size of the variable type specified. |
| length | The number of entries in the list. |
| variableType | The variable type to initialize the list with (macros starting with VARTYPE ). |
- Returns
- 0 on success,
MCS_NO_FOLDER
if the requested folder does not exist.
◆ MCS_List_Set()
int MCS_List_Set |
( |
const char * |
folder, |
|
|
const char * |
name, |
|
|
uint32_t |
size, |
|
|
int |
index, |
|
|
uint8_t |
variableType, |
|
|
void * |
data |
|
) |
| |
Sets an element of a list in the MCS.
- Parameters
-
[in] | folder | The folder containing the list variable. |
[in] | name | The name of the list variable. |
| size | The size of the data to store in the element. |
| index | The index into the list of the element to modify. |
| variableType | The type of the data to be stored in the list element (macros starting with VARTYPE ). |
[in] | data | The data to copy into the list element. |
- Returns
- 0 on success,
MCS_NO_FOLDER
if the requested folder does not exist, MCS_NO_VARIABLE
if the variable does not exist, MCS_NOT_LIST
if the variable was not a list, or MCS_INDEX_OOB
if the index was out of bounds.
◆ MCS_SetVariable()
int MCS_SetVariable |
( |
const char * |
folder, |
|
|
const char * |
name, |
|
|
uint8_t |
variableType, |
|
|
uint32_t |
size, |
|
|
void * |
data |
|
) |
| |
Sets the value of a variable stored in the MCS. Can be used to create a new variable, or replace the value of an existing variable.
This function does not create the folder if it does not exist. Use MCS_CreateFolder to create a folder if necessary.
- Parameters
-
[in] | folder | The folder the variable to set it stored in. |
[in] | name | The name of the desired MCS variable. |
| variableType | The type of the variable (macros starting with VARTYPE ). |
| size | The size of the variable's data. |
[in] | data | A pointer to the data to copy into the variable. |
- Returns
- 0 if the variable was set successfully, or
MCS_NO_FOLDER
if the specified folder does not exist.
◆ MCS_FOLDER_EXISTS
const int MCS_FOLDER_EXISTS = 0x42 |
Error code signaling that the folder already exists.
◆ MCS_INDEX_OOB
const int MCS_INDEX_OOB = 0x63 |
Error code signaling that the index was out of bounds.
◆ MCS_NO_FOLDER
const int MCS_NO_FOLDER = 0x40 |
Error code signaling that the folder does not exist.
◆ MCS_NO_VARIABLE
const int MCS_NO_VARIABLE = 0x30 |
Error code signaling that the variable does not exist.
◆ MCS_NOT_LIST
const int MCS_NOT_LIST = 0x62 |
Error code signaling that the variable was not a list.
◆ MCS_SIZE_NOT_PO2
const int MCS_SIZE_NOT_PO2 = 0x61 |
Error code signaling that the specified size was not a power of 2.
◆ VARTYPE_CBCD
const uint8_t VARTYPE_CBCD = 0x02 |
Variable type: CBCD (struct
CBCD).
◆ VARTYPE_FUNC
const uint8_t VARTYPE_FUNC = 0x48 |
◆ VARTYPE_GEO
const uint8_t VARTYPE_GEO = 0x54 |
Variable type: geometry data.
◆ VARTYPE_LIST
const uint8_t VARTYPE_LIST = 0x0A |
◆ VARTYPE_MAT
const uint8_t VARTYPE_MAT = 0x0C |
◆ VARTYPE_OBCD
const uint8_t VARTYPE_OBCD = 0x01 |
Variable type: OBCD (struct
OBCD).
◆ VARTYPE_PRGM
const uint8_t VARTYPE_PRGM = 0x47 |
◆ VARTYPE_STR
const uint8_t VARTYPE_STR = 0x05 |
Variable type: null-terminated string.