| 487 | return true; |
| 488 | } |
| 489 | bool 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 | |
| 516 | bool load_input_dev(pb_istream_t *stream, const pb_field_t *field, void **arg) |
| 517 | { |
nothing calls this directly
no test coverage detected