.. highlight:: java Data Processor ============== As mentioned in the :doc:`data_route` page, the data processor can perform simple calcutaions on the data before passing it to the user. Adding and configuring processors is handled with the ``RouteBuilder`` api and the `IDataProcessor `_ interface is used to interact with the processors that were tagged with the `Name `_ component. :: using MbientLab.MetaWear.Core; IDataProcessor dataproc = metawear.GetModule(); Modifying Processors -------------------- Some processors have parameters that can be modified after they are created. Call `Edit `_ using the same string passed into the ``Name`` component and the type of editor to return. Make sure the editor class is appropriate for the desired processor. ============ =================== ====================================== Processor Editor Editable Parameters ============ =================== ====================================== Accumulate IAccumulatorEditor Accumulated sum Average IAverageEditor Sample size, reset running avg Comparison IComparatorEditor Comparison operation, reference values Counter ICounterEditor Accumulated count Differential IDifferentialEditor Minimum distance Map IMapEditor Right hand value for 2 op functions Passthrough IPassthroughEditor Passthrough type and value Pulse IPulseEditor Threshold and min sample size Threshold IThresholdEditor Boundary and hysteresis Time ITimeEditor Period ============ =================== ====================================== :: using MbientLab.MetaWear.Core.DataProcessor; // assume route built with // .Count().Name("counter") // reset internal count dataproc.Edit("counter").Reset(); Internal State -------------- Some processors have an internal state, represented as a forced data producer. These state data producers are retrieved with the `State `_ method using the same string passed into the ``Name`` component. =========== ========================= Processor Description =========== ========================= Accumulate Current accumulated sum Buffer Last received input Counter Current accumulated count Passthrough Value parameter =========== ========================= :: // assume route built with // .Buffer().Name("buffer") // access the buffer state IForcedDataProducer producer = dataproc.State("buffer")