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 nRF51822 circular_buffer
AccelService.h@10:8c5a246b9045, 2016-03-08 (annotated)
- Committer:
- agufal
- Date:
- Tue Mar 08 16:38:49 2016 +0000
- Revision:
- 10:8c5a246b9045
- Parent:
- 9:3708b94b2312
- Child:
- 13:e4c3b3e00e3d
Arreglada la forma de enviar por BLE los ejes. Ahora los manda cada uno partido en dos bytes.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| agufal | 9:3708b94b2312 | 1 | #ifndef ACCELSERVICE_H |
| agufal | 9:3708b94b2312 | 2 | #define ACCELSERVICE_H |
| agufal | 9:3708b94b2312 | 3 | |
| agufal | 9:3708b94b2312 | 4 | #include "BLE.h" |
| agufal | 9:3708b94b2312 | 5 | #include "Vector.h" |
| agufal | 9:3708b94b2312 | 6 | |
| agufal | 9:3708b94b2312 | 7 | #define SERVICE_UUID 0xA000 |
| agufal | 9:3708b94b2312 | 8 | #define CHARACTERISTIC_UUID 0xA001 |
| agufal | 9:3708b94b2312 | 9 | |
| agufal | 9:3708b94b2312 | 10 | class AccelService { |
| agufal | 9:3708b94b2312 | 11 | |
| agufal | 9:3708b94b2312 | 12 | public: |
| agufal | 9:3708b94b2312 | 13 | AccelService(); |
| agufal | 9:3708b94b2312 | 14 | void updateAccelState(Vector v); |
| agufal | 9:3708b94b2312 | 15 | |
| agufal | 9:3708b94b2312 | 16 | private: |
| agufal | 9:3708b94b2312 | 17 | GattCharacteristic _accelState; |
| agufal | 10:8c5a246b9045 | 18 | uint8_t _values[6]; // 3 ejes * 2 bytes por eje |
| agufal | 9:3708b94b2312 | 19 | |
| agufal | 9:3708b94b2312 | 20 | static void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params){ |
| agufal | 9:3708b94b2312 | 21 | |
| agufal | 9:3708b94b2312 | 22 | BLE::Instance().gap().startAdvertising(); |
| agufal | 9:3708b94b2312 | 23 | |
| agufal | 9:3708b94b2312 | 24 | } |
| agufal | 9:3708b94b2312 | 25 | |
| agufal | 9:3708b94b2312 | 26 | static void connectionCallback(const Gap::ConnectionCallbackParams_t *params){ |
| agufal | 9:3708b94b2312 | 27 | |
| agufal | 9:3708b94b2312 | 28 | BLE::Instance().gap().stopAdvertising(); |
| agufal | 9:3708b94b2312 | 29 | |
| agufal | 9:3708b94b2312 | 30 | } |
| agufal | 9:3708b94b2312 | 31 | }; |
| agufal | 9:3708b94b2312 | 32 | |
| agufal | 9:3708b94b2312 | 33 | #endif //#ifndef ACCELSERVICE_H |
