Access the store on a BrainStem Module.
The store provides a flat file system on modules that have storage capacity. Files are referred to as slots and they have simple zero-based numbers for access. Store slots can be used for generalized storage and commonly contain compiled reflex code (files ending in .map) or templates used by the system. Slots simply contain bytes with no expected organization but the code or use of the slot may impose a structure.
Stores have fixed indices based on type. Not every module contains a store of each type. Consult the module datasheet for details on which specific stores are implemented, if any, and the capacities of implemented stores.
- Useful Constants:
- INTERNAL_STORE (0)
- RAM_STORE (1)
- SD_STORE (2)
Get the slot capacity.
Returns the Capacity of the slot, i.e. The number of bytes it can hold.
Returns: Either the capacity of the slot in Result.value or an error. Return type: Result
Get the slot size.
Returns the size of the data currently filling the slot in bytes.
Returns: Either the size of the slot in Result.value or an error. Return type: Result
Get slot state.
Slots which contain reflexes may be “enabled,” i.e. the reflexes contained in the slot are active.
Parameters: slot (int) – The slot number. Returns:
- Return result object with NO_ERROR set and the current
- state of the slot in the Result.value or an Error.
Return type: Result
loadSlot(slot, data, length)¶
Load the slot.
- slot (int) – The slot number.
- data (str, bytes) – The data.
- length (int) – The data length in bytes.
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
Disable the slot
Enable the slot