StateFS
 All Classes Files Functions Variables Typedefs Enumerations Groups Pages
In/Out Loader

InOut Loader and Providers

InOut loader purpose is to provide a way to expose statefs properties just registering simple configuration file and supplying data by means of writing to the file.

So, to supply any statefs property one who wants to provide a property (a) composes configuration file (format is decribed in this Configuration/provider file format section, (b) register it with statefs-type "inout" and (c) writes to the file @<ProvidedNamespace>/<ProvidedProperty> to set a <ProvidedNamespace>/<ProvidedProperty> value.

Configuration/provider file format

Configuration file is written in a simple LISP-like language (S-expressions). Grammar (PEG with perl-like regexps) is:

ascii <- \w
name <- '"' [A-Z0-9_-]+ '"'
provider-name <- name
namespace-name <- name
property-name <- name
property-default-value <- '"' ascii* '"'
property <- '(' 'prop' property-name property-default-value ')'
namespace <- '(' 'ns' namespace-name property* ')'
configuration-file <- '(' 'provider' provider-params namespace* ')'

So, it looks like:

(provider "<provider-name>" "" :type "inout"
(ns "<namespace-name>"
(prop "<property-name>" "<property-default-value")
...
)
...
)

And full example:

(provider "power-emu" "" :type "inout"
(ns "Battery"
(prop "ChargeBars" "")
(prop "ChargePercentage" "100")
(prop "IsCharging" "0")
(prop "LowBattery" "0")
(prop "OnBattery" "1")
(prop "TimeUntilFull" "0")
(prop "TimeUntilLow" "1000"))
(ns "Charger" (prop "Online" "0")))