Files
HBshuiwuConcentrator/yw/doc.h
2025-12-15 16:07:49 +08:00

47 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef __DOC__
#define __DOC__
#include "global.h"
//#define MAX_METER_NUM (200) //超过200写flash会挂未查明原因
#define MAX_METER_NUM (200)
/*
档案
*/
struct meter_struct
{
u16 id; //表序号 BCD 2
u8 addr[7]; //表地址BCD 7
u8 type; //表类型代码BCD 1
u8 pro; //协议类别BCD 1
u8 baud; //波特率BCD 1
u8 password[4]; //表密码HEX 4
u8 colladdr[6]; //采集模块/中继器编号(地址) BCD 6
u8 port; //采集端口BCD 1
u8 state; //开关
u8 isopen; //档案是否关闭
};
void meter_close(u8 * id);
void meter_add(u16 id,u8 * addr,u8 type,u8 pro,u8 baud,u8 * pd,u8 * coladdr,u8 port);
void meter_read(u8 * id,u8 * val,u16 * len);
void doc_write();
void doc_read();
u16 meter_get_count();
bool meter_getfromid(u16 id,u8 * addr);
bool meter_get_id(u16 index,u16 * id);
bool meter_get_addr(u16 index,u8 * addr);
bool meter_find_id(u8 * addr,u16 * id);
bool meter_find_addr6(u8 * addr);
//直接根据index得到id;
bool meter_get_real_id(u16 index,u16 * id);
bool is_doctype_ok(u16 index);
bool meter_find_id_fromaddr(u8 * addr,u16 * id);
bool meter_getaddress_fromid(u16 id,u8 * addr);
bool meter_get_addr(u16 index,u8 * addr);
bool meter_get_id(u16 index,u16 * id);
#endif