ZigBee Modem Status example for mbed XBeeLib By Digi

Dependencies:   XBeeLib mbed

Description

This example shows how to register a function callback to be aware of modem status changes. This library will call the registered callback whenever the XBee module radio modem changes its status

See Handling modem status changes chapter for more information.

Common Setup

Make sure you have a valid Example Common Setup

Example Setup

This example does not require any additional setup.

Running the example

Build and deploy the example to the mbed module.
Reset the mbed module so the example starts. You should see the example debug information through the debug interface configured in the 'Local Setup' chapter.

It you set up a network as described in the Common Setup section, you should see following modem status in the debug interface:

  • Modem Status 0x0: Corresponds to 'HwReset' meaning 'Hardware reset'
  • Modem Status 0x2: Corresponds to 'JoinedNW' meaning 'Joined network (ZigBee routers and end devices)'

Note: You may not see the HwReset modem status if the device is joining to the coordinator fast (within the call to xbee.init())

If you now unplug the network coordinator you should see following modem status in the debug interface:

  • Modem Status 0x3: Corresponds to 'Disassociated' meaning 'Disassociated (ZigBee)'
Committer:
spastor
Date:
Tue May 05 18:30:36 2015 +0200
Revision:
0:0c8d070617b1
Child:
2:c796a5ac7c69
Automatic upload

Who changed what in which revision?

UserRevisionLine numberNew contents of line
spastor 0:0c8d070617b1 1
spastor 0:0c8d070617b1 2 #if !defined(__CONFIG_H_)
spastor 0:0c8d070617b1 3 #define __CONFIG_H_
spastor 0:0c8d070617b1 4
spastor 0:0c8d070617b1 5 //#define PATFORM_ARCHPRO
spastor 0:0c8d070617b1 6
spastor 0:0c8d070617b1 7 /** Library configuration options */
spastor 0:0c8d070617b1 8 #define ENABLE_LOGGING
spastor 0:0c8d070617b1 9 #define ENABLE_ASSERTIONS
spastor 0:0c8d070617b1 10 #define FRAME_BUFFER_SIZE 4
spastor 0:0c8d070617b1 11 #define MAX_FRAME_PAYLOAD_LEN 128
spastor 0:0c8d070617b1 12 #define ENABLE_PM_SUPPORT
spastor 0:0c8d070617b1 13
spastor 0:0c8d070617b1 14 #define SYNC_OPS_TIMEOUT_MS 2000
spastor 0:0c8d070617b1 15
spastor 0:0c8d070617b1 16 #if defined(PATFORM_ARCHPRO)
spastor 0:0c8d070617b1 17 #define RADIO_TX P4_28
spastor 0:0c8d070617b1 18 #define RADIO_RX P4_29
spastor 0:0c8d070617b1 19 #define RADIO_RESET NC
spastor 0:0c8d070617b1 20 //#define RADIO_RESET NC
spastor 0:0c8d070617b1 21 #define RADIO_SLEEP_REQ NC
spastor 0:0c8d070617b1 22 #define RADIO_ON_SLEEP NC
spastor 0:0c8d070617b1 23 #define DEBUG_TX P0_2
spastor 0:0c8d070617b1 24 #define DEBUG_RX P0_3
spastor 0:0c8d070617b1 25 #elif defined(TARGET_LPC1768)
spastor 0:0c8d070617b1 26 #define RADIO_TX p9
spastor 0:0c8d070617b1 27 #define RADIO_RX p10
spastor 0:0c8d070617b1 28 #define RADIO_RESET p30
spastor 0:0c8d070617b1 29 #define RADIO_SLEEP_REQ NC
spastor 0:0c8d070617b1 30 #define RADIO_ON_SLEEP NC
spastor 0:0c8d070617b1 31 #define DEBUG_TX P0_2
spastor 0:0c8d070617b1 32 #define DEBUG_RX P0_3
spastor 0:0c8d070617b1 33 #elif defined(TARGET_FRDM_KL25)
spastor 0:0c8d070617b1 34 #define RADIO_TX PTD3
spastor 0:0c8d070617b1 35 #define RADIO_RX PTD2
spastor 0:0c8d070617b1 36 #define RADIO_RESET NC
spastor 0:0c8d070617b1 37 #define RADIO_SLEEP_REQ NC
spastor 0:0c8d070617b1 38 #define RADIO_ON_SLEEP NC
spastor 0:0c8d070617b1 39 #define DEBUG_TX USBTX
spastor 0:0c8d070617b1 40 #define DEBUG_RX USBRX
spastor 0:0c8d070617b1 41 #elif (defined TARGET_LPC11U24)
spastor 0:0c8d070617b1 42 #define RADIO_TX p9
spastor 0:0c8d070617b1 43 #define RADIO_RX p10
spastor 0:0c8d070617b1 44 #define RADIO_RESET p30
spastor 0:0c8d070617b1 45 #define RADIO_SLEEP_REQ NC
spastor 0:0c8d070617b1 46 #define RADIO_ON_SLEEP NC
spastor 0:0c8d070617b1 47 #define DEBUG_TX USBTX
spastor 0:0c8d070617b1 48 #define DEBUG_RX USBRX
spastor 0:0c8d070617b1 49 #else
spastor 0:0c8d070617b1 50 #error "Define a platform"
spastor 0:0c8d070617b1 51 #endif
spastor 0:0c8d070617b1 52
spastor 0:0c8d070617b1 53 #endif /* __CONFIG_H_ */
spastor 0:0c8d070617b1 54