SimpleLink CC32xx ATCommands Library
Simplifies the implementation of Internet connectivity
NetCfg

Controls the configuration of the device addresses (i.e. IP and MAC addresses) More...

Functions

int32_t ATCmdNetcfg_getCallback (void *arg)
 Netcfg Get callback. More...
 
int32_t ATCmdNetcfg_setCallback (void *arg)
 Netcfg Set callback. More...
 

Detailed Description

Controls the configuration of the device addresses (i.e. IP and MAC addresses)

Function Documentation

§ ATCmdNetcfg_getCallback()

int32_t ATCmdNetcfg_getCallback ( void *  arg)

Netcfg Get callback.

This routine gets network configurations

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

This routine gets network configurations

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 543 of file atcmd_netcfg.c.

544 {
545  int32_t ret = 0;
546  ATCmdNetcfg_t *params;
547  uint16_t *pOption = NULL;
548 
549  params = malloc(sizeof(ATCmdNetcfg_t));
550 
551  if (params == NULL)
552  {
553  ATCmd_errorResult(ATCmd_errorAllocStr,0);
554  return -1;
555  }
556  memset(params, 0x0, sizeof(ATCmdNetcfg_t));
557 
558  /* Call the command parser */
559  ret = ATCmdNetcfg_getParse((char *)arg, params);
560 
561  if (ret < 0)
562  {
563  ATCmd_errorResult(ATCmd_errorParseStr,ret);
564  ATCmdNetcfg_getFree(params);
565  return -1;
566  }
567  if ((params->id != SL_NETCFG_IF) && (params->id != SL_NETCFG_AP_STATIONS_NUM_CONNECTED))
568  {
569  pOption = &params->option;
570  }
571 
572  /* set netapp option */
573  ret = sl_NetCfgGet(params->id,pOption,&params->len,params->value);
574 
575  if (ret < 0)
576  {
577  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
578  ATCmdNetcfg_getFree(params);
579  }
580  else
581  {
582  ATCmd_commandResult(ATCmdNetcfg_getResult,params,0);
583  ATCmd_okResult();
584  }
585 
586  return ret;
587 }

§ ATCmdNetcfg_setCallback()

int32_t ATCmdNetcfg_setCallback ( void *  arg)

Netcfg Set callback.

This routine sets network configurations

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

This routine sets network configurations

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 304 of file atcmd_netcfg.c.

305 {
306  int32_t ret = 0;
307  ATCmdNetcfg_t params;
308 
309  memset(&params, 0x0, sizeof(ATCmdNetcfg_t));
310 
311  /* Call the command parser */
312  ret = ATCmdNetcfg_setParse((char *)arg, &params);
313 
314  if (ret < 0)
315  {
316  ATCmd_errorResult(ATCmd_errorParseStr,ret);
317  ATCmdNetcfg_setFree(&params);
318  return -1;
319  }
320 
321  /* set netcfg option */
322  ret = sl_NetCfgSet(params.id,params.option,params.len,params.value);
323 
324  if (ret < 0)
325  {
326  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
327  }
328  else
329  {
330  ATCmd_okResult();
331  }
332 
333  ATCmdNetcfg_setFree(&params);
334  return ret;
335 }