Merge pull request #144 from DavidLin1577/patch-1

Minor optimizes such as mqtt_wrapper.h and so on
This commit is contained in:
Arthur
2020-04-20 10:35:42 +08:00
committed by GitHub
3 changed files with 12 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
#ifndef _MQTT_WRAPPER_H_ #ifndef _MQTT_WRAPPER_H_
#define _MQTT_WRAPPER_H_ #define _MQTT_WRAPPER_H_
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -11,8 +11,8 @@
* @brief connection option * @brief connection option
*/ */
typedef struct mqtt_connect_option_st { typedef struct mqtt_connect_option_st {
unsigned short keep_alive_interval; /**< keep alive */ unsigned short keep_alive_interval; /**< keep alive */
unsigned char cleansession; /**< clean session flag */ unsigned char cleansession; /**< clean session flag */
char *client_id; /**< client id */ char *client_id; /**< client id */
char *username; /**< username */ char *username; /**< username */
char *password; /**< password */ char *password; /**< password */
@@ -27,7 +27,7 @@ typedef struct mqtt_publish_option_st {
unsigned char dup; /**< DUP flag */ unsigned char dup; /**< DUP flag */
unsigned short id; /**< message id */ unsigned short id; /**< message id */
char *topic; /**< mqtt topic */ char *topic; /**< mqtt topic */
unsigned char *payload; /**< mqtt payload */ unsigned char *payload; /**< mqtt payload */
int payload_len; /**< mqtt payload length */ int payload_len; /**< mqtt payload length */
@@ -41,7 +41,7 @@ typedef struct mqtt_subscribe_option_st {
int count; /**< number of members in the topicFilters and reqQos arrays */ int count; /**< number of members in the topicFilters and reqQos arrays */
unsigned char dup; /**< DUP flag */ unsigned char dup; /**< DUP flag */
unsigned short id; /**< message id */ unsigned short id; /**< message id */
char *topic; /**< mqtt topic */ char *topic; /**< mqtt topic */
} mqtt_sub_opt_t; } mqtt_sub_opt_t;
/** /**
@@ -49,7 +49,7 @@ typedef struct mqtt_subscribe_option_st {
* *
* @param[in] host mqtt server(domain name and ip address both are fine). * @param[in] host mqtt server(domain name and ip address both are fine).
* @param[in] port mqtt port. * @param[in] port mqtt port.
* @param[in] param mqtt connect parameter. * @param[in] opt mqtt connect parameter.
* *
* @return socket id or error if -1. * @return socket id or error if -1.
*/ */
@@ -59,7 +59,7 @@ int tos_mqtt_connect(char *host, const char *port, mqtt_con_opt_t *opt);
* @brief Publish a message. * @brief Publish a message.
* *
* @param[in] sock socket id returned by a tos_mqtt_connect. * @param[in] sock socket id returned by a tos_mqtt_connect.
* @param[in] param mqtt publish parameter. * @param[in] opt mqtt publish parameter.
* *
* @return successful if 0, or error if -1. * @return successful if 0, or error if -1.
*/ */
@@ -69,7 +69,7 @@ int tos_mqtt_publish(int sock, mqtt_pub_opt_t *opt);
* @brief Subscribe a topic. * @brief Subscribe a topic.
* *
* @param[in] sock socket id returned by a tos_mqtt_connect. * @param[in] sock socket id returned by a tos_mqtt_connect.
* @param[in] param mqtt subscribe parameter. * @param[in] opt mqtt subscribe parameter.
* *
* @return successful if 0, or error if -1. * @return successful if 0, or error if -1.
*/ */

View File

@@ -1,5 +1,5 @@
#ifndef _QCLOUD_ #ifndef _QCLOUD_H_
#define _QCLOUD_ #define _QCLOUD_H_
#include "qcloud_config_def.h" #include "qcloud_config_def.h"
#include "qcloud_config.h" #include "qcloud_config.h"
@@ -47,5 +47,5 @@
#include "qcloud_coap_config.h" #include "qcloud_coap_config.h"
#include "qcloud_coap.h" #include "qcloud_coap.h"
#endif #endif/*_QCLOUD_H_*/

View File

@@ -172,7 +172,7 @@ static int sim7600ce_init(void)
//return -1; //return -1;
} }
if (sim7600ce_csocksetpn() != 0) { if (sim7600ce_csocksetpn() != 0) {
printf("sim7600ce_net_open FAILED\n"); printf("sim7600ce_csocksetpn FAILED\n");
return -1; return -1;
} }