libjnetio 0.5, published on the 19th january 2012



CHANGELOG

	- fixed bug which prevented connections to NETIO-230B devices
	- added timeout exception to netio_httpclient



COMPONENTS

	CLASSES
	
		This library contains the following classes:
	
			CLASS						USAGE
			netio_client						class for controlling a NETIO client through a KShell session
			netio_httpclient					class for controlling the power outputs using the CGI interface
			tcp_client						class for implementing a simple tcp/ip connection
	
	
	
	TOOLS
	
		This library contains the following tools
		
			PROGRAM						USAGE
			jnetio_example					Example program (take a look in the source code)
			jnetio_http_example				Example program for CGI interface (take a look in the source code)
	
	
	
	USAGE
	
		The classes are used in following under the dependencies:
		
		*tcp_client* establishes a TCP/IP connection to the NETIO device and sends/receives messages.
		*netio_client* abstracts the connetion to the device and helps using/configuring the device using 
		simple functions that send the needed commands to the device.
		*netio_httpclient* is a additional primitive class for managing the power outputs of the NETIO device.
		This class can't be used for configuring and other commands - due to the bug in NETIO firmware which
		freezes the KShell after several connects/disconnects it is recommended to use that class for power on/off.



FUNCTIONS
	
	CLASS "tcp_client"
	
		FUNCTION							DESCRIPTION
	
		###CONSTRUCTORS###
		tcp_client(String hostname, int port,		constructor; new client based on hostname, port, username and password
		String username, String password)
		
		###NET FUNCTIONS###
		connect()							establishes the connection
		command(String command)				sends a command to the NETIO device
		close()							closes the connection to the device
		
		###DEBUG FUNCTIONS###
		isClosed()							returns whether the socket is closed or not
		debugMsg(String msg)					writes a debug message (internal use only)
	
	
	
	CLASS "netio_client"
	
		FUNKTION							DESCRIPTION
		
		###CONSTRUCTORS###
		netio_client(String hostname, int port,		Constructor; new client based on hostname, port, username and password
		String username, String password)
		
		###BASIC FUNCTIONS###
		command(String command)				sends command
		login()							login using username and password
		logout()							performs a logout
		countChars(String s, char c)				prints the amount of equal char in a string
		
		###GET FUNCTIONS###
		getHostname()						gets the hostname
		getVersion()						...the firmware version
		getTime()							...the local time in format YYYY/MM/DD,HH:MM:SS
		getTimezone()						....the timezone offset
		getSNTPState()						...SNTP state (enabled/disabled)
		getSNTP()							...all SNTP information (IP address, enabled/disabled, synchronized)
		getPowerDelay()						...power delay before operations
		getPorts()							...an array with all port information (status, name, timer/manual mode, delay)
		getPort(int port)						...state of a port
		getPortWatchdog(int port)				...all information of a defined port watchdog (status/ip address/timeout/delay/ping refresh/max retry/max retry poweroff/send mail)
		getSystemDiscover()					...state of system discover function
		getNetwork()						...all network information (configuration method/ip address/netmask/gateway/DNS/NTP)
		getDNS()							...configured DNS server
		getMailserver()						...configured mail server
		
		###SET FUNCTIONS###
		setHostname(String name)				sets the hostname
		setTime(String time)					...the local time in format YYYY/MM/DD,HH:MM:SS
		setTimezone(String offset)				...the timezone offset
		setSNTP(String address)				...SNTP server
		enableSNTP()						enables SNTP for time synchronization
		disableSNTP()						disables SNTP
		setPowerDelay(int delay)				sets the delay delay before operations
		configurePort(int port, String name,			configures a port
		boolean useTimer, int delay,
		boolean poweredOn)
		setPortActive(int port)					enables a port
		setPortInactive(int port)				disables a port
		configureTimer()						TODO
		configureWatchdog(int port, String address,	configures a port's watchdog
		int timeout,	int pon_delay, int ping_interval,
		int max_retry, boolean max_retry_poff,
		boolean send_mail)
		enableWatchdog(int port)				enables the watchdog of a specified port
		disableWatchdog(int port)				disables the watchdog of a specified port
		enableDiscover()						enables the discovery functionality
		disableDiscover()						disables the discovery functionality
		setNetwork(String address, String netmask,	configures the network based on given address, netmask and gateway
		String gateway)
		enableDHCP()						enables DHCP for network auto-configuration
		setDNS(String address)					sets the DNS server
		setMailserver(String address)				configures the mailserver
		
		###KILL FUNCTIONS###
		deviceReboot()						reboots the NETIO device immediately
		hardReset()						resets the whole NETIO device configuration
	
	
	
	CLASS "netio_httpclient"
	
		FUNCTION							DESCRIPTION
		
		###CONSTRUCTORS###
		netio_httpclient(String hostname,			new HTTP client based on hostname, username, password and cryptLogin
		String username, String password,
		boolean cryptLogin)
		
		###BASIC FUNCTIONS###
		login()							login using username and password - internal use only
		logout()							logout - internal use only
		command(String command)				send command to control interface
		sendCommand(String command)			sends command DIRECTLY - internal use by login()/logout() only
		
		###GET FUNCTIONS###
		getPorts()							get array with port states
		getPort(int port)						get single port state
		
		###SET FUNCTIONS###
		setPorts(int[] ports)					set all port states
		setPort(int port)						get single port state
		
		###DEBUG FUNCTIONS###
		getFix()							tells wether the logout-fix is enabled/disabled
		setFix(boolean bool)					enables/disables the logout-fix
		debugMsg(String msg)					sends a debug message - internal use only



KNOWN ISSUES AND BUGS

	- Due to a bug in the NETIO firmware the KShell isn't responding sometimes or it isn't possible to connect after several KShell sessions anymore
	- Port timers cannot be configured currently.



NOTICES

	This software is published unter the terms of Creative Commons 3.0 BY-NC-SA - please consult the attached file "LEGAL"