SZSPTP ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
Network

Network configuration and use. More...

+ Collaboration diagram for Network:

Modules

 Network configuration.
 Values from ZASA example application, file sample_app.c, with modifications considering swra175a.pdf 6.3.1.2.
 
 Network default parameters.
 Values from ZASA example application, file sample_app.c, with modifications considering swra175a.pdf 6.3.9.2.
 

Files

file  nwk.c
 Network functions implementation.
 
file  nwk.h
 Network functions interface.
 

Classes

struct  nwk_neighbor
 Neighbor data. More...
 

Macros

#define NWK_CFG_PANID   "\xFF\xFF"
 swra175a.pdf - 6.2.4.1 ZCD_NV_PANID
 
#define NWK_CFG_CHANLIST   "\x00\x00\x01\x00"
 swra175a.pdf - 6.2.4.2 ZCD_NV_CHANLIST
 
#define NWK_CFG_PRECFGKEY   "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
 swra175a.pdf - 6.2.4.3 ZCD_NV_PRECFGKEY
 
#define NWK_CFG_PRECFGKEYS_ENABLE   "\x01"
 swra175a.pdf - 6.2.4.4 ZCD_NV_PRECFGKEYS_ENABLE
 
#define NWK_CFG_SECURITY_MODE   "\x00"
 swra175a.pdf - 6.2.4.5 ZCD_NV_SECURITY_MODE
 
#define NWK_CFG_BCAST_RETRIES   "\x02"
 swra175a.pdf - 6.2.4.6 ZCD_NV_BCAST_RETRIES
 
#define NWK_CFG_PASSIVE_ACK_TIMEOUT   "\x05"
 swra175a.pdf - 6.2.4.7 ZCD_NV_PASSIVE_ACK_TIMEOUT
 
#define NWK_CFG_BCAST_DELIVERY_TIME   "\x1E"
 swra175a.pdf - 6.2.4.8 ZCD_NV_BCAST_DELIVERY_TIME
 
#define NWK_CFG_ROUTE_EXPIRY_TIME   "\x3C"
 swra175a.pdf - 6.2.4.9 ZCD_NV_ROUTE_EXPIRY_TIME
 
#define NWK_DEVTYPE_DEFALUT   NWK_DEVTYPE_ROUTER
 The default device type on network initialization.
 
#define NWK_NEIGHBORMAX   3
 Max number of expected direct neighbors.
 

Typedefs

typedef enum nwk_devType nwk_devType
 Device types.
 
typedef struct nwk_neighbor nwk_neighbor
 Neighbor data. More...
 

Enumerations

enum  nwk_devType { NWK_DEVTYPE_COORDINATOR, NWK_DEVTYPE_ROUTER, NWK_DEVTYPE_ENDDEVICE, NWK_DEVTYPE_NONE }
 Device types. More...
 

Functions

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_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_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_startFrame (UInt16 destination, UInt16 cmdId, UInt8 radius, UInt8 len)
 Start Frame. More...
 
UInt8 nwk_snd (UInt8 size, 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 i)
 Get neighbor foreign port. More...
 
UInt16 nwk_getNeighborAddress (UInt8 i)
 Get neighbor address. More...
 
UInt8 nwk_registerNeighbor (UInt16 a)
 Register neighbor. More...
 

Variables

nwk_neighbor nwk_neighbors [NWK_NEIGHBORMAX]
 Neighbors information.
 

Detailed Description

Network configuration and use.

Typedef Documentation

typedef struct nwk_neighbor nwk_neighbor

Neighbor data.

Known neighbors data.

Enumeration Type Documentation

Device types.

Enumerator
NWK_DEVTYPE_COORDINATOR 

Coordinator.

NWK_DEVTYPE_ROUTER 

Router.

NWK_DEVTYPE_ENDDEVICE 

End device.

NWK_DEVTYPE_NONE 

None, invalid in a network.

Definition at line 222 of file nwk.h.

Function Documentation

UInt8 nwk_allow_bind ( UInt8  timeout)

