57 lines
1.3 KiB
C
57 lines
1.3 KiB
C
/**
|
|
* @file slmptcpmaster.h
|
|
* @brief 三菱SLMP协议TCP客户端主站头文件
|
|
*/
|
|
#ifndef SLMPTCPMASTER_H
|
|
#define SLMPTCPMASTER_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
// ============================================================================
|
|
// 全局变量
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ============================================================================
|
|
// 接口函数
|
|
// ============================================================================
|
|
|
|
/**
|
|
* @brief 处理接收到的SLMP响应
|
|
* @param size: 接收数据长度
|
|
* @return true: 处理成功,false: 不是有效的读响应
|
|
*/
|
|
_Bool slmp_handle_recv(uint16_t size);
|
|
|
|
/**
|
|
* @brief 构建SLMP请求帧
|
|
* @return 发送长度,0表示不发送(参数非法)
|
|
*/
|
|
uint16_t slmp_build_send(void);
|
|
|
|
/**
|
|
* @brief 超时计数,由主循环每次调用递增
|
|
*/
|
|
void update_timeout_slmp(void);
|
|
|
|
/**
|
|
* @brief SLMP TCP客户端主函数,W5500socket主循环处理
|
|
* @param sn: socket编号
|
|
* @param destip: 目标IP地址
|
|
* @param destport: 目标端口
|
|
* @return 0/正表示正常,负表示错误
|
|
*/
|
|
int32_t loopback_tcpc_slmp(uint8_t sn, uint8_t *destip, uint16_t destport);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|