Ejemplo n.º 1
0
int QueryAck(int id,Tipo_XML *xmlresp,char szQueryAck[])
{
	//Si hay una respuesta y un query de ack
	if ((xmlresp) && (strlen(szQueryAck)>0))
	{
		char szSql[MAX_BUFFER];
		ReemplazaTagsStr(xmlresp,szQueryAck,szSql);
		printf("SQL Ack=%s\n\r",szSql);
		WriteLog(id,szSql);
		SendDatabase(id,szSql);
	}
	else 
	{
		char szTmp[100];
		sprintf(szTmp,"Query ACK MAL %x",xmlresp);
		WriteLog(id,szTmp);
		WriteLog(id,szQueryAck);
		
	}
}
Ejemplo n.º 2
0
/***********************************************************************
 *
 * FUNCTION:		PilotMain
 *
 * DESCRIPTION:	This function is the equivalent of a main() function
 *						in standard ÒCÓ.  It is called by the Emulator to begin
 *						execution of this application.
 *
 * PARAMETERS:		cmd - command specifying how to launch the application.
 *						cmdPBP - parameter block for the command.
 *						launchFlags - flags used to configure the launch.			
 *
 * RETURNED:		Any applicable error code.
 *
 ***********************************************************************/
UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
	UInt32 err = 0;
	

	// Check for a normal launch.
	if (cmd == sysAppLaunchCmdNormalLaunch){
		// process the passed in parameters
		char * args = cmdPBP;

		int startChar = 0;
		int argc = 0;
		int i=0;

		BeamParamsPtr pBP;
		MemHandle memHandle;
		
		// If we were not launched as a subroutine, i.e. we were launched from the application launcher
		// then we must return (exit - do not run)
		if (cmdPBP == NULL){
			FrmAlert (2000);
			return(err);
		}

		memHandle = MemHandleNew(sizeof(BeamParamsType));		
	
		// check for out of memory problem
		if(memHandle == 0) return (err);

		pBP = (BeamParamsPtr)MemHandleLock(memHandle);
		
		// Create exgSocket structure
		MemSet(pBP, sizeof(BeamParamsType), 0);

		pBP->cardNo = 0;

		while(true){
			if(args[i] == ',' || args[i] == 0){
				int len = i-startChar;

				switch(argc){
				case 0: 
					parseArgs(pBP->inName, args, startChar, len, 32);
					break;					
				case 1:
					parseArgs(pBP->outName, args, startChar, len, 32);
					break;
				case 2:
					parseArgs(pBP->appName, args, startChar, len, 32);
					break;					
				case 3:
					parseArgs(pBP->description, args, startChar, len, 256);
					break;
				}
				startChar = i+1;
				argc++;
			}
			if(args[i] == 0){
				break;
			}
			i++;
		} 

		SendDatabase(pBP);
	}

	else if (cmd == sysAppLaunchCmdSyncNotify)
		{
		// register our extension on syncNotify so we do not need to
		// be run before we can receive data.
		RegisterExtensions();
		}

	else if (cmd == sysAppLaunchCmdExgReceiveData)
		{
		err = ReceiveDatabase((ExgSocketPtr)cmdPBP);
		}
	
	return(err);
}