MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / decodeJVCMSB

Method decodeJVCMSB

src/ir_JVC.hpp:166–214  ·  view source on GitHub ↗

* Old deprecated functions, kept for backward compatibility to old 2.0 tutorials *********************************************************************************/

Source from the content-addressed store, hash-verified

164 * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials
165 *********************************************************************************/
166bool IRrecv::decodeJVCMSB(decode_results *aResults) {
167 unsigned int offset = 1; // Skip first space
168
169 // Check for repeat
170 if ((aResults->rawlen - 1 == 33) && matchMark(aResults->rawbuf[offset], JVC_BIT_MARK)
171 && matchMark(aResults->rawbuf[aResults->rawlen - 1], JVC_BIT_MARK)) {
172 aResults->bits = 0;
173 aResults->value = 0xFFFFFFFF;
174 decodedIRData.flags = IRDATA_FLAGS_IS_REPEAT;
175 decodedIRData.protocol = JVC;
176 return true;
177 }
178
179 // Initial mark
180 if (!matchMark(aResults->rawbuf[offset], JVC_HEADER_MARK)) {
181 return false;
182 }
183 offset++;
184
185 // Check we have enough data - +3 for start bit mark and space + stop bit mark
186 if (aResults->rawlen <= (2 * JVC_BITS) + 3) {
187 DEBUG_PRINT(F("Data length="));
188 DEBUG_PRINT(aResults->rawlen);
189 DEBUG_PRINTLN(F(" is too small. >= 36 is required."));
190 return false;
191 }
192
193 // Initial space
194 if (!matchSpace(aResults->rawbuf[offset], JVC_HEADER_SPACE)) {
195 return false;
196 }
197 offset++;
198
199 decodePulseDistanceWidthData(JVC_BITS, offset, JVC_BIT_MARK, JVC_ONE_SPACE, 0, PROTOCOL_IS_MSB_FIRST);
200
201 // Stop bit
202 if (!matchMark(aResults->rawbuf[offset + (2 * JVC_BITS)], JVC_BIT_MARK)) {
203 DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
204 return false;
205 }
206
207 // Success
208 aResults->value = decodedIRData.decodedRawData;
209 aResults->bits = JVC_BITS;
210 aResults->decode_type = JVC;
211 decodedIRData.protocol = JVC;
212
213 return true;
214}
215
216/**
217 * With Send sendJVCMSB() you can send your old 32 bit codes.

Callers

nothing calls this directly

Calls 2

matchMarkFunction · 0.85
matchSpaceFunction · 0.85

Tested by

no test coverage detected