XNCP Library Callbacks#

These callbacks are contributed by the XNCP Library plugin.

Functions#

emberAfPluginXncpIncomingCustomFrameCallback(uint8_t messageLength, uint8_t *messagePayload, uint8_t *replyPayloadLength, uint8_t *replyPayload)

Called when the NCP receives a custom EZSP message from the HOST.

bool
emberAfIncomingMessageCallback(EmberIncomingMessageType type, EmberApsFrame *apsFrame, EmberMessageBuffer message)

Called when the NCP receives an incoming Zigbee PRO message.

bool
emberAfPluginCommandHandlerPermitNcpToHostFrameCallback(uint16_t frameId, uint8_t payloadLength, uint8_t *payload)

Called when the NCP wants to inform the HOST of a callback that has been called on the NCP.

bool
emberAfPluginCommandHandlerPermitHostToNcpFrameCallback(uint16_t frameId, uint8_t payloadLength, uint8_t *payload)

Enables or disables the processing of EZSP commands on the NCP.

void
emberAfPluginXncpGetXncpInformation(uint16_t *manufacturerId, uint16_t *versionNumber)

Gets XNCP information.

Function Documentation#

emberAfPluginXncpIncomingCustomFrameCallback#

EmberStatus emberAfPluginXncpIncomingCustomFrameCallback (uint8_t messageLength, uint8_t * messagePayload, uint8_t * replyPayloadLength, uint8_t * replyPayload)

Called when the NCP receives a custom EZSP message from the HOST.

Parameters
TypeDirectionArgument NameDescription
uint8_tN/AmessageLength

The length of the messagePayload.

uint8_t *N/AmessagePayload

The custom message that was sent from the HOST. Ver.: always

uint8_t *N/AreplyPayloadLength

The length of the replyPayload. This needs to be set by the implementation for a properly formed response to be sent back to the HOST. Ver.: always

uint8_t *N/AreplyPayload

The custom message to send back to the HOST in respose to the custom message. Ver.: always

The message length and payload is passed to the callback in the first two arguments. The implementation can then fill in the replyPayload and set the replayPayloadLength to the number of bytes in the replyPayload. See documentation for the function ezspCustomFrame on sending these messages from the HOST.

Returns

  • An EmberStatus indicating the result of the custom message handling. This returned status is always the first byte of the EZSP response.


emberAfIncomingMessageCallback#

bool emberAfIncomingMessageCallback (EmberIncomingMessageType type, EmberApsFrame * apsFrame, EmberMessageBuffer message)

Called when the NCP receives an incoming Zigbee PRO message.

Parameters
TypeDirectionArgument NameDescription
EmberIncomingMessageTypeN/Atype

The EmberIncomingMessageType of the incoming message. Ver.: always

EmberApsFrame *N/AapsFrame

The EmberApsFrame recieved in the incoming message. Ver.: always

EmberMessageBufferN/Amessage

The payload of the incoming message, in the form of an ::EmberMessageBuffer. Ver.: always

This handling is done before any other action is taken by the NCP on the callback. If the function returns true, the incoming message is done being handled, and the NCP does not need to record the callback or report it to the HOST.

Returns

  • A ::bool value. If this value is true, the NCP will not handle the incoming message any further and it will not report the incoming message to the HOST. If the returned value is false, the NCP will continue to process the incoming message and the callback will also be passed to the HOST.


emberAfPluginCommandHandlerPermitNcpToHostFrameCallback#

bool emberAfPluginCommandHandlerPermitNcpToHostFrameCallback (uint16_t frameId, uint8_t payloadLength, uint8_t * payload)

Called when the NCP wants to inform the HOST of a callback that has been called on the NCP.

Parameters
TypeDirectionArgument NameDescription
uint16_tN/AframeId

The frameId of the callback. Ver.: always

uint8_tN/ApayloadLength

The length of the payload carried in the callback. Ver.: always

uint8_t *N/Apayload

The actual payload carried by the callback. Ver.: always

If this function returns false, the NCP will not notify the HOST of the callback. If the function returns true, then the NCP will continue scheduling the notification of the HOST regarding the callback.

Returns

  • A ::bool value. If the value is false, then the NCP will not notify the HOST of the callback. If the return value is true, the NCP will continue scheduling the notification of the HOST regarding the callback.


emberAfPluginCommandHandlerPermitHostToNcpFrameCallback#

bool emberAfPluginCommandHandlerPermitHostToNcpFrameCallback (uint16_t frameId, uint8_t payloadLength, uint8_t * payload)

Enables or disables the processing of EZSP commands on the NCP.

Parameters
TypeDirectionArgument NameDescription
uint16_tN/AframeId

The EZSP frame ID of the message. Ver.: always

uint8_tN/ApayloadLength

The length of the payload of the EZSP message. Ver.: always

uint8_t *N/Apayload

The EZSP message payload. Ver.: always

The application can use this callback to enable or disable the processing of EZSP commands on the NCP. If this function returns true, the frame will be handled by the NCP in a normal manner. If this function returns false, the NCP will disregard this command and respond to the HOST that it is an invalid frame.

Returns

  • A ::bool value indicating whether or not the frame will continue to be handled. If this function returns true, the frame will be handled by the NCP in a normal manner. If this function returns false, then the NCP will disregard this command and respond to the HOST that it is an invalid frame.


emberAfPluginXncpGetXncpInformation#

void emberAfPluginXncpGetXncpInformation (uint16_t * manufacturerId, uint16_t * versionNumber)

Gets XNCP information.

Parameters
TypeDirectionArgument NameDescription
uint16_t *N/AmanufacturerId

The version number of the NCP application.

uint16_t *N/AversionNumber

The manufacturer ID of the NCP application.

This callback enables users to communicate the version number and manufacturer ID of their NCP application to the framework. This information is needed for the EZSP command frame called getXncpInfo. This callback will be called when that frame is received so that the application can report its version number and manufacturer ID to be sent back to the HOST.