| | |
| | | return plc.Write(address, Convert.ToString(value)); |
| | | case TypeCode.Char: |
| | | return plc.Write(address, Convert.ToChar(value)); |
| | | //case TypeCode.arr: |
| | | // return plc.Write(address, Convert.ToChar(value)); |
| | | default: |
| | | if (value is int[]) |
| | | { |
| | |
| | | case SiemensDBDataType.DataType_Char: |
| | | |
| | | break; |
| | | |
| | | case SiemensDBDataType.DataType_ByteArray: |
| | | { |
| | | byte[] writeVal; |
| | | try |
| | | { |
| | | writeVal = Encoding.UTF8.GetBytes(value.ToString()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new CommunicationException(string.Format(CommunicationExceptionMessage.TypeConvertError, dataType, address, value, ex.Message), CommunicationErrorType.TypeError, innerException: ex); |
| | | } |
| | | obj = GetResult(Write(address, writeVal), address, writeVal); |
| | | } |
| | | break; |
| | | default: |
| | | throw new CommunicationException(string.Format(CommunicationExceptionMessage.DataTypeErrorException, dataType, address), CommunicationErrorType.TypeError); |
| | | } |