Exemplo n.º 1
0
 /// <summary>
 /// 获取数据
 /// </summary>
 /// <param name="belongAddress">从站地址</param>
 /// <param name="masterAddress">主站地址</param>
 /// <param name="startAddress">开始地址</param>
 /// <param name="getTypeAndCount">获取类型和个数</param>
 /// <returns>接收到的对应的类型和数据</returns>
 public virtual object[] GetDatas(byte belongAddress, byte masterAddress, string startAddress,
                                  KeyValuePair <Type, int> getTypeAndCount)
 {
     return(AsyncHelper.RunSync(() => GetDatasAsync(belongAddress, masterAddress, startAddress, getTypeAndCount)));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 设置数据
 /// </summary>
 /// <param name="belongAddress">从站地址</param>
 /// <param name="masterAddress">主站地址</param>
 /// <param name="startAddress">开始地址</param>
 /// <param name="setContents">设置数据</param>
 /// <returns>是否设置成功</returns>
 public virtual bool SetDatas(byte belongAddress, byte masterAddress, string startAddress, object[] setContents)
 {
     return(AsyncHelper.RunSync(() => SetDatasAsync(belongAddress, masterAddress, startAddress, setContents)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取数据
 /// </summary>
 /// <param name="belongAddress">从站地址</param>
 /// <param name="masterAddress">主站地址</param>
 /// <param name="startAddress">开始地址</param>
 /// <param name="getByteCount">获取字节数个数</param>
 /// <returns>接收到的byte数据</returns>
 public virtual byte[] GetDatas(byte belongAddress, byte masterAddress, string startAddress, int getByteCount)
 {
     return(AsyncHelper.RunSync(() => GetDatasAsync(belongAddress, masterAddress, startAddress, getByteCount)));
 }
Exemplo n.º 4
0
 public override bool SendMsgWithoutReturn(byte[] message)
 {
     return(AsyncHelper.RunSync(() => SendMsgWithoutReturnAsync(message)));
 }
Exemplo n.º 5
0
 public override byte[] SendMsg(byte[] message)
 {
     return(AsyncHelper.RunSync(() => SendMsgAsync(message)));
 }
Exemplo n.º 6
0
 public override bool Connect()
 {
     return(AsyncHelper.RunSync(ConnectAsync));
 }
Exemplo n.º 7
0
 /// <summary>
 ///     写入数据
 /// </summary>
 /// <param name="setDataType">写入类型</param>
 /// <param name="values">需要写入的数据字典,当写入类型为Address时,键为需要写入的地址,当写入类型为CommunicationTag时,键为需要写入的单元的描述</param>
 /// <returns>是否写入成功</returns>
 public bool SetDatas(MachineSetDataType setDataType, Dictionary <string, double> values)
 {
     return(AsyncHelper.RunSync(() => SetDatasAsync(setDataType, values)));
 }
Exemplo n.º 8
0
 /// <summary>
 ///     读取数据
 /// </summary>
 /// <returns>从设备读取的数据</returns>
 public Dictionary <string, ReturnUnit> GetDatas(MachineGetDataType getDataType)
 {
     return(AsyncHelper.RunSync(() => GetDatasAsync(getDataType)));
 }
Exemplo n.º 9
0
 /// <summary>
 ///     发送并接收数据,不进行协议扩展和收缩,用于特殊协议
 /// </summary>
 /// <param name="content">发送协议的内容</param>
 /// <returns>接收协议的内容</returns>
 public virtual byte[] SendReceiveWithoutExtAndDec(byte[] content)
 {
     return(AsyncHelper.RunSync(() => SendReceiveWithoutExtAndDecAsync(content)));
 }
Exemplo n.º 10
0
 /// <summary>
 ///     发送并接收数据
 /// </summary>
 /// <param name="content">发送协议的内容</param>
 /// <returns>接收协议的内容</returns>
 public virtual byte[] SendReceive(byte[] content)
 {
     return(AsyncHelper.RunSync(() => SendReceiveAsync(content)));
 }