X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=include%2FCECExports.h;h=16f24dfa447fbb6fc41d3dd41dbf44072eb9ec46;hb=5f150ee2e57b5c3e16361074e37b5bdb54b687ab;hp=47dcdff364686801443655a59fd2bccb0328efa1;hpb=b5ed9b9ed6bf72799ccb58263856598e8ad6dab3;p=deb_libcec.git diff --git a/include/CECExports.h b/include/CECExports.h index 47dcdff..16f24df 100644 --- a/include/CECExports.h +++ b/include/CECExports.h @@ -263,11 +263,18 @@ namespace CEC { uint8_t data[20]; uint8_t size; - void shift(uint8_t num) + void shift(uint8_t iShiftBy) { - for (uint8_t iPtr = 0; iPtr < num; iPtr++) - data[iPtr] = iPtr + num < size ? data[iPtr + num] : 0; - size -= num; + if (iShiftBy >= size) + { + clear(); + } + else + { + for (uint8_t iPtr = 0; iPtr < size; iPtr++) + data[iPtr] = (iPtr + iShiftBy < size) ? data[iPtr + iShiftBy] : 0; + size = (uint8_t) (size - iShiftBy); + } } void push_back(uint8_t add) @@ -299,6 +306,23 @@ namespace CEC { }; } cec_command; + typedef enum cec_vendor_id + { + CEC_VENDOR_SAMSUNG = 240, + CEC_VENDOR_UNKNOWN = 0 + } vendor_id; + + static const char *CECVendorIdToString(const uint64_t iVendorId) + { + switch (iVendorId) + { + case CEC_VENDOR_SAMSUNG: + return "Samsung"; + default: + return "Unknown"; + } + } + //default physical address 1.0.0.0 #define CEC_DEFAULT_PHYSICAL_ADDRESS 0x1000