Library to easily communicate with XBee modules.

Dependencies:   DigiLogger

Dependents:   WaterLogger XbeeGateway XBee_Cooker ProjetReceiver ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FH_AtCmdResp.h Source File

FH_AtCmdResp.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(__FH_AT_CMD_RESP_H_)
00014 #define __FH_AT_CMD_RESP_H_
00015 
00016 #include "FrameHandler.h"
00017 #include "XBee/XBee.h"
00018 
00019 namespace XBeeLib {
00020 typedef void (*at_cmd_resp_cb_t)(const uint8_t * data, uint16_t len);
00021 
00022 class FH_AtCmdResp : public FrameHandler
00023 {
00024     private:
00025         /** Callback function, invoked (if registered) when an at command response packet is received */
00026         at_cmd_resp_cb_t at_cmd_resp_cb;
00027 
00028     public:
00029 
00030         /** Class constructor */
00031         FH_AtCmdResp();
00032 
00033         /** Class constructor */
00034         FH_AtCmdResp(ApiFrame::ApiFrameType type);
00035 
00036 
00037         /** Class destructor */
00038         virtual ~FH_AtCmdResp();
00039 
00040         virtual void process_frame_data(const ApiFrame *const frame);
00041 
00042         virtual void register_at_cmd_resp_cb(at_cmd_resp_cb_t function);
00043 
00044         virtual void unregister_at_cmd_resp_cb();
00045 };
00046 
00047 /**
00048  * @defgroup callback_types "Callback types declaration"
00049  * @{
00050  */
00051 /** Node Discovery Response callback type declaration for ZigBee
00052   * @param remote discovered remote node.
00053   * @param node_id Node Identifier (NI parameter) of remote.
00054   */
00055 typedef void (*node_discovery_zb_cb_t)(const RemoteXBeeZB& remote, char const * const node_id);
00056 /**
00057  * @}
00058  */
00059 
00060 class FH_NodeDiscoveryZB : public FH_AtCmdResp
00061 {
00062     private:
00063         /** Callback function, invoked (if registered) when an at command response packet is received */
00064         node_discovery_zb_cb_t node_discovery_cb;
00065 
00066     public:
00067 
00068         /** Class constructor */
00069         FH_NodeDiscoveryZB();
00070 
00071         /** Class destructor */
00072         virtual ~FH_NodeDiscoveryZB();
00073 
00074         virtual void process_frame_data(const ApiFrame *const frame);
00075 
00076         virtual void register_node_discovery_cb(node_discovery_zb_cb_t function);
00077 
00078         virtual void unregister_node_discovery_cb();
00079 };
00080 
00081 /**
00082  * @defgroup callback_types "Callback types declaration"
00083  * @{
00084  */
00085 /** Node Discovery Response callback type declaration for ZigBee
00086   * @param remote discovered remote node.
00087   * @param node_id Node Identifier (NI parameter) of remote.
00088   */
00089 typedef void (*node_discovery_dm_cb_t)(const RemoteXBeeDM& remote, char const * const node_id);
00090 /**
00091  * @}
00092  */
00093 
00094 class FH_NodeDiscoveryDM : public FH_AtCmdResp
00095 {
00096     private:
00097         /** Callback function, invoked (if registered) when an at command response packet is received */
00098         node_discovery_dm_cb_t node_discovery_cb;
00099 
00100     public:
00101 
00102         /** Class constructor */
00103         FH_NodeDiscoveryDM();
00104 
00105         /** Class destructor */
00106         virtual ~FH_NodeDiscoveryDM();
00107 
00108         virtual void process_frame_data(const ApiFrame *const frame);
00109 
00110         virtual void register_node_discovery_cb(node_discovery_dm_cb_t function);
00111 
00112         virtual void unregister_node_discovery_cb();
00113 };
00114 
00115 /**
00116  * @defgroup callback_types "Callback types declaration"
00117  * @{
00118  */
00119 /** Node Discovery Response callback type declaration for 802.15.4
00120   * @param remote discovered remote node.
00121   * @param node_id Node Identifier (NI parameter) of remote.
00122   */
00123 typedef void (*node_discovery_802_cb_t)(const RemoteXBee802& remote, char const * const node_id);
00124 /**
00125  * @}
00126  */
00127 
00128 class FH_NodeDiscovery802 : public FH_AtCmdResp
00129 {
00130     private:
00131         /** Callback function, invoked (if registered) when an at command response packet is received */
00132         node_discovery_802_cb_t node_discovery_cb;
00133 
00134     public:
00135 
00136         /** Class constructor */
00137         FH_NodeDiscovery802();
00138 
00139         /** Class destructor */
00140         virtual ~FH_NodeDiscovery802();
00141 
00142         virtual void process_frame_data(const ApiFrame *const frame);
00143 
00144         virtual void register_node_discovery_cb(node_discovery_802_cb_t function);
00145 
00146         virtual void unregister_node_discovery_cb();
00147 };
00148 
00149 } /* namespace XBeeLib */
00150 
00151 #endif /* __FH_AT_CMD_RESP_H_ */