| | |
| | | int key; |
| | | int size; |
| | | int sec, nsec; |
| | | char topics_buf[MAX_STR_LEN] = { 0x00 }; |
| | | char data_buf[MAX_STR_LEN * 3] = { 0x00 }; |
| | | char *topics_buf = NULL; |
| | | char *data_buf = NULL; |
| | | |
| | | struct _ReadSubReply |
| | | { |
| | |
| | | if (len > size) { |
| | | len = size; |
| | | } |
| | | strncpy(topics_buf, (char *)buf, len > (sizeof(topics_buf) - 1) ? (sizeof(topics_buf) - 1) : len); |
| | | |
| | | topics_buf = (char *)malloc(len + 10); |
| | | if (topics_buf == NULL) { |
| | | |
| | | rv = EBUS_NO_MEM; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | | memset(topics_buf, 0x00, len + 10); |
| | | |
| | | strncpy(topics_buf, (char *)buf, len); |
| | | |
| | | if (len < size) { |
| | | len = strlen(topics_buf) + 1; |
| | | |
| | | data_buf = (char *)malloc(size - len + 10); |
| | | if (data_buf == NULL) { |
| | | |
| | | rv = EBUS_NO_MEM; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | logger->error("in BHRequest: Out of memory!\n"); |
| | | |
| | | free(topics_buf); |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | return false; |
| | | } |
| | | memset(data_buf, 0x00, size - len + 10); |
| | | |
| | | len = strlen(topics_buf) + 1; |
| | | strncpy(data_buf, (char *)buf + len, size - len); |
| | | } |
| | | |
| | |
| | | *proc_id = malloc(*proc_id_len); |
| | | memcpy(*proc_id, rsr.proc_id.data(), *proc_id_len); |
| | | } |
| | | |
| | | free(topics_buf); |
| | | free(data_buf); |
| | | |
| | | ::bhome_msg::MsgPublish Mp; |
| | | Mp.set_topic(rsr.topic); |