commit | author | age
|
e30a4c
|
1 |
/********************************************************************************* |
GW |
2 |
* Copyright: (C) 2019 LingYun IoT System Studio |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* Filename: conf.h |
|
6 |
* Description: This file is iotd configure file parser function |
|
7 |
* |
|
8 |
* Version: 1.0.0(2019年06月25日) |
|
9 |
* Author: Guo Wenxue <guowenxue@gmail.com> |
|
10 |
* ChangeLog: 1, Release initial version on "2019年06月25日 22时23分55秒" |
|
11 |
* |
|
12 |
********************************************************************************/ |
|
13 |
#ifndef __CONF_H_ |
|
14 |
#define __CONF_H_ |
|
15 |
|
|
16 |
#include "hal.h" |
|
17 |
#include "mqtt.h" |
|
18 |
|
|
19 |
enum |
|
20 |
{ |
|
21 |
Qos0, /* 发送者只发送一次消息,不进行重试,Broker不会返回确认消息。在Qos0情况下,Broker可能没有接受到消息 */ |
|
22 |
Qos1, /* 发送者最少发送一次消息,确保消息到达Broker,Broker需要返回确认消息PUBACK。在Qos1情况下,Broker可能接受到重复消息 */ |
|
23 |
Qos2, /* Qos2使用两阶段确认来保证消息的不丢失和不重复。在Qos2情况下,Broker肯定会收到消息,且只收到一次 */ |
|
24 |
}; |
|
25 |
|
|
26 |
|
|
27 |
typedef struct log_ctx_s |
|
28 |
{ |
|
29 |
/* logger settings */ |
|
30 |
char logfile[128]; /* logger record file */ |
|
31 |
int loglevel; /* logger level */ |
|
32 |
int logsize; /* logger file maxsize, oversize will rollback */ |
|
33 |
} log_ctx_t; |
|
34 |
|
|
35 |
typedef struct iotd_ctx_s |
|
36 |
{ |
|
37 |
log_ctx_t log_ctx; |
|
38 |
hal_ctx_t hal_ctx; |
|
39 |
mqtt_ctx_t mqtt_ctx; |
|
40 |
} iotd_ctx_t; |
|
41 |
|
|
42 |
|
|
43 |
extern int parser_conf(const char *conf_file, iotd_ctx_t *ctx, int debug); |
|
44 |
|
|
45 |
#endif /* ----- #ifndef _CONF_H_ ----- */ |
|
46 |
|