// General housekeeping TEST(TestDecodeVestelAc, Housekeeping) { ASSERT_EQ("VESTEL_AC", typeToString(VESTEL_AC)); ASSERT_FALSE(hasACState(VESTEL_AC)); // Uses uint64_t, not uint8_t*. }
// General housekeeping TEST(TestTeco, Housekeeping) { ASSERT_EQ("TECO", typeToString(TECO)); ASSERT_FALSE(hasACState(TECO)); // Uses uint64_t, not uint8_t*. }
int main(int argc, char * argv[]) { int argv_offset = 1; bool dumpraw = false; bool prontohex = false; // Check the invocation/calling usage. if (argc < 2 || argc > 4) { usage_error(argv[0]); return 1; } if (strncmp("-prontohex", argv[argv_offset], 10) == 0) { prontohex = true; argv_offset++; } if (strncmp("-raw", argv[argv_offset], 4) == 0) { dumpraw = true; argv_offset++; } if (argc - argv_offset != 1) { usage_error(argv[0]); return 1; } uint16_t gc_test[MAX_GC_CODE_LENGTH]; int index = 0; char *pch; char *saveptr1; char *sep = const_cast<char *>(","); int codebase = 10; if (prontohex) { sep = const_cast<char *>(" "); codebase = 16; } pch = strtok_r(argv[argv_offset], sep, &saveptr1); while (pch != NULL && index < MAX_GC_CODE_LENGTH) { str_to_uint16(pch, &gc_test[index], codebase); pch = strtok_r(NULL, sep, &saveptr1); index++; } IRsendTest irsend(4); IRrecv irrecv(4); irsend.begin(); irsend.reset(); if (prontohex) { irsend.sendPronto(gc_test, index); } else { irsend.sendGC(gc_test, index); } irsend.makeDecodeResult(); irrecv.decode(&irsend.capture); std::cout << "Code length " << index << std::endl << "Code type " << irsend.capture.decode_type << " (" << typeToString(irsend.capture.decode_type) << ")" << std::endl << "Code bits " << irsend.capture.bits << std::endl; if (hasACState(irsend.capture.decode_type)) { std::cout << "State value 0x"; for (uint16_t i = 0; i < irsend.capture.bits / 8; i++) printf("%02X", irsend.capture.state[i]); std::cout << std::endl; } else { std::cout << "Code value 0x" << std::hex << irsend.capture.value << std::endl << "Code address 0x" << std::hex << irsend.capture.address << std::endl << "Code command 0x" << std::hex << irsend.capture.command << std::endl; } if (dumpraw || irsend.capture.decode_type == UNKNOWN) irsend.dumpRawResult(); return 0; }
// Tests for general utility functions. TEST(TestGeneralPanasonic, hasACState) { EXPECT_TRUE(hasACState(PANASONIC_AC)); ASSERT_FALSE(hasACState(PANASONIC)); }
TEST(TestIRUtils, SharpAc) { ASSERT_EQ("SHARP_AC", typeToString(decode_type_t::SHARP_AC)); ASSERT_EQ(decode_type_t::SHARP_AC, strToDecodeType("SHARP_AC")); ASSERT_TRUE(hasACState(decode_type_t::SHARP_AC)); }
TEST(TestIRUtils, Sharp) { ASSERT_EQ("SHARP", typeToString(decode_type_t::SHARP)); ASSERT_EQ(decode_type_t::SHARP, strToDecodeType("SHARP")); ASSERT_FALSE(hasACState(decode_type_t::SHARP)); }