private RouteComponent createCombiner(DataTypeBase source, bool rss) { if (source.attributes.length() <= 0) { throw new IllegalRouteOperationException(string.Format("Cannot apply \'{0}\' to null data", !rss ? "rms" : "rss")); } else if (source.eventConfig[0] == (byte)SENSOR_FUSION) { throw new IllegalRouteOperationException(string.Format("Cannot apply \'{0}\' to sensor fusion data", !rss ? "rms" : "rss")); } var config = new DataProcessorConfig.CombinerConfig(source.attributes, rss); var next = source.transform(config); return(postCreate(next.Item2, new NullEditor(config, next.Item1, state.bridge))); }
private IRouteComponent applyAverager(byte samples, bool hpf, string name) { var hasHpf = state.bridge.lookupModuleInfo(DATA_PROCESSOR).revision >= DataProcessor.HPF_REVISION; if (source.attributes.length() <= 0) { throw new IllegalRouteOperationException(string.Format("Cannot apply {0} filter to null data", name)); } if (source.attributes.length() > 4 && !hasHpf) { throw new IllegalRouteOperationException(string.Format("Cannot apply {0} filter to data longer than 4 bytes", name)); } DataProcessorConfig config = new DataProcessorConfig.AverageConfig(source.attributes, samples, hpf, hasHpf); var next = source.transform(config); return(postCreate(next.Item2, new AverageEditorInner(config, next.Item1, state.bridge))); }