package jbCAP;

/** @file bCapEngine.java
 *
 *  @brief b-CAP client library
 *
 *  @version	1.2
 *	@date		2014/5/26
 *	@author		DENSO WAVE (m)
 *
 */
public class bCapEngine {
	private int m_hr;
	private bCapControllers m_ctrls;
	
	public bCapEngine()
	{
		m_hr = 0;
		m_ctrls = new bCapControllers();
	}
		
	public void Release()
	{
		m_ctrls.Clear();
	}

	public bCapControllers get_Controllers()
	{
		return m_ctrls;
	}
	
	public bCapController AddController(String host, int port, boolean UDP, String strController, String strProvider, String strMachine, String strOption)
	{
		return AddController(host, port, UDP, 500, 5, 0, 0, strController, strProvider, strMachine, strOption);
	}
	
	public bCapController AddController(String host, int port, boolean UDP, int timeout, int retry, String strController, String strProvider, String strMachine, String strOption)
	{
		return AddController(host, port, UDP, timeout, retry, 0, 0, strController, strProvider, strMachine, strOption);
	}
	
	public bCapController AddController(String host, int port, boolean UDP, int timeout, int retry, int wdt, String strController, String strProvider, String strMachine, String strOption)
	{
		return AddController(host, port, UDP, timeout, retry, wdt, 0, strController, strProvider, strMachine, strOption);
	}
	
	public bCapController AddController(String host, int port, boolean UDP, int timeout, int retry, int wdt, int zipMode, String strController, String strProvider, String strMachine, String strOption){
		bCapController ctrl = m_ctrls.Add(host, port, UDP, timeout, retry, wdt, zipMode, strController, strProvider, strMachine, strOption);
		m_hr = m_ctrls.HRESULT();
		
		return ctrl;
	}
	
	public int HRESULT()
	{
		return m_hr;
	}
}
