LingYun IoT Studio NB-IoT research project
guowenxue
2019-03-27 6db0960200c5a1307914486172094fccf23b33ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/********************************************************************************
 *      Copyright:  (C) 2018 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  iotd_conf.h
 *    Description:  This file is for iotd configure file parser API
 *
 *        Version:  1.0.0(2018年11月20日)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2018年11月20日 12时28分20秒"
 *                 
 ********************************************************************************/
#ifndef  _IOTD_CONF_H_
#define  _IOTD_CONF_H_
 
#include "cp_logger.h"
 
#define DISABLE                 0
#define ENABLE                  1
 
#define HOSTN_LEN              64
 
#ifndef FILEN_LEN 
#define FILEN_LEN              64
#endif
 
#define DEF_LOG_FILE         "/tmp/iotd.log"
#define DEF_LOG_LEVEL        LOG_LEVEL_NRML
 
typedef struct lora_conf_s 
{
    int               enable;
    char              comport[FILEN_LEN];    /*  Comport device name */
    int               baudrate;              /*  Baudrate, default 9600 */  
    char              settings[5];           /*  "8N1N", DataBit[8/7],Parity[O/E/N],StopBit[1/0],FlowControl[S/H/N] */ 
} lora_conf_t;  
 
 
typedef struct nbiot_conf_s 
{
    unsigned char     enable;
    char              comport[FILEN_LEN];    /*  Comport device name */
    int               baudrate;              /*  Baudrate, default 9600 */  
    char              settings[5];           /*  "8N1N", DataBit[8/7],Parity[O/E/N],StopBit[1/0],FlowControl[S/H/N] */ 
} nbiot_conf_t;  
 
 
typedef struct mqtt_conf_s 
{
    unsigned char      enable;  /* Enable this thread or not */
    char               hostname[HOSTN_LEN];   /*  Remote MQTT server hostname: IP or Domain name format */
    unsigned short     port; /* MQTT Server listen port */
} mqtt_conf_t;  
 
 
typedef struct iotd_conf_s 
{
    logger_t          logger;
    lora_conf_t       lora_conf;
    nbiot_conf_t      nbiot_conf;
    mqtt_conf_t       mqtt_conf;
} iotd_conf_t;  
 
 
extern int parser_iotd_conf(char *conf_file, iotd_conf_t *iotd_conf);
 
#endif   /* ----- #ifndef _IOTD_CONF_H_  ----- */