OSI/MHS P7 Application Programmatic Interface (P7 API) Manual

C Language Example Program
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
E-4
/* to send and receive */
ResultFileNum[MAX_CONNECTIONS]; /* messages on. */
long long RecvOffset; /* Current position in multiple receive */
/* of data buffers */
long long SendOffset; /* Offset into buffer to be sent out. */
/* used when multiple sends are needed */
long long SendLength; /* Length of data to be sent */
char SendBuffer[ZMHS_VAL_LOUAPI_MAX_MSG_SIZE];
/* Buffer containing data to be sent */
char *RecvBufferPtr; /* Pointer to locally allocated buffer */
/* to receive incoming data */
char *ReplyBufferPtr; /* Pointer to reply buffer */
#pragma page
/***************************************************************************/
/* Function name: main */
/* */
/* Description: This is the main procedure of the P7 programming example*/
/* It consists of an infinite loop that asks for user */
/* input, executes it ( sendData function), then processes */
/* the results of that action ( awaitCompletion function ).*/
/* The program then loops back to get more user input. */
/* */
/***************************************************************************/
int main( void )
{
long int status; /* Used for calling P7 API procs */
static char buffer[ZMHS_VAL_LOUAPI_MAX_MSG_SIZE];
int connection; /* Connection number to work on */
int choice; /* User input on menu */
printf ("\n P7 API programming example starting\n");
RecvOffset = 0;
/* Initialize the P7 */
printf ("calling LOS_INITIALIZE_()\n");
status = LOS_INITIALIZE_();
if (status != P7_SUCCESS)
{
statusError ("LOS INITIALIZE failed", status);
exit (EXIT_FAILURE);
}
/* Main LOOP of program */
choice = 1;
while ( choice != EXIT_PROGRAM )
{
/* Obtain connection to perform operation on */
printf ("\nEnter Connection to do operation on >> ");
scanf ("%d",&connection);
printf (" \n");
choice = 0;
/* Prompt user for an operation to perform */
printf ("P7 API Operations Menu : \n");
printf ("Send Bind - 0\n");
printf ("Await Completion - 1\n");
printf ("Send Data - 2\n");
printf ("Send Unbind - 3\n");
printf ("Quit - 4\n");
printf ("selection >> ");