You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
7 months ago
|
//
|
||
|
// Created by hyz on 2024/6/5.
|
||
|
//
|
||
|
|
||
|
#ifndef WEATHERCOMM_H
|
||
|
#define WEATHERCOMM_H
|
||
|
|
||
|
#include <string>
|
||
|
#include "GPIOControl.h"
|
||
|
|
||
|
#define MAX_STRING_LEN 32
|
||
|
#define IOT_PARAM_WRITE 0xAE
|
||
|
#define IOT_PARAM_READ 0xAF
|
||
|
|
||
|
#define LOGE(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, "serial_port_comm", fmt, ##args)
|
||
|
|
||
|
// 串口参数
|
||
|
typedef struct
|
||
|
{
|
||
|
int baudrate; /* 波特率*/
|
||
|
int databit; /* 数据位*/
|
||
|
char stopbit[8]; /* 停止位*/
|
||
|
char parity; /* 校验位*/
|
||
|
char pathname[128];/* 串口文件名及路径*/
|
||
|
} SERIAL_PARAM;
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
int m_iRevStatus; /* */
|
||
|
int m_iRecvLen; /* */
|
||
|
int m_iNeedRevLength; /* */
|
||
|
int iRecvTime; /* */
|
||
|
int RevCmdFlag;
|
||
|
unsigned char m_au8RecvBuf[128];/* */
|
||
|
} SIO_PARAM_SERIAL_DEF;
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
int cmd;
|
||
|
int value;
|
||
|
int result;
|
||
|
long value2;
|
||
|
char str[MAX_STRING_LEN];
|
||
|
}IOT_PARAM;
|
||
|
|
||
|
void PortDataProcess( );
|
||
|
int serial_port_comm();
|
||
|
static int weather_comm(SERIAL_PARAM weatherport);
|
||
|
int set_port_attr (int fd, int baudrate, int databit, const char *stopbit, char parity, int vtime, int vmin );
|
||
|
|
||
|
#endif //WEATHERCOMM_H
|