/*	Copyright  (c)	Günter Woigk 2016 - 2016
					mailto:kio@little-bat.de

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	Permission to use, copy, modify, distribute, and sell this software and
	its documentation for any purpose is hereby granted without fee, provided
	that the above copyright notice appear in all copies and that both that
	copyright notice and this permission notice appear in supporting
	documentation, and that the name of the copyright holder not be used
	in advertising or publicity pertaining to distribution of the software
	without specific, written prior permission.  The copyright holder makes no
	representations about the suitability of this software for any purpose.
	It is provided "as is" without express or implied warranty.

	THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
	INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
	EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
	CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
	DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
	TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
	PERFORMANCE OF THIS SOFTWARE.
*/

#define SAFE 3
#define LOG 1
#include "kio/kio.h"
#include "IOPort.h"




IOPort::IOPort()
{}

IOPort::~IOPort()
{}

int	IOPort::write(cstr)
{
	TODO();
}


SioPort::SioPort()
{
	TODO();
}

int	SioPort::write(const uchar*, uint)
{
	TODO();
}

int SioPort::read(uchar*, uint)
{
	TODO();
}



TestPort::TestPort()
:
	state(0)
{
	XLogLine("new TestPort");
}

int	TestPort::write(const uchar*, uint)
{
	TODO();
}

int TestPort::read(uchar* p, uint sz)
{
	uint n;

	switch(state)
	{
	case 0:
		static uint8 u0[] = "\01\x10\x60Hallo Kio!\07 \x10\x00Wie geht's denn so?\n\r\07\n\r\x10\x01Sag was: \07";
		n = sizeof(u0); if(sz >= n) { memcpy(p,u0,n); state++; return n; }

	//	uint8 j2 = Identify ;
	//	addJob(stream,&j2,1);
	//	uint8 r1[100];
	//	uint sz = getReply(stream,r1,100,500);
	//	addJob(stream,
	//		 sz ? catstr("\n\rIdentify: \x10\x80",substr((ptr)r1+1,(ptr)r1+sz),"\r\n\07")
	//			: "\n\rget reply for Identify timed out\n\r\07");

	//	addJob(stream,
	//		"\x10\x01 Bold..\x10\x02 Underline..\x10\x03 Bold Underline..\n\r"
	//		"\x10\x04 Inverted..\x10\x05 Bold Inverted..\x10\x06 Underline Inverted..\n\r"
	//		"\x10\x07 Bold Inverted Underline..\x10\x08 Italic..\n\r"
	//		"\x10\x09 Bold Italic..\x10\x0A Underline Italic..\x10\x0B Bold Underline Italic..\n\r"
	//		"\x10\x0C Inverted Italic..\x10\x0D Bold Inverted Italic..\x10\x0E Underline Inverted Italic..\n\r"
	//		"\x10\x0F Bold Inverted Underline Italic..\x10\x80 Graphics.. oops!..\n\r"
	//		);

	default:
		state++;
		if(state==1000) state = 0;
		return 0;
	}
}


















