# Atmel Software Framework

nwk.h File Reference

Network layer public interface.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission.
4. This software may only be redistributed and used in connection with an Atmel microcontroller product.

THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <stdint.h>
#include <stdbool.h>
#include "sysConfig.h"
#include "nwkRoute.h"
#include "nwkGroup.h"
#include "nwkSecurity.h"
#include "nwkDataReq.h"

## Data Structures

struct  NwkIb_t

#define NWK_ENDPOINTS_AMOUNT   16

enum  NWK_Status_t {
NWK_SUCCESS_STATUS = 0x00,
NWK_ERROR_STATUS = 0x01,
NWK_OUT_OF_MEMORY_STATUS = 0x02,
NWK_NO_ACK_STATUS = 0x10,
NWK_NO_ROUTE_STATUS = 0x11,
NWK_PHY_CHANNEL_ACCESS_FAILURE_STATUS = 0x20,
NWK_PHY_NO_ACK_STATUS = 0x21
}

typedef struct NwkIb_t NwkIb_t

NwkIb_t nwkIb

void NWK_Init (void)
Initializes all network layer modules. More...

Sets network address of the node. More...

void NWK_SetPanId (uint16_t panId)
Sets network identifier (PAN) of the node. More...

void NWK_OpenEndpoint (uint8_t id, bool(*handler)(NWK_DataInd_t *ind))
Registers callback ind for the endpoint endpoint. More...

bool NWK_Busy (void)
Checks if network layer is ready for sleep. More...

void NWK_Lock (void)
Increases the lock counter and sets a busy state. More...

void NWK_Unlock (void)
Decreases the lock counter and sets a free state if counter reaches 0. More...

void NWK_SleepReq (void)
Puts network layer to a sleeping state. More...

void NWK_WakeupReq (void)
Puts network layer to an active state. More...