Files
STM32F4-Base/IEC60870-Slave/104/business/IEC104_Interrogation_Internal.h
T
STF 7596f3371a
CI / L0 静态门禁 (pre-commit) (push) Failing after 44s
CI / L0.5 主机侧单测 (MSVC) (push) Failing after 42s
补充总召唤的广播地址,电度召唤+时钟同步业务的实现
2026-10-29 03:20:19 -07:00

40 lines
2.6 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.
/*
* 104共用召唤引擎与种类文件之间的私有接口,不供业务直接调用。
* 规则函数必须无状态:不访问网络、不保存业务进度、不回调引擎。
* 规则表在实例整个寿命内保持有效且只读;现有两种请求共用6字节公共头、3字节IOA和1字节限定词。
*/
#ifndef IEC104_INTERROGATION_INTERNAL_H
#define IEC104_INTERROGATION_INTERNAL_H
#include "IEC104_Interrogation.h"
typedef struct {
uint8_t type_id; /* 请求类型,用于入口分派和应答副本校验。 */
bool has_deactivation; /* 是否受理COT=8撤销;不支持时按未知传送原因应答。 */
/* 解析首对象,输出IOA、种类限定词及FRZ;总召FRZ恒为0,失败不改输出。 */
bool (*decode)(const IEC60870_AsduInfo_t *info, uint32_t *ioa, uint8_t *qualifier, uint8_t *freeze);
/* 校验协议允许的限定词范围;应用是否配置该组留到BEGIN判断。 */
bool (*qualifier_valid)(uint8_t qualifier);
/* 返回准入请求应使用的数据COT;只读元数据,不改变原请求。 */
uint8_t (*data_cause)(uint8_t qualifier);
/* 校验数据类型、SQ及动作是否允许携带数据;公共头和容量由引擎另行检查。 */
bool (*data_allowed)(const IEC60870_AsduInfo_t *info, uint8_t freeze);
bool (*has_data)(uint8_t freeze); /* false表示肯定ACT_CON提交后直接完成,不产生数据事件或ACT_TERM。 */
} IEC104_InterrogationRules_t;
/* 种类文件各自定义,只读规则也供不经过网络的规则单测使用;引擎不引用这两个具体符号。 */
extern const IEC104_InterrogationRules_t IEC104_GENERAL_INTERROGATION_RULES;
extern const IEC104_InterrogationRules_t IEC104_COUNTER_INTERROGATION_RULES;
/* 复制配置并借用rules;校验全部规则回调,同一Slave与同一规则表只能创建一个实例。
* 其他创建/存储契约与公开Create一致,失败返回NULL,不触发网络操作。 */
IEC104_Interrogation_t *IEC104_Interrogation_Create_With_Rules(IEC104_Slave_t *slave,
const IEC104_InterrogationConfig_t *config, const IEC104_InterrogationRules_t *rules);
/* 动作入口的内部实现:额外匹配rules身份,校验并消费BEGIN后才调用一次同步action。
* WAIT/STALE/ERROR不调用action;TEST不执行动作而生成否定确认。成功与失败均不保留回调指针。 */
IEC104_InterrogationReplyResult_t IEC104_Interrogation_Execute_Action(
IEC104_Interrogation_t *self, const IEC104_InterrogationEvent_t *event,
const IEC104_InterrogationRules_t *rules,
bool (*action)(void *context, const IEC104_InterrogationRequest_t *request), void *context);
#endif