Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:f1d3878b8dd9 1 /**
vpcola 0:f1d3878b8dd9 2 * Copyright (c) 2015 Digi International Inc.,
vpcola 0:f1d3878b8dd9 3 * All rights not expressly granted are reserved.
vpcola 0:f1d3878b8dd9 4 *
vpcola 0:f1d3878b8dd9 5 * This Source Code Form is subject to the terms of the Mozilla Public
vpcola 0:f1d3878b8dd9 6 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
vpcola 0:f1d3878b8dd9 7 * You can obtain one at http://mozilla.org/MPL/2.0/.
vpcola 0:f1d3878b8dd9 8 *
vpcola 0:f1d3878b8dd9 9 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
vpcola 0:f1d3878b8dd9 10 * =======================================================================
vpcola 0:f1d3878b8dd9 11 */
vpcola 0:f1d3878b8dd9 12
vpcola 0:f1d3878b8dd9 13 #if !defined(__XBEE_REMOTE_H_)
vpcola 0:f1d3878b8dd9 14 #define __XBEE_REMOTE_H_
vpcola 0:f1d3878b8dd9 15
vpcola 0:f1d3878b8dd9 16 #include "XBee/Addresses.h"
vpcola 0:f1d3878b8dd9 17
vpcola 0:f1d3878b8dd9 18 namespace XBeeLib {
vpcola 0:f1d3878b8dd9 19
vpcola 0:f1d3878b8dd9 20 /** Class for Remote XBee modules. Not to be used directly. */
vpcola 0:f1d3878b8dd9 21 class RemoteXBee
vpcola 0:f1d3878b8dd9 22 {
vpcola 0:f1d3878b8dd9 23 public:
vpcola 0:f1d3878b8dd9 24
vpcola 0:f1d3878b8dd9 25 /** Default Class constructor for a remote device (connected wirelessly). No address set.
vpcola 0:f1d3878b8dd9 26 */
vpcola 0:f1d3878b8dd9 27 RemoteXBee();
vpcola 0:f1d3878b8dd9 28
vpcola 0:f1d3878b8dd9 29 /** Class constructor for a remote device (connected wirelessly) using 64bit addressing
vpcola 0:f1d3878b8dd9 30 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 31 */
vpcola 0:f1d3878b8dd9 32 RemoteXBee(uint64_t remote64);
vpcola 0:f1d3878b8dd9 33
vpcola 0:f1d3878b8dd9 34 /** Class destructor */
vpcola 0:f1d3878b8dd9 35 ~RemoteXBee();
vpcola 0:f1d3878b8dd9 36
vpcola 0:f1d3878b8dd9 37 /** get_addr64 - returns the 64bit address of the remote device
vpcola 0:f1d3878b8dd9 38 *
vpcola 0:f1d3878b8dd9 39 * @returns the 64bit address of the remote device
vpcola 0:f1d3878b8dd9 40 */
vpcola 0:f1d3878b8dd9 41 uint64_t get_addr64() const;
vpcola 0:f1d3878b8dd9 42
vpcola 0:f1d3878b8dd9 43 /** get_addr16 - returns the 16bit address of the remote device
vpcola 0:f1d3878b8dd9 44 *
vpcola 0:f1d3878b8dd9 45 * @returns the 16bit address of the remote device
vpcola 0:f1d3878b8dd9 46 */
vpcola 0:f1d3878b8dd9 47 uint16_t get_addr16() const;
vpcola 0:f1d3878b8dd9 48
vpcola 0:f1d3878b8dd9 49 /** operator == overload so the object can be compared to equal */
vpcola 0:f1d3878b8dd9 50 inline bool operator == (const RemoteXBee &b) const
vpcola 0:f1d3878b8dd9 51 {
vpcola 0:f1d3878b8dd9 52 return ((b._dev_addr16 == _dev_addr16) &&
vpcola 0:f1d3878b8dd9 53 (b._dev_addr64 == _dev_addr64));
vpcola 0:f1d3878b8dd9 54 }
vpcola 0:f1d3878b8dd9 55
vpcola 0:f1d3878b8dd9 56 /** operator != overload so the object can be compared to not equal */
vpcola 0:f1d3878b8dd9 57 inline bool operator != (const RemoteXBee &b) const
vpcola 0:f1d3878b8dd9 58 {
vpcola 0:f1d3878b8dd9 59 return !(this == &b);
vpcola 0:f1d3878b8dd9 60 }
vpcola 0:f1d3878b8dd9 61
vpcola 0:f1d3878b8dd9 62 /** is_valid_addr16b - checks if the RemoteXBee object has a valid 16b address
vpcola 0:f1d3878b8dd9 63 * @returns true if valid, false otherwise
vpcola 0:f1d3878b8dd9 64 */
vpcola 0:f1d3878b8dd9 65 inline bool is_valid_addr16b() const
vpcola 0:f1d3878b8dd9 66 {
vpcola 0:f1d3878b8dd9 67 return (_dev_addr16 != ADDR16_UNKNOWN);
vpcola 0:f1d3878b8dd9 68 }
vpcola 0:f1d3878b8dd9 69
vpcola 0:f1d3878b8dd9 70 /** is_valid_addr64b - checks if the RemoteXBee object has a valid 64b address
vpcola 0:f1d3878b8dd9 71 * @returns true if valid, false otherwise
vpcola 0:f1d3878b8dd9 72 */
vpcola 0:f1d3878b8dd9 73 inline bool is_valid_addr64b() const
vpcola 0:f1d3878b8dd9 74 {
vpcola 0:f1d3878b8dd9 75 return !(_dev_addr64 == ADDR64_UNASSIGNED);
vpcola 0:f1d3878b8dd9 76 }
vpcola 0:f1d3878b8dd9 77
vpcola 0:f1d3878b8dd9 78
vpcola 0:f1d3878b8dd9 79 protected:
vpcola 0:f1d3878b8dd9 80 /** Remote Device 64 bit address */
vpcola 0:f1d3878b8dd9 81 uint64_t _dev_addr64;
vpcola 0:f1d3878b8dd9 82
vpcola 0:f1d3878b8dd9 83 /** Remote Device 16 bit address */
vpcola 0:f1d3878b8dd9 84 uint16_t _dev_addr16;
vpcola 0:f1d3878b8dd9 85 };
vpcola 0:f1d3878b8dd9 86
vpcola 0:f1d3878b8dd9 87 class FH_NodeDiscovery802;
vpcola 0:f1d3878b8dd9 88 /** Class for 802.15.4 Remote XBee modules */
vpcola 0:f1d3878b8dd9 89 class RemoteXBee802 : public RemoteXBee
vpcola 0:f1d3878b8dd9 90 {
vpcola 0:f1d3878b8dd9 91 public:
vpcola 0:f1d3878b8dd9 92
vpcola 0:f1d3878b8dd9 93 /** Default Class constructor for a 802.15.4 remote device (connected wirelessly). No address set.
vpcola 0:f1d3878b8dd9 94 */
vpcola 0:f1d3878b8dd9 95 RemoteXBee802();
vpcola 0:f1d3878b8dd9 96
vpcola 0:f1d3878b8dd9 97 /** Class constructor for a 802.15.4 remote device (connected wirelessly) using 64bit addressing
vpcola 0:f1d3878b8dd9 98 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 99 */
vpcola 0:f1d3878b8dd9 100 RemoteXBee802(uint64_t remote64);
vpcola 0:f1d3878b8dd9 101
vpcola 0:f1d3878b8dd9 102 /** Class constructor for a 802.15.4 remote device (connected wirelessly) using 16bit addressing
vpcola 0:f1d3878b8dd9 103 * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
vpcola 0:f1d3878b8dd9 104 */
vpcola 0:f1d3878b8dd9 105 RemoteXBee802(uint16_t remote16);
vpcola 0:f1d3878b8dd9 106
vpcola 0:f1d3878b8dd9 107 /** Class destructor */
vpcola 0:f1d3878b8dd9 108 ~RemoteXBee802();
vpcola 0:f1d3878b8dd9 109
vpcola 0:f1d3878b8dd9 110 inline bool is_valid(void)
vpcola 0:f1d3878b8dd9 111 {
vpcola 0:f1d3878b8dd9 112 return is_valid_addr64b() || is_valid_addr16b();
vpcola 0:f1d3878b8dd9 113 }
vpcola 0:f1d3878b8dd9 114
vpcola 0:f1d3878b8dd9 115 protected:
vpcola 0:f1d3878b8dd9 116
vpcola 0:f1d3878b8dd9 117 friend FH_NodeDiscovery802;
vpcola 0:f1d3878b8dd9 118 friend class XBee802;
vpcola 0:f1d3878b8dd9 119
vpcola 0:f1d3878b8dd9 120 /** Class constructor for a 802.15.4 remote device (connected wirelessly) for which both the 64-bit and 16-bit addresses are known.
vpcola 0:f1d3878b8dd9 121 * This constructor is only used by FH_NodeDiscovery802 class.
vpcola 0:f1d3878b8dd9 122 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 123 * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
vpcola 0:f1d3878b8dd9 124 */
vpcola 0:f1d3878b8dd9 125 RemoteXBee802(uint64_t remote64, uint16_t remote16);
vpcola 0:f1d3878b8dd9 126 };
vpcola 0:f1d3878b8dd9 127
vpcola 0:f1d3878b8dd9 128 /** Class for ZigBee Remote XBee modules */
vpcola 0:f1d3878b8dd9 129 class RemoteXBeeZB : public RemoteXBee
vpcola 0:f1d3878b8dd9 130 {
vpcola 0:f1d3878b8dd9 131 public:
vpcola 0:f1d3878b8dd9 132
vpcola 0:f1d3878b8dd9 133 /** Default Class constructor for a ZigBee remote device (connected wirelessly). No address set.
vpcola 0:f1d3878b8dd9 134 */
vpcola 0:f1d3878b8dd9 135 RemoteXBeeZB();
vpcola 0:f1d3878b8dd9 136
vpcola 0:f1d3878b8dd9 137 /** Class constructor for a ZigBee remote device (connected wirelessly) using 64bit addressing
vpcola 0:f1d3878b8dd9 138 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 139 */
vpcola 0:f1d3878b8dd9 140 RemoteXBeeZB(uint64_t remote64);
vpcola 0:f1d3878b8dd9 141
vpcola 0:f1d3878b8dd9 142 /** Class constructor for a ZigBee remote device (connected wirelessly) using 64bit and 16b addressing
vpcola 0:f1d3878b8dd9 143 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 144 * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
vpcola 0:f1d3878b8dd9 145 */
vpcola 0:f1d3878b8dd9 146 RemoteXBeeZB(uint64_t remote64, uint16_t remote16);
vpcola 0:f1d3878b8dd9 147
vpcola 0:f1d3878b8dd9 148 /** Class destructor */
vpcola 0:f1d3878b8dd9 149 ~RemoteXBeeZB();
vpcola 0:f1d3878b8dd9 150
vpcola 0:f1d3878b8dd9 151 inline bool is_valid(void)
vpcola 0:f1d3878b8dd9 152 {
vpcola 0:f1d3878b8dd9 153 return is_valid_addr64b();
vpcola 0:f1d3878b8dd9 154 }
vpcola 0:f1d3878b8dd9 155 };
vpcola 0:f1d3878b8dd9 156
vpcola 0:f1d3878b8dd9 157 /** Class for DigiMesh Remote XBee modules */
vpcola 0:f1d3878b8dd9 158 class RemoteXBeeDM : public RemoteXBee
vpcola 0:f1d3878b8dd9 159 {
vpcola 0:f1d3878b8dd9 160 public:
vpcola 0:f1d3878b8dd9 161
vpcola 0:f1d3878b8dd9 162 /** Default Class constructor for a DigiMesh remote device (connected wirelessly). No address set.
vpcola 0:f1d3878b8dd9 163 */
vpcola 0:f1d3878b8dd9 164 RemoteXBeeDM();
vpcola 0:f1d3878b8dd9 165
vpcola 0:f1d3878b8dd9 166 /** Class constructor for a DigiMesh remote device (connected wirelessly) using 64bit addressing
vpcola 0:f1d3878b8dd9 167 * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
vpcola 0:f1d3878b8dd9 168 */
vpcola 0:f1d3878b8dd9 169 RemoteXBeeDM(uint64_t remote64);
vpcola 0:f1d3878b8dd9 170
vpcola 0:f1d3878b8dd9 171 /** Class destructor */
vpcola 0:f1d3878b8dd9 172 ~RemoteXBeeDM();
vpcola 0:f1d3878b8dd9 173
vpcola 0:f1d3878b8dd9 174 inline bool is_valid(void)
vpcola 0:f1d3878b8dd9 175 {
vpcola 0:f1d3878b8dd9 176 return is_valid_addr64b();
vpcola 0:f1d3878b8dd9 177 }
vpcola 0:f1d3878b8dd9 178 };
vpcola 0:f1d3878b8dd9 179
vpcola 0:f1d3878b8dd9 180 } /* namespace XBeeLib */
vpcola 0:f1d3878b8dd9 181
vpcola 0:f1d3878b8dd9 182 #endif /* defined(__XBEE_REMOTE_H_) */