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@9:3708b94b2312, 2016-03-08 (annotated)
- Committer:
- agufal
- Date:
- Tue Mar 08 15:33:13 2016 +0000
- Revision:
- 9:3708b94b2312
- Child:
- 10:8c5a246b9045
Creada la clase AccelService, que se encarga de mandar por Bluetooth la informaci?n del aceler?metro. ; OJO: parece que env?a, pero no se si los datos que se mandan est?n bien.
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 | 9:3708b94b2312 | 18 | int _values[3]; |
| 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 |
