Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

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