Network functions implementation. More...
#include <msp430.h>#include "nwk.h"#include "cc2480ai.h"#include "led.h"#include "ptp.h"#include "uart.h"
Include dependency graph for nwk.c:Go to the source code of this file.
Macros | |
| #define | NWK_NEIGHBORHEARTBEATTIMEOUT 9 |
| Timeout after a neighbor is considered disconnected. | |
| #define | NWK_START_TIMEOUT 10 |
| #define | NWK_FLAGIDX_SINK 0x01 |
| #define | NWK_FLAGIDX_NSINK 0xFE |
| #define | NWK_FLAGIDX_BOUND 0x02 |
| #define | NWK_FLAGIDX_NBOUND 0xFD |
| #define | NWK_FLAGIDX_SENDFAIL 0x04 |
| #define | NWK_FLAGIDX_NSENDFAIL 0xFB |
| #define | NWK_FLAGIDX_FAILJOIN 0x08 |
| #define | NWK_FLAGIDX_NFAILJOIN 0xF7 |
Typedefs | |
| typedef enum nwk_state | nwk_state |
| States for the network. | |
Enumerations | |
| enum | nwk_state { NWK_S_INIT, NWK_S_SUSPENDED, NWK_S_CONFIGSTART, NWK_S_CONFIGSTARTWAIT, NWK_S_SETDEVICETYPE, NWK_S_RESETWAIT, NWK_S_CONFIGURE, NWK_S_REGISTER, NWK_S_START, NWK_S_STARTWAIT, NWK_S_POSTSTARTCONFIGURE, NWK_S_GETINFO, NWK_S_CHECKFORBIND, NWK_S_RUNNING } |
| States for the network. | |
Functions | |
| UInt8 | nwk_sendHeartBeat () |
| Send heart beat. More... | |
| void | nwk_init () |
| Network initialization. More... | |
| UInt16 | nwk_process () |
| Network process. More... | |
| void | nwk_suspend () |
| network suspend More... | |
| UInt8 | nwk_wakeUp () |
| Network wake up. More... | |
| void | nwk_setDeviceType (nwk_devType newType) |
| Set device type. More... | |
| nwk_devType | nwk_getDeviceType () |
| This function gets the device type. More... | |
| void | nwk_resetResume () |
| Resume from CC2480 reset. More... | |
| UInt8 | nwk_configureWrite () |
| Write configuration. More... | |
| void | nwk_configureWriteRsp (UInt8 status) |
| Response to a configuration write. More... | |
| UInt8 | nwk_register () |
| Register application request. More... | |
| void | nwk_registerRsp (UInt8 status) |
| Register application response. More... | |
| UInt8 | nwk_start () |
| Start network request. More... | |
| void | nwk_startRsp () |
| Start network response. More... | |
| void | nwk_startConfirm (UInt8 status) |
| Start network confirmation. More... | |
| UInt8 | nwk_allow_bind (UInt8 timeout) |
| Allow bind request. More... | |
| void | nwk_allow_bindRsp () |
| Allow bind response. More... | |
| void | nwk_allow_bindConfirm (char *pBuf) |
| Allow bind confirmation. More... | |
| UInt8 | nwk_bind_device (UInt8 create, UInt16 commandId, uint64_t destination) |
| Bind device request. More... | |
| void | nwk_bind_deviceRsp () |
| Bind device response. More... | |
| void | nwk_bind_deviceConfirm (char *pBuf) |
| Bind device confirmation. More... | |
| UInt8 | nwk_getDeviceInfo () |
| Get device information request. More... | |
| void | nwk_getDeviceInfoRsp (UInt8 param, void *pValue) |
| Get device information response. More... | |
| UInt8 | nwk_setPermitJoin (UInt8 timeout) |
| Permit join request. More... | |
| void | nwk_setPermitJoinRsp () |
| Permit join response. More... | |
| UInt8 | nwk_allowJoin () |
| Allow join. More... | |
| UInt8 | nwk_disallowJoin () |
| Disallow join. More... | |
| UInt8 | nwk_isClient () |
| Is client. More... | |
| UInt8 | nwk_isSink () |
| Is sink. More... | |
| UInt8 | nwk_isBound () |
| Is bound. More... | |
| void | nwk_setSink (UInt8 sink) |
| Set sink. More... | |
| UInt16 | nwk_getShortAddress () |
| Get shotr address. More... | |
| uint64_t | nwk_getIeeeAddress () |
| Get IEEE address. More... | |
| uint64_t * | nwk_getPIeeeAddress () |
| Get pointer to the IEEE address. More... | |
| UInt8 | nwk_startFrame (UInt16 destination, UInt16 cmdId, UInt8 radius, UInt8 len) |
| Start Frame. More... | |
| UInt8 | nwk_snd (UInt8 len, void *pBuf) |
| Send data. More... | |
| void | nwk_endFrame (UInt8 forwardToSerial) |
| End frame. More... | |
| UInt8 | nwk_sndUInt8 (UInt8 v) |
| Send unsigned 8 bits integer. More... | |
| UInt8 | nwk_sndUInt16 (UInt16 v) |
| Send unsigned 16 bits integer. More... | |
| UInt8 | nwk_sndUInt32 (UInt32 *p) |
| Send unsigned 32 bits integer. More... | |
| UInt8 | nwk_sndUInt48 (uint64_t *p) |
| Send unsigned 48 bits integer. More... | |
| UInt8 | nwk_sndUInt64 (uint64_t *p) |
| Send unsigned 64 bits integer. More... | |
| UInt8 | nwk_sndInt64 (int64_t *p) |
| Send signed 64 bits integer. More... | |
| void | nwk_send_dataConfirm (UInt8 dataHandle, UInt8 status) |
| Send data confirmation. More... | |
| void | nwk_rcv (char *pBuf) |
| Network receive. More... | |
| UInt8 | nwk_getNeighborPort (UInt16 a) |
| Get neighbor port. More... | |
| UInt8 | nwk_getNeighborForeignPort (UInt8 portNumber) |
| Get neighbor foreign port. More... | |
| UInt16 | nwk_getNeighborAddress (UInt8 portNumber) |
| Get neighbor address. More... | |
| UInt8 | nwk_registerNeighbor (UInt16 a) |
| Register neighbor. More... | |
Variables | |
| nwk_neighbor | nwk_neighbors [NWK_NEIGHBORMAX] |
| Neighbors information. | |
| nwk_state | nwk_currentState |
| Current state of the LEDs control. More... | |
| nwk_state | nwk_returnState |
| State on suspend. More... | |
| UInt8 | nwk_lastParam |
| Last parameter. More... | |
| UInt8 | nwk_lastParamSuccess |
| Last successful parameter. More... | |
| nwk_devType | nwk_currentDevType |
| Current device type. | |
| UInt16 | nwk_address |
| Short address of the device. | |
| uint64_t | nwk_ieeeAddress |
| Short address of the device. | |
| UInt8 | nwk_dataHandle |
| Handle used to identify one packet. | |
| UInt8 | nwk_freezeDetect |
| Counter used to detect freezes. | |
| UInt8 | nwk_runCounter |
| Children information. | |
| UInt8 | nwk_flags |
Network functions implementation.
Definition in file nwk.c.
| UInt8 nwk_sendHeartBeat | ( | ) |
Send heart beat.
This function sends a heart beat over the network.
Definition at line 1502 of file nwk.c.
References NWK_CMDIDHEARTBEAT, nwk_endFrame(), NWK_NEIGHBORMAX, nwk_sndUInt16(), nwk_sndUInt8(), and nwk_startFrame().
Referenced by nwk_process().
Here is the call graph for this function:
Here is the caller graph for this function:| nwk_state nwk_currentState |
Current state of the LEDs control.
Definition at line 203 of file nwk.c.
Referenced by nwk_configureWrite(), nwk_configureWriteRsp(), nwk_getDeviceInfoRsp(), nwk_getDeviceType(), nwk_init(), nwk_isClient(), nwk_process(), nwk_registerRsp(), nwk_resetResume(), nwk_setDeviceType(), nwk_setPermitJoin(), nwk_startConfirm(), nwk_startFrame(), nwk_startRsp(), nwk_suspend(), and nwk_wakeUp().
| UInt8 nwk_lastParam |
Last parameter.
Used to write or read configuration/information from CC2480.
Definition at line 217 of file nwk.c.
Referenced by nwk_configureWrite(), nwk_configureWriteRsp(), nwk_getDeviceInfo(), nwk_getDeviceInfoRsp(), nwk_init(), nwk_resetResume(), nwk_setDeviceType(), nwk_suspend(), and nwk_wakeUp().
| UInt8 nwk_lastParamSuccess |
Last successful parameter.
Used to write or read configuration/information from CC2480.
Definition at line 224 of file nwk.c.
Referenced by nwk_configureWrite(), nwk_configureWriteRsp(), nwk_getDeviceInfo(), nwk_getDeviceInfoRsp(), nwk_init(), nwk_resetResume(), nwk_setDeviceType(), nwk_suspend(), and nwk_wakeUp().
| nwk_state nwk_returnState |
State on suspend.
State when gone suspend, and to try to back when wake-up.
Definition at line 210 of file nwk.c.
Referenced by nwk_init(), nwk_suspend(), and nwk_wakeUp().