Added missing freertos function needed with nimble + added function to stop echoing from client during telnet session

This commit is contained in:
Anatole SCHRAMM 2022-07-05 14:32:16 +02:00
parent c043d6702e
commit 6c617c1f82
4 changed files with 51 additions and 5 deletions

View File

@ -450,13 +450,13 @@ int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
{
if(strcmp(argv[1], "enable") == 0)
{
//shell_printf("Enabling bluetooth : %d"NEW_LINE, demo_bt_enable());
shell_printf("Enabling bluetooth test"NEW_LINE);
shell_printf("Enabling bluetooth : %d"NEW_LINE, demo_bt_enable());
//shell_printf("Enabling bluetooth test"NEW_LINE);
}
else if(strcmp(argv[1], "disable") == 0)
{
//shell_printf("Disabling bluetooth : %d"NEW_LINE, demo_bt_destroy());
shell_printf("Disabling bluetooth test"NEW_LINE);
shell_printf("Disabling bluetooth : %d"NEW_LINE, demo_bt_destroy());
//shell_printf("Disabling bluetooth test"NEW_LINE);
}
else if(strcmp(argv[1], "start_demo") == 0)
{
@ -478,6 +478,22 @@ int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
return 0;
}
int _telnet(const shell_cmd_t *pcmd, int argc, char *const argv[])
{
if(argc > 1)
{
if(strcmp(argv[1], "dont_echo") == 0)
{
shell_printf("Disabling client echo"NEW_LINE"%c%c%c"NEW_LINE, 0xFF, 0xFB, 0x01);
}
}
else
{
shell_printf("List of %s actions :"NEW_LINE"dont_echo"NEW_LINE, argv[0]);
}
return 0;
}
NANO_SHELL_ADD_CMD(system,
_system,
"Query system information",
@ -518,3 +534,7 @@ NANO_SHELL_ADD_CMD(bluetooth,
_bluetooth,
"Command to control bluetooth functionality",
" Use this command to interact use bluetooth"NEW_LINE);
NANO_SHELL_ADD_CMD(telnet,
_telnet,
"Command to set the telnet session up",
" USe this command to set telnet session parameters"NEW_LINE);

View File

@ -29,7 +29,8 @@ void network_write(char c)
{
if(send(client_sock, &c, 1, 0) < 0)
{
shell_printf("Failed to send data to client - errno(%d)."NEW_LINE, errno);
// Failed to send data to client because he probably disconnected
// or the connection got broken
}
}
}

View File

@ -514,6 +514,18 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
* @endverbatim
*/
#define xTimerChangePeriod( xTimer, xNewPeriod, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xTicksToWait ) )
/**
* Returns the time in ticks at which the timer will expire. If this is less
* than the current tick count then the expiry time has overflowed from the
* current time.
*
* @param xTimer The handle of the timer being queried.
*
* @return If the timer is running then the time in ticks at which the timer
* will next expire is returned. If the timer is not running then the return
* value is undefined.
*/
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
/**
* BaseType_t xTimerDelete( TimerHandle_t xTimer, TickType_t xTicksToWait );

View File

@ -350,6 +350,19 @@ TimerHandle_t xTimerCreateExt( const signed char *pcTimerName, portTickType xTim
return ( TimerHandle_t ) pxNewTimer;
}
/*-----------------------------------------------------------*/
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )
{
Timer_t * pxTimer = ( xTIMER * ) xTimer;
TickType_t xReturn;
configASSERT( xTimer );
xReturn = listGET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ) );
return xReturn;
}
/*-----------------------------------------------------------*/
BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait )