update GoKit3_STM32F103C8T6 board mqtt client demo ...

This commit is contained in:
jiejietop
2020-06-18 20:28:37 +08:00
parent 475ce85d6d
commit b203904468
4 changed files with 63 additions and 1496 deletions

View File

@@ -93,6 +93,7 @@ typedef struct at_echo_st {
size_t __w_idx;
int __is_expecting;
k_sem_t __expect_notify;
int __is_fuzzy_match;
} at_echo_t;
typedef void (*at_event_callback_t)(void);
@@ -113,7 +114,7 @@ typedef struct at_agent_st {
k_task_t parser;
at_cache_t recv_cache;
at_timer_t timer;
k_stopwatch_t timer;
k_mutex_t global_lock;
@@ -268,7 +269,7 @@ __API__ int tos_at_init(hal_uart_port_t uart_port, at_event_t *event_table, size
*
* @attention None
*
* @return
* @return
None
*/
__API__ void tos_at_deinit(void);
@@ -289,6 +290,22 @@ __API__ void tos_at_deinit(void);
*/
__API__ int tos_at_echo_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect);
/**
* @brief Create a echo struct with fuzzy matching for expected echo.
*
* @attention None
*
* @param[in] echo pointer to the echo struct.
* @param[out] buffer buffer to hold the received message from the module.
* @param[in] buffer_size size of the buffer.
* @param[in] echo_expect_contains if the echo message contains echo_expect_contains, it is a matching.
*
* @return errcode
* @retval -1 create failed(error).
* @retval 0 create successfully.
*/
__API__ int tos_at_echo_fuzzy_matching_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect_contains);
/**
* @brief Execute an at command.
*
@@ -456,5 +473,5 @@ __API__ const char *tos_at_agent_channel_ip_get(int channel_id);
*/
__API__ const char *tos_at_agent_channel_port_get(int channel_id);
#endif /* __AT_AGENT_H_ */
#endif /* _TOS_AT_H_ */

View File

@@ -16,7 +16,7 @@
<TargetCommonOption>
<Device>STM32F103C8</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-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
@@ -54,7 +54,7 @@
<CreateLib>0</CreateLib>
<CreateHexFile>0</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>0</BrowseInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath></ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
@@ -837,25 +837,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>log.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log.h</FilePath>
<FileName>mqtt_list.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_list.c</FilePath>
</File>
<File>
<FileName>error.h</FileName>
<FileName>mqtt_log.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\error.h</FilePath>
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_log.h</FilePath>
</File>
<File>
<FileName>mqtt_error.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\mqtt_error.h</FilePath>
</File>
</Files>
</Group>
@@ -867,6 +867,16 @@
<FileType>1</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\network.c</FilePath>
</File>
<File>
<FileName>nettype_tcp.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\nettype_tcp.c</FilePath>
</File>
<File>
<FileName>nettype_tls.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\nettype_tls.c</FilePath>
</File>
</Files>
</Group>
<Group>
@@ -887,16 +897,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>

View File

@@ -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_ */