| 557 | } |
| 558 | |
| 559 | void RGBController::ReadDeviceDescription(unsigned char* data_buf, unsigned int protocol_version) |
| 560 | { |
| 561 | unsigned int data_ptr = 0; |
| 562 | |
| 563 | data_ptr += sizeof(unsigned int); |
| 564 | |
| 565 | /*---------------------------------------------------------*\ |
| 566 | | Copy in type | |
| 567 | \*---------------------------------------------------------*/ |
| 568 | memcpy(&type, &data_buf[data_ptr], sizeof(device_type)); |
| 569 | data_ptr += sizeof(device_type); |
| 570 | |
| 571 | /*---------------------------------------------------------*\ |
| 572 | | Copy in name | |
| 573 | \*---------------------------------------------------------*/ |
| 574 | unsigned short name_len; |
| 575 | memcpy(&name_len, &data_buf[data_ptr], sizeof(unsigned short)); |
| 576 | data_ptr += sizeof(unsigned short); |
| 577 | |
| 578 | name = (char *)&data_buf[data_ptr]; |
| 579 | data_ptr += name_len; |
| 580 | |
| 581 | /*---------------------------------------------------------*\ |
| 582 | | Copy in vendor if protocol version is 1 or higher | |
| 583 | \*---------------------------------------------------------*/ |
| 584 | if(protocol_version >= 1) |
| 585 | { |
| 586 | unsigned short vendor_len; |
| 587 | memcpy(&vendor_len, &data_buf[data_ptr], sizeof(unsigned short)); |
| 588 | data_ptr += sizeof(unsigned short); |
| 589 | |
| 590 | vendor = (char *)&data_buf[data_ptr]; |
| 591 | data_ptr += vendor_len; |
| 592 | } |
| 593 | |
| 594 | /*---------------------------------------------------------*\ |
| 595 | | Copy in description | |
| 596 | \*---------------------------------------------------------*/ |
| 597 | unsigned short description_len; |
| 598 | memcpy(&description_len, &data_buf[data_ptr], sizeof(unsigned short)); |
| 599 | data_ptr += sizeof(unsigned short); |
| 600 | |
| 601 | description = (char *)&data_buf[data_ptr]; |
| 602 | data_ptr += description_len; |
| 603 | |
| 604 | /*---------------------------------------------------------*\ |
| 605 | | Copy in version | |
| 606 | \*---------------------------------------------------------*/ |
| 607 | unsigned short version_len; |
| 608 | memcpy(&version_len, &data_buf[data_ptr], sizeof(unsigned short)); |
| 609 | data_ptr += sizeof(unsigned short); |
| 610 | |
| 611 | version = (char *)&data_buf[data_ptr]; |
| 612 | data_ptr += version_len; |
| 613 | |
| 614 | /*---------------------------------------------------------*\ |
| 615 | | Copy in serial | |
| 616 | \*---------------------------------------------------------*/ |
no test coverage detected