Eddystone test using modified DAL

Dependencies:   BLE_API mbed-dev-bin nRF51822

Dependents:   microbit-eddystone

Fork of microbit-dal by Lancaster University

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MemberFunctionCallback.cpp Source File

MemberFunctionCallback.cpp

00001 /*
00002 The MIT License (MIT)
00003 
00004 Copyright (c) 2016 British Broadcasting Corporation.
00005 This software is provided by Lancaster University by arrangement with the BBC.
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a
00008 copy of this software and associated documentation files (the "Software"),
00009 to deal in the Software without restriction, including without limitation
00010 the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011 and/or sell copies of the Software, and to permit persons to whom the
00012 Software is furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00023 DEALINGS IN THE SOFTWARE.
00024 */
00025 
00026 /**
00027   * Class definition for a MemberFunctionCallback.
00028   *
00029   * C++ member functions (also known as methods) have a more complex
00030   * representation than normal C functions. This class allows a reference to
00031   * a C++ member function to be stored then called at a later date.
00032   *
00033   * This class is used extensively by the MicroBitMessageBus to deliver
00034   * events to C++ methods.
00035   */
00036 
00037 #include "MicroBitConfig.h"
00038 #include "MemberFunctionCallback.h"
00039 
00040 /**
00041   * Calls the method reference held by this MemberFunctionCallback.
00042   *
00043   * @param e The event to deliver to the method
00044   */
00045 void MemberFunctionCallback::fire(MicroBitEvent e)
00046 {
00047     invoke(object, method, e);
00048 }
00049 
00050 /**
00051   * A comparison of two MemberFunctionCallback objects.
00052   *
00053   * @return true if the given MemberFunctionCallback is equivalent to this one, false otherwise.
00054   */
00055 bool MemberFunctionCallback::operator==(const MemberFunctionCallback &mfc)
00056 {
00057     return (object == mfc.object && (memcmp(method,mfc.method,sizeof(method))==0));
00058 }