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

C Language Example Program
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
E-11
{
long int status; /* Used in P7 API call */
short int dataLen; /* Used in LOS_DT_SEND_ call */
long int maxDataLen = ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
/* Length of received data */
int resultFile; /* Holds fileNum to close for errors */
/* Check if send was successful */
printf ("calling LOS_DT_FINISH_SEND_() on send file\n");
status = LOS_DT_FINISH_SEND_(fileNum, (int *)buffer);
if (status != P7_SUCCESS)
{
/* Report Error and aborted association to client */
statusError("LOS_DT_FINISH_SEND_ failed", status);
mapSendFileNum(fileNum, &resultFile);
status = LOS_CLOSE_(fileNum, resultFile);
}
else
{
printf("LOS_DT_FINISH_SEND_, success\n");
/* Check if more data needs to be sent and send it */
if (SendOffset != 0 && SendLength != 0)
{
/* if amount left to be sent is more than the MAX size */
if (SendLength - SendOffset > ZMHS_VAL_LOUAPI_MAX_DATA_SIZE)
{
/* send a block of MAX_DATA_SIZE and set counters for
next send */
dataLen = ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
status = LOS_DT_SEND_(fileNum,
(int *) &SendBuffer[SendOffset],
dataLen,
maxDataLen,
ZMHS_VAL_DT_MORE_DATA,
ZMHS_VAL_DT_P_DATA);
SendOffset = SendOffset + ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
if (status != P7_SUCCESS)
{
/* Report Error and aborted association to client */
statusError("LOS_DT_SEND_ failed", status);
mapSendFileNum(fileNum, &resultFile);
status = LOS_CLOSE_(fileNum, resultFile);
}
}
else /* amount to send is not more than MAX_DATA_SIZE */
{
/* send final block of data and set counters to signal
we are done sending */
dataLen = SendLength - SendOffset;
SendLength = 0;
status = LOS_DT_SEND_(fileNum,
(int *) &SendBuffer[SendOffset],
dataLen,
maxDataLen,
ZMHS_VAL_DT_MORE_DATA,
ZMHS_VAL_DT_P_DATA);
SendOffset = 0;
if (status != P7_SUCCESS)
{
/* Report Error and aborted association to client */
statusError("LOS_DT_SEND_ failed", status);
mapSendFileNum(fileNum, &resultFile);
status = LOS_CLOSE_(fileNum, resultFile);
}
}