MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / UpdateCallbackId

Method UpdateCallbackId

cpp/src/Msg.cpp:209–230  ·  view source on GitHub ↗

----------------------------------------------------------------------------- If this message has a callback ID, increment it and recalculate the checksum -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

207// If this message has a callback ID, increment it and recalculate the checksum
208//-----------------------------------------------------------------------------
209void Msg::UpdateCallbackId()
210{
211 if( m_bCallbackRequired )
212 {
213 if( 0 == s_nextCallbackId )
214 {
215 s_nextCallbackId = 10;
216 }
217
218 // update the callback ID
219 m_buffer[m_length-2] = s_nextCallbackId;
220 m_callbackId = s_nextCallbackId++;
221
222 // Recalculate the checksum
223 uint8 checksum = 0xff;
224 for( int32 i=1; i<m_length-1; ++i )
225 {
226 checksum ^= m_buffer[i];
227 }
228 m_buffer[m_length-1] = checksum;
229 }
230}
231
232
233//-----------------------------------------------------------------------------

Callers 1

WriteMsgMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected