smart-stream-wrapper

A wrapper for smart-stream for scheduling

Synopsis

smart-stream-wrapper [OPTIONS]...

Description

smart-stream-wrapper adds a maintenance schedule layer around smart-stream to manage automatic multi-sensor calibration, selection, and schedule a duty-cycle for activating a built-in heater element. smart-stream-wrapper will invoke the smart-stream process sequentially to conform with the maintenance schedule based on the additional maintenance options described below until terminated by SIGINT or error. Other options are passed to the smart-stream verbatim with the exception of --duration. If --duration is specified, this is the maximum value passed to the underlying smart-stream process. The smart-stream-wrapper may use shorter values to conform to the maintenance schedule.

The smart-stream-wrapper will selectively pass --enable-heater, and --use-backup-sensor in accordance with the maintenance schedule. For calibration, smart-stream-wrapper will invoke smart-stream using --calibrate to measure the response of the two redundant sensors and automatically choose the best one.

Options

--schedule-heater on-duration off-duration

Specify the on-duration and off-duration duty-cycle for the heater in seconds. The --enable-heater parameter will be passed to the underlying smart-stream program during the on periods.

--schedule-calibrate freq amp target period

A calibration will run every period seconds to calibrate and measure the primary sensor (for one second) and the backup sensor (for another second) by invoking smart-stream with the --calibrate option. The frequency in Hz and the amplitude as a fraction of full scale is passed to smart-stream. The sensor measuring closest to the target value in dB relative to full scale will be chosen. Subsequent invocations of smart-stream will optionally use --use-backup-sensor.

--stdout path

Append standard output (csv results) to specified file.

--stderr path

Append standard error (logging) to specified file.

Hook

When smart-stream-wrapper performs a calibration sequence, a user-defined bash shell script may be executed to respond to microphone communciation failures and calibration measurements. If the file /var/www/html/storage/smart-calibrate-hook.sh is present, it will be executed with the following arguments:

serial-number ($1)

Device serial number.

primary result ($2)

Primary sensor calibration result, or blank on error.

backup result ($3)

Backup sensor calibration result, or blank on error.

result target ($4)

Target result as passed from smart-stream-wrapper, or blank on error.

Files

/var/www/html/storage/smart-calibrate-hook.sh Optional hook invoked during calibration cycle