Skip to content

Commit e2ef5e0

Browse files
committed
统一代码缩进风格
1 parent f4553ad commit e2ef5e0

File tree

131 files changed

+9512
-9817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+9512
-9817
lines changed

include/exports/qcloud_iot_export_coap.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ typedef void (*OnRespCallback)(void *message, void *userContext);
3636
* CoAP EVENT TYPE
3737
*/
3838
typedef enum {
39-
COAP_EVENT_RECEIVE_ACK = 0, // MSG ACK received
39+
COAP_EVENT_RECEIVE_ACK = 0, // MSG ACK received
4040

41-
COAP_EVENT_RECEIVE_RESPCONTENT = 1, // MSG response received
41+
COAP_EVENT_RECEIVE_RESPCONTENT = 1, // MSG response received
4242

43-
COAP_EVENT_UNAUTHORIZED = -1, // Device auth failed or token expired
43+
COAP_EVENT_UNAUTHORIZED = -1, // Device auth failed or token expired
4444

45-
COAP_EVENT_FORBIDDEN = -2, // CoAP URI invalid or without permission
45+
COAP_EVENT_FORBIDDEN = -2, // CoAP URI invalid or without permission
4646

47-
COAP_EVENT_INTERNAL_SERVER_ERROR = -3, // CoAP server error
47+
COAP_EVENT_INTERNAL_SERVER_ERROR = -3, // CoAP server error
4848

49-
COAP_EVENT_ACK_TIMEOUT = -4, // MSG ACK timeout
49+
COAP_EVENT_ACK_TIMEOUT = -4, // MSG ACK timeout
5050

51-
COAP_EVENT_SEPRESP_TIMEOUT = -5, // MSG response timeout
51+
COAP_EVENT_SEPRESP_TIMEOUT = -5, // MSG response timeout
5252
} CoAPEventType;
5353

