Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The very step to avoid difficult integration times: unit test the external communication with ACE.

Topics covered:

  • Trace in ACE

Code Block
breakoutModewide
languagec
// NAME.......  Tutorial #1
// PURPOSE....	This code presents how to connect onto ACE and to use aceOut
//
//	Hypothesis and optimizations:
//		Communication between ACE and acceptance device is IP
//
// PROJECT....  Wiki
// REFERENCES.	--
//
// Copyright ©2005-2020 - 9164-4187 QUEBEC INC (“AMADIS”), All Rights Reserved
//
//---------------------------------------------------------
//            Main
//---------------------------------------------------------
int main(int argc, char** argv)
{
	// Communication
	int port, length;
	char address[50]="";

	// Get Communication parameters from ini file
	// These paramerters maybe wired inside the code for training purposes
	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);
	
	// Initialize running mode
	aceSetMode(pmSDK);

	// Set ACE option
	aceSetUIDisplay(bTRUE);

	// Trace into ACE
	aceOut("Training Session - BEGIN\n");
	aceOut("Hello World!\n");
	aceOut("Training Session - END\n");

	return 0;
}

...