# znp_simple_app_utils.c File Reference

Utilities for ZNP simple application examples. More...

`#include "../HAL/hal.h"`
`#include "../ZNP/znp_interface.h"`
`#include "../Common/utilities.h"`
`#include "../Common/printf.h"`
`#include "../ZNP/af_zdo.h"`
`#include "../ZNP/znp_commands.h"`
`#include "znp_simple_app_utils.h"`
`#include "../ZNP/znp_interface_spi.h"`

## Defines
#define | WAIT_FOR_DEVICE_STATE_TIMEOUT 4000000l
## Functions
void | pollAndDisplay ()
signed int | waitForDeviceState (unsigned char expectedState)
signed int | startZnp (unsigned char deviceType)
## Variables
unsigned char | znpBuf [100]
signed int | znpResult

## Detailed Description

Utilities for ZNP simple application examples.

See also:
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  603

Author
  dsmith

Date
  2010-06-16 13:10:13 -0700 (Wed, 16 Jun 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

## Function Documentation

void pollAndDisplay | ( |  | ) |

Poll the ZNP for any messages and display them to the console.

Precondition:
  SRDY went LOW indicating data is ready

signed int startZnp | ( | unsigned char | deviceType | ) |

Attempts to start the ZNP.

Parameters:

  | the | type of device we're starting, e.g. ROUTER

Postcondition:
  znpResult contains the ZNP library error code, if any.

Returns:
  ZNP_SUCCESS if successful, else an error code indicating where it failed.

See also:
  Communications Examples for more information about each of these steps.

signed int waitForDeviceState | ( | unsigned char | expectedState | ) |

Wait until a message is received. Exits if received message is a ZDO_STATE_CHANGE_IND and the state matches what we want. Else loops.

Parameters:

  | expectedState | the deviceState we are expecting - DEV_ZB_COORD etc.

Returns:
  0 if success, -1 if timeout

All Data Structures Files Functions Variables Defines