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

C Language Example Program
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
E-7
long int maxDataLen; /* Length of received data */
long int status; /* Used in P7 API call */
int *buf1; /* Buffer used in LOS_OPEN call */
int *buf2; /* Buffer used in LOS_OPEN call */
ProcName mhsMgrName; /* Holds manager name for LOS_OPEN_ */
maxDataLen = ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
/* Switch on the dataType of the user selection */
switch (dataType)
{
case ZMHS_VAL_DT_MS_BIND_ARG:
/*
* Fill in the MHSMGR name
*
* NOTE: The MHS manager name below may need to be changed for
* your particular environment.
*/
strcpy(&mhsMgrName.name[0], "$ZX1");
mhsMgrName.length = strlen(&mhsMgrName.name[0]);
buf1 = (int *) calloc (1, sizeof (zmhs_ddl_uapi_request_def));
buf2 = (int *) calloc (1, sizeof (zmhs_ddl_uapi_request_def));
/* Open the LOS */
printf ("calling LOS_OPEN_\n");
status = LOS_OPEN_((int *) &mhsMgrName,
(int) ZMHS_VAL_EM_NO_WAIT,
buf1,
buf2,
&SendFileNum[connection],
&ResultFileNum[connection]);
if (status != P7_SUCCESS)
{
/* Report the open error, inform client and return */
SendFileNum[connection] = 0;
ResultFileNum[connection] = 0;
statusError("LOS_OPEN_ failed", status);
return;
}
else
{
printf("LOS_OPEN_ success for Connection >> (%d) \n",
connection);
/*
* Fill in the buffer and set up data length.
* After calling this function, the data starts at
* ZMHS_VAL_DT_DATA_OFFSET in the buffer.
*/
getData (buffer, dataType, &dataLen);
/* Bind arg is small hence will fit in one send */
/* send the MS BIND to the LOS */
printf ("calling LOS_DT_SEND_() with MS BIND request\n");
status = LOS_DT_SEND_(SendFileNum[connection],
(int *) buffer,
dataLen,
maxDataLen,
ZMHS_VAL_DT_NO_MORE_DATA,
ZMHS_VAL_DT_MS_BIND_ARG);
if (status != P7_SUCCESS)
{
/* Report the error, inform client and return */
statusError("LOS_DT_SEND_ failed", status);
return;
}