Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:a1734fe1ec4b 1 /**
vpcola 0:a1734fe1ec4b 2 * Copyright (c) 2015 Digi International Inc.,
vpcola 0:a1734fe1ec4b 3 * All rights not expressly granted are reserved.
vpcola 0:a1734fe1ec4b 4 *
vpcola 0:a1734fe1ec4b 5 * This Source Code Form is subject to the terms of the Mozilla Public
vpcola 0:a1734fe1ec4b 6 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
vpcola 0:a1734fe1ec4b 7 * You can obtain one at http://mozilla.org/MPL/2.0/.
vpcola 0:a1734fe1ec4b 8 *
vpcola 0:a1734fe1ec4b 9 * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
vpcola 0:a1734fe1ec4b 10 * =======================================================================
vpcola 0:a1734fe1ec4b 11 */
vpcola 0:a1734fe1ec4b 12
vpcola 0:a1734fe1ec4b 13 #include "FH_ModemStatus.h"
vpcola 0:a1734fe1ec4b 14
vpcola 0:a1734fe1ec4b 15 /** Class constructor */
vpcola 0:a1734fe1ec4b 16 FH_ModemStatus::FH_ModemStatus() : FrameHandler(ApiFrame::AtModemStatus), modem_status_cb(NULL)
vpcola 0:a1734fe1ec4b 17 {
vpcola 0:a1734fe1ec4b 18 }
vpcola 0:a1734fe1ec4b 19
vpcola 0:a1734fe1ec4b 20 /** Class destructor */
vpcola 0:a1734fe1ec4b 21 FH_ModemStatus::~FH_ModemStatus()
vpcola 0:a1734fe1ec4b 22 {
vpcola 0:a1734fe1ec4b 23 }
vpcola 0:a1734fe1ec4b 24
vpcola 0:a1734fe1ec4b 25 void FH_ModemStatus::register_modem_status_cb(modem_status_cb_t function)
vpcola 0:a1734fe1ec4b 26 {
vpcola 0:a1734fe1ec4b 27 modem_status_cb = function;
vpcola 0:a1734fe1ec4b 28 }
vpcola 0:a1734fe1ec4b 29
vpcola 0:a1734fe1ec4b 30 void FH_ModemStatus::unregister_modem_status_cb(void)
vpcola 0:a1734fe1ec4b 31 {
vpcola 0:a1734fe1ec4b 32 modem_status_cb = NULL;
vpcola 0:a1734fe1ec4b 33 }
vpcola 0:a1734fe1ec4b 34
vpcola 0:a1734fe1ec4b 35 void FH_ModemStatus::process_frame_data(const ApiFrame *const frame)
vpcola 0:a1734fe1ec4b 36 {
vpcola 0:a1734fe1ec4b 37 /* The caller checks that the type matches, so no need to check it here again */
vpcola 0:a1734fe1ec4b 38
vpcola 0:a1734fe1ec4b 39 if (modem_status_cb == NULL) {
vpcola 0:a1734fe1ec4b 40 return;
vpcola 0:a1734fe1ec4b 41 }
vpcola 0:a1734fe1ec4b 42
vpcola 0:a1734fe1ec4b 43 modem_status_cb((AtCmdFrame::ModemStatus)frame->get_data_at(0));
vpcola 0:a1734fe1ec4b 44 }