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.
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal by
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 /** 00034 * Class definition for a MicroBit BLE Animation Service. 00035 */ 00036 00037 extern const uint8_t MicroBitAnimationServiceUUID[]; 00038 // animation type: indicates the type of animation that should be executed by the microbit : R|W 00039 extern const uint8_t MicroBitAnimationServiceAnimationTypeCharacteristicUUID[]; 00040 // animation status: indicates whether or not an animation is currently in progress : R|N 00041 extern const uint8_t MicroBitAnimationServiceAnimationStatusCharacteristicUUID[]; 00042 // animation control: allows various types of control to be exercised (start|stop|faster|slower) : W 00043 extern const uint8_t MicroBitAnimationServiceAnimationControlCharacteristicUUID[]; 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 uint8_t animation_type_buffer[1]; 00069 uint8_t animation_status_buffer[1]; 00070 uint8_t animation_control_buffer[1]; 00071 00072 // TODO: handles on this service's characterisitics. 00073 GattAttribute::Handle_t animationTypeCharacteristicHandle; 00074 GattAttribute::Handle_t animationStatusCharacteristicHandle; 00075 GattAttribute::Handle_t animationControlCharacteristicHandle; 00076 00077 void animationStatusUpdate(MicroBitEvent e); 00078 00079 }; 00080 00081 #endif
Generated on Tue Jul 12 2022 19:14:05 by
1.7.2
