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

Method FindSwitchPoint

cpp/src/value_classes/ValueSchedule.cpp:324–360  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Get the index of the switch point at the specified time -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

322// Get the index of the switch point at the specified time
323//-----------------------------------------------------------------------------
324bool ValueSchedule::FindSwitchPoint
325(
326 uint8 const _hours,
327 uint8 const _minutes,
328 uint8* o_idx
329)const
330{
331 for( uint8 i=0; i<m_numSwitchPoints; ++i )
332 {
333 if( m_switchPoints[i].m_hours == _hours )
334 {
335 if( m_switchPoints[i].m_minutes == _minutes )
336 {
337 // Found a match
338 if( o_idx )
339 {
340 *o_idx = i;
341 }
342 return true;
343 }
344
345 if( m_switchPoints[i].m_minutes > _minutes )
346 {
347 // Gone past any possible match
348 return false;
349 }
350 }
351 else if( m_switchPoints[i].m_hours > _hours )
352 {
353 // Gone past any possible match
354 return false;
355 }
356 }
357
358 // No match found
359 return false;
360}
361
362string const ValueSchedule::GetAsString() const {
363 /* we should actuall find a way to return the arrays of switchpoints nicely */

Callers 1

RemoveSwitchPointMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected