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

Function ShouldSecureCommandClass

cpp/src/ZWSecurity.cpp:357–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355 }
356
357 SecurityStrategy ShouldSecureCommandClass(uint8 CommandClass) {
358 string securestrategy;
359 Options::Get()->GetOptionAsString( "SecurityStrategy", &securestrategy );
360
361 if (ToUpper(securestrategy) == "ESSENTIAL") {
362 return SecurityStrategy_Essential;
363 } else if (ToUpper(securestrategy) == "SUPPORTED") {
364 return SecurityStrategy_Supported;
365 } else if (ToUpper(securestrategy) == "CUSTOM") {
366 string customsecurecc;
367 Options::Get()->GetOptionAsString( "CustomSecuredCC", &customsecurecc);
368
369 char* pos = const_cast<char*>(customsecurecc.c_str());
370 while( *pos )
371 {
372 if (CommandClass == (uint8)strtol( pos, &pos, 16 )) {
373 return SecurityStrategy_Supported;
374 }
375 if( (*pos) == ',' )
376 {
377 ++pos;
378 }
379 }
380 }
381 return SecurityStrategy_Essential;
382 }
383
384}

Callers 1

SetSecuredClassesMethod · 0.85

Calls 4

ToUpperFunction · 0.85
GetOptionAsStringMethod · 0.80
GetFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected