fix mqttclient sample compilation error on board-LTE_DTU_EC20_SIM7600CE ...
This commit is contained in:
@@ -7,16 +7,13 @@
|
||||
|
||||
#define USE_EC20
|
||||
|
||||
mqtt_client_t client;
|
||||
client_init_params_t init_params;
|
||||
|
||||
static void tos_topic_handler(void* client, message_data_t* msg)
|
||||
{
|
||||
(void) client;
|
||||
LOG_I("-----------------------------------------------------------------------------------");
|
||||
LOG_I("%s:%d %s()...\ntopic: %s, qos: %d. \nmessage:\n\t%s\n", __FILE__, __LINE__, __FUNCTION__,
|
||||
MQTT_LOG_I("-----------------------------------------------------------------------------------");
|
||||
MQTT_LOG_I("%s:%d %s()...\ntopic: %s, qos: %d. \nmessage:\n\t%s\n", __FILE__, __LINE__, __FUNCTION__,
|
||||
msg->topic_name, msg->message->qos, (char*)msg->message->payload);
|
||||
LOG_I("-----------------------------------------------------------------------------------\n");
|
||||
MQTT_LOG_I("-----------------------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +22,7 @@ void mqttclient_task(void)
|
||||
int error;
|
||||
|
||||
char buf[100] = { 0 };
|
||||
mqtt_client_t *client = NULL;
|
||||
|
||||
mqtt_message_t msg;
|
||||
|
||||
@@ -37,36 +35,28 @@ void mqttclient_task(void)
|
||||
#ifdef USE_EC20
|
||||
ec20_sal_init(HAL_UART_PORT_2);
|
||||
#endif
|
||||
mqtt_log_init();
|
||||
|
||||
client = mqtt_lease();
|
||||
|
||||
init_params.read_buf_size = 256;
|
||||
init_params.write_buf_size = 256;
|
||||
mqtt_set_port(client, "1883");
|
||||
mqtt_set_host(client, "111.230.189.156");
|
||||
mqtt_set_client_id(client, "RUAP1R610Vsupowang");
|
||||
mqtt_set_user_name(client, "RUAP1R610Vsupowang;12010126;OQHZL;1626061655");
|
||||
mqtt_set_password(client, "ed41ae0cdf9100ce2aa5d5874566f8f4f77b1eab80b19ede4d1419eafe92eb54;hmacsha256");
|
||||
mqtt_set_clean_session(client, 1);
|
||||
mqtt_set_read_buf_size(client, 256);
|
||||
mqtt_set_write_buf_size(client, 256);
|
||||
|
||||
#ifdef MQTT_NETWORK_TYPE_TLS
|
||||
init_params.connect_params.network_params.network_ssl_params.ca_crt = test_ca_get();
|
||||
init_params.connect_params.network_params.port = "8883";
|
||||
#else
|
||||
init_params.connect_params.network_params.port = "1883";
|
||||
#endif
|
||||
init_params.connect_params.network_params.addr = "111.230.189.156"; //"47.95.164.112";//"jiejie01.top"; //"129.204.201.235"; //"192.168.1.101";
|
||||
|
||||
init_params.connect_params.user_name = "RUAP1R610Vsupowang;12010126;OQHZL;1626061655"; // random_string(10); //"jiejietop-acer1";
|
||||
init_params.connect_params.password = "ed41ae0cdf9100ce2aa5d5874566f8f4f77b1eab80b19ede4d1419eafe92eb54;hmacsha256"; //random_string(10); // "123456";
|
||||
init_params.connect_params.client_id = "RUAP1R610Vsupowang";; //random_string(10); // "clientid-acer1";
|
||||
init_params.connect_params.clean_session = 1;
|
||||
|
||||
log_init();
|
||||
|
||||
mqtt_init(&client, &init_params);
|
||||
|
||||
error = mqtt_connect(&client);
|
||||
error = mqtt_connect(client);
|
||||
|
||||
LOG_D("mqtt connect error is %#x", error);
|
||||
MQTT_LOG_D("mqtt connect error is %#x", error);
|
||||
|
||||
//mqtt_set_interceptor_handler(&client,tos_topic_handler);
|
||||
|
||||
mqtt_subscribe(&client, "RUAP1R610V/supowang/data", QOS0, tos_topic_handler);
|
||||
mqtt_subscribe(client, "RUAP1R610V/supowang/data", QOS0, tos_topic_handler);
|
||||
|
||||
LOG_D("mqtt subscribe error is %#x", error);
|
||||
MQTT_LOG_D("mqtt subscribe error is %#x", error);
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
@@ -77,7 +67,7 @@ void mqttclient_task(void)
|
||||
msg.qos = QOS0;
|
||||
msg.payload = (void *) buf;
|
||||
|
||||
error = mqtt_publish(&client, "RUAP1R610V/supowang/data", &msg);
|
||||
error = mqtt_publish(client, "RUAP1R610V/supowang/data", &msg);
|
||||
|
||||
tos_task_delay(4000);
|
||||
}
|
||||
|
@@ -223,7 +223,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>Application/User</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1007,7 +1007,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1027,7 +1027,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/mqtt</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1155,7 +1155,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/salof</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1223,7 +1223,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/common</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1234,23 +1234,23 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>16</GroupNumber>
|
||||
<FileNumber>77</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\random.c</PathWithFileName>
|
||||
<FilenameWithoutPath>random.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>16</GroupNumber>
|
||||
<FileNumber>77</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\mqtt_list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>mqtt_list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>16</GroupNumber>
|
||||
<FileNumber>78</FileNumber>
|
||||
@@ -1258,8 +1258,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\error.h</PathWithFileName>
|
||||
<FilenameWithoutPath>error.h</FilenameWithoutPath>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\mqtt_error.h</PathWithFileName>
|
||||
<FilenameWithoutPath>mqtt_error.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -1270,8 +1270,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\log.h</PathWithFileName>
|
||||
<FilenameWithoutPath>log.h</FilenameWithoutPath>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\common\mqtt_log.h</PathWithFileName>
|
||||
<FilenameWithoutPath>mqtt_log.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -1279,7 +1279,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/network</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -1295,17 +1295,41 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>17</GroupNumber>
|
||||
<FileNumber>81</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\network\nettype_tls.c</PathWithFileName>
|
||||
<FilenameWithoutPath>nettype_tls.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>17</GroupNumber>
|
||||
<FileNumber>82</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\network\nettype_tcp.c</PathWithFileName>
|
||||
<FilenameWithoutPath>nettype_tcp.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/platform</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>81</FileNumber>
|
||||
<FileNumber>83</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1317,7 +1341,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>82</FileNumber>
|
||||
<FileNumber>84</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1329,7 +1353,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>83</FileNumber>
|
||||
<FileNumber>85</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@@ -1339,30 +1363,6 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>84</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tcp.c</PathWithFileName>
|
||||
<FilenameWithoutPath>platform_nettype_tcp.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>85</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tls.c</PathWithFileName>
|
||||
<FilenameWithoutPath>platform_nettype_tls.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>18</GroupNumber>
|
||||
<FileNumber>86</FileNumber>
|
||||
@@ -1391,7 +1391,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>mqttclient/config</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F103RB</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.2.0</PackID>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
@@ -832,25 +832,25 @@
|
||||
<Group>
|
||||
<GroupName>mqttclient/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>random.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\random.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>error.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\error.h</FilePath>
|
||||
<FileName>mqtt_list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>log.h</FileName>
|
||||
<FileName>mqtt_error.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log.h</FilePath>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_error.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mqtt_log.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_log.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -862,6 +862,16 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\network.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nettype_tls.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\nettype_tls.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>nettype_tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\nettype_tcp.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@@ -882,16 +892,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_net_socket.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_nettype_tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_nettype_tls.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tls.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_thread.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
@@ -1,48 +1,48 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2019-12-15 00:42:16
|
||||
* @LastEditTime: 2020-02-25 09:25:35
|
||||
* @LastEditTime: 2020-06-17 19:31:41
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _MQTT_CONFIG_H_
|
||||
#define _MQTT_CONFIG_H_
|
||||
|
||||
//#define LOG_IS_SALOF
|
||||
//#define MQTT_LOG_IS_SALOF
|
||||
|
||||
#define LOG_LEVEL DEBUG_LEVEL //WARN_LEVEL DEBUG_LEVEL
|
||||
#define MQTT_NETSOCKET_USING_AT
|
||||
|
||||
#ifdef LOG_IS_SALOF
|
||||
#define USE_LOG (1U)
|
||||
#define USE_SALOF (1U)
|
||||
#define SALOF_OS USE_TENCENTOS
|
||||
#define USE_IDLE_HOOK (0U)
|
||||
#define LOG_COLOR (0U)
|
||||
#define LOG_TS (0U)
|
||||
#define LOG_TAR (0U)
|
||||
#define SALOF_BUFF_SIZE (512U)
|
||||
#define SALOF_FIFO_SIZE (1024U)
|
||||
#define SALOF_TASK_STACK_SIZE (1024U)
|
||||
#define SALOF_TASK_TICK (50U)
|
||||
#define MQTT_LOG_LEVEL MQTT_LOG_DEBUG_LEVEL //MQTT_LOG_WARN_LEVEL MQTT_LOG_DEBUG_LEVEL
|
||||
|
||||
#ifdef MQTT_LOG_IS_SALOF
|
||||
#define SALOF_USING_LOG (1U)
|
||||
#define SALOF_USING_SALOF (1U)
|
||||
#define SALOF_LOG_LEVEL MQTT_LOG_LEVEL
|
||||
#define SALOF_OS SALOF_USING_TENCENTOS
|
||||
#define SALOF_USING_IDLE_HOOK (0U)
|
||||
#define SALOF_LOG_COLOR (1U)
|
||||
#define SALOF_LOG_TS (0U)
|
||||
#define SALOF_LOG_TAR (0U)
|
||||
#define SALOF_BUFF_SIZE 512
|
||||
#define SALOF_FIFO_SIZE 4096
|
||||
#define SALOF_TASK_STACK_SIZE 1024
|
||||
#define SALOF_TASK_TICK 50
|
||||
#endif
|
||||
|
||||
|
||||
#define MQTT_MAX_PACKET_ID (0xFFFF - 1)
|
||||
#define MQTT_TOPIC_LEN_MAX 64
|
||||
#define MQTT_ACK_HANDLER_NUM_MAX 64
|
||||
#define MQTT_DEFAULT_BUF_SIZE 1024
|
||||
#define MQTT_DEFAULT_CMD_TIMEOUT 4000
|
||||
#define MQTT_DEFAULT_CMD_TIMEOUT 5000
|
||||
#define MQTT_MAX_CMD_TIMEOUT 20000
|
||||
#define MQTT_MIN_CMD_TIMEOUT 1000
|
||||
#define MQTT_KEEP_ALIVE_INTERVAL 100 // unit: second
|
||||
#define MQTT_KEEP_ALIVE_INTERVAL 50 // unit: second
|
||||
#define MQTT_VERSION 4 // 4 is mqtt 3.1.1
|
||||
#define MQTT_RECONNECT_DEFAULT_DURATION 1000
|
||||
#define MQTT_THREAD_STACK_SIZE 2048
|
||||
#define MQTT_THREAD_PRIO 5
|
||||
#define MQTT_THREAD_TICK 50
|
||||
|
||||
#define MQTT_NETSOCKET_USE_AT
|
||||
|
||||
//#define MQTT_NETWORK_TYPE_TLS
|
||||
#define MQTT_NETWORK_TYPE_NO_TLS
|
||||
|
||||
#endif /* _MQTT_CONFIG_H_ */
|
||||
|
Reference in New Issue
Block a user