Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of XBeeLib by
FH_IoDataSampleDM.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 "XBeeLib.h" 00014 00015 using namespace XBeeLib; 00016 00017 /** Class constructor */ 00018 FH_IoDataSampeDM::FH_IoDataSampeDM() : FrameHandler(ApiFrame::IoSampleRxZBDM), 00019 io_data_cb(NULL) 00020 { 00021 } 00022 00023 /** Class destructor */ 00024 FH_IoDataSampeDM::~FH_IoDataSampeDM() 00025 { 00026 } 00027 00028 void FH_IoDataSampeDM::register_io_data_cb(io_data_cb_dm_t function) 00029 { 00030 io_data_cb = function; 00031 } 00032 00033 void FH_IoDataSampeDM::unregister_io_data_cb() 00034 { 00035 io_data_cb = NULL; 00036 } 00037 00038 /* DM RX packet offsets */ 00039 #define DM_IO_SAMPLE_DATA_OFFSET 11 00040 00041 void FH_IoDataSampeDM::process_frame_data(const ApiFrame *const frame) 00042 { 00043 const uint8_t * const datap = frame->get_data();; 00044 00045 /* The caller checks that the type matches, so no need to check it here again */ 00046 if (io_data_cb == NULL) { 00047 return; 00048 } 00049 00050 /* We got an IO packet, decode it... */ 00051 const uint64_t sender64 = addr64_from_uint8_t(datap); 00052 const RemoteXBeeDM sender = RemoteXBeeDM(sender64); 00053 const IOSampleDM ioSample = IOSampleDM(&datap[DM_IO_SAMPLE_DATA_OFFSET], frame->get_data_len() - DM_IO_SAMPLE_DATA_OFFSET); 00054 00055 io_data_cb(sender, ioSample); 00056 }
Generated on Tue Jul 12 2022 17:33:34 by
1.7.2
