Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Tutorial #1: test shared RAM

Code Block
breakoutModewide
languagec
//---------------------------------------------------------
//            Main
//---------------------------------------------------------
//  Main function:
//		- Hypothesis: IP communication with ACE
//      - Use aceOut from Agnos tutorials
//
//  Visibility: Public
//  Hypothesis: --
//  Reference: --
//
int main(int argc, char** argv)
{
	// Communication
	int port, length;
	char address[50]="";
	// Trace for debugging
	char tmp[100]="";

	// Get Communication parameters from ini file
	xgpiIniSetFilename("agnos.ini");
	xgpiIniGetString("COM", "Address", 50, address, &length);
	xgpiIniGetNumeric("COM", "Port", &port);

	// Initialize ACE
	// Initialize generic communication interface
	assert(tcpInit(0) == TCP_NO_ERROR);
	// Create server and client
	assert(comtcpOpen(&gACEServerCOMTCP, TCP_SERVER, 0, port) == COM_NO_ERROR);
	assert(comtcpOpen(&gACEClientCOMTCP, TCP_CLIENT, address, 1979) == COM_NO_ERROR);
	// Set ACE with server and client
	aceInitializeCommunication(&gACEServerCOMTCP.com,&gACEClientCOMTCP.com);

	// Set up ACE's options
	aceSetUIDisplay(bTRUE);
	// Activate SDK to access to ACE services
	aceSetMode(pmSDK);

	aceOut("Training Session - BEGIN\n");

	tByte *buffer = NULL;
	tDataFileSize size=0;
	char* parameters;

	// Initialize GPI
	// This is platform dependent. On Kizis AVT, this set PCSC readers' name from agnos.ini
	gpiMain(0,&parameters);


	if (admNO_ERROR == gpiGetTotalRAM(&buffer,&size))
	{
		sprintf(tmp,"Total RAM Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		sprintf(tmp,"Size = %ld\n",size);
		aceOut("Total RAM Issue\n");
	}
	if (admNO_ERROR == gpiGetRAMForTags(&buffer,&size))
	{
		sprintf(tmp,"RAM for Tags Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		aceOut("RAM for Tags Issue\n");
	}
	if (admNO_ERROR == gpiGetRAMForUnknownTags(&buffer,&size))
	{
		sprintf(tmp,"Unknown Tags RAM Size = %ld\n",s
		
		ize);
		aceOut(tmp);
	}
	else
	{
		aceOut("Unknown Tags RAM Issue\n");
	}
	if (admNO_ERROR == gpiGetFreeRAM(&buffer,&size))
	{
		sprintf(tmp,"Free RAM Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		aceOut("Free RAM Issue\n");
	}
	if (admNO_ERROR == gpiGetPrivateScratchPAD(MASTERCARD_PAYPASS,&buffer,&size))
	{
		sprintf(tmp,"MCW Scracth PAD Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		aceOut("MCW SP Issue\n");
	}
	if (admNO_ERROR == gpiGetPrivateScratchPAD(JCB_JSPEEDY,&buffer,&size))
	{
		sprintf(tmp,"JCB Scratch PAD Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		aceOut("JCB SP RAM Issue\n");
	}
	if (admNO_ERROR == gpiGetDataObjectRAM(&buffer,&size))
	{
		sprintf(tmp,"DO RAM Size = %ld\n",size);
		aceOut(tmp);
	}
	else
	{
		aceOut("Object RAM Issue\n");
	}

	aceOut("Training Session - END\n");

	return 0;
}

Tutorial #2: send data to ACE over communication link

Code Block
breakoutModewide
languagec
//---------------------------------------------------------
//            Main
//---------------------------------------------------------
//  Main function:
//		- Hypothesis: IP communication with ACE
//      - Use aceOut from Agnos tutorials
//
//  Visibility: Public
//  Hypothesis: --
//  Reference: --
//
int main(int argc, char** argv)
{
	// Communication
	int port, length;
	char address[50]="";

	// Get Communication parameters from ini file
	xgpiIniSetFilename("agnos.ini");
	xgpiIniGetString("COM", "Address", 50, address, &length);
	xgpiIniGetNumeric("COM", "Port", &port);

	// Initialize ACE
	// Initialize generic communication interface
	assert(tcpInit(0) == TCP_NO_ERROR);
	// Create server and client
	assert(comtcpOpen(&gACEServerCOMTCP, TCP_SERVER, 0, port) == COM_NO_ERROR);
	assert(comtcpOpen(&gACEClientCOMTCP, TCP_CLIENT, address, 1979) == COM_NO_ERROR);
	// Set ACE with server and client
	aceInitializeCommunication(&gACEServerCOMTCP.com,&gACEClientCOMTCP.com);

	// Set up ACE's options
	aceSetUIDisplay(bTRUE);
	// Activate SDK to access to ACE services
	aceSetMode(pmSDK);

	aceOut("Training Session - BEGIN\n");

	tByte *buffer = NULL;
	tDataFileSize size=0;
	char* parameters;
	char workingString[1000]="";

	// Initialize GPI
	// This is platform dependent. On Kizis AVT, this set PCSC readers' name from agnos.ini
	gpiMain(0,&parameters);

	tFileHandler ifp = 0;

	gpiGetTotalRAM(&buffer,&size);
	sprintf(workingString,"%sENTRY_POINT","./AGNOS/");

	if(gpiFileOpen(workingString,&ifp,READ|BINARY)==filNO_ERROR)
	{
		gpiFileRead(ifp,buffer,&size);
		gpiFileClose(ifp);
	}

	// Send data read but skip file header
	aceSendRawDD(buffer+21,size-21);

	aceOut("Training Session - END\n");

	return 0;
}