Commit 69005e6
committed
fix(s7commplus): decode struct PValues per the real wire format (packed + normal)
decode_pvalue_to_bytes treated every Struct (0x17) as a VLQ element count
followed by that many nested PValues. Real S7-1500 structs use neither shape:
the leading struct id is a fixed UInt32, and the body comes in two forms (per
ValueStruct.Deserialize in the thomas-v2/S7CommPlusDriver reference):
- Packed struct — system datatypes and optimized-DB struct reads, id in
0x90000000..0x9fffffff or 0x02000000..0x02ffffff: a UInt64 interface
timestamp, VLQ transport flags, a VLQ element count (a second count follows
when the Count2Present flag is set), then the members as one raw byte blob,
returned verbatim for the caller to interpret using the struct's layout.
- Normal struct — members as [VLQ key][PValue], terminated by a 0 key.
Verified against a real S7-1500: reading a struct node now returns the packed
member bytes, which decode to the expected scalar values (matching the
individual leaf reads).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 999c065 commit 69005e6
2 files changed
Lines changed: 76 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
470 | | - | |
471 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
472 | 499 | | |
473 | | - | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
474 | 503 | | |
475 | 504 | | |
476 | 505 | | |
| 506 | + | |
| 507 | + | |
477 | 508 | | |
478 | 509 | | |
479 | 510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
547 | 548 | | |
548 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
549 | 584 | | |
550 | 585 | | |
551 | 586 | | |
| |||
0 commit comments