#ifndef __EC800M_H
#define __EC800M_H
#include "stm32f4xx.h"
#include "string.h"
#include "sys.h"
#include "string.h"
#include "stdio.h" 
#include "usart.h"

extern unsigned char Flag_topic;

typedef struct
{
    uint8_t CSQ;    
    uint8_t Socketnum;   //编号
    uint8_t reclen;   //获取到数据的长度
    uint8_t res;      
    uint8_t recdatalen[10];
    uint8_t recdata[100];
    uint8_t netstatus;//网络指示灯
} CSTX_4G;

typedef struct {    
    int year;    
    int month;    
    int day;    
    int hour;    
    int minute;    
    int second;    
}TimeInfo;  

void Clear_Buffer(uint16_t *USARTx_RX_STA, uint8_t *USARTx_RX_BUF);
uint8_t CSTX_4G_Init(void);
void CSTX_4G_CreateTCPSokcet(void);
void CSTX_4G_Senddata(int len,uint8_t *data);
void CSTX_4G_RegALiYunIOT(unsigned char topic);//平台注册
uint16_t MakeALiYunPayload_s(char *Str,char *Data, const char* identifier);//上发数据，上发的数据跟对应的插件有关系，用户需要注意插件然后对应数据即可
char* Get_4GIMEI_NUM(void); //获取IMEI号
unsigned char CSTX_4G_RECData(void);
void extract_IMSI(uint8_t *input_str, char *output_str);
void CSTX_4G_ALiYunIOTSenddata_string(char *Data,const char* identifier);
TimeInfo parseTimeInfo(const char *jsonString);

#endif
