software/drivers/sd8887/src/wlan/mapp/wifidirectutl/wifi_display.c
/**
 * @brief Checkes a particular input for validatation for wifidisplay.
 *
 * @param cmd      Type of input
 * @param argc     Number of arguments
 * @param argv     Pointer to the arguments
 * @return         SUCCESS or FAILURE
 */
@brief Checkes a particular input for validatation for wifidisplay.
@param cmd      Type of input
@param argc     Number of arguments
@param argv     Pointer to the arguments
@return         SUCCESS or FAILURE
@brief Checkes a particular input for validatation for wifidisplay . @param cmd Type of input @param argc Number of arguments @param argv Pointer to the arguments @return SUCCESS or FAILURE
int
is_wifidisplay_input_valid(display_valid_inputs cmd, int argc, char *argv[])
{
	if (argc == 0)
		return FAILURE;
	if (argc != 1) {
		printf("ERR:Incorrect number of arguments\n");
		return FAILURE;
	}
	switch (cmd) {
	case WFD_DEVICE_INFO:
		if ((ISDIGIT(argv[0]) == 0) || (atoi(argv[0]) < 0)
		    || (atoi(argv[0]) > ((1 << 10) - 1))) {
			printf("ERR:Coupled sink paramater must be > 0 and < %d", ((1 << 10) - 1));
			return FAILURE;
		}
		if ((atoi(argv[0]) & 48) > 16) {
			printf("ERR:Coupled sink paramater must not have bit 4 and 5 equal to 10 or 11 ");
			return FAILURE;
		}
		break;
	case WFD_SESSION_MGMT_CONTROL_PORT:
	case WFD_DEVICE_THROUGHPUT:
		if ((ISDIGIT(argv[0]) == 0) || (atoi(argv[0]) < 0)
		    || (atoi(argv[0]) > ((1 << 16) - 1))) {
			printf("ERR:Paramater must be > 0 and < %d",
			       ((1 << 16) - 1));
			return FAILURE;
		}
		break;
	case WFD_COUPLED_SINK:
		if ((ISDIGIT(argv[0]) == 0) || (atoi(argv[0]) < 0)
		    || (atoi(argv[0]) > 2)) {
			printf("ERR:Coupled sink paramater must be > 0 and < 3");
			return FAILURE;
		}
		break;
	}
	return SUCCESS;
}
int is_wifidisplay_input_valid ( display_valid_inputs cmd , int argc , char * argv [ ] ) { if ( argc == 0 ) return FAILURE ; if ( argc != 1 ) { printf ( " \n " ) ; return FAILURE ; } switch ( cmd ) { case WFD_DEVICE_INFO : if ( ( ISDIGIT ( argv [ 0 ] ) == 0 ) || ( atoi ( argv [ 0 ] ) < 0 ) || ( atoi ( argv [ 0 ] ) > ( ( 1 << 10 ) - 1 ) ) ) { printf ( " " , ( ( 1 << 10 ) - 1 ) ) ; return FAILURE ; } if ( ( atoi ( argv [ 0 ] ) & 48 ) > 16 ) { printf ( " " ) ; return FAILURE ; } break ; case WFD_SESSION_MGMT_CONTROL_PORT : case WFD_DEVICE_THROUGHPUT : if ( ( ISDIGIT ( argv [ 0 ] ) == 0 ) || ( atoi ( argv [ 0 ] ) < 0 ) || ( atoi ( argv [ 0 ] ) > ( ( 1 << 16 ) - 1 ) ) ) { printf ( " " , ( ( 1 << 16 ) - 1 ) ) ; return FAILURE ; } break ; case WFD_COUPLED_SINK : if ( ( ISDIGIT ( argv [ 0 ] ) == 0 ) || ( atoi ( argv [ 0 ] ) < 0 ) || ( atoi ( argv [ 0 ] ) > 2 ) ) { printf ( " " ) ; return FAILURE ; } break ; } return SUCCESS ; }
@brief Checkes a particular input for validatation for wifidisplay.
@brief Checkes a particular input for validatation for wifidisplay .
/*Bits 10-15 are reserved for device info */ /*bits 4 and 5 values 10 and 11 are reserved */ /*Maximum value of coupled sink is 2 */