
package turgen.generator;

/** Electric signal writer
 * 
 * @author michael
 */
public interface SignalWriter {
   
    /** Prepare signal writer
     * 
     * @param outputFile Output file
     * @return Error message or null when preparation is OK
     */
    public String prepare(String outputFile);
    
    
    /** Write initial signal
     * 
     * @param signal Signal
     * @throws Exception 
     */
    public void writeInitialSignal(byte[] signal) throws Exception;
    
    /** Write termination signal
     * 
     * @return True when this method should be called again, false otherwise.
     * @throws Exception 
     * 
     */
    public boolean writeTerminationSignal() throws Exception;
    
    /** Write data
     * 
     * @param signal
     * @throws Exception 
     */
    public void write(byte[] signal) throws Exception;
    
    /** Prepare for closing
     * 
     * @throws Exception 
     */
    public void prepareForClose() throws Exception;
    
    /** Close writer
     * 
     * @throws Exception 
     */
    public void close() throws Exception;
    
    /** Flush data instantly
     * @throws java.lang.Exception
     */
    public void flush() throws Exception;
    
    /** Prepare for terminal silence*/
    public void prepareForTerminationSignal(byte[] signal);
    
}
