mqtt client release v1.1.0 ...

This commit is contained in:
jiejietop
2020-06-18 20:29:15 +08:00
parent b203904468
commit d58bd1e84d
5 changed files with 79 additions and 83 deletions

View File

@@ -10,7 +10,7 @@
int platform_net_socket_connect(const char *host, const char *port, int proto)
{
int fd, ret = MQTT_SOCKET_UNKNOWN_HOST_ERROR;
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
fd = tos_sal_module_connect(host, port, TOS_SAL_PROTO_TCP);
@@ -57,7 +57,7 @@ int platform_net_socket_connect(const char *host, const char *port, int proto)
int platform_net_socket_recv(int fd, void *buf, size_t len, int flags)
{
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
return tos_sal_module_recv(fd, buf, len);
#else
return recv(fd, buf, len, flags);
@@ -66,7 +66,7 @@ int platform_net_socket_recv(int fd, void *buf, size_t len, int flags)
int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int timeout)
{
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
return tos_sal_module_recv_timeout(fd, buf, len, timeout);
#else
int nread;
@@ -103,7 +103,7 @@ int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int ti
int platform_net_socket_write(int fd, void *buf, size_t len)
{
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
return tos_sal_module_send(fd, buf, len);
#else
return write(fd, buf, len);
@@ -112,7 +112,7 @@ int platform_net_socket_write(int fd, void *buf, size_t len)
int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout)
{
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
return tos_sal_module_send(fd, buf, len);
#else
struct timeval tv = {
@@ -133,14 +133,14 @@ int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int t
int platform_net_socket_close(int fd)
{
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
return tos_sal_module_close(fd);
#else
return close(fd);
#endif
}
#ifndef MQTT_NETSOCKET_USE_AT
#ifndef MQTT_NETSOCKET_USING_AT
int platform_net_socket_set_block(int fd)
{

View File

@@ -11,7 +11,7 @@
#include "network.h"
#include "mqtt_error.h"
#ifdef MQTT_NETSOCKET_USE_AT
#ifdef MQTT_NETSOCKET_USING_AT
#include "sal_module_wrapper.h"
@@ -35,7 +35,7 @@ int platform_net_socket_write(int fd, void *buf, size_t len);
int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout);
int platform_net_socket_close(int fd);
#ifndef MQTT_NETSOCKET_USE_AT
#ifndef MQTT_NETSOCKET_USING_AT
int platform_net_socket_set_block(int fd);
int platform_net_socket_set_nonblock(int fd);
int platform_net_socket_setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen);