Martin Woolley / microbit-dal-bluetooth-mdw_starter

Dependencies:   BLE_API mbed-dev-bin nRF51822-bluetooth-mdw

Fork of microbit-dal-bluetooth-mdw by Martin Woolley

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MicroBitAnimationService.h Source File

MicroBitAnimationService.h

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 Animation 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 #ifndef MICROBIT_ANIMATION_SERVICE_H
00027 #define MICROBIT_ANIMATION_SERVICE_H
00028 
00029 #include "MicroBitConfig.h"
00030 #include "Animator.h"
00031 #include "ble/BLE.h"
00032 
00033 // UUIDs for our service and characteristics
00034 extern const uint8_t  MicroBitAnimationServiceUUID[];
00035 // animation type: indicates the type of animation that should be executed by the microbit            : R|W
00036 extern const uint8_t  MicroBitAnimationServiceAnimationTypeCharacteristicUUID[];
00037 // animation status: indicates whether or not an animation is currently in progress                   : R|N
00038 extern const uint8_t  MicroBitAnimationServiceAnimationStatusCharacteristicUUID[];
00039 // animation control: allows various types of control to be exercised (start|stop|faster|slower)      : W
00040 extern const uint8_t  MicroBitAnimationServiceAnimationControlCharacteristicUUID[];
00041 
00042 /**
00043   * Class definition for a MicroBit BLE Animation Service.
00044   */
00045 class MicroBitAnimationService
00046 {
00047     public:
00048 
00049     /**
00050       * Constructor.
00051       * Create a representation of the AnimationService
00052       * @param _ble The instance of a BLE device that we're running on.
00053       */
00054     MicroBitAnimationService(BLEDevice &_ble);
00055 
00056     /**
00057       * Callback. Invoked when a characteristic is written to
00058       */
00059     void onDataWritten(const GattWriteCallbackParams *params);
00060     
00061     private:
00062 
00063     // Bluetooth stack we're running on.
00064     BLEDevice           &ble;
00065     
00066     
00067     // TODO: memory for our Animation characteristics.
00068 
00069 
00070 
00071     // TODO: handles on this service's characterisitics.
00072     
00073     
00074     
00075     void animationStatusUpdate(MicroBitEvent e);
00076 
00077 };
00078 
00079 #endif