Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RemoteXBee.h Source File

RemoteXBee.h

00001 /**
00002  * Copyright (c) 2015 Digi International Inc.,
00003  * All rights not expressly granted are reserved.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
00007  * You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
00010  * =======================================================================
00011  */
00012 
00013 #if !defined(__XBEE_REMOTE_H_)
00014 #define __XBEE_REMOTE_H_
00015 
00016 #include "XBee/Addresses.h"
00017 
00018 namespace XBeeLib {
00019 
00020 /** Class for Remote XBee modules. Not to be used directly. */
00021 class RemoteXBee
00022 {
00023     public:
00024 
00025          /** Default Class constructor for a remote device (connected wirelessly). No address set.
00026          */
00027         RemoteXBee();
00028 
00029         /** Class constructor for a remote device (connected wirelessly) using 64bit addressing
00030          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00031          */
00032         RemoteXBee(uint64_t remote64);
00033 
00034         /** Class destructor */
00035         ~RemoteXBee();
00036 
00037         /** get_addr64 - returns the 64bit address of the remote device
00038          *
00039          *  @returns the 64bit address of the remote device
00040          */
00041         uint64_t get_addr64() const;
00042 
00043         /** get_addr16 - returns the 16bit address of the remote device
00044          *
00045          *  @returns the 16bit address of the remote device
00046          */
00047         uint16_t get_addr16() const;
00048 
00049         /** operator == overload so the object can be compared to equal */
00050         inline bool operator == (const RemoteXBee &b) const
00051         {
00052             return ((b._dev_addr16 == _dev_addr16) &&
00053                     (b._dev_addr64 == _dev_addr64));
00054         }
00055 
00056         /** operator != overload so the object can be compared to not equal */
00057         inline bool operator != (const RemoteXBee &b) const
00058         {
00059             return !(this == &b);
00060         }
00061 
00062         /** is_valid_addr16b - checks if the RemoteXBee object has a valid 16b address
00063          *  @returns true if valid, false otherwise
00064          */
00065         inline bool is_valid_addr16b() const
00066         {
00067             return (_dev_addr16 != ADDR16_UNKNOWN);
00068         }
00069 
00070         /** is_valid_addr64b - checks if the RemoteXBee object has a valid 64b address
00071          *  @returns true if valid, false otherwise
00072          */
00073         inline bool is_valid_addr64b() const
00074         {
00075             return !(_dev_addr64 == ADDR64_UNASSIGNED);
00076         }
00077 
00078 
00079     protected:
00080         /** Remote Device 64 bit address */
00081         uint64_t      _dev_addr64;
00082 
00083         /** Remote Device 16 bit address */
00084         uint16_t    _dev_addr16;
00085 };
00086 
00087 class FH_NodeDiscovery802;
00088 /** Class for 802.15.4 Remote XBee modules */
00089 class RemoteXBee802 : public RemoteXBee
00090 {
00091     public:
00092 
00093          /** Default Class constructor for a 802.15.4 remote device (connected wirelessly). No address set.
00094          */
00095         RemoteXBee802();
00096 
00097         /** Class constructor for a 802.15.4 remote device (connected wirelessly) using 64bit addressing
00098          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00099          */
00100         RemoteXBee802(uint64_t remote64);
00101 
00102         /** Class constructor for a 802.15.4 remote device (connected wirelessly) using 16bit addressing
00103          * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
00104          */
00105         RemoteXBee802(uint16_t remote16);
00106 
00107         /** Class destructor */
00108         ~RemoteXBee802();
00109 
00110         inline bool is_valid(void)
00111         {
00112             return is_valid_addr64b() || is_valid_addr16b();
00113         }
00114 
00115     protected:
00116 
00117         friend FH_NodeDiscovery802;
00118         friend class XBee802;
00119 
00120         /** Class constructor for a 802.15.4 remote device (connected wirelessly) for which both the 64-bit and 16-bit addresses are known.
00121          * This constructor is only used by FH_NodeDiscovery802 class.
00122          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00123          * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
00124          */
00125         RemoteXBee802(uint64_t remote64, uint16_t remote16);
00126 };
00127 
00128 /** Class for ZigBee Remote XBee modules */
00129 class RemoteXBeeZB : public RemoteXBee
00130 {
00131     public:
00132 
00133          /** Default Class constructor for a ZigBee remote device (connected wirelessly). No address set.
00134          */
00135         RemoteXBeeZB();
00136 
00137        /** Class constructor for a ZigBee remote device (connected wirelessly) using 64bit addressing
00138          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00139          */
00140         RemoteXBeeZB(uint64_t remote64);
00141 
00142         /** Class constructor for a ZigBee remote device (connected wirelessly) using 64bit and 16b addressing
00143          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00144          * @param remote16 the 16-bit address (ATMY parameter) of the remote XBee module
00145          */
00146         RemoteXBeeZB(uint64_t remote64, uint16_t remote16);
00147 
00148         /** Class destructor */
00149         ~RemoteXBeeZB();
00150 
00151         inline bool is_valid(void)
00152         {
00153             return is_valid_addr64b();
00154         }
00155 };
00156 
00157 /** Class for DigiMesh Remote XBee modules */
00158 class RemoteXBeeDM : public RemoteXBee
00159 {
00160     public:
00161 
00162          /** Default Class constructor for a DigiMesh remote device (connected wirelessly). No address set.
00163          */
00164         RemoteXBeeDM();
00165 
00166        /** Class constructor for a DigiMesh remote device (connected wirelessly) using 64bit addressing
00167          * @param remote64 the 64-bit address (ATSH and ATSL parameters) of the remote XBee module
00168          */
00169         RemoteXBeeDM(uint64_t remote64);
00170 
00171         /** Class destructor */
00172         ~RemoteXBeeDM();
00173 
00174         inline bool is_valid(void)
00175         {
00176             return is_valid_addr64b();
00177         }
00178 };
00179 
00180 }   /* namespace XBeeLib */
00181 
00182 #endif /* defined(__XBEE_REMOTE_H_) */