| 1 | /* IRLib_P06_JVC.h |
|---|
| 2 | * Part of IRLib Library for Arduino receiving, decoding, and sending |
|---|
| 3 | * infrared signals. See COPYRIGHT.txt and LICENSE.txt for more information. |
|---|
| 4 | */ |
|---|
| 5 | /* |
|---|
| 6 | * JVC omits the mark/space header on repeat sending. Therefore we multiply |
|---|
| 7 | * it by 0 if it's a repeat. The only device I had to test this protocol was |
|---|
| 8 | * an old JVC VCR. It would only work if at least 2 frames are sent separated |
|---|
| 9 | * by 45 time periods of "space". Therefore you should call this routine once |
|---|
| 10 | * with "first=true" and it will send a first frame followed by one repeat |
|---|
| 11 | * frame. If First==false, it will only send a single repeat frame. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef IRLIB_PROTOCOL_06_H |
|---|
| 15 | #define IRLIB_PROTOCOL_06_H |
|---|
| 16 | #define IR_SEND_PROTOCOL_06 case 06: IRsendJVC::send(data,(bool)data2); break; |
|---|
| 17 | #define IR_DECODE_PROTOCOL_06 if(IRdecodeJVC::decode()) return true; |
|---|
| 18 | #ifdef IRLIB_HAVE_COMBO |
|---|
| 19 | #define PV_IR_DECODE_PROTOCOL_06 ,public virtual IRdecodeJVC |
|---|
| 20 | #define PV_IR_SEND_PROTOCOL_06 ,public virtual IRsendJVC |
|---|
| 21 | #else |
|---|
| 22 | #define PV_IR_DECODE_PROTOCOL_06 public virtual IRdecodeJVC |
|---|
| 23 | #define PV_IR_SEND_PROTOCOL_06 public virtual IRsendJVC |
|---|
| 24 | #endif |
|---|
| 25 | |
|---|
| 26 | #ifdef IRLIBSENDBASE_H |
|---|
| 27 | class IRsendJVC: public virtual IRsendBase { |
|---|
| 28 | public: |
|---|
| 29 | void send(uint32_t data, bool first=true) { |
|---|
| 30 | sendGeneric(data, 16,525*16*first, 525*8*first, 525, 525,525*3, 525, 38, true); |
|---|
| 31 | space(525*45); |
|---|
| 32 | if(first) { |
|---|
| 33 | sendGeneric(data, 16,0,0, 525, 525,525*3, 525, 38, true); |
|---|
| 34 | space(525*45); |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | }; |
|---|
| 38 | #endif //IRLIBSENDBASE_H |
|---|
| 39 | |
|---|
| 40 | #ifdef IRLIBDECODEBASE_H |
|---|
| 41 | class IRdecodeJVC: public virtual IRdecodeBase { |
|---|
| 42 | public: |
|---|
| 43 | bool decode(void) { |
|---|
| 44 | // JVC does not send any header if there is a repeat. |
|---|
| 45 | // first try with the header. If that fails, try without. |
|---|
| 46 | IRLIB_ATTEMPT_MESSAGE(F("JVC")); |
|---|
| 47 | if(!decodeGeneric(36,525*16,525*8,525,525*3,525)) { |
|---|
| 48 | IRLIB_ATTEMPT_MESSAGE(F("JVC Repeat")); |
|---|
| 49 | if (recvGlobal.decodeLength==34) { |
|---|
| 50 | if(!decodeGeneric(0,525,0,525,525*3,525)) { |
|---|
| 51 | return IRLIB_REJECTION_MESSAGE(F("JVC repeat failed generic")); |
|---|
| 52 | } else { |
|---|
| 53 | //If this is a repeat code then IRdecodeBase::decodeGeneric fails to add the most significant bit |
|---|
| 54 | if (MATCH(recvGlobal.decodeBuffer[2],(525*3))) { |
|---|
| 55 | value |= 0x8000; |
|---|
| 56 | } else { |
|---|
| 57 | if (!MATCH(recvGlobal.decodeBuffer[2],525)) return DATA_SPACE_ERROR(525); |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | bits++; |
|---|
| 61 | } |
|---|
| 62 | else return RAW_COUNT_ERROR; |
|---|
| 63 | } |
|---|
| 64 | address=(recvGlobal.decodeLength==36); |
|---|
| 65 | protocolNum =JVC; |
|---|
| 66 | return true; |
|---|
| 67 | } |
|---|
| 68 | }; |
|---|
| 69 | #endif //IRLIBDECODEBASE_H |
|---|
| 70 | |
|---|
| 71 | #define IRLIB_HAVE_COMBO |
|---|
| 72 | |
|---|
| 73 | #endif //IRLIB_PROTOCOL_06_H |
|---|