@@ -106,7 +106,7 @@ TEST(TestArgoACClass, MessageConstructon) {
106
106
auto actual = ac.getRaw ();
107
107
EXPECT_THAT (std::vector<uint8_t >(actual, actual + static_cast <uint8_t >(
108
108
ceil (static_cast <float >(kArgoBits ) / 8.0 ))),
109
- ::testing::ElementsAreArray (expected));
109
+ ::testing::ElementsAreArray (expected));
110
110
EXPECT_EQ (
111
111
" Model: 1 (WREM2), Power: On, Mode: 0 (Cool), Fan: 0 (Auto), Temp: 20C, "
112
112
" Sensor Temp: 21C, Max: On, IFeel: On, Night: On" ,
@@ -1516,20 +1516,34 @@ TEST(TestDecodeArgo, Issue2133_90bit_message) {
1516
1516
// /
1517
1517
struct ArgoE2ETestParam {
1518
1518
const std::vector<uint16_t > rawDataInput;
1519
- const uint8_t expectedEncodedSizeBytes ;
1519
+ const uint8_t expectedEncodedSizeBits ;
1520
1520
const std::vector<uint8_t > expectedEncodedValue;
1521
1521
const std::string expectedString;
1522
+ const argo_ac_remote_model_t expectedModel;
1523
+
1524
+ ArgoE2ETestParam (std::vector<uint16_t > _raw, uint8_t _encSizeBits,
1525
+ std::vector<uint8_t > _encValue, std::string _str,
1526
+ argo_ac_remote_model_t _model)
1527
+ : rawDataInput(_raw), expectedEncodedSizeBits(_encSizeBits),
1528
+ expectedEncodedValue (_encValue), expectedString(_str),
1529
+ expectedModel(_model) {}
1522
1530
1523
- ArgoE2ETestParam (std::vector<uint16_t > _raw, uint8_t _encSize ,
1531
+ ArgoE2ETestParam (std::vector<uint16_t > _raw, uint8_t _encSizeBytes ,
1524
1532
std::vector<uint8_t > _encValue, std::string _str)
1525
- : rawDataInput(_raw), expectedEncodedSizeBytes(_encSize),
1526
- expectedEncodedValue (_encValue), expectedString(_str) {}
1533
+ : ArgoE2ETestParam(_raw, _encSizeBytes * 8 , _encValue, _str,
1534
+ argo_ac_remote_model_t ::SAC_WREM3) {}
1535
+
1536
+ inline uint16_t getExpectedEncodedSizeBytes () const {
1537
+ return static_cast <int >(ceil (static_cast <float >(
1538
+ expectedEncodedSizeBits) / 8.0 ));
1539
+ }
1527
1540
1528
1541
friend std::ostream& operator <<(std::ostream& os, const ArgoE2ETestParam& v) {
1529
1542
return os << " rawDataInput: " << ::testing::PrintToString (v.rawDataInput )
1530
1543
<< " \n\t expectedEncodedSize: "
1531
- << static_cast <int >(v.expectedEncodedSizeBytes )
1532
- << " [B]" << " \n\t expectedEncodedValue: 0x"
1544
+ << static_cast <int >(v.expectedEncodedSizeBits )
1545
+ << " [b] (" << v.getExpectedEncodedSizeBytes () << " [B])"
1546
+ << " \n\t expectedEncodedValue: 0x"
1533
1547
<< bytesToHexString (v.expectedEncodedValue ) << " \n\t expectedString: "
1534
1548
<< v.expectedString ;
1535
1549
}
@@ -1553,13 +1567,20 @@ TEST_P(TestArgoE2E, RealExampleCommands) {
1553
1567
1554
1568
ASSERT_TRUE (irrecv.decode (&irsend.capture ));
1555
1569
EXPECT_EQ (decode_type_t ::ARGO, irsend.capture .decode_type );
1556
- ASSERT_TRUE (IRArgoAC_WREM3::isValidWrem3Message (irsend.capture .state ,
1557
- irsend.capture .bits , true ));
1558
1570
1559
- EXPECT_EQ (GetParam ().expectedEncodedSizeBytes * 8 , irsend.capture .bits );
1571
+ if (GetParam ().expectedModel == argo_ac_remote_model_t ::SAC_WREM3) {
1572
+ ASSERT_TRUE (IRArgoAC_WREM3::isValidWrem3Message (irsend.capture .state ,
1573
+ irsend.capture .bits , true ));
1574
+ } else if (GetParam ().expectedEncodedSizeBits != kArgoShortBits ) {
1575
+ ASSERT_TRUE (IRArgoAC::validChecksum (irsend.capture .state ,
1576
+ ceil (static_cast <float >(
1577
+ irsend.capture .bits ) / 8.0 )));
1578
+ }
1579
+
1580
+ EXPECT_EQ (GetParam ().expectedEncodedSizeBits , irsend.capture .bits );
1560
1581
1561
1582
std::vector<uint8_t > stateActual (irsend.capture .state , irsend.capture .state
1562
- + GetParam ().expectedEncodedSizeBytes );
1583
+ + GetParam ().getExpectedEncodedSizeBytes () );
1563
1584
EXPECT_THAT (stateActual, ::testing::ElementsAreArray (
1564
1585
GetParam ().expectedEncodedValue ));
1565
1586
@@ -1651,8 +1672,103 @@ INSTANTIATE_TEST_CASE_P(
1651
1672
},
1652
1673
kArgo3ConfigStateLength ,
1653
1674
std::vector<uint8_t > { 0xCB , 0x0C , 0x4A , 0x21 },
1654
- " Config[CH#0]: Model: 2 (WREM3), Key: 12, Value: 74" )),
1675
+ " Config[CH#0]: Model: 2 (WREM3), Key: 12, Value: 74" ),
1676
+
1677
+
1678
+ // ////
1679
+ // WREM2 test cases
1680
+ // ////
1681
+ ArgoE2ETestParam(
1682
+ std::vector<uint16_t > {
1683
+ 6390 , 3192 , 430 , 848 , 424 , 852 , 432 , 2124 , 424 , 2132 , 426 , 850 , 422 ,
1684
+ 2134 , 424 , 852 , 432 , 2124 , 424 , 2132 , 426 , 852 , 432 , 2122 , 424 , 852 ,
1685
+ 432 , 2124 , 424 , 2132 , 426 , 2130 , 428 , 2126 , 432 , 846 , 426 , 850 , 422 ,
1686
+ 854 , 430 , 848 , 426 , 850 , 432 , 844 , 428 , 850 , 424 , 2130 , 426 , 2128 , 430 ,
1687
+ 848 , 426 , 852 , 432 , 2122 , 424 , 2132 , 426 , 850 , 422 , 854 , 430 , 2126 , 432 ,
1688
+ 844 , 430 , 2126 , 432 , 2124 , 424 , 852 , 430 , 848 , 426 , 850 , 424 , 854 , 428 ,
1689
+ 848 , 424 , 852 , 432 , 844 , 430 , 848 , 424 , 852 , 432 , 846 , 428 , 2128 , 430 ,
1690
+ 2124 , 434 , 2122 , 424 , 852 , 432 , 846 , 428 , 850 , 424 , 854 , 430 , 846 , 426 ,
1691
+ 850 , 422 , 854 , 430 , 848 , 426 , 2130 , 430 , 2126 , 430 , 2124 , 422 , 2132 ,
1692
+ 426 , 2130 , 428 , 2126 , 430 , 2124 , 422 , 2132 , 426 , 2128 , 430 , 2126 , 432 ,
1693
+ 2124 , 424 , 2130 , 426 , 2128 , 430 , 848 , 426 , 852 , 432 , 844 , 428 , 848 , 424 ,
1694
+ 852 , 432 , 846 , 428 , 850 , 424 , 854 , 430 , 846 , 426 , 850 , 434 , 844 , 430 ,
1695
+ 848 , 424 , 2130 , 428 , 850 , 424 , 854 , 430 , 846 , 426 , 850 , 422 , 854 , 430 ,
1696
+ 848 , 426 , 2128 , 428 , 2128 , 430
1697
+ },
1698
+ kArgoBits ,
1699
+ std::vector<uint8_t > { 0xAC , 0xF5 , 0x80 , 0x99 , 0x06 , 0xE0 , 0x00 , 0xFF ,
1700
+ 0x1F , 0x00 , 0x02 , 0x03 },
1701
+ " Model: 1 (WREM2), Power: Off, Mode: 0 (Cool), Fan: 3 (Max), Temp: 10C, "
1702
+ " Sensor Temp: 24C, Max: Off, IFeel: Off, Night: Off" ,
1703
+ argo_ac_remote_model_t ::SAC_WREM2),
1704
+
1705
+
1706
+ ArgoE2ETestParam(
1707
+ std::vector<uint16_t > {
1708
+ 6420 , 3164 , 426 , 850 , 422 , 854 , 462 , 2092 , 432 , 2122 , 424 , 852 , 432 ,
1709
+ 2124 , 422 , 854 , 462 , 2092 , 434 , 2122 , 458 , 820 , 454 , 2102 , 424 , 854 ,
1710
+ 430 , 2126 , 454 , 2100 , 458 , 2096 , 428 , 2126 , 432 , 846 , 460 , 816 , 424 ,
1711
+ 854 , 464 , 814 , 426 , 852 , 432 , 844 , 430 , 848 , 490 , 2066 , 426 , 2128 , 452 ,
1712
+ 826 , 458 , 818 , 454 , 2100 , 458 , 2098 , 462 , 816 , 422 , 854 , 452 , 2102 , 456 ,
1713
+ 822 , 462 , 2092 , 454 , 2100 , 458 , 820 , 454 , 824 , 460 , 816 , 456 , 820 , 452 ,
1714
+ 824 , 460 , 818 , 422 , 854 , 462 , 814 , 458 , 818 , 454 , 822 , 428 , 2126 , 454 ,
1715
+ 2102 , 456 , 2098 , 458 , 818 , 432 , 844 , 462 , 816 , 458 , 820 , 454 , 824 , 460 ,
1716
+ 816 , 458 , 820 , 452 , 824 , 426 , 2128 , 462 , 2092 , 454 , 2102 , 456 , 2098 ,
1717
+ 458 , 2096 , 462 , 2092 , 454 , 2102 , 456 , 2098 , 426 , 2128 , 464 , 2092 , 456 ,
1718
+ 2100 , 456 , 2098 , 460 , 2094 , 452 , 824 , 460 , 818 , 456 , 820 , 462 , 814 , 458 ,
1719
+ 818 , 454 , 824 , 460 , 816 , 456 , 820 , 452 , 2102 , 456 , 822 , 462 , 816 , 458 ,
1720
+ 820 , 454 , 2102 , 424 , 854 , 452 , 824 , 460 , 818 , 456 , 822 , 462 , 814 , 458 ,
1721
+ 2098 , 460 , 2094 , 454 , 2102 , 424
1722
+ },
1723
+ kArgoBits ,
1724
+ std::vector<uint8_t > { 0xAC , 0xF5 , 0x80 , 0x99 , 0x06 , 0xE0 , 0x00 , 0xFF ,
1725
+ 0x1F , 0x20 , 0x82 , 0x03 },
1726
+ " Model: 1 (WREM2), Power: On, Mode: 0 (Cool), Fan: 3 (Max), Temp: 10C, "
1727
+ " Sensor Temp: 24C, Max: Off, IFeel: Off, Night: Off" ,
1728
+ argo_ac_remote_model_t ::SAC_WREM2),
1729
+
1730
+
1731
+ ArgoE2ETestParam(
1732
+ std::vector<uint16_t > {
1733
+ 6388 , 3196 , 428 , 850 , 424 , 852 , 430 , 2124 , 424 , 2132 , 426 , 852 , 432 ,
1734
+ 2124 , 424 , 854 , 430 , 2124 , 422 , 2132 , 426 , 852 , 434 , 2122 , 424 , 852 ,
1735
+ 432 , 2124 , 422 , 2134 , 424 , 2130 , 428 , 2126 , 432 , 846 , 428 , 850 , 422 ,
1736
+ 854 , 430 , 848 , 426 , 852 , 432 , 844 , 428 , 848 , 424 , 2130 , 428 , 2128 , 430 ,
1737
+ 848 , 424 , 852 , 432 , 2124 , 424 , 2132 , 426 , 850 , 422 , 854 , 430 , 2126 , 432 ,
1738
+ 846 , 428 , 2128 , 430 , 2124 , 422 , 854 , 428 , 848 , 424 , 852 , 432 , 846 , 428 ,
1739
+ 850 , 424 , 854 , 430 , 846 , 426 , 850 , 422 , 854 , 430 , 848 , 426 , 2130 , 428 ,
1740
+ 2128 , 430 , 2124 , 422 , 854 , 484 , 794 , 424 , 852 , 432 , 844 , 428 , 850 , 424 ,
1741
+ 852 , 430 , 846 , 426 , 850 , 422 , 2132 , 426 , 2130 , 428 , 2126 , 430 , 2124 ,
1742
+ 422 , 2132 , 426 , 2130 , 428 , 2126 , 430 , 2124 , 434 , 2122 , 426 , 2130 , 428 ,
1743
+ 2126 , 430 , 2124 , 434 , 2122 , 424 , 852 , 432 , 844 , 428 , 850 , 422 , 854 , 430 ,
1744
+ 846 , 426 , 852 , 432 , 844 , 428 , 848 , 424 , 2130 , 428 , 848 , 424 , 2132 , 426 ,
1745
+ 852 , 432 , 2122 , 424 , 852 , 432 , 846 , 428 , 850 , 424 , 854 , 430 , 846 , 426 ,
1746
+ 2128 , 430 , 2126 , 432 , 846 , 428
1747
+ },
1748
+ kArgoBits ,
1749
+ std::vector<uint8_t > { 0xAC , 0xF5 , 0x80 , 0x99 , 0x06 , 0xE0 , 0x00 , 0xFF ,
1750
+ 0x1F , 0xA0 , 0x82 , 0x01 },
1751
+ " Model: 1 (WREM2), Power: On, Mode: 0 (Cool), Fan: 3 (Max), Temp: 10C, "
1752
+ " Sensor Temp: 24C, Max: Off, IFeel: On, Night: Off" ,
1753
+ argo_ac_remote_model_t ::SAC_WREM2),
1754
+
1755
+
1756
+
1757
+ ArgoE2ETestParam(
1758
+ std::vector<uint16_t > {
1759
+ 6388 , 3194 , 430 , 848 , 426 , 852 , 432 , 2122 , 424 , 2130 , 428 , 850 , 424 ,
1760
+ 2132 , 426 , 850 , 434 , 2122 , 424 , 2130 , 426 , 850 , 424 , 2132 , 426 , 852 ,
1761
+ 422 , 2132 , 424 , 2130 , 428 , 2128 , 430 , 2124 , 422 , 854 , 430 , 2126 , 434 ,
1762
+ 844 , 428 , 2126 , 432 , 846 , 426 , 2128 , 430 , 846 , 426 , 2130 , 428 , 2126 ,
1763
+ 432 , 2122 , 424 , 854 , 432 , 2124 , 424 , 854 , 430 , 846 , 426 , 2130 , 428 ,
1764
+ 848 , 424
1765
+ },
1766
+ kArgoShortBits ,
1767
+ std::vector<uint8_t > { 0xAC , 0xF5 , 0xAA , 0x4B },
1768
+ " Model: 1 (WREM2), Sensor Temp: 25C" ,
1769
+ argo_ac_remote_model_t ::SAC_WREM2)),
1655
1770
[](const testing::TestParamInfo<ArgoE2ETestParam>& info) {
1656
- return bytesToHexString (info.param .expectedEncodedValue );
1771
+ return irutils::modelToStr (decode_type_t ::ARGO, info.param .expectedModel )
1772
+ + " _" + bytesToHexString (info.param .expectedEncodedValue );
1657
1773
}
1658
1774
);
0 commit comments