This workspace contains crates for the behavioral experiment framework decide.
decide-protocol: protobuf definitions, error types, theComponenttrait, and trait implementations for transforming betweentmq::Multipartmessages and the types used internallydecide-core: the main logic for initializing components and routing messages between clients and componentscomponents/*: crates with a type that implementsdecide_protocol::Component
Since this workspace only contains a single binary crate, decide-core, you can use cargo build and cargo run as normal. If you want to set feature flags (e.g. dummy-mode, see [decide-core/src/lib.rs] for details), you can pass them from the command line, like
cargo run --features dummy-mode.
To compile for a specific architecture (BBB in our case), use cross (make sure you have docker installed):
cargo install cross
docker build -t decide-rs/image:tag ./
cross build --target armv7-unknown-linux-gnueabihf --releaseLogging level defaults to INFO, but can be overwritten with export DECIDE_LOG="value"
- Design component as a separate crate ("package") under
./components/according to the protocol. Follow./components/lightsas an example. - Include component crate in
decide-coredependencies (./decide-core/Cargo.toml). - Import
Component-implemented struct and add to list of components inimpl_components!macro in./decide-core/src/components.rs - Include component crate in the main cargo manifest (
./Cargo.toml)
The tests require a running instance of decide, otherwise they will hang.
mkdir -p ~/.config/decide/
ln -s components/lights/tests/components.yml ~/.config/decide/
cargo run &
cargo test
kill $(jobs -l -p)