/*! * \brief The set bicolor ledb2 value command: set the value of the bicolor ledb2. * Takes up to six parameters * the first parameter is the green parameter, the second parameter is its value in [0,255], * the third parameter is the red parameter, the fourth parameter is its value in [0,255], * the fifth is the time parameter(optional), the sixth is the time value(optional) expressed in seconds. * Format: set_actuator_value actuator=actuatorname green=value red=value [time=date] * * \note This function must be of the type pfShellCmd defined by the shell module. * * \param xModId Input. The module that is calling this function. * \param ac Input. The argument counter. For this command, should be * at least 4, at most 6. * \param av Input. The argument vector. * \param ppcStringReply Input/Output. The response string. * If Input is NULL, no response string will be output. * Else a malloc for the response string is performed here; * the caller must free this string. * * \return the status of the command execution. */ eExecStatus e_ledb2_set_value( eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply ) { /* 1) Check the input. */ // i) Arguments: at least 4, at most 6. if( ( 4 > ac ) || ( 6 < ac ) ) { // Syntax error. *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } // ii) Check that the 1st arg is 'green' and that the 3rd is 'red'. if( strcmp( (char *)av[0], "green" ) || strcmp( (char *)av[2], "red" )) { *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } // iii) If there is a fifth parameter, check that it is equal to "time" and // record a new scheduling. if( 6 == ac ) { return( e_actuator_ScheduleCmdSet( CPTIME_SCHEDCMDID_SETLEDB2VAL, ac, av, ppcStringReply ) ); } /* 2) Set the val. */ LED_Set_Intensity( LEDB2G, atoi( (char *)av[1] ) ); LED_Set_Intensity( LEDB2R, atoi( (char *)av[3] ) ); return( SHELL_EXECSTATUS_OK ); }
/*! * \brief Set the user msg area of the lcd. * Takes up to four parameters * the first parameter is the usrmsg parameter, the second parameter is its value, * the third is the time parameter(optional), the fourth is the time value(optional). * Format: set_actuator_value actuator=lcd usrmsg=msg [time=date] * * \param xModId Input. The module that is calling this function. * \param ac Input. The argument counter. For this command, should be * at least 2, at most 4. * \param av Input. The argument vector. * \param ppcStringReply Input/Output. The response string. * If Input is NULL, no response string will be output. * If the action is successful, no response string is output. * If the action failed, a response string is output. * * \return the status of the command execution. */ eExecStatus e_lcd_set_value( eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply ) { /* 1) Check the input. */ // i) Arguments: at least 2, at most 4. if( ( 2 > ac ) || ( 4 < ac ) ) { // Syntax error. *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } // ii) Check that the 1st arg is 'usrmsg'. if (strcmp((char *)av[0] , "usrmsg")) { // Syntax error. *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_OK_NO_FREE ); } // iii) If there is a third parameter, check that it is equal to "time" and // record a new scheduling. if( 4 == ac ) { return( e_actuator_ScheduleCmdSet( CPTIME_SCHEDCMDID_SETLCDVAL, ac, av, ppcStringReply ) ); } // Display the user msg. #ifdef MMILCD_ENABLE vMMI_UserMessDisplay((portCHAR *)av[1]); return( SHELL_EXECSTATUS_OK ); #else *ppcStringReply = (signed portCHAR *)LCD_ERRMSG_UNAVAILABLE; return( SHELL_EXECSTATUS_OK_NO_FREE ); #endif }
/*! * \brief The set monocolor led2 value command: set the value of the monocolor led2. * Takes up to four parameters * the first parameter is the state parameter, the second parameter is its value(on/off), * the third is the time parameter(optional), the fourth is the time value(optional). * Format: set_actuator_value actuator=actuatorname state=value [time=date] * * \note This function must be of the type pfShellCmd defined by the shell module. * * \param xModId Input. The module that is calling this function. * \param ac Input. The argument counter. For this command, should be * at least 2, at most 4. * \param av Input. The argument vector. * \param ppcStringReply Input/Output. The response string. * If Input is NULL, no response string will be output. * Else a malloc for the response string is performed here; * the caller must free this string. * * \return the status of the command execution. */ eExecStatus e_ledm2_set_value( eModId xModId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply ) { /* 1) Check the input. */ // i) Arguments: at least 2, at most 4. if( ( 2 > ac ) || ( 4 < ac ) ) { // Syntax error. *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } // ii) Check that the 1st arg is state. if( strcmp( (char *)av[0], "state" ) ) { *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } // iii) If there is a third parameter, check that it is equal to "time" and // record a new scheduling. if( 4 == ac ) { return( e_actuator_ScheduleCmdSet( CPTIME_SCHEDCMDID_SETLEDM2VAL, ac, av, ppcStringReply ) ); } if( !strcmp( (char *)av[1], (char *)CPLED_ON_STR ) ) { LED_On( LEDM2 ); } else if( !strcmp( (char *)av[1], (char *)CPLED_OFF_STR ) ) { LED_Off( LEDM2 ); } else { *ppcStringReply = (signed portCHAR *)ACTUATOR_ERRMSG_SETVAL_SYNTAXERROR; return( SHELL_EXECSTATUS_KO ); } return( SHELL_EXECSTATUS_OK ); }