Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

StateStore

Cai Biesinger edited this page Jun 26, 2018 · 1 revision

Scarlet has a simple way of storing basic data between program runs, called the StateStore. Some Scarlet components rely on the StateStore to work, for example BBBPinManager to keep track of device tree versions.

Preparation: To begin using the StateStore, you'll want to initialize it near the beginning of execution of your program by doing this:
StateStore.Start("YourClientApplicationName"); (e.g. "SciRover")

Usage: Now, the following methods are available to you:

  • void StateStore.Save();
    • This simply saves all of the currently stored settings into the file. Do this after changing important data, or when your program is exiting (changes are not auto-saved).
  • void StateStore.Set(string Key, string Value);
    • Creates a key if it doesn't yet exist. Sets it to the given value.
  • string StateStore.Get(string Key);
    • Gets a value, or null if the key does not exist.
  • string StateStore.GetOrCreate(string Key, string DefaultValue);
    • If the key exists, returns its value. If it doesn't, creates it, sets it to DefaultValue, then returns that.
  • bool StateStore.Started;
    • Whether or not StateStore.Start() has been called and StateStore is ready for use.

Logo

Quick Links:
NuGet
Pin Diagrams: RPi | BBB
Developers: CaiB, Baldstrom

General Info:
Home
Common Issues
Getting Started
Supported Devices

Sections:
Logging
DataLog
Filters
Hardware I/O:
- BeagleBone Black
- Raspberry Pi
- Pin Diagrams: RPi | BBB
- GPIO: Using | For Beginners
- PWM: Using | For Beginners
- ADC: Using | For Beginners
- I2C: Using | For Beginners
- SPI: Using | For Beginners
- UART: Using | For Beginners
- CAN: Using | For Beginners
Networking
Sensors
StateStore

Other: Interesting Case Studies

Clone this wiki locally