----------------------------------------------------------------------------- Add a value to a message as a sequence of bytes -----------------------------------------------------------------------------
| 616 | // Add a value to a message as a sequence of bytes |
| 617 | //----------------------------------------------------------------------------- |
| 618 | void CommandClass::AppendValue |
| 619 | ( |
| 620 | Msg* _msg, |
| 621 | string const& _value, |
| 622 | uint8 const _scale |
| 623 | )const |
| 624 | { |
| 625 | uint8 precision; |
| 626 | uint8 size; |
| 627 | int32 val = ValueToInteger( _value, &precision, &size ); |
| 628 | |
| 629 | _msg->Append( (precision<<c_precisionShift) | (_scale<<c_scaleShift) | size ); |
| 630 | |
| 631 | int32 shift = (size-1)<<3; |
| 632 | for( int32 i=size; i>0; --i, shift-=8 ) |
| 633 | { |
| 634 | _msg->Append( (uint8)(val >> shift) ); |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | //----------------------------------------------------------------------------- |
| 639 | // <CommandClass::GetAppendValueSize> |