예제 #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)));
 }
예제 #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)));
 }
예제 #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)));
 }
예제 #4
0
 public override bool SendMsgWithoutReturn(byte[] message)
 {
     return(AsyncHelper.RunSync(() => SendMsgWithoutReturnAsync(message)));
 }
예제 #5
0
 public override byte[] SendMsg(byte[] message)
 {
     return(AsyncHelper.RunSync(() => SendMsgAsync(message)));
 }
예제 #6
0
 public override bool Connect()
 {
     return(AsyncHelper.RunSync(ConnectAsync));
 }
예제 #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)));
 }
예제 #8
0
 /// <summary>
 ///     读取数据
 /// </summary>
 /// <returns>从设备读取的数据</returns>
 public Dictionary <string, ReturnUnit> GetDatas(MachineGetDataType getDataType)
 {
     return(AsyncHelper.RunSync(() => GetDatasAsync(getDataType)));
 }
예제 #9
0
 /// <summary>
 ///     发送并接收数据,不进行协议扩展和收缩,用于特殊协议
 /// </summary>
 /// <param name="content">发送协议的内容</param>
 /// <returns>接收协议的内容</returns>
 public virtual byte[] SendReceiveWithoutExtAndDec(byte[] content)
 {
     return(AsyncHelper.RunSync(() => SendReceiveWithoutExtAndDecAsync(content)));
 }
예제 #10
0
 /// <summary>
 ///     发送并接收数据
 /// </summary>
 /// <param name="content">发送协议的内容</param>
 /// <returns>接收协议的内容</returns>
 public virtual byte[] SendReceive(byte[] content)
 {
     return(AsyncHelper.RunSync(() => SendReceiveAsync(content)));
 }