Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FH_ModemStatus.cpp Source File

FH_ModemStatus.cpp

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 #include "FH_ModemStatus.h"
00014 
00015 /** Class constructor */
00016 FH_ModemStatus::FH_ModemStatus() : FrameHandler(ApiFrame::AtModemStatus), modem_status_cb(NULL)
00017 {
00018 }
00019 
00020 /** Class destructor */
00021 FH_ModemStatus::~FH_ModemStatus()
00022 {
00023 }
00024 
00025 void FH_ModemStatus::register_modem_status_cb(modem_status_cb_t function)
00026 {
00027     modem_status_cb = function;
00028 }
00029 
00030 void FH_ModemStatus::unregister_modem_status_cb(void)
00031 {
00032     modem_status_cb = NULL;
00033 }
00034 
00035 void FH_ModemStatus::process_frame_data(const ApiFrame *const frame)
00036 {
00037     /* The caller checks that the type matches, so no need to check it here again */
00038 
00039     if (modem_status_cb == NULL) {
00040         return;
00041     }
00042 
00043     modem_status_cb((AtCmdFrame::ModemStatus)frame->get_data_at(0));
00044 }