Add mbtk_source git commit info
Change-Id: I9867613657db269bba81d28c4b3712062ae41bdd
diff --git a/mbtk/libmbtk_mqtt/mbtk_mqtt.c b/mbtk/libmbtk_mqtt/mbtk_mqtt.c
index 3af31f2..3b78429 100755
--- a/mbtk/libmbtk_mqtt/mbtk_mqtt.c
+++ b/mbtk/libmbtk_mqtt/mbtk_mqtt.c
@@ -1,7 +1,7 @@
/*************************************************************************
> File Name: main.c
> Author: LFJ
- > Mail:
+ > Mail:
> Created Time: 2018年09月05日 星期三 13时48分17秒
************************************************************************/
@@ -22,6 +22,7 @@
#include "mbtk_type.h"
#include "mbtk_http.h"
+#include "mbtk_log.h"
/*
static Cloud_MQTT_t *iot_mqtt;
@@ -327,16 +328,16 @@
char content[300] = {0};
uint8_t source_temp[65]={0};
sprintf(content,"clientId%s.%sdeviceName%sproductKey%stimestamp%s",product_key, device_name, device_name, product_key,CORE_AUTH_TIMESTAMP);
-
+
// sprintf(content,"clientId%sdeviceName%sproductKey%stimestamp%s",client_id, device_name, product_key,CORE_AUTH_TIMESTAMP);
core_hmac_sha256((uint8_t *)content, strlen((const char *)content), (uint8_t *)device_secret, strlen(device_secret),
source_temp);
-
+
core_hex2str(source_temp, 32, dest,0);
}
-void iot_aliyun_mqtt_init(Cloud_MQTT_t *piot_mqtt,int host,int port ,char *device_name,char *product_key,
- char * DeviceSecret,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
+void iot_aliyun_mqtt_init(Cloud_MQTT_t *piot_mqtt,int host,int port ,char *device_name,char *product_key,
+ char * DeviceSecret,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
{
mbtk_imqtt_auth_hostname(piot_mqtt->mqtt_host,product_key,host);
mbtk_imqtt_auth_clientid(piot_mqtt->mqtt_client_id,product_key,device_name);
@@ -350,18 +351,18 @@
printf("mqtt_host is %s\nmqtt_port is %d\nmqtt_client_id is %s\nmqtt_user is %s\nmqtt_pass is %s\n",piot_mqtt->mqtt_host,piot_mqtt->mqtt_port,piot_mqtt->mqtt_client_id,piot_mqtt->mqtt_user,piot_mqtt->mqtt_pass);
memset(piot_mqtt->sub_topic, '\0', MQTT_TOPIC_SIZE);
memset(piot_mqtt->pub_topic, '\0', MQTT_TOPIC_SIZE);
-
+
sprintf(piot_mqtt->sub_topic, "%s", sub_topic); //将初始化好的订阅主题填到数组中
printf("subscribe:%s\n", piot_mqtt->sub_topic);
sprintf(piot_mqtt->pub_topic, "%s", pub_topic); //将初始化好的发布主题填到数组中
printf("pub:%s\n", piot_mqtt->pub_topic);
-
+
piot_mqtt->DataArrived_Cb = mqtt_data_rx_cb; //设置接收到数据回调函数
printf("iot_mqtt_init end\n");
}
-void mbtk_aliyun_mqtt_one_type_one_secret_unregin_set_info_init(Cloud_MQTT_t *piot_mqtt,mbtk_mqtt_device_session_t *device,int keepAliveInterval,int version,pMessageArrived_Fun mqtt_data_rx_cb)
+void mbtk_aliyun_mqtt_one_type_one_secret_unregin_set_info_init(Cloud_MQTT_t *piot_mqtt,mbtk_mqtt_device_session_t *device,int keepAliveInterval,int version,pMessageArrived_Fun mqtt_data_rx_cb)
{
mbtk_imqtt_auth_hostname(piot_mqtt->mqtt_host,device->product_key,device->host);
@@ -375,7 +376,7 @@
printf("piot_mqtt->mqtt_version:%d\n", piot_mqtt->mqtt_version);
memset(piot_mqtt->sub_topic, '\0', MQTT_TOPIC_SIZE);
memset(piot_mqtt->pub_topic, '\0', MQTT_TOPIC_SIZE);
-
+
piot_mqtt->DataArrived_Cb = mqtt_data_rx_cb; //设置接收到数据回调函数
printf("iot_mqtt_init end\n");
}
@@ -398,7 +399,7 @@
void iot_aliyun_mqtt_one_type_one_secret_unregin_connect_init(Cloud_MQTT_t *piot_mqtt,mbtk_mqtt_device_session_t *device, char *clientId, char *deviceToken,
- int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
+ int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
{
mbtk_imqtt_auth_hostname(piot_mqtt->mqtt_host,device->product_key,device->host);
mbtk_imqtt_auth_clientid_yixinyimi_unregin(piot_mqtt->mqtt_client_id, clientId);
@@ -412,20 +413,20 @@
printf("mqtt_host is %s\nmqtt_port is %d\nmqtt_client_id is %s\nmqtt_user is %s\nmqtt_pass is %s\n",piot_mqtt->mqtt_host,piot_mqtt->mqtt_port,piot_mqtt->mqtt_client_id,piot_mqtt->mqtt_user,piot_mqtt->mqtt_pass);
memset(piot_mqtt->sub_topic, '\0', MQTT_TOPIC_SIZE);
memset(piot_mqtt->pub_topic, '\0', MQTT_TOPIC_SIZE);
-
+
sprintf(piot_mqtt->sub_topic, "%s", sub_topic); //将初始化好的订阅主题填到数组中
printf("subscribe:%s\n", piot_mqtt->sub_topic);
sprintf(piot_mqtt->pub_topic, "%s", pub_topic); //将初始化好的发布主题填到数组中
printf("pub:%s\n", piot_mqtt->pub_topic);
-
+
piot_mqtt->DataArrived_Cb = mqtt_data_rx_cb; //设置接收到数据回调函数
printf("iot_mqtt_init end\n");
}
-void mbtk_aliyun_mqtt_one_type_one_secret_regint_connect_init(Cloud_MQTT_t *piot_mqtt,int host,int port ,char *device_name,char *product_key,
- char * DeviceSecret,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
+void mbtk_aliyun_mqtt_one_type_one_secret_regint_connect_init(Cloud_MQTT_t *piot_mqtt,int host,int port ,char *device_name,char *product_key,
+ char * DeviceSecret,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
{
mbtk_imqtt_auth_hostname(piot_mqtt->mqtt_host,product_key,host);
mbtk_aliyun_imqtt_auth_clientid(piot_mqtt->mqtt_client_id,product_key,device_name);
@@ -439,19 +440,19 @@
printf("mqtt_host is %s\nmqtt_port is %d\nmqtt_client_id is %s\nmqtt_user is %s\nmqtt_pass is %s\n",piot_mqtt->mqtt_host,piot_mqtt->mqtt_port,piot_mqtt->mqtt_client_id,piot_mqtt->mqtt_user,piot_mqtt->mqtt_pass);
memset(piot_mqtt->sub_topic, '\0', MQTT_TOPIC_SIZE);
memset(piot_mqtt->pub_topic, '\0', MQTT_TOPIC_SIZE);
-
+
sprintf(piot_mqtt->sub_topic, "%s", sub_topic); //将初始化好的订阅主题填到数组中
printf("subscribe:%s\n", piot_mqtt->sub_topic);
sprintf(piot_mqtt->pub_topic, "%s", pub_topic); //将初始化好的发布主题填到数组中
printf("pub:%s\n", piot_mqtt->pub_topic);
-
+
piot_mqtt->DataArrived_Cb = mqtt_data_rx_cb; //设置接收到数据回调函数
printf("iot_mqtt_init end\n");
}
-void iot_mqtt_init(Cloud_MQTT_t *piot_mqtt,char *host,int port ,char *clientid,char *user,char *pass,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
+void iot_mqtt_init(Cloud_MQTT_t *piot_mqtt,char *host,int port ,char *clientid,char *user,char *pass,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb)
{
memcpy(piot_mqtt->mqtt_host,host,strlen(host));
@@ -462,24 +463,24 @@
piot_mqtt->keepAliveInterval = keepAliveInterval;
piot_mqtt->mqtt_version = version;
-
+
printf("mqtt_host is %s\nmqtt_port is %d\nmqtt_client_id is %s\nmqtt_user is %s\nmqtt_pass is %s\n",piot_mqtt->mqtt_host,piot_mqtt->mqtt_port,piot_mqtt->mqtt_client_id,piot_mqtt->mqtt_user,piot_mqtt->mqtt_pass);
memset(piot_mqtt->sub_topic, '\0', MQTT_TOPIC_SIZE);
memset(piot_mqtt->pub_topic, '\0', MQTT_TOPIC_SIZE);
-
+
sprintf(piot_mqtt->sub_topic, "%s", sub_topic); //将初始化好的订阅主题填到数组中
printf("subscribe:%s\n", piot_mqtt->sub_topic);
sprintf(piot_mqtt->pub_topic, "%s", pub_topic); //将初始化好的发布主题填到数组中
printf("pub:%s\n", piot_mqtt->pub_topic);
-
+
piot_mqtt->DataArrived_Cb = mqtt_data_rx_cb; //设置接收到数据回调函数
printf("iot_mqtt_init end\n");
}
/*
void MQTTMessageArrived_Cb(MessageData* md)
{
- MQTTMessage *message = md->message;
+ MQTTMessage *message = md->message;
Cloud_MQTT_t *piot_mqtt = get_mqtt_t();
@@ -667,3 +668,9 @@
return ret;
}
+void mbtk_mqtt_lib_info_print()
+{
+ MBTK_SOURCE_INFO_PRINT("mbtk_mqtt_lib");
+}
+
+