Commit 1d237af9 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Changed parameters for nmxp_receiveData()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@124 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 72b5d580
......@@ -185,15 +185,12 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, uint32
*
* \param isock A descriptor referencing the socket.
* \param channelList Channel list.
* \param func_processData Pointer to the function manages data extracted. It could be NULL.
*
* \retval SOCKET_OK on success
* \retval SOCKET_ERROR on error
* \retval Pointer to the structure NMXP_DATA_PROCESS on success
* \retval NULL on error
*
*/
int nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList,
int (*func_processData)(NMXP_DATA_PROCESS *pd)
);
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList);
/*! \brief Sends the message "ConnectRequest" on a socket
......
......@@ -98,35 +98,25 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, uint32
}
int nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList,
int (*func_processData)(NMXP_DATA_PROCESS *pd)
) {
int ret;
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList) {
NMXP_MSG_SERVER type;
void *buffer;
void *buffer = NULL;
uint32_t length;
NMXP_DATA_PROCESS *pd = NULL;
ret = nmxp_receiveMessage(isock, &type, &buffer, &length);
if(type == NMXP_MSG_COMPRESSED) {
pd = nmxp_processCompressedDataFunc(buffer, length, channelList);
} else if(type == NMXP_MSG_DECOMPRESSED) {
pd = nmxp_processDecompressedDataFunc(buffer, length, channelList);
} else {
nmxp_log(1, 0, "Type %d is not NMXP_MSG_COMPRESSED or NMXP_MSG_DECOMPRESSED!\n", type);
}
if(pd) {
func_processData(pd);
}
if(buffer) {
free(buffer);
if(nmxp_receiveMessage(isock, &type, &buffer, &length) == NMXP_SOCKET_OK) {
if(type == NMXP_MSG_COMPRESSED) {
nmxp_log(0, 1, "Type %d is NMXP_MSG_COMPRESSED!\n", type);
pd = nmxp_processCompressedData(buffer, length, channelList);
} else if(type == NMXP_MSG_DECOMPRESSED) {
nmxp_log(0, 1, "Type %d is NMXP_MSG_DECOMPRESSED!\n", type);
pd = nmxp_processDecompressedData(buffer, length, channelList);
} else {
nmxp_log(1, 0, "Type %d is not NMXP_MSG_COMPRESSED or NMXP_MSG_DECOMPRESSED!\n", type);
}
}
return ret;
return pd;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment