| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | topics_buf = (char *)malloc(total); |
| | | if (topics_buf == NULL) { |
| | | |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHRegisterTopics: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | free(topics_buf); |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | min = (strlen(_input1) > (MAX_STR_LEN - 1) ? (MAX_STR_LEN - 1) : strlen(_input1)); |
| | | strncpy(topics_buf, _input1, min); |
| | |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | if (query != NULL) { |
| | | strncpy(data_buf, (char *)query, (sizeof(data_buf) - 1) > query_len ? query_len : (sizeof(data_buf) - 1)); |
| | | } |
| | |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | struct _MsgQueryProcReply |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | topics_buf = (char *)malloc(total); |
| | | if (topics_buf == NULL) { |
| | | |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHSubscribeTopics: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | free(topics_buf); |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | if (timeout_ms > 0) { |
| | | rv = net_mod_socket_pub_timeout(gNetmod_socket, &node_arr, node_arr_len, _input.topic, strlen(_input.topic), _input.data, strlen(_input.data), timeout_ms); |
| | |
| | | } |
| | | #endif |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | if (rv > 0) |
| | | return true; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | | memset(topics_buf, 0x00, len + 10); |
| | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | free(topics_buf); |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | strncpy(buf_temp, _input1.topic, (sizeof(buf_temp) - 1) > strlen(_input1.topic) ? strlen(_input1.topic) : (sizeof(buf_temp) - 1)); |
| | | #else |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | if((msg_id == NULL) || (msg_id_len == NULL)) { |
| | | if (rv == 0) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | if (rv == 0) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | strncpy(buf_temp, _input1.topic, (sizeof(buf_temp) - 1) > strlen(_input1.topic) ? strlen(_input1.topic) : (sizeof(buf_temp) - 1)); |
| | | #else |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | | memset(topics_buf, 0x00, size + 10); |
| | |
| | | |
| | | free(buf); |
| | | free(topics_buf); |
| | | } |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | data = net_mod_socket_svr_get(gNetmod_socket); |
| | | rv = net_mod_socket_sendto(gNetmod_socket, _input, strlen(_input), *(int *)src, SVR_STR, data); |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | } else { |
| | | |
| | | rv = EBUS_RES_BUSY; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | if (rv == 0) |
| | | return true; |