Digi XBee(R) ANSI C Host Library
register_device.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343
10  * ===========================================================================
11  */
12 
23 #ifndef XBEE_REGISTER_DEVICE_H
24 #define XBEE_REGISTER_DEVICE_H
25 
26 #include "xbee/device.h"
27 #include "wpan/types.h"
28 
30 
31 #define XBEE_ZIGBEE_INSTALL_KEY_LEN 18
32 #define XBEE_ZIGBEE_LINK_KEY_MAXLEN 16
33 
34 #define XBEE_FRAME_REGISTER_DEVICE 0x24
35 typedef XBEE_PACKED(xbee_header_register_device_t, {
36  uint8_t frame_type;
37  uint8_t frame_id;
38  addr64 device_addr_be;
39  uint16_t reserved_be;
40  uint8_t options;
41 #define XBEE_REG_DEV_OPT_LINK_KEY 0x00
42 #define XBEE_REG_DEV_OPT_INSTALL_CODE 0x01
43  // header followed by optional key (1-16 bytes for link key, 18 bytes for
44  // install code, 0 bytes to deregister a device)
46 
47 #define XBEE_FRAME_REGISTER_DEVICE_STATUS 0xA4
48 typedef XBEE_PACKED(xbee_frame_register_device_status_t, {
49  uint8_t frame_type;
50  uint8_t frame_id;
51  uint8_t status;
52 #define XBEE_REG_DEV_STATUS_SUCCESS 0x00
53 #define XBEE_REG_DEV_STATUS_KEY_TOO_LONG 0x01
54 #define XBEE_REG_DEV_STATUS_ADDR_NOT_FOUND 0xB1
55 #define XBEE_REG_DEV_STATUS_KEY_INVALID 0xB2
56 #define XBEE_REG_DEV_STATUS_ADDR_INVALID 0xB3
57 #define XBEE_REG_DEV_STATUS_KEY_TABLE_FULL 0xB4
58 #define XBEE_REG_DEV_STATUS_BAD_INSTALL_CRC 0xBD
59 #define XBEE_REG_DEV_STATUS_KEY_NOT_FOUND 0xFF
61 
77 int xbee_register_device(xbee_dev_t *xbee, addr64 device_addr_be,
78  const void *key, unsigned key_len);
79 
81 #define XBEE_REGISTER_DEVICE_STR_BUF_SIZE 40
82 
86  uint8_t status, char buffer[XBEE_REGISTER_DEVICE_STR_BUF_SIZE]);
87 
97 int xbee_dump_register_device_status(xbee_dev_t *xbee, const void FAR *rawframe,
98  uint16_t length, void FAR *context);
99 
101 
102 #endif // XBEE_REGISTER_DEVICE_H
103 
WPAN datatypes and support functions, valid for ZigBee and DigiMesh.
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
const char * xbee_register_device_status_str(uint8_t status, char buffer[XBEE_REGISTER_DEVICE_STR_BUF_SIZE])
Get a description of an XBEE_REG_DEV_STATUS_xxx value (returned in an XBEE_FRAME_REGISTER_DEVICE_STAT...
Definition: xbee_register_device.c:54
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
< XBEE_FRAME_REGISTER_DEVICE (0x24) ID to match REGISTER_DEVICE_STATUS frame 64-bit address of destin...
Definition: register_device.h:45
< XBEE_FRAME_REGISTER_DEVICE_STATUS (0xA4) ID of REGISTER_DEVICE frame result of operation ...
Definition: register_device.h:60
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
#define XBEE_REGISTER_DEVICE_STR_BUF_SIZE
Buffer size used for xbee_register_device_status_str().
Definition: register_device.h:81
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
int xbee_register_device(xbee_dev_t *xbee, addr64 device_addr_be, const void *key, unsigned key_len)
Send a Register Joining Device frame to a local XBee3 Zigbee module.
Definition: xbee_register_device.c:27
Typedef used to hold a 64-bit IEEE address, represented as 8 bytes, 4 16-bit values or 2 32-bit value...
Definition: types.h:34
Definition: device.h:361
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
int xbee_dump_register_device_status(xbee_dev_t *xbee, const void FAR *rawframe, uint16_t length, void FAR *context)
Debugging frame handler to print Register Device Status (0xA4) frames.
Definition: xbee_register_device.c:73