nRF5 SDK for Thread v0.11.0
Data Structures | Macros | Typedefs | Functions
Network Co-Processor

This module includes functions that control the Thread stack's execution. More...

Data Structures

struct  otNcpLegacyHandlers
 

Macros

#define OT_NCP_LEGACY_ULA_PREFIX_LENGTH   8
 Legacy ULA size (in bytes)
 

Typedefs

typedef bool(* otNcpDelegateAllowPeekPoke )(uint32_t aAddress, uint16_t aCount)
 
typedef void(* otNcpHandlerStartLegacy )(void)
 
typedef void(* otNcpHandlerStopLegacy )(void)
 
typedef void(* otNcpHandlerJoinLegacyNode )(const otExtAddress *aExtAddress)
 
typedef void(* otNcpHandlerSetLegacyUlaPrefix )(const uint8_t *aUlaPrefix)
 
typedef struct otNcpLegacyHandlers otNcpLegacyHandlers
 

Functions

void otNcpInit (otInstance *aInstance)
 
otError otNcpStreamWrite (int aStreamId, const uint8_t *aDataPtr, int aDataLen)
 Send data to the host via a specific stream. More...
 
otError otNcpRegisterPeekPokeDelagates (otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
 
void otNcpHandleLegacyNodeDidJoin (const otExtAddress *aExtAddr)
 
void otNcpHandleDidReceiveNewLegacyUlaPrefix (const uint8_t *aUlaPrefix)
 
void otNcpRegisterLegacyHandlers (const otNcpLegacyHandlers *aHandlers)
 
void otNcpPlatLogv (otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list ap)
 

Detailed Description

This module includes functions that control the Thread stack's execution.

Typedef Documentation

typedef bool(* otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount)

Defines delegate (function pointer) type to control behavior of peek/poke operation.

This delegate function is called to decide whether to allow peek or poke of a specific memory region. It is used if NCP support for peek/poke commands is enabled.

Parameters
[in]aAddressStart address of memory region.
[in]aCountNumber of bytes to peek or poke.
Returns
TRUE to allow peek/poke of the given memory region, FALSE otherwise.
typedef void(* otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress)

Defines handler (function pointer) type for initiating joining process.

Parameters
[in]aExtAddressA pointer to the extended address for the node to join or NULL if desired to join any neighboring node.

Invoked to initiate a legacy join procedure to any or a specific node.

typedef void(* otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix)

Defines handler (function pointer) type for setting the legacy ULA prefix.

Parameters
[in]aUlaPrefixA pointer to buffer containing the legacy ULA prefix.

Invoked to set the legacy ULA prefix.

typedef void(* otNcpHandlerStartLegacy)(void)

Defines handler (function pointer) type for starting legacy network

Invoked to start the legacy network.

typedef void(* otNcpHandlerStopLegacy)(void)

Defines handler (function pointer) type for stopping legacy network

Invoked to stop the legacy network.

Defines a struct containing all the legacy handlers (function pointers).

Function Documentation

void otNcpHandleDidReceiveNewLegacyUlaPrefix ( const uint8_t *  aUlaPrefix)

This callback is invoked by the legacy stack to notify that the legacy ULA prefix has changed.

param[in] aUlaPrefix A pointer to the received ULA prefix.

void otNcpHandleLegacyNodeDidJoin ( const otExtAddress aExtAddr)

This callback is invoked by the legacy stack to notify that a new legacy node did join the network.

Parameters
[in]aExtAddrA pointer to the extended address of the joined node.
void otNcpInit ( otInstance aInstance)

Initialize the NCP.

Parameters
[in]aInstanceThe OpenThread instance structure.
void otNcpPlatLogv ( otLogLevel  aLogLevel,
otLogRegion  aLogRegion,
const char *  aFormat,
va_list  ap 
)

Callback to write the OpenThread Log to the NCP Spinel Tunnel.

Parameters
[in]aLogLevelThe log level.
[in]aLogRegionThe log region.
[in]aFormatA pointer to the format string.
[in]apva_list matching aFormat.
void otNcpRegisterLegacyHandlers ( const otNcpLegacyHandlers aHandlers)

This method registers a set of legacy handlers with NCP.

The set of handlers provided by the struct aHandlers are used by NCP code to start/stop legacy network. The aHandlers can be NULL to disable legacy support on NCP. Individual handlers in the given handlers struct can also be NULL.

Parameters
[in]aHandlersA pointer to a handler struct.
otError otNcpRegisterPeekPokeDelagates ( otNcpDelegateAllowPeekPoke  aAllowPeekDelegate,
otNcpDelegateAllowPeekPoke  aAllowPokeDelegate 
)

This method registers peek/poke delegate functions with NCP module.

The delegate functions are called by NCP module to decide whether to allow peek or poke of a specific memory region. If the delegate pointer is set to NULL, it allows peek/poke operation for any address.

Parameters
[in]aAllowPeekDelegateDelegate function pointer for peek operation.
[in]aAllowPokeDelegateDelegate function pointer for poke operation.
Return values
OT_ERROR_NONESuccessfully registered delegate functions.
OT_ERROR_DISABLED_FEATUREPeek/Poke feature is disabled (by a build-time configuration option).
otError otNcpStreamWrite ( int  aStreamId,
const uint8_t *  aDataPtr,
int  aDataLen 
)

Send data to the host via a specific stream.

This function attempts to send the given data to the host using the given aStreamId. This is useful for reporting error messages, implementing debug/diagnostic consoles, and potentially other types of datastreams.

The write either is accepted in its entirety or rejected. Partial writes are not attempted.

Parameters
[in]aStreamIdA numeric identifier for the stream to write to. If set to '0', will default to the debug stream.
[in]aDataPtrA pointer to the data to send on the stream. If aDataLen is non-zero, this param MUST NOT be NULL.
[in]aDataLenThe number of bytes of data from aDataPtr to send.
Return values
OT_ERROR_NONEThe data was queued for delivery to the host.
OT_ERROR_BUSYThere are not enough resources to complete this request. This is usually a temporary condition.
OT_ERROR_INVALID_ARGSThe given aStreamId was invalid.

Documentation feedback | Developer Zone | Subscribe | Updated