package nl.nikhef.safaripark.dolly;

import java.io.IOException;

import nl.nikhef.safaripark.ContextCache;
import nl.nikhef.safaripark.extra.Module;
import nl.nikhef.sfp.ddmi.DDMIValue;

public class ModuleValueGetter implements ValueGetter {

	private Module _mod;
	private ContextCache _ctxCache;
	
	public ModuleValueGetter(ContextCache cache, Module sourceModule) 
	{
		_mod = sourceModule;
		_ctxCache = cache;
	}

	@Override
	public byte[] getValue(DDMIValue v) throws IOException {
		return v.readRaw(_ctxCache.getContextFor(_mod.dev, _mod.bay));
	}

}