Allow bind request.

Set allow bind on the device for timeout seconds. if timeout is 0xFF, the bind is allowed indefinitely.

Documentation says "range from 1 through 65. If 0, the Allow Bind mode will be set false without timeout. If greater than 64, the Allow Bind mode will be true indefinitely.", but the device doesn't work this way. http://e2e.ti.com/support/wireless_connectivity/f/158/p/17331/67151#67151 and http://e2e.ti.com/support/wireless_connectivity/f/158/p/17331/67152#67152 .

Parameters
[in]timeoutamount of seconds to allow binding

Definition at line 890 of file nwk.c.

References ccai_s_zb_allow_bind().

Referenced by nwk_process(), and nwk_setSink().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_allow_bindConfirm ( char *  pBuf)

Allow bind confirmation.

This function takes action on a bind confirmation, that arrive when another device binds to this one.

Parameters
[in]pBufThe complete message from cc2480

Definition at line 913 of file nwk.c.

References uart_forwardCmd().

Referenced by ccai_p_zb_allow_bind_confirm().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_allow_bindRsp ( )

Allow bind response.

Takes action on response of an allow bind request. The cc2480 is sending command 6600 instead of 6602 that would trigger this code, so it will not run.

Definition at line 901 of file nwk.c.

Referenced by ccai_r_zb_allow_bind().

+ Here is the caller graph for this function:

UInt8 nwk_allowJoin ( )

Allow join.

This function permits new devices joining the network indefinitely.

Returns
1 if successful, 0 otherwise

Definition at line 1134 of file nwk.c.

References nwk_setPermitJoin().

+ Here is the call graph for this function:

UInt8 nwk_bind_device ( UInt8  create,
UInt16  commandId,
uint64_t  destination 
)

Bind device request.

Bind The device to another one

Parameters
[in]create1 to create a binding, 0 to remove.
[in]commandIdIdentifier of the bind.
[in]destination64-bit IEEE address of the device to bind to, set to 0 if unknown and destination device is set to allow bind mode.

Definition at line 932 of file nwk.c.

References ccai_s_zb_bind_device().

Referenced by nwk_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_bind_deviceConfirm ( char *  pBuf)

Bind device confirmation.

Takes action on a bind confirmation

Definition at line 950 of file nwk.c.

References CCAI_STA_ZSUCCESS, NWK_CMDIDRPT, and uart_forwardCmd().

Referenced by ccai_p_zb_bind_confirm().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_bind_deviceRsp ( )

Bind device response.

Response to a request to create or delete a binding.

Definition at line 941 of file nwk.c.

Referenced by ccai_r_zb_bind_device().

+ Here is the caller graph for this function:

UInt8 nwk_configureWrite ( )

Write configuration.

This function configures the network. Only one configuration is written each time. When the result is received this function is called again to write next configuration.

Returns
1 if finished, 0 otherwise, a return velue of 1 doesn't mean that the response from the last configuration was received.

Definition at line 572 of file nwk.c.

