Library to easily communicate with XBee modules.
Fork of XBeeLib by
FrameHandlers/FrameHandler.h@10:273032d9299a, 2018-03-27 (annotated)
- Committer:
- basvuyk
- Date:
- Tue Mar 27 14:13:12 2018 +0000
- Revision:
- 10:273032d9299a
- Parent:
- 4:629712865107
Slave V1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spastor | 0:fcaad0dfa051 | 1 | /** |
spastor | 0:fcaad0dfa051 | 2 | * Copyright (c) 2015 Digi International Inc., |
spastor | 0:fcaad0dfa051 | 3 | * All rights not expressly granted are reserved. |
spastor | 0:fcaad0dfa051 | 4 | * |
spastor | 0:fcaad0dfa051 | 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
spastor | 0:fcaad0dfa051 | 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
spastor | 0:fcaad0dfa051 | 7 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
spastor | 0:fcaad0dfa051 | 8 | * |
spastor | 0:fcaad0dfa051 | 9 | * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 |
spastor | 0:fcaad0dfa051 | 10 | * ======================================================================= |
spastor | 0:fcaad0dfa051 | 11 | */ |
spastor | 0:fcaad0dfa051 | 12 | |
spastor | 0:fcaad0dfa051 | 13 | #if !defined(__FRAME_HANDLER_H_) |
spastor | 0:fcaad0dfa051 | 14 | #define __FRAME_HANDLER_H_ |
spastor | 0:fcaad0dfa051 | 15 | |
spastor | 0:fcaad0dfa051 | 16 | #include "Frames/ApiFrame.h" |
spastor | 0:fcaad0dfa051 | 17 | |
spastor | 0:fcaad0dfa051 | 18 | /** Class for the frame handlers */ |
spastor | 0:fcaad0dfa051 | 19 | class FrameHandler |
spastor | 0:fcaad0dfa051 | 20 | { |
spastor | 0:fcaad0dfa051 | 21 | friend class ApiFrame; |
spastor | 4:629712865107 | 22 | |
spastor | 0:fcaad0dfa051 | 23 | public: |
spastor | 0:fcaad0dfa051 | 24 | /** Class constructor |
spastor | 0:fcaad0dfa051 | 25 | * |
spastor | 0:fcaad0dfa051 | 26 | * @param type frame type handled by this frame handler |
spastor | 0:fcaad0dfa051 | 27 | */ |
spastor | 0:fcaad0dfa051 | 28 | FrameHandler(ApiFrame::ApiFrameType type); |
spastor | 0:fcaad0dfa051 | 29 | |
spastor | 0:fcaad0dfa051 | 30 | FrameHandler(const FrameHandler& other); /* Intentionally not implemented */ |
spastor | 0:fcaad0dfa051 | 31 | /** Class destructor */ |
spastor | 0:fcaad0dfa051 | 32 | virtual ~FrameHandler(); |
spastor | 4:629712865107 | 33 | |
spastor | 0:fcaad0dfa051 | 34 | /** get_type returns the type of frames handled by this handler |
spastor | 0:fcaad0dfa051 | 35 | * |
spastor | 0:fcaad0dfa051 | 36 | * @returns the frame type handled by the handler |
spastor | 0:fcaad0dfa051 | 37 | */ |
spastor | 0:fcaad0dfa051 | 38 | ApiFrame::ApiFrameType get_type() const; |
spastor | 0:fcaad0dfa051 | 39 | |
spastor | 0:fcaad0dfa051 | 40 | /** process_frame_data method called by the library to process the |
spastor | 0:fcaad0dfa051 | 41 | * the incoming frames if the type matches. |
spastor | 0:fcaad0dfa051 | 42 | * |
spastor | 0:fcaad0dfa051 | 43 | * @param frame pointer pointing to the api frame that must be processed |
spastor | 0:fcaad0dfa051 | 44 | */ |
spastor | 0:fcaad0dfa051 | 45 | virtual void process_frame_data(const ApiFrame *const frame) = 0; |
spastor | 0:fcaad0dfa051 | 46 | |
spastor | 0:fcaad0dfa051 | 47 | protected: |
spastor | 0:fcaad0dfa051 | 48 | /** frame type handled by this handler */ |
spastor | 4:629712865107 | 49 | ApiFrame::ApiFrameType _type; |
spastor | 0:fcaad0dfa051 | 50 | }; |
spastor | 0:fcaad0dfa051 | 51 | |
spastor | 0:fcaad0dfa051 | 52 | #endif /* defined(__FRAME_HANDLER_H_) */ |