public static void insertFromDevState ( final DevState devStateValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { final Integer integerValue = Integer . valueOf ( devStateValue . value ( ) ) ; switch ( deviceAttributeWritten . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : deviceAttributeWritten . insert ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : deviceAttributeWritten . insert_us ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : deviceAttributeWritten . insert_uc ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : deviceAttributeWritten . insert_ul ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_LONG64 not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_ULONG64 : deviceAttributeWritten . insert_u64 ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : deviceAttributeWritten . insert ( integerValue . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : deviceAttributeWritten . insert ( integerValue . doubleValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : deviceAttributeWritten . insert ( integerValue . toString ( ) ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : if ( integerValue . doubleValue ( ) == 1 ) { deviceAttributeWritten . insert ( true ) ; } else { deviceAttributeWritten . insert ( false ) ; } break ; case TangoConst . Tango_DEV_STATE : deviceAttributeWritten . insert ( devStateValue ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; } }
Insert data in DeviceAttribute from a DevState .