fix build issue.
This commit is contained in:
parent
376ad5f60d
commit
0827fbd065
@ -301,7 +301,6 @@ int DataTrans::Gets(const std::string &strUrl, std::string &strResponse, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
int DataTrans::upload_file(const std::string &strUrl, const std::string &filename, std::string &response) {
|
int DataTrans::upload_file(const std::string &strUrl, const std::string &filename, std::string &response) {
|
||||||
CURLcode res;
|
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLM *multi_handle;
|
CURLM *multi_handle;
|
||||||
int still_running;
|
int still_running;
|
||||||
@ -341,10 +340,10 @@ int DataTrans::upload_file(const std::string &strUrl, const std::string &filenam
|
|||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
||||||
curl_multi_add_handle(multi_handle, curl);
|
curl_multi_add_handle(multi_handle, curl);
|
||||||
res = curl_multi_perform(multi_handle, &still_running);
|
CURLMcode ret1 = curl_multi_perform(multi_handle, &still_running);
|
||||||
if (res != CURLE_OK) {
|
if (ret1 != CURLM_OK) {
|
||||||
zlog_error(zct, "[upload_file] curl_multi_perform() failed: %s", curl_easy_strerror(res));
|
zlog_error(zct, "[upload_file] curl_multi_perform() failed: %d", ret1);
|
||||||
return res;
|
return ret1;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|||||||
@ -77,7 +77,7 @@ int data_publish_wave(WAVE_CONTAIN *str, const char *topic) {
|
|||||||
str->waveData[(str->number - 2)]);
|
str->waveData[(str->number - 2)]);
|
||||||
ret = mosquitto_publish(mosq, &mid_sent, topic, sizeof(WAVE_CONTAIN), str, ud.topic_qos, false);
|
ret = mosquitto_publish(mosq, &mid_sent, topic, sizeof(WAVE_CONTAIN), str, ud.topic_qos, false);
|
||||||
if (ret != MOSQ_ERR_SUCCESS) {
|
if (ret != MOSQ_ERR_SUCCESS) {
|
||||||
zlog_error(zct, "fail to send mqtt msg, ret: [%s], topic: %s, str: %s", mosquitto_strerror(ret), topic, str);
|
zlog_error(zct, "fail to send mqtt msg, ret: [%s], topic: %s", mosquitto_strerror(ret), topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -103,16 +103,11 @@ int disconnect() { return mosquitto_disconnect(mosq); }
|
|||||||
|
|
||||||
int reconnect() { return mosquitto_reconnect(mosq); }
|
int reconnect() { return mosquitto_reconnect(mosq); }
|
||||||
int start_client(const char *boardname, const char *gwid, const char *gwip, const char *gwver, const char *gwcode, std::string &salt) {
|
int start_client(const char *boardname, const char *gwid, const char *gwip, const char *gwver, const char *gwcode, std::string &salt) {
|
||||||
char *id = NULL;
|
|
||||||
char *id_prefix = NULL;
|
|
||||||
char *host;
|
char *host;
|
||||||
int port = 51613;
|
int port = 51613;
|
||||||
char *bind_address = NULL;
|
char *bind_address = NULL;
|
||||||
int keepalive = 60;
|
int keepalive = 60;
|
||||||
bool clean_session = true;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char hostname[256];
|
|
||||||
int len;
|
|
||||||
char will_payload[100];
|
char will_payload[100];
|
||||||
long will_payloadlen = 0;
|
long will_payloadlen = 0;
|
||||||
int will_qos = 0;
|
int will_qos = 0;
|
||||||
@ -189,12 +184,8 @@ int start_client(const char *boardname, const char *gwid, const char *gwip, cons
|
|||||||
ud.resp_topic = res_topic;
|
ud.resp_topic = res_topic;
|
||||||
sprintf(will_payload, "{\"cmd\":\"15\",\"gwID\":\"%s\"}", mqttsdata.gwid);
|
sprintf(will_payload, "{\"cmd\":\"15\",\"gwID\":\"%s\"}", mqttsdata.gwid);
|
||||||
will_payloadlen = strlen(will_payload);
|
will_payloadlen = strlen(will_payload);
|
||||||
zlog_info(zct, "will_payload:%s,will_payloadlen:%ld", will_payload, will_payloadlen);
|
zlog_info(zct, "will_payload:%s,will_payloadlen:%ld", will_payload, will_payloadlen);
|
||||||
|
|
||||||
hostname[0] = '\0';
|
|
||||||
gethostname(hostname, 256);
|
|
||||||
hostname[255] = '\0';
|
|
||||||
len = strlen("mosqsub/-") + 6 + strlen(hostname);
|
|
||||||
mosquitto_lib_init();
|
mosquitto_lib_init();
|
||||||
mosq = mosquitto_new(NULL, true, &ud);
|
mosq = mosquitto_new(NULL, true, &ud);
|
||||||
if (!mosq) {
|
if (!mosq) {
|
||||||
|
|||||||
@ -417,9 +417,6 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
|
|||||||
|
|
||||||
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos) {
|
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos) {
|
||||||
int i;
|
int i;
|
||||||
struct userdata *ud;
|
|
||||||
assert(obj);
|
|
||||||
ud = (struct userdata *)obj;
|
|
||||||
zlog_info(zct, "Subscribed (mid: %d): %d", mid, granted_qos[0]);
|
zlog_info(zct, "Subscribed (mid: %d): %d", mid, granted_qos[0]);
|
||||||
for (i = 1; i < qos_count; i++) {
|
for (i = 1; i < qos_count; i++) {
|
||||||
zlog_info(zct, ", %d", granted_qos[i]);
|
zlog_info(zct, ", %d", granted_qos[i]);
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void UdpSys::recvUdpData() { udpSock.async_receive_from(boost::asio::buffer(m_bu
|
|||||||
void UdpSys::HandleRead(const boost::system::error_code& pEc, std::size_t pBytesTransferred) {
|
void UdpSys::HandleRead(const boost::system::error_code& pEc, std::size_t pBytesTransferred) {
|
||||||
std::string ip = senderEndPoint.address().to_string();
|
std::string ip = senderEndPoint.address().to_string();
|
||||||
if (pEc) {
|
if (pEc) {
|
||||||
zlog_error(zct, "pEc value:%d, category name:%s, message:%s", pEc.value(), pEc.category().name(), pEc.message());
|
zlog_error(zct, "pEc value:%d, category name:%s, message:%s", pEc.value(), pEc.category().name(), pEc.message().c_str());
|
||||||
} else if (pBytesTransferred == 0) {
|
} else if (pBytesTransferred == 0) {
|
||||||
zlog_info(zct, "rev has rec!");
|
zlog_info(zct, "rev has rec!");
|
||||||
if (pBytesTransferred == 0) {
|
if (pBytesTransferred == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user