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: SDFileSystem circular_buffer MPU6050 SoftSerial
MPUService.h
00001 #ifndef __BLE_MPU_SERVICE_H__ 00002 #define __BLE_MPU_SERVICE_H__ 00003 00004 class MPUService { 00005 public: 00006 const static uint16_t MPU_SERVICE_UUID = 0xA000; 00007 const static uint16_t MPU_STATE_CHARACTERISTIC_UUID = 0xA001; 00008 00009 MPUService(BLEDevice &_ble, double x) : 00010 ble(_ble), mpuState(MPU_STATE_CHARACTERISTIC_UUID, &x,GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) 00011 { 00012 GattCharacteristic *charTable[] = {&mpuState}; 00013 GattService mpuService(MPU_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); 00014 ble.addService(mpuService); 00015 } 00016 00017 GattAttribute::Handle_t getValueHandle() const 00018 { 00019 return mpuState.getValueHandle(); 00020 } 00021 void updateSensorValue(double newValue) { 00022 ble.gattServer().write(mpuState.getValueHandle(), (uint8_t *)&newValue, sizeof(double)); 00023 } 00024 00025 private: 00026 BLEDevice &ble; 00027 ReadWriteGattCharacteristic<double> mpuState; 00028 }; 00029 00030 #endif /* #ifndef __BLE_MPU_SERVICE_H__ */
Generated on Tue Jul 19 2022 05:48:25 by
1.7.2