forking microbit-dal
Dependencies: BLE_API mbed-dev-bin nRF51822-bluetooth-mdw
Fork of microbit-dal by
inc/bluetooth/MicroBitAnimationService.h@77:9909cbcd0ece, 2016-12-27 (annotated)
- Committer:
- bluetooth_mdw
- Date:
- Tue Dec 27 11:55:17 2016 +0000
- Revision:
- 77:9909cbcd0ece
- Parent:
- 74:9771cd712730
- Child:
- 79:ab48b2043312
Animation service skeleton
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bluetooth_mdw | 74:9771cd712730 | 1 | /* |
bluetooth_mdw | 74:9771cd712730 | 2 | The MIT License (MIT) |
bluetooth_mdw | 74:9771cd712730 | 3 | |
bluetooth_mdw | 74:9771cd712730 | 4 | Copyright (c) 2016 British Broadcasting Corporation. |
bluetooth_mdw | 74:9771cd712730 | 5 | This software is provided by Lancaster University by arrangement with the BBC. |
bluetooth_mdw | 74:9771cd712730 | 6 | |
bluetooth_mdw | 74:9771cd712730 | 7 | Permission is hereby granted, free of charge, to any person obtaining a |
bluetooth_mdw | 74:9771cd712730 | 8 | copy of this software and associated documentation files (the "Software"), |
bluetooth_mdw | 74:9771cd712730 | 9 | to deal in the Software without restriction, including without limitation |
bluetooth_mdw | 74:9771cd712730 | 10 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
bluetooth_mdw | 74:9771cd712730 | 11 | and/or sell copies of the Software, and to permit persons to whom the |
bluetooth_mdw | 74:9771cd712730 | 12 | Software is furnished to do so, subject to the following conditions: |
bluetooth_mdw | 74:9771cd712730 | 13 | |
bluetooth_mdw | 74:9771cd712730 | 14 | The above copyright notice and this permission notice shall be included in |
bluetooth_mdw | 74:9771cd712730 | 15 | all copies or substantial portions of the Software. |
bluetooth_mdw | 74:9771cd712730 | 16 | |
bluetooth_mdw | 74:9771cd712730 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
bluetooth_mdw | 74:9771cd712730 | 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
bluetooth_mdw | 74:9771cd712730 | 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO Animation SHALL |
bluetooth_mdw | 74:9771cd712730 | 20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
bluetooth_mdw | 74:9771cd712730 | 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
bluetooth_mdw | 74:9771cd712730 | 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
bluetooth_mdw | 74:9771cd712730 | 23 | DEALINGS IN THE SOFTWARE. |
bluetooth_mdw | 74:9771cd712730 | 24 | */ |
bluetooth_mdw | 74:9771cd712730 | 25 | |
bluetooth_mdw | 74:9771cd712730 | 26 | #ifndef MICROBIT_ANIMATION_SERVICE_H |
bluetooth_mdw | 74:9771cd712730 | 27 | #define MICROBIT_ANIMATION_SERVICE_H |
bluetooth_mdw | 74:9771cd712730 | 28 | |
bluetooth_mdw | 74:9771cd712730 | 29 | #include "MicroBitConfig.h" |
bluetooth_mdw | 74:9771cd712730 | 30 | #include "Animator.h" |
bluetooth_mdw | 74:9771cd712730 | 31 | #include "ble/BLE.h" |
bluetooth_mdw | 74:9771cd712730 | 32 | |
bluetooth_mdw | 77:9909cbcd0ece | 33 | // TODO: UUIDs for our service and characteristics |
bluetooth_mdw | 74:9771cd712730 | 34 | |
bluetooth_mdw | 74:9771cd712730 | 35 | /** |
bluetooth_mdw | 74:9771cd712730 | 36 | * Class definition for a MicroBit BLE Animation Service. |
bluetooth_mdw | 74:9771cd712730 | 37 | */ |
bluetooth_mdw | 74:9771cd712730 | 38 | class MicroBitAnimationService |
bluetooth_mdw | 74:9771cd712730 | 39 | { |
bluetooth_mdw | 74:9771cd712730 | 40 | public: |
bluetooth_mdw | 74:9771cd712730 | 41 | |
bluetooth_mdw | 74:9771cd712730 | 42 | /** |
bluetooth_mdw | 74:9771cd712730 | 43 | * Constructor. |
bluetooth_mdw | 74:9771cd712730 | 44 | * Create a representation of the AnimationService |
bluetooth_mdw | 74:9771cd712730 | 45 | * @param _ble The instance of a BLE device that we're running on. |
bluetooth_mdw | 74:9771cd712730 | 46 | */ |
bluetooth_mdw | 74:9771cd712730 | 47 | MicroBitAnimationService(BLEDevice &_ble); |
bluetooth_mdw | 74:9771cd712730 | 48 | |
bluetooth_mdw | 74:9771cd712730 | 49 | /** |
bluetooth_mdw | 74:9771cd712730 | 50 | * Callback. Invoked when a characteristic is written to |
bluetooth_mdw | 74:9771cd712730 | 51 | */ |
bluetooth_mdw | 74:9771cd712730 | 52 | void onDataWritten(const GattWriteCallbackParams *params); |
bluetooth_mdw | 74:9771cd712730 | 53 | |
bluetooth_mdw | 74:9771cd712730 | 54 | private: |
bluetooth_mdw | 74:9771cd712730 | 55 | |
bluetooth_mdw | 74:9771cd712730 | 56 | // Bluetooth stack we're running on. |
bluetooth_mdw | 74:9771cd712730 | 57 | BLEDevice &ble; |
bluetooth_mdw | 74:9771cd712730 | 58 | |
bluetooth_mdw | 77:9909cbcd0ece | 59 | |
bluetooth_mdw | 77:9909cbcd0ece | 60 | // TODO: memory for our Animation characteristics. |
bluetooth_mdw | 77:9909cbcd0ece | 61 | |
bluetooth_mdw | 74:9771cd712730 | 62 | |
bluetooth_mdw | 77:9909cbcd0ece | 63 | |
bluetooth_mdw | 77:9909cbcd0ece | 64 | // TODO: handles on this service's characterisitics. |
bluetooth_mdw | 77:9909cbcd0ece | 65 | |
bluetooth_mdw | 77:9909cbcd0ece | 66 | |
bluetooth_mdw | 74:9771cd712730 | 67 | |
bluetooth_mdw | 74:9771cd712730 | 68 | void animationStatusUpdate(MicroBitEvent e); |
bluetooth_mdw | 74:9771cd712730 | 69 | |
bluetooth_mdw | 74:9771cd712730 | 70 | }; |
bluetooth_mdw | 74:9771cd712730 | 71 | |
bluetooth_mdw | 74:9771cd712730 | 72 | #endif |