Commit 9494257a authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Changed parameters in nmxp_receiveData() nmxp_processCompressedData()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@135 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent a2f949ba
......@@ -185,12 +185,13 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, uint32
*
* \param isock A descriptor referencing the socket.
* \param channelList Channel list.
* \param network_code Network code. It can be NULL.
*
* \retval Pointer to the structure NMXP_DATA_PROCESS on success
* \retval NULL on error
*
*/
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList);
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, const char *network_code);
/*! \brief Sends the message "ConnectRequest" on a socket
......
......@@ -138,11 +138,12 @@ int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, uint32_
* \param buffer_data Pointer to the data buffer containing Compressed Nanometrics packets.
* \param length_data Buffer length in bytes.
* \param channelList Pointer to the Channel List.
* \param network_code Network code. It can be NULL.
*
* \return Return a pointer to static struct NMXP_DATA_PROCESS.
*
*/
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList);
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code);
/*! \brief Process decompressed Data message by function func_processData().
......@@ -150,11 +151,12 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
* \param buffer_data Pointer to the data buffer containing Decompressed Nanometrics packets.
* \param length_data Buffer length in bytes.
* \param channelList Pointer to the Channel List.
* \param network_code Network code. It can be NULL.
*
* \return Return a pointer to static struct NMXP_DATA_PROCESS.
*
*/
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList);
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code);
#endif
......@@ -98,7 +98,7 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST *channelList, uint32
}
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList) {
NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList, const char *network_code) {
NMXP_MSG_SERVER type;
void *buffer = NULL;
uint32_t length;
......@@ -107,10 +107,10 @@ NMXP_DATA_PROCESS *nmxp_receiveData(int isock, NMXP_CHAN_LIST *channelList) {
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);
pd = nmxp_processCompressedData(buffer, length, channelList, network_code);
} else if(type == NMXP_MSG_DECOMPRESSED) {
nmxp_log(0, 1, "Type %d is NMXP_MSG_DECOMPRESSED!\n", type);
pd = nmxp_processDecompressedData(buffer, length, channelList);
pd = nmxp_processDecompressedData(buffer, length, channelList, network_code);
} else {
nmxp_log(1, 0, "Type %d is not NMXP_MSG_COMPRESSED or NMXP_MSG_DECOMPRESSED!\n", type);
}
......
......@@ -229,7 +229,7 @@ int nmxp_receiveMessage(int isock, NMXP_MSG_SERVER *type, void **buffer, uint32_
}
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList)
NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code)
{
int32_t netInt = 0;
int32_t pKey = 0;
......@@ -285,6 +285,9 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da
nmxp_data_init(&pd);
pd.key = pKey;
if(network_code) {
strcpy(pd.network, network_code);
}
if(sta) {
strncpy(pd.station, sta, STATION_LENGTH);
}
......@@ -311,7 +314,7 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da
}
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList)
NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data, NMXP_CHAN_LIST *channelList, const char *network_code)
{
int32_t pKey = 0;
double pTime = 0.0;
......@@ -461,6 +464,9 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data
nmxp_data_init(&pd);
pd.key = pKey;
if(network_code) {
strcpy(pd.network, network_code);
}
if(sta) {
strncpy(pd.station, sta, STATION_LENGTH);
}
......
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