5454
typedef struct {
@@ -71,11 +71,11 @@ typedef struct {
7171
* @brief CoAP data structure when sending msg
7272
*/
7373
typedef struct {
74-
bool need_resp; // Need response from peer (true), or not (false). Currently only false is supported
75-
char *pay_load; // COAP msg payload
76-
size_t pay_load_len; // COAP msg payload length
77-
void *user_context; // user context for callback
78-
OnRespCallback resp_callback; // function callback when recv msg response, valid only when need_resp is true
74+
bool need_resp; // Need response from peer (true), or not (false). Currently only false is supported
75+
char *pay_load; // COAP msg payload
76+
size_t pay_load_len; // COAP msg payload length
77+
void *user_context; // user context for callback
78+
OnRespCallback resp_callback; // function callback when recv msg response, valid only when need_resp is true
7979
} SendMsgParams;
8080

8181
#define DEFAULT_SENDMSG_PARAMS {false, NULL, 0, NULL, NULL}
@@ -95,7 +95,7 @@ typedef struct {
9595
char *device_secret; // device secret
9696
#endif
9797

98-
uint32_t command_timeout; // coap timeout value when waiting for ACK/response
98+
uint32_t command_timeout; // coap timeout value when waiting for ACK/response
9999

100100
unsigned char max_retry_count; // CoAP max sending retry count
101101

@@ -104,9 +104,9 @@ typedef struct {
104104
} CoAPInitParams;
105105

106106
#ifdef AUTH_MODE_CERT
107-
#define DEFAULT_COAPINIT_PARAMS { NULL, NULL, NULL, NULL, 2000, 5, {0}}
107+
#define DEFAULT_COAPINIT_PARAMS { NULL, NULL, NULL, NULL, 2000, 5, {0}}
108108
#else
109-
#define DEFAULT_COAPINIT_PARAMS { NULL, NULL, NULL, 2000, 5, {0}}
109+
#define DEFAULT_COAPINIT_PARAMS { NULL, NULL, NULL, 2000, 5, {0}}
110110
#endif
111111

112112
/**
@@ -138,9 +138,9 @@ int IOT_COAP_Yield(void *pClient, uint32_t timeout_ms);
138138
/**
139139
* @brief Send/publish CoAP msg
140140
*
141-
* @param pClient COAPClient pointer
142-
* @param topicName CoAP URI (msg topic)
143-
* @param sendParams Tx msg parameters
141+
* @param pClient COAPClient pointer
142+
* @param topicName CoAP URI (msg topic)
143+
* @param sendParams Tx msg parameters
144144
* @return value > 0 for msg Id; value < 0 for failure
145145
*/
146146
int IOT_COAP_SendMessage(void *pClient, char *topicName, SendMsgParams *sendParams);
@@ -156,9 +156,9 @@ int IOT_COAP_GetMessageId(void *pMessage);
156156
/**
157157
* @brief Get COAP Response payload
158158
*
159-
* @param pMessage COAP Response msg
160-
* @param payload msg payload
161-
* @param payloadLen msg payload length
159+
* @param pMessage COAP Response msg
160+
* @param payload msg payload
161+
* @param payloadLen msg payload length
162162
* @return QCLOUD_RET_SUCCESS when success, otherwise fail
163163
*/
164164
int IOT_COAP_GetMessagePayload(void *pMessage, char **payload, int *payloadLen);
@@ -167,7 +167,7 @@ int IOT_COAP_GetMessagePayload(void *pMessage, char **payload, int *payloadLen
167167
* @brief Get COAP Response msg error code
168168
*
169169
* @param pMessage COAP Response msg
170-
* @return COAPEventType converted from msg error code
170+
* @return COAPEventType converted from msg error code
171171
*/
172172
int IOT_COAP_GetMessageCode(void *pMessage);
173173

include/exports/qcloud_iot_export_dynreg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*/
1515

16-
#ifndef QLCOUD_IOT_EXPORT_DYNREG_H_
16+
#ifndef QLCOUD_IOT_EXPORT_DYNREG_H_
1717
#define QLCOUD_IOT_EXPORT_DYNREG_H_
1818

1919
#ifdef __cplusplus
@@ -23,7 +23,7 @@ extern "C" {
2323
#include "qcloud_iot_export.h"
2424

2525
/**
26-
* @brief Do dynamic register/create device
26+
* @brief Do dynamic register/create device
2727
*
2828
* @param pDevInfo In: device info with [ProductId, ProductKey, DeviceName]
2929
* Out: device info with [ProductId, DeviceName, DeviceSecret or Device cert/key file]

include/exports/qcloud_iot_export_error.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef enum {
3434
QCLOUD_RET_MQTT_RECONNECTED = 1, // Reconnected with MQTT server successfully
3535

3636
QCLOUD_RET_SUCCESS = 0, // Successful return
37-
37+
3838
QCLOUD_ERR_FAILURE = -1001, // Generic failure return
3939
QCLOUD_ERR_INVAL = -1002, // Invalid parameter
4040
QCLOUD_ERR_DEV_INFO = -1003, // Fail to get device info
@@ -76,7 +76,7 @@ typedef enum {
7676
QCLOUD_ERR_JSON_BUFFER_TOO_SMALL = -134, // JSON parsing buffer not enough
7777
QCLOUD_ERR_JSON = -135, // JSON generation error
7878
QCLOUD_ERR_MAX_JSON_TOKEN = -136, // JSON token out of range
79-
79+
8080
QCLOUD_ERR_MAX_APPENDING_REQUEST = -137, // appending request out of range
8181
QCLOUD_ERR_MAX_TOPIC_LENGTH = -138, // Topic length oversize
8282

@@ -85,7 +85,7 @@ typedef enum {
8585
QCLOUD_ERR_COAP_INTERNAL = -152, // COAP interval error
8686
QCLOUD_ERR_COAP_BADMSG = -153, // COAP bad msg
8787
QCLOUD_ERR_DTLS_PEER_CLOSE_NOTIFY = -160, // DTLS connection is closed
88-
88+
8989
QCLOUD_ERR_SHADOW_PROPERTY_EXIST = -201, // Shadow property already exist
9090
QCLOUD_ERR_SHADOW_NOT_PROPERTY_EXIST = -202, // Shadow property not exist
9191
QCLOUD_ERR_SHADOW_UPDATE_TIMEOUT = -203, // Shadow update timeout
@@ -101,7 +101,7 @@ typedef enum {
101101

102102
QCLOUD_ERR_TCP_SOCKET_FAILED = -601, // TLS TCP socket connect fail
103103
QCLOUD_ERR_TCP_UNKNOWN_HOST = -602, // TCP unknown host (DNS fail)
104-
QCLOUD_ERR_TCP_CONNECT = -603, // TCP/UDP socket connect fail
104+
QCLOUD_ERR_TCP_CONNECT = -603, // TCP/UDP socket connect fail
105105
QCLOUD_ERR_TCP_READ_TIMEOUT = -604, // TCP read timeout
106106
QCLOUD_ERR_TCP_WRITE_TIMEOUT = -605, // TCP write timeout
107107
QCLOUD_ERR_TCP_READ_FAIL = -606, // TCP read error

include/exports/qcloud_iot_export_gateway.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ extern "C" {
2626
/* Gateway and sub-device parameter */
2727
typedef struct {
2828
/*gateway device info */
29-
char *product_id;
30-
char *device_name;
31-
/*sub-device device info */
32-
char *subdev_product_id;
33-
char *subdev_device_name;
29+
char *product_id;
30+
char *device_name;
31+
/*sub-device device info */
32+
char *subdev_product_id;
33+
char *subdev_device_name;
3434

3535
} GatewayParam;
3636

@@ -50,9 +50,9 @@ typedef void (*GatewayEventHandleFun)(void *client, void *context, void *msg);
5050

5151
/* The structure of gateway init param */
5252
typedef struct {
53-
MQTTInitParams init_param; /* MQTT params */
54-
void *event_context; /* the user context */
55-
GatewayEventHandleFun event_handler; /* event handler for gateway user*/
53+
MQTTInitParams init_param; /* MQTT params */
54+
void *event_context; /* the user context */
55+
GatewayEventHandleFun event_handler; /* event handler for gateway user*/
5656
} GatewayInitParam;
5757

5858
#define DEFAULT_GATEWAY_INIT_PARAMS { DEFAULT_MQTTINIT_PARAMS, NULL, NULL}
@@ -87,7 +87,7 @@ int IOT_Gateway_Destroy(void *client);
8787
int IOT_Gateway_Subdev_Online(void *client, GatewayParam* param);
8888

8989
/**
90-
* @brief Make sub-device offline
90+
* @brief Make sub-device offline
9191
*
9292
* @param client handle to gateway client
9393
* @param param sub-device parameters
@@ -100,7 +100,7 @@ int IOT_Gateway_Subdev_Offline(void *client, GatewayParam* param);
100100
/**
101101
* @brief Publish gateway MQTT message
102102
*
103-
* @param client handle to gateway client
103+
* @param client handle to gateway client
104104
* @param topic_name MQTT topic name
105105
* @param params publish parameters
106106
*
@@ -112,7 +112,7 @@ int IOT_Gateway_Publish(void *client, char *topic_name, PublishParams *params);
112112
/**
113113
* @brief Subscribe gateway MQTT topic
114114
*
115-
* @param client handle to gateway client
115+
* @param client handle to gateway client
116116
* @param topic_filter MQTT topic filter
117117
* @param params subscribe parameters
118118
*
@@ -124,8 +124,8 @@ int IOT_Gateway_Subscribe(void *client, char *topic_filter, SubscribeParams *par
124124
/**
125125
* @brief unsubscribe gateway MQTT topic
126126
*
127-
* @param client handle to gateway client
128-
* @param topic_filter MQTT topic filter
127+
* @param client handle to gateway client
128+
* @param topic_filter MQTT topic filter
129129
*
130130
* @return packet id (>=0) when success, or err code (<0) for failure
131131
*/

include/exports/qcloud_iot_export_log.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ typedef bool (*LogMessageHandler)(const char* message);
5353
/**
5454
* @brief user callback for saving/reading logs into/from NVS(files/FLASH) after upload fail/recover
5555
*/
56-
// callback for saving logs into NVS(files/FLASH) after upload fail
56+
// callback for saving logs into NVS(files/FLASH) after upload fail
5757
typedef size_t (*LogSaveFunc)(const char *msg, size_t wLen);
5858
// callback for reading logs from NVS(files/FLASH) when upload ready
5959
typedef size_t (*LogReadFunc)(char *buff, size_t rLen);
@@ -72,8 +72,8 @@ typedef struct {
7272
/* auth key, use device secret for PSK device and cert file path for cert device */
7373
const char *sign_key;
7474
/* user callback saving/reading logs into/from NVS(files/FLASH) */
75-
LogSaveFunc save_func;
76-
LogReadFunc read_func;
75+
LogSaveFunc save_func;
76+
LogReadFunc read_func;
7777
LogDelFunc del_func;
7878
LogGetSizeFunc get_size_func;
7979
} LogUploadInitParams;
@@ -82,7 +82,7 @@ typedef struct {
8282
/**
8383
* @brief Set the global log level of print
8484
*
85-
* @param level
85+
* @param level
8686
*/
8787
void IOT_Log_Set_Level(LOG_LEVEL level);
8888

@@ -129,14 +129,14 @@ int IOT_Log_Init_Uploader(LogUploadInitParams *init_params);
129129
/**
130130
* @brief Stop log upload and release the resource
131131
*
132-
* @return
132+
* @return
133133
*/
134134
void IOT_Log_Fini_Uploader(void);
135135

136136
/**
137137
* @brief Do one log upload
138138
*
139-
* @param force_upload true = upload log at once, false = upload in defined time interval
139+
* @param force_upload true = upload log at once, false = upload in defined time interval
140140
* @return QCLOUD_RET_SUCCESS when success, or error code when fail
141141
*/
142142
int IOT_Log_Upload(bool force_upload);
@@ -162,34 +162,34 @@ void IOT_Log_Gen(const char *file, const char *func, const int line, const int l
162162

163163
/* Macro for debug mode */
164164
#ifdef IOT_DEBUG
165-
#define IOT_FUNC_ENTRY \
166-
{\
167-
printf("FUNC_ENTRY: %s L#%d \n", __FUNCTION__, __LINE__); \
168-
}
169-
#define IOT_FUNC_EXIT \
170-
{\
171-
printf("FUNC_EXIT: %s L#%d \n", __FUNCTION__, __LINE__); \
172-
return;\
173-
}
174-
#define IOT_FUNC_EXIT_RC(x) \
175-
{\
176-
printf("FUNC_EXIT: %s L#%d Return Code : %ld \n", __FUNCTION__, __LINE__, (long)(x)); \
177-
return x; \
178-
}
165+
#define IOT_FUNC_ENTRY \
166+
{\
167+
printf("FUNC_ENTRY: %s L#%d \n", __FUNCTION__, __LINE__); \
168+
}
169+
#define IOT_FUNC_EXIT \
170+
{\
171+
printf("FUNC_EXIT: %s L#%d \n", __FUNCTION__, __LINE__); \
172+
return;\
173+
}
174+
#define IOT_FUNC_EXIT_RC(x) \
175+
{\
176+
printf("FUNC_EXIT: %s L#%d Return Code : %ld \n", __FUNCTION__, __LINE__, (long)(x)); \
177+
return x; \
178+
}
179179
#else
180-
#define IOT_FUNC_ENTRY
181-
#define IOT_FUNC_EXIT \
182-
{\
183-
return;\
184-
}
185-
#define IOT_FUNC_EXIT_RC(x) \
186-
{\
187-
return x; \
188-
}
180+
#define IOT_FUNC_ENTRY
181+
#define IOT_FUNC_EXIT \
182+
{\
183+
return;\
184+
}
185+
#define IOT_FUNC_EXIT_RC(x) \
186+
{\
187+
return x; \
188+
}
189189
#endif
190190

191191
/* Macro for interval debug */
192-
//#define LOG_UPLOAD_DEBUG
192+
//#define LOG_UPLOAD_DEBUG
193193
#ifdef LOG_UPLOAD_DEBUG
194194
#define UPLOAD_DBG(fmt, ...) HAL_Printf(">>LOG-DBG>>%s(%d): " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
195195
#else

0 commit comments

Comments
 (0)