References CCAI_CFGD_BIT_STARTOPT_AUTO_START, CCAI_CFGD_BIT_STARTOPT_CLEAR_CONFIG, CCAI_CFGD_BIT_STARTOPT_CLEAR_STATE, CCAI_CFGD_LOGICAL_TYPE_COORDINATOR, CCAI_CFGD_LOGICAL_TYPE_ENDDEVICE, CCAI_CFGD_LOGICAL_TYPE_ROUTER, CCAI_CFGD_ZCD_NV_LOGICAL_TYPE, CCAI_CFGD_ZCD_NV_STARTUP_OPTION, CCAI_CFGN_ZCD_NV_BCAST_DELIVERY_TIME, CCAI_CFGN_ZCD_NV_BCAST_RETRIES, CCAI_CFGN_ZCD_NV_CHANLIST, CCAI_CFGN_ZCD_NV_PANID, CCAI_CFGN_ZCD_NV_PASSIVE_ACK_TIMEOUT, CCAI_CFGN_ZCD_NV_PRECFGKEY, CCAI_CFGN_ZCD_NV_PRECFGKEYS_ENABLE, CCAI_CFGN_ZCD_NV_ROUTE_EXPIRY_TIME, CCAI_CFGN_ZCD_NV_SECURITY_MODE, ccai_s_zb_write_configuration(), NWK_CFG_BCAST_DELIVERY_TIME, NWK_CFG_BCAST_RETRIES, NWK_CFG_CHANLIST, NWK_CFG_PANID, NWK_CFG_PASSIVE_ACK_TIMEOUT, NWK_CFG_PRECFGKEY, NWK_CFG_PRECFGKEYS_ENABLE, NWK_CFG_ROUTE_EXPIRY_TIME, NWK_CFG_SECURITY_MODE, nwk_currentDevType, nwk_currentState, NWK_DEVTYPE_COORDINATOR, NWK_DEVTYPE_ENDDEVICE, NWK_DEVTYPE_ROUTER, nwk_lastParam, and nwk_lastParamSuccess.

Referenced by nwk_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_configureWriteRsp ( UInt8  status)

Response to a configuration write.

This function takes action on response from a written configuration. If last configuration was written, set nwk_currentState to the next state.

Parameters
[in]statusResult of the request to write the configuration

Definition at line 749 of file nwk.c.

References ccai_resetLight(), CCAI_STA_ZSUCCESS, nwk_currentState, nwk_lastParam, and nwk_lastParamSuccess.

Referenced by ccai_r_zb_write_configuration().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_disallowJoin ( )

Disallow join.

This function disallow new devices joining the network.

Returns
1 if successful, 0 otherwise

Definition at line 1145 of file nwk.c.

References nwk_setPermitJoin().

+ Here is the call graph for this function:

void nwk_endFrame ( UInt8  forwardToSerial)

End frame.

This function sends the written frame to the specified address over the network.

Parameters
[in]forwardToSerial1 to forward the message to the serial port 0 to do not.

Definition at line 1300 of file nwk.c.

References ccai_s_zb_send_data_request_end(), and nwk_dataHandle.

Referenced by nwk_sendHeartBeat(), ptp_endFrame(), and rep_endFrame().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_getDeviceInfo ( )

Get device information request.

This function reads information from the device and network. Only one information is read each time. After receiving the information, this function is called again until all of the information has been requested.

Returns
1 if finished, 0 otherwise, a return value of 1 doesn't indicate that the response from the last configuration was received.

Definition at line 975 of file nwk.c.

References CCAI_INFO_IEEEADDRESS, CCAI_INFO_PARENTIEEEADDRESS, CCAI_INFO_PARENTSHORTADDRESS, CCAI_INFO_SHORTADDRESS, CCAI_INFO_STATE, CCAI_INFO_ZBCHANNEL, CCAI_INFO_ZBEXTENDEDPANID, CCAI_INFO_ZBPANID, ccai_s_zb_get_device_info(), nwk_lastParam, and nwk_lastParamSuccess.

Referenced by nwk_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_getDeviceInfoRsp ( UInt8  param,
void *  pValue 
)

Get device information response.

This function acts on a response from ZB_GET_DEVICE_INFO.

Parameters
[in]param- the parameter that was read from CC2480.
[in]pValue- pointer to the value of the parameter.

Definition at line 1038 of file nwk.c.

References CCAI_INFO_IEEEADDRESS, CCAI_INFO_PARENTIEEEADDRESS, CCAI_INFO_PARENTSHORTADDRESS, CCAI_INFO_SHORTADDRESS, CCAI_INFO_STATE, CCAI_INFO_ZBCHANNEL, CCAI_INFO_ZBEXTENDEDPANID, CCAI_INFO_ZBPANID, led_redConfigure(), nwk_address, nwk_currentDevType, nwk_currentState, NWK_DEVTYPE_COORDINATOR, NWK_DEVTYPE_ENDDEVICE, NWK_DEVTYPE_ROUTER, nwk_ieeeAddress, nwk_lastParam, nwk_lastParamSuccess, and ptp_initEnd().

Referenced by ccai_r_zb_get_device_info().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

nwk_devType nwk_getDeviceType ( )

This function gets the device type.

If network state is not NWK_S_RUNNING, the returned value will be NWK_DEVTYPE_NONE, else it will be the device type sent to the CC2480.

Returns
Current device Type

Definition at line 535 of file nwk.c.

References nwk_currentDevType, nwk_currentState, and NWK_DEVTYPE_NONE.

Referenced by ptp_portsSetListening().

+ Here is the caller graph for this function:

uint64_t nwk_getIeeeAddress ( )

Get IEEE address.

This function returns the device IEEE address on the ZigBee network.

Returns
Device IEEE address on the ZigBee network

Definition at line 1230 of file nwk.c.

References nwk_ieeeAddress.

UInt16 nwk_getNeighborAddress ( UInt8  portNumber)

Get neighbor address.

This function gets short address of a neighbor.

Parameters
[in]portNumberThe number of the port associated to the neighbor
Returns
The short address of the neighbor.

Definition at line 1578 of file nwk.c.

References NWK_NEIGHBORMAX.

Referenced by ptp_bmc(), ptp_MsgPdelayReqSnd(), ptp_MsgPdelayRespSnd(), ptp_portUpdateDS(), and ptp_process().

+ Here is the caller graph for this function:

UInt8 nwk_getNeighborForeignPort ( UInt8  portNumber)

Get neighbor foreign port.

This function gets the port that a neighbor associate to this device.

Parameters
[in]portNumberThe number of the port associated to the neighbor
Returns
Number of the foreign port that the neighbor associated to this device.

Definition at line 1562 of file nwk.c.

References NWK_NEIGHBORMAX.

Referenced by nwk_rcv(), ptp_MsgPdelayRespSnd(), and ptp_portUpdateDS().

+ Here is the caller graph for this function:

UInt8 nwk_getNeighborPort ( UInt16  a)

Get neighbor port.

This function gets the port associated to a neighbor.

Parameters
[in]aShort address of the neighbor to get the port
Returns
Number of the port associated to the neighbor or 0 if none.

Definition at line 1539 of file nwk.c.

References NWK_NEIGHBORMAX.

Referenced by nwk_rcv().

+ Here is the caller graph for this function:

uint64_t* nwk_getPIeeeAddress ( )

Get pointer to the IEEE address.

This function returns a pointer to the device IEEE address on the ZigBee network. The value must not be overwritten, the address will not change.

Returns
Pointer to the device IEEE address on the ZigBee network

Definition at line 1245 of file nwk.c.

References nwk_ieeeAddress.

Referenced by ptp_getClockIdentity(), and rep_proccess().

+ Here is the caller graph for this function:

UInt16 nwk_getShortAddress ( )

Get shotr address.

This function returns the device short address on the ZigBee network.

Returns
Device short address on the ZigBee network

Definition at line 1217 of file nwk.c.

References nwk_address.

void nwk_init ( )

Network initialization.

This function initializes the network variables.

Definition at line 277 of file nwk.c.

References nwk_address, nwk_currentDevType, nwk_currentState, nwk_dataHandle, NWK_DEVTYPE_DEFALUT, NWK_DEVTYPE_NONE, nwk_freezeDetect, nwk_ieeeAddress, nwk_lastParam, nwk_lastParamSuccess, NWK_NEIGHBORMAX, nwk_returnState, and nwk_runCounter.

Referenced by main(), and uart_proccessCmd().

+ Here is the caller graph for this function:

UInt8 nwk_isBound ( )

Is bound.

This function checks if the device is bound to another device on the network

Returns
1 if bound, 0 otherwise

Definition at line 1182 of file nwk.c.

Referenced by rep_endFrame(), rep_proccess(), rep_snd(), rep_sndInt64(), rep_sndUInt16(), rep_sndUInt32(), rep_sndUInt48(), rep_sndUInt48sc(), rep_sndUInt64(), rep_sndUInt8(), and rep_startFrame().

+ Here is the caller graph for this function:

UInt8 nwk_isClient ( )

Is client.

This function checks if the device is a client on the network and it is running.

Returns
1 if client on a running network, 0 otherwise

Definition at line 1156 of file nwk.c.

References nwk_currentDevType, nwk_currentState, NWK_DEVTYPE_ENDDEVICE, and NWK_DEVTYPE_ROUTER.

UInt8 nwk_isSink ( )

Is sink.

This function checks if the device is configured as a sink on the network

Returns
1 if configured as sink, 0 otherwise

Definition at line 1170 of file nwk.c.

Referenced by nwk_rcv(), rep_endFrame(), rep_proccess(), rep_snd(), rep_sndInt64(), rep_sndUInt16(), rep_sndUInt32(), rep_sndUInt48(), rep_sndUInt48sc(), rep_sndUInt64(), rep_sndUInt8(), and rep_startFrame().

+ Here is the caller graph for this function:

UInt16 nwk_process ( )

Network process.

This function processes the tasks of the network.

Returns
Time to run again (ms); 0 means 65536ms

Definition at line 311 of file nwk.c.

References ccai_resetFull(), led_redConfigure(), nwk_allow_bind(), nwk_bind_device(), NWK_CMDIDRPT, nwk_configureWrite(), nwk_currentDevType, nwk_currentState, NWK_DEVTYPE_COORDINATOR, NWK_DEVTYPE_ENDDEVICE, nwk_freezeDetect, nwk_getDeviceInfo(), nwk_ieeeAddress, NWK_NEIGHBORMAX, nwk_register(), nwk_runCounter, nwk_sendHeartBeat(), nwk_setDeviceType(), and nwk_start().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_rcv ( char *  pBuf)

Network receive.

This function receives packets from the network and forward as appropriate

Parameters
[in]pBufPointer to the received packet

Definition at line 1430 of file nwk.c.

References nwk_address, NWK_CMDIDHEARTBEAT, NWK_CMDIDPTP, NWK_CMDIDRPT, nwk_freezeDetect, nwk_getNeighborForeignPort(), nwk_getNeighborPort(), nwk_ieeeAddress, nwk_isSink(), NWK_NEIGHBORHEARTBEATTIMEOUT, nwk_registerNeighbor(), ptp_rcvmessage(), and uart_forwardCmd().

Referenced by ccai_p_zb_receive_data_indication().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_register ( )

Register application request.

This function register the application on the network.

Returns
1 on success, 0 on fail

Definition at line 807 of file nwk.c.

References ccai_s_zb_app_register_request(), NWK_CFG_APPENDPOINT, NWK_CFG_APPPROFILEID, NWK_CFG_DEVICEID, NWK_CFG_DEVICEVERSION, NWK_CFG_INPUTCMDCOUNT, NWK_CFG_INPUTCMDLIST, NWK_CFG_OUTPUTCMDCOUNT, and NWK_CFG_OUTPUTCMDLIST.

Referenced by nwk_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_registerNeighbor ( UInt16  a)

Register neighbor.

This function associate a port to a neighbor.

Parameters
[in]aShort address of the neighbor associate
Returns
Number of the associated port.

Definition at line 1595 of file nwk.c.

References NWK_NEIGHBORHEARTBEATTIMEOUT, and NWK_NEIGHBORMAX.

Referenced by nwk_rcv().

+ Here is the caller graph for this function:

void nwk_registerRsp ( UInt8  status)

Register application response.

This function takes action on the response of a application register request.

Parameters
[in]statusThe returning status from CC2480.

Definition at line 823 of file nwk.c.

References CCAI_STA_ZSUCCESS, and nwk_currentState.

Referenced by ccai_r_zb_app_register_request().

+ Here is the caller graph for this function:

void nwk_resetResume ( )

Resume from CC2480 reset.

This function sets state to NWK_S_SETDEVICETYPE.

Definition at line 549 of file nwk.c.

References led_redConfigure(), nwk_currentState, nwk_lastParam, and nwk_lastParamSuccess.

Referenced by ccai_p_sys_reset_ind().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_send_dataConfirm ( UInt8  dataHandle,
UInt8  status 
)

Send data confirmation.

This function acts on a send data confirmation

Parameters
[in]dataHandleData handle of the sent packet
[in]statusStatus returned by cc2480

Definition at line 1407 of file nwk.c.

References CCAI_STA_ZAPSNOBOUNDDEVICE, and CCAI_STA_ZFAILURE.

Referenced by ccai_p_zb_send_data_confirm().

+ Here is the caller graph for this function:

void nwk_setDeviceType ( nwk_devType  newType)

Set device type.

This function sets a device type on the cc2480. The configuration may take up to the larger return value from mwk_proccess (ms).

Parameters
[in]newTypeNew device type to be set on the cc2480.

Definition at line 517 of file nwk.c.

References led_redConfigure(), nwk_currentDevType, nwk_currentState, nwk_lastParam, and nwk_lastParamSuccess.

Referenced by but_proccess(), ccai_p_sys_reset_ind(), nwk_process(), and uart_proccessCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_setPermitJoin ( UInt8  timeout)

Permit join request.

This function change permission to new devices join the network. The device address is passed as 0xFFFC, that means all routers and coordinator, this function may be changed by adding a parameter so that a single device can also be specified.

Parameters
[in]timeoutTime to extend the permission to join, if 0xFF, joining will be permitted indefinitely, if 0x00, joining will be prohibited.
Returns
1 if successful, 0 otherwise

Definition at line 1107 of file nwk.c.

References ccai_s_zb_permit_joining_request(), and nwk_currentState.

Referenced by nwk_allowJoin(), and nwk_disallowJoin().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_setPermitJoinRsp ( )

Permit join response.

This function acts on a response from ZB_PERMIT_JOINING_REQUEST.

Definition at line 1121 of file nwk.c.

Referenced by ccai_r_zb_permit_joining_request().

+ Here is the caller graph for this function:

void nwk_setSink ( UInt8  sink)

Set sink.

This function sets the sink state of the device on the network. On sink, device allows bind and forward received commands or reports to serial port. If a device bound to this one, it may not be enough to just make this device not a sink to stop the other device to send reports to this one.

Parameters
[in]sink1 to make device a sink, 0 to make device nota a sink

Definition at line 1198 of file nwk.c.

References nwk_allow_bind().

Referenced by uart_proccessCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_snd ( UInt8  len,
void *  pBuf 
)

Send data.

This function write data to the buffer, the nwk_startFrame must be called prior to this function.

Parameters
[in]lenAmount of data, in bytes to write to the network buffer.
[in]pBufPointer to source data buffer to copy to the network buffer.
Returns
1 on success, 0 on fail because size is larger than remaining bytes on buffer accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1285 of file nwk.c.

References ccai_s_zb_send_data_request_payload().

Referenced by nwk_sndInt64(), nwk_sndUInt16(), nwk_sndUInt32(), nwk_sndUInt48(), nwk_sndUInt64(), nwk_sndUInt8(), ptp_snd(), and rep_snd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndInt64 ( int64_t *  p)

Send signed 64 bits integer.

This function write a 64-bit value to the network buffer.

Parameters
[in]pPointer to the value to send.
Returns
1 on success, 0 on fail (fail because buffer overflow) Accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1394 of file nwk.c.

References nwk_snd().

Referenced by ptp_sndInt64(), and rep_sndInt64().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndUInt16 ( UInt16  v)

Send unsigned 16 bits integer.

This function write a 16-bit value to the network buffer.

Parameters
[in]vValue to write.
Returns
1 on success, 0 on fail (fail because buffer overflow) Accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1333 of file nwk.c.

References nwk_snd().

Referenced by nwk_sendHeartBeat(), ptp_sndUInt16(), ptp_sndUInt48sc(), rep_sndUInt16(), and rep_sndUInt48sc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndUInt32 ( UInt32 *  p)

Send unsigned 32 bits integer.

This function write a 32-bit value to the network buffer.

Parameters
[in]pPointer to the value to write.
Returns
1 on success, 0 on fail (fail because buffer overflow) buffer accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1349 of file nwk.c.

References nwk_snd().

Referenced by ptp_sndUInt32(), ptp_sndUInt48sc(), rep_sndUInt32(), and rep_sndUInt48sc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndUInt48 ( uint64_t *  p)

Send unsigned 48 bits integer.

This function write a 48-bit value to the network buffer.

Parameters
[in]pPointer to the value to send, it is a 64-bit, but only the 48 less significant bits are sent.
Returns
1 on success, 0 on fail (fail because buffer overflow) buffer accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1366 of file nwk.c.

References nwk_snd().

Referenced by ptp_sndUInt48(), and rep_sndUInt48().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndUInt64 ( uint64_t *  p)

Send unsigned 64 bits integer.

This function write a 64-bit value to the network buffer.

Parameters
[in]pPointer to the value to send.
Returns
1 on success, 0 on fail (fail because buffer overflow) Accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1380 of file nwk.c.

References nwk_snd().

Referenced by ptp_sndUInt64(), and rep_sndUInt64().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_sndUInt8 ( UInt8  v)

Send unsigned 8 bits integer.

This function write a 8-bit value to the network buffer.

Parameters
[in]vValue to write.
Returns
1 on success, 0 on fail (fail because buffer overflow) Accordingly to the requested bytes on the call to nwk_startFrame.

Definition at line 1317 of file nwk.c.

References nwk_snd().

Referenced by nwk_sendHeartBeat(), ptp_sndUInt8(), and rep_sndUInt8().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 nwk_start ( )

Start network request.

This function requests the start of network operations.

Returns
1 on success, 0 on fail

Definition at line 839 of file nwk.c.

References ccai_s_zb_start_request().

Referenced by nwk_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_startConfirm ( UInt8  status)

Start network confirmation.

This function takes action on a ZB_START_REQUEST confirmation.

Parameters
[in]statusThe returning status from CC2480

Definition at line 868 of file nwk.c.

References CCAI_STA_ZSUCCESS, and nwk_currentState.

Referenced by ccai_p_zb_start_confirm().

+ Here is the caller graph for this function:

UInt8 nwk_startFrame ( UInt16  destination,
UInt16  cmdId,
UInt8  radius,
UInt8  len 
)

Start Frame.

This function starts to write a frame (packet) to be send over the network.

Parameters
[in]destinationDestination of the frame.
[in]cmdIdCommand id.
[in]radiusRadius of propagation.
[in]lenLenght of the data.
Returns
1 on success, 0 on fail because size is too large or nwk_currentState != NWK_S_RUNNING.

Definition at line 1264 of file nwk.c.

References ccai_s_zb_send_data_request_begin(), nwk_currentState, nwk_dataHandle, and NWK_DEFACK.

Referenced by nwk_sendHeartBeat(), ptp_startFrame(), and rep_startFrame().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nwk_startRsp ( )

Start network response.

This function confirms that ZB_START_REQUEST has been received.

Definition at line 850 of file nwk.c.

References nwk_currentState.

Referenced by ccai_r_zb_start_request().

+ Here is the caller graph for this function:

void nwk_suspend ( )

network suspend

This function saves the current network state and put it on the suspended state.

Definition at line 459 of file nwk.c.

References nwk_currentState, nwk_lastParam, nwk_lastParamSuccess, and nwk_returnState.

UInt8 nwk_wakeUp ( )

Network wake up.

This function try to go back to the state before suspend, if fail, a network reset is done.

Definition at line 475 of file nwk.c.

References led_redConfigure(), nwk_currentState, nwk_lastParam, nwk_lastParamSuccess, and nwk_returnState.

Referenced by ccai_p_sys_reset_ind().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: