MCPcopy Create free account
hub / github.com/Santroller/Santroller / load_toggle

Function load_toggle

src/config.cpp:489–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487 return true;
488}
489bool load_toggle(pb_istream_t *stream, const pb_field_t *field, void **arg)
490{
491 auto profile = working_profile;
492 printf("found toggle! %p\r\n", profile.get());
493 auto last_toggle = new ToggleInput();
494 last_special = last_toggle;
495 proto_ToggleInput input;
496 input.input.cb_input.funcs.decode = load_input_dev;
497 input.input.cb_input.arg = arg;
498 if (!pb_decode(stream, proto_ToggleInput_fields, &input))
499 {
500 printf("couldnt decode toggle input?\r\n");
501 return false;
502 }
503
504 printf("check %d %d\r\n", input.deviceid, profile->devices.size());
505 if (profile->devices.find(input.deviceid) == profile->devices.end())
506 {
507 printf("why tho\r\n");
508 return true;
509 }
510 printf("loading toggle\r\n");
511 last_toggle->load(input, std::static_pointer_cast<ToggleDevice>(profile->devices[input.deviceid]), input.has_input ? make_input(input.input, profile, stream) : nullptr);
512 printf("loaded toggle\r\n");
513 return true;
514}
515
516bool load_input_dev(pb_istream_t *stream, const pb_field_t *field, void **arg)
517{

Callers

nothing calls this directly

Calls 4

pb_decodeFunction · 0.85
make_inputFunction · 0.85
endMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected