Library to easily communicate with XBee modules.
Fork of XBeeLib by
FrameHandlers/FH_RxPacketDM.h@6:06522f3a6642, 2016-07-28 (annotated)
- Committer:
- hbujanda
- Date:
- Thu Jul 28 10:17:20 2016 +0200
- Revision:
- 6:06522f3a6642
Automatic upload
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hbujanda | 6:06522f3a6642 | 1 | /** |
hbujanda | 6:06522f3a6642 | 2 | * Copyright (c) 2015 Digi International Inc., |
hbujanda | 6:06522f3a6642 | 3 | * All rights not expressly granted are reserved. |
hbujanda | 6:06522f3a6642 | 4 | * |
hbujanda | 6:06522f3a6642 | 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
hbujanda | 6:06522f3a6642 | 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
hbujanda | 6:06522f3a6642 | 7 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
hbujanda | 6:06522f3a6642 | 8 | * |
hbujanda | 6:06522f3a6642 | 9 | * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 |
hbujanda | 6:06522f3a6642 | 10 | * ======================================================================= |
hbujanda | 6:06522f3a6642 | 11 | */ |
hbujanda | 6:06522f3a6642 | 12 | |
hbujanda | 6:06522f3a6642 | 13 | #if !defined(__FH_RX_PACKET_DM_H_) |
hbujanda | 6:06522f3a6642 | 14 | #define __FH_RX_PACKET_DM_H_ |
hbujanda | 6:06522f3a6642 | 15 | |
hbujanda | 6:06522f3a6642 | 16 | #include "FrameHandler.h" |
hbujanda | 6:06522f3a6642 | 17 | #include "RemoteXBee/RemoteXBee.h" |
hbujanda | 6:06522f3a6642 | 18 | |
hbujanda | 6:06522f3a6642 | 19 | namespace XBeeLib { |
hbujanda | 6:06522f3a6642 | 20 | |
hbujanda | 6:06522f3a6642 | 21 | /** |
hbujanda | 6:06522f3a6642 | 22 | * @defgroup callback_types "Callback types declaration" |
hbujanda | 6:06522f3a6642 | 23 | * @{ |
hbujanda | 6:06522f3a6642 | 24 | */ |
hbujanda | 6:06522f3a6642 | 25 | /** receive callback type declaration |
hbujanda | 6:06522f3a6642 | 26 | * @param remote the remote module that sent the data |
hbujanda | 6:06522f3a6642 | 27 | * @param broadcast a boolean to tell if the message was broadcast (true) or unicast (false) |
hbujanda | 6:06522f3a6642 | 28 | * @param data a pointer to data sent by @b remote. |
hbujanda | 6:06522f3a6642 | 29 | * @param len length (in bytes) of @b data buffer |
hbujanda | 6:06522f3a6642 | 30 | */ |
hbujanda | 6:06522f3a6642 | 31 | typedef void (*receive_dm_cb_t)(const RemoteXBeeDM& remote, bool broadcast, const uint8_t *const data, uint16_t len); |
hbujanda | 6:06522f3a6642 | 32 | /** |
hbujanda | 6:06522f3a6642 | 33 | * @} |
hbujanda | 6:06522f3a6642 | 34 | */ |
hbujanda | 6:06522f3a6642 | 35 | |
hbujanda | 6:06522f3a6642 | 36 | class FH_RxPacketDM : public FrameHandler |
hbujanda | 6:06522f3a6642 | 37 | { |
hbujanda | 6:06522f3a6642 | 38 | private: |
hbujanda | 6:06522f3a6642 | 39 | /** Callback function, invoked if registered */ |
hbujanda | 6:06522f3a6642 | 40 | receive_dm_cb_t receive_cb; |
hbujanda | 6:06522f3a6642 | 41 | |
hbujanda | 6:06522f3a6642 | 42 | public: |
hbujanda | 6:06522f3a6642 | 43 | /** Class constructor */ |
hbujanda | 6:06522f3a6642 | 44 | FH_RxPacketDM(); |
hbujanda | 6:06522f3a6642 | 45 | |
hbujanda | 6:06522f3a6642 | 46 | /** Class destructor */ |
hbujanda | 6:06522f3a6642 | 47 | virtual ~FH_RxPacketDM(); |
hbujanda | 6:06522f3a6642 | 48 | |
hbujanda | 6:06522f3a6642 | 49 | /** Method called by the stack to process the modem status frame data |
hbujanda | 6:06522f3a6642 | 50 | |
hbujanda | 6:06522f3a6642 | 51 | \param frame pointer pointing to api frame that must be processed */ |
hbujanda | 6:06522f3a6642 | 52 | virtual void process_frame_data(const ApiFrame* const frame); |
hbujanda | 6:06522f3a6642 | 53 | |
hbujanda | 6:06522f3a6642 | 54 | void register_receive_cb(receive_dm_cb_t function); |
hbujanda | 6:06522f3a6642 | 55 | |
hbujanda | 6:06522f3a6642 | 56 | void unregister_receive_cb(); |
hbujanda | 6:06522f3a6642 | 57 | }; |
hbujanda | 6:06522f3a6642 | 58 | |
hbujanda | 6:06522f3a6642 | 59 | } /* namespace XBeeLib */ |
hbujanda | 6:06522f3a6642 | 60 | |
hbujanda | 6:06522f3a6642 | 61 | #endif /* __FH_RX_PACKET_DM_H_ */ |