12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System.Threading.Tasks;
- namespace Team.Utility
- {
- public interface IRobotControlService
- {
- /// <summary>
- /// 写点地址
- /// </summary>
- /// <param name="id">字地址</param>
- /// <returns></returns>
- Task<bool> SavePointAsync(int id);
- /// <summary>
- /// 连接到modbus 服务
- /// </summary>
- /// <returns></returns>
- bool Connect();
- /// <summary>
- /// 读保持寄存器位地址
- /// </summary>
- /// <param name="address">字地址</param>
- /// <param name="bitNo">字位</param>
- /// <returns></returns>
- Task<bool> ReadAsync(int address, int bitNo);
- //void SetDataFormat(DataFormat dataFormat);
- /// <summary>
- /// 设置连接超时时间
- /// </summary>
- /// <param name="duration">单位second</param>
- void SetConnectTimeout(int duration);
- bool IsConnect { get; }
- /// <summary>
- /// 写字地址
- /// </summary>
- /// <param name="id">字地址</param>
- /// <param name="value"></param>
- /// <returns></returns>
- Task<bool> WriteShortAsync(int id,int value);
- Task<bool> WriteUshortAsync(int id, ushort value);
- Task<bool> WriteIntAsync(int id, int value);
- Task<bool> WriteUintAsync(int id, uint value);
- Task<bool> WriteFloatAsync(int id, float value);
- Task<bool> WriteDoubleAsync(int id, double value);
- Task<bool> WriteStringAsync(int id, string value);
- /// <summary>
- /// 在modbus服务器写入32位整数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<int> ReadInt32Async(int address);
- /// <summary>
- /// 在modbus服务器写入32正位整数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<uint> ReadUintAsync(int address);
- /// <summary>
- /// 在modbus服务器写入32浮点数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<float> ReadFloatAsync(int address);
- /// <summary>
- /// 在modbus服务器写入64浮点数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<double> ReadDoubleAsync(int address);
- /// <summary>
- /// 在modbus服务器写入16位整数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<short> ReadShortAsync(int address);
- /// <summary>
- /// 在modbus服务器写入16正位整数
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <returns></returns>
- Task<ushort> ReadUshortAsync(int address);
- /// <summary>
- /// 在modbus服务器写入字符串
- /// </summary>
- /// <param name="address">地址开始位</param>
- /// <param name="length">字符串长度</param>
- /// <returns></returns>
- Task<string> ReadStringAsync(int address, ushort length);
- }
- }
|