MqttRpcDeviceReadInt32Async 方法 (String, UInt16) |
命名空间: HslCommunication.MQTT
public virtual Task<OperateResult<int[]>> ReadInt32Async( string address, ushort length )
MelsecMcNet melsec_net = new MelsecMcNet( "192.168.0.100", 6000 ); // 以下是简单的读取,没有仔细校验的方式 int[] d100_119 = (await melsec_net.ReadInt32Async( "D100", 10 )).Content; // 如果需要判断是否读取成功 OperateResult<int[]> R_d100_119 = await melsec_net.ReadInt32Async( "D100", 10 ); if (R_d100_119.IsSuccess) { // success int value_d100 = R_d100_119.Content[0]; int value_d102 = R_d100_119.Content[1]; int value_d104 = R_d100_119.Content[2]; int value_d106 = R_d100_119.Content[3]; int value_d108 = R_d100_119.Content[4]; int value_d110 = R_d100_119.Content[5]; int value_d112 = R_d100_119.Content[6]; int value_d114 = R_d100_119.Content[7]; int value_d116 = R_d100_119.Content[8]; int value_d118 = R_d100_119.Content[9]; } else { // failed }