Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
lwipdemo.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cascoda-bm/cascoda_evbme.h"
#include "cascoda-bm/cascoda_interface.h"
#include "cascoda-bm/cascoda_serial.h"
#include "cascoda-bm/cascoda_types.h"
#include "cascoda-util/cascoda_time.h"
#include "openthread/cli.h"
#include "openthread/instance.h"
#include "openthread/link.h"
#include "openthread/thread.h"
#include "platform.h"
#include "lwip/dns.h"
#include "lwip/init.h"
#include "lwip/tcp.h"
#include "lwip-port.h"
Include dependency graph for lwipdemo.c:

Enumerations

enum  { DEMO_PORT = 51700 }
 

Functions

err_t demo_tcpconnected (void *arg, struct tcp_pcb *tpcb, err_t err)
 Callback triggered when TCP socket is connected. More...
 
void demo_tcperr (void *arg, err_t err)
 Callback triggered when the TCP socket is disconnected unexpectedly. More...
 
void demo_dnsfound (const char *name, const ip_addr_t *ipaddr, void *callback_arg)
 A callback triggered when a dns query is completed. More...
 
void handle_cli_lwipdemo (void *aContext, uint8_t aArgsLength, char *aArgs[])
 Process a CLI command to change the state of the lwip demo. More...
 
ca_error init_lwipdemo (otInstance *aInstance, struct ca821x_dev *pDeviceRef)
 Initialise the lwip demo. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEMO_PORT 

Function Documentation

◆ demo_dnsfound()

void demo_dnsfound ( const char *  name,
const ip_addr_t *  ipaddr,
void *  callback_arg 
)

A callback triggered when a dns query is completed.

Parameters
namepointer to the name that was looked up.
ipaddrpointer to an ip_addr_t containing the IP address of the hostname, or NULL if the name could not be found (or on any other error).
callback_arga user-specified callback argument passed to dns_gethostbyname

◆ demo_tcpconnected()

err_t demo_tcpconnected ( void *  arg,
struct tcp_pcb *  tpcb,
err_t  err 
)

Callback triggered when TCP socket is connected.

Parameters
argunused
tpcba pointer to the relevant socket
errthe status of the connection
Returns
ERR_OK

◆ demo_tcperr()

void demo_tcperr ( void *  arg,
err_t  err 
)

Callback triggered when the TCP socket is disconnected unexpectedly.

Parameters
arg
err

◆ handle_cli_lwipdemo()

void handle_cli_lwipdemo ( void *  aContext,
uint8_t  aArgsLength,
char *  aArgs[] 
)

Process a CLI command to change the state of the lwip demo.

Should be linked to the openthread CLI using otCliSetUserCommands.

Parameters
aContextCLI Context
aArgsLengthsize of aArgs string array
aArgsarray of arguments

◆ init_lwipdemo()

ca_error init_lwipdemo ( otInstance *  aInstance,
struct ca821x_dev pDeviceRef 
)

Initialise the lwip demo.

Should be called once at program startup.

Parameters
aInstance- Pointer to an OpenThread instance.
pDeviceRef- Pointer to initialised ca821x_device_ref struct.
Returns
CA_ERROR_SUCCESS for success.