----------------------------------------------------------------------------- Gets a value as a collection of bytes -----------------------------------------------------------------------------
| 2292 | // Gets a value as a collection of bytes |
| 2293 | //----------------------------------------------------------------------------- |
| 2294 | bool Manager::GetValueAsRaw |
| 2295 | ( |
| 2296 | ValueID const& _id, |
| 2297 | uint8** o_value, |
| 2298 | uint8* o_length |
| 2299 | ) |
| 2300 | { |
| 2301 | bool res = false; |
| 2302 | |
| 2303 | if( o_value && o_length ) |
| 2304 | { |
| 2305 | if( ValueID::ValueType_Raw == _id.GetType() ) |
| 2306 | { |
| 2307 | if( Driver* driver = GetDriver( _id.GetHomeId() ) ) |
| 2308 | { |
| 2309 | LockGuard LG(driver->m_nodeMutex); |
| 2310 | if( ValueRaw* value = static_cast<ValueRaw*>( driver->GetValue( _id ) ) ) |
| 2311 | { |
| 2312 | *o_length = value->GetLength(); |
| 2313 | *o_value = new uint8[*o_length]; |
| 2314 | memcpy( *o_value, value->GetValue(), *o_length ); |
| 2315 | value->Release(); |
| 2316 | res = true; |
| 2317 | } else { |
| 2318 | OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueAsRaw"); |
| 2319 | } |
| 2320 | } |
| 2321 | } else { |
| 2322 | OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueAsRaw is not a Raw Value"); |
| 2323 | } |
| 2324 | } |
| 2325 | |
| 2326 | return res; |
| 2327 | } |
| 2328 | |
| 2329 | //----------------------------------------------------------------------------- |
| 2330 | // <Manager::GetValueAsShort> |