/********************************************************************************
|
* 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_ ----- */
|