main/duktape_event.c
void event_newCommandLineEvent(
		char *commandData, // The data received from the command input.
		size_t commandLength, // The length of the data received.
		int fromKeyboard // True if it came from the keyboard
	) {
	esp32_duktape_event_t event;

	if (commandLength == 0 || commandData == NULL) {
		LOGE("event_newCommandLineEvent: problem ... length of command was %d which should be > 0 or commandData was NULL=%s ", (int)commandLength, commandData==NULL?"yes":"no");
		return;
	}
	assert(commandLength > 0);
	assert(commandData != NULL);

	event.commandLine.type = ESP32_DUKTAPE_EVENT_COMMAND_LINE;
	event.commandLine.commandLine = malloc(commandLength);
	assert(event.commandLine.commandLine != NULL);

	memcpy(event.commandLine.commandLine, commandData, commandLength);
	event.commandLine.commandLineLength = commandLength;
	event.commandLine.fromKeyboard = fromKeyboard;

	postEvent(&event, false); // Post the event.
}
/**
 * Post a new command line event.  The commandData is expected to have been
 * malloced() and should NOT be freed by the caller.  It will be freed
 * when the event has completed being processed.
 */
Post a new command line event.  The commandData is expected to have been
malloced() and should NOT be freed by the caller.  It will be freed
when the event has completed being processed.
Post a new command line event . The commandData is expected to have been malloced () and should NOT be freed by the caller . It will be freed when the event has completed being processed .
void event_newCommandLineEvent(
		char *commandData, 
		size_t commandLength, 
		int fromKeyboard 
	) {
	esp32_duktape_event_t event;
	if (commandLength == 0 || commandData == NULL) {
		LOGE("event_newCommandLineEvent: problem ... length of command was %d which should be > 0 or commandData was NULL=%s ", (int)commandLength, commandData==NULL?"yes":"no");
		return;
	}
	assert(commandLength > 0);
	assert(commandData != NULL);
	event.commandLine.type = ESP32_DUKTAPE_EVENT_COMMAND_LINE;
	event.commandLine.commandLine = malloc(commandLength);
	assert(event.commandLine.commandLine != NULL);
	memcpy(event.commandLine.commandLine, commandData, commandLength);
	event.commandLine.commandLineLength = commandLength;
	event.commandLine.fromKeyboard = fromKeyboard;
	postEvent(&event, false); 
}
void event_newCommandLineEvent ( char * commandData , size_t commandLength , int fromKeyboard ) { esp32_duktape_event_t event ; if ( commandLength == 0 || commandData == NULL ) { LOGE ( " " , ( int ) commandLength , commandData == NULL ? " " : " " ) ; return ; } assert ( commandLength > 0 ) ; assert ( commandData != NULL ) ; event . commandLine . type = ESP32_DUKTAPE_EVENT_COMMAND_LINE ; event . commandLine . commandLine = malloc ( commandLength ) ; assert ( event . commandLine . commandLine != NULL ) ; memcpy ( event . commandLine . commandLine , commandData , commandLength ) ; event . commandLine . commandLineLength = commandLength ; event . commandLine . fromKeyboard = fromKeyboard ; postEvent ( & event , false ) ; }
Post a new command line event.
Post a new command line event .
// The data received from the command input. // The length of the data received. // True if it came from the keyboard // Post the event.