Library to easily communicate with XBee modules.

Fork of XBeeLib by Digi International Inc.

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?

UserRevisionLine numberNew 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 #include "FH_ModemStatus.h"
spastor 0:fcaad0dfa051 14
spastor 0:fcaad0dfa051 15 /** Class constructor */
spastor 0:fcaad0dfa051 16 FH_ModemStatus::FH_ModemStatus() : FrameHandler(ApiFrame::AtModemStatus), modem_status_cb(NULL)
spastor 0:fcaad0dfa051 17 {
spastor 0:fcaad0dfa051 18 }
spastor 0:fcaad0dfa051 19
spastor 0:fcaad0dfa051 20 /** Class destructor */
spastor 0:fcaad0dfa051 21 FH_ModemStatus::~FH_ModemStatus()
spastor 0:fcaad0dfa051 22 {
spastor 0:fcaad0dfa051 23 }
spastor 0:fcaad0dfa051 24
spastor 0:fcaad0dfa051 25 void FH_ModemStatus::register_modem_status_cb(modem_status_cb_t function)
spastor 0:fcaad0dfa051 26 {
spastor 4:629712865107 27 modem_status_cb = function;
spastor 0:fcaad0dfa051 28 }
spastor 0:fcaad0dfa051 29
spastor 0:fcaad0dfa051 30 void FH_ModemStatus::unregister_modem_status_cb(void)
spastor 0:fcaad0dfa051 31 {
spastor 4:629712865107 32 modem_status_cb = NULL;
spastor 0:fcaad0dfa051 33 }
spastor 0:fcaad0dfa051 34
spastor 0:fcaad0dfa051 35 void FH_ModemStatus::process_frame_data(const ApiFrame *const frame)
spastor 0:fcaad0dfa051 36 {
spastor 4:629712865107 37 /* The caller checks that the type matches, so no need to check it here again */
spastor 4:629712865107 38
spastor 4:629712865107 39 if (modem_status_cb == NULL) {
spastor 0:fcaad0dfa051 40 return;
spastor 4:629712865107 41 }
spastor 0:fcaad0dfa051 42
spastor 0:fcaad0dfa051 43 modem_status_cb((AtCmdFrame::ModemStatus)frame->get_data_at(0));
spastor 0:fcaad0dfa051 44 }