void ERxIRControllerService::Execute(ERxServiceContext& context) { // Command Format // <IR_SEND_xxx><SPACE><IR_CODE_VALUE>[<OTHER_PARAMETERS>] bool bHandled = true; switch (context.GetCommandId()) { case IR_SEND_NEC: { const unsigned long codeValue = context.GetCommandParameterStream().parseULong(); #ifdef DEBUG_IR Serial.print(codeValue, HEX); Serial.print("\r\n"); #endif SendIR(codeValue, 32, NEC, false); } break; case IR_SEND_SONY: { const unsigned long codeValue = context.GetCommandParameterStream().parseULong(); SendIR(codeValue, 12, SONY, false); } break; case IR_SEND_RC5: { const unsigned long codeValue = context.GetCommandParameterStream().parseULong(); SendIR(codeValue, 12, RC5, false); } break; case IR_SEND_RC6: { const unsigned long codeValue = context.GetCommandParameterStream().parseULong(); SendIR(codeValue, 20, RC6, false); } break; default: bHandled = false; break; } if(bHandled) { context.SetIsCommandExecuted(true); context.SetIsCommandSuccess(true); context.GetResultStream().print("OK\r\n"); } }
/******************************************************************** * Function: void ProcessIO(void) * Overview: This function is a place holder for other user * routines. It is a mixture of both USB and * non-USB tasks. *******************************************************************/ void ProcessIO(void) { LED1_PORT = 0; IRLED_PORT = 0; ButtonProc(); ReadIR(); SendIR(); }