BLE test with temp

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 X_NUCLEO_IKS01A2 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
tomotakaw
Date:
Mon Aug 13 07:09:13 2018 +0000
Revision:
22:ef03ce1c6c99
BLE test with temp sensor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tomotakaw 22:ef03ce1c6c99 1 /* mbed Microcontroller Library
tomotakaw 22:ef03ce1c6c99 2 * Copyright (c) 2006-2013 ARM Limited
tomotakaw 22:ef03ce1c6c99 3 *
tomotakaw 22:ef03ce1c6c99 4 * Licensed under the Apache License, Version 2.0 (the "License");
tomotakaw 22:ef03ce1c6c99 5 * you may not use this file except in compliance with the License.
tomotakaw 22:ef03ce1c6c99 6 * You may obtain a copy of the License at
tomotakaw 22:ef03ce1c6c99 7 *
tomotakaw 22:ef03ce1c6c99 8 * http://www.apache.org/licenses/LICENSE-2.0
tomotakaw 22:ef03ce1c6c99 9 *
tomotakaw 22:ef03ce1c6c99 10 * Unless required by applicable law or agreed to in writing, software
tomotakaw 22:ef03ce1c6c99 11 * distributed under the License is distributed on an "AS IS" BASIS,
tomotakaw 22:ef03ce1c6c99 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomotakaw 22:ef03ce1c6c99 13 * See the License for the specific language governing permissions and
tomotakaw 22:ef03ce1c6c99 14 * limitations under the License.
tomotakaw 22:ef03ce1c6c99 15 */
tomotakaw 22:ef03ce1c6c99 16
tomotakaw 22:ef03ce1c6c99 17 #ifndef __BLE_LED_SERVICE_H__
tomotakaw 22:ef03ce1c6c99 18 #define __BLE_LED_SERVICE_H__
tomotakaw 22:ef03ce1c6c99 19
tomotakaw 22:ef03ce1c6c99 20 class LEDService {
tomotakaw 22:ef03ce1c6c99 21 public:
tomotakaw 22:ef03ce1c6c99 22 const static uint16_t LED_SERVICE_UUID = 0xA000;
tomotakaw 22:ef03ce1c6c99 23 const static uint16_t LED_STATE_CHARACTERISTIC_UUID = 0xA001;
tomotakaw 22:ef03ce1c6c99 24
tomotakaw 22:ef03ce1c6c99 25 LEDService(BLEDevice &_ble, bool initialValueForLEDCharacteristic) :
tomotakaw 22:ef03ce1c6c99 26 ble(_ble), ledState(LED_STATE_CHARACTERISTIC_UUID, &initialValueForLEDCharacteristic)
tomotakaw 22:ef03ce1c6c99 27 {
tomotakaw 22:ef03ce1c6c99 28 GattCharacteristic *charTable[] = {&ledState};
tomotakaw 22:ef03ce1c6c99 29 GattService ledService(LED_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
tomotakaw 22:ef03ce1c6c99 30 ble.addService(ledService);
tomotakaw 22:ef03ce1c6c99 31 }
tomotakaw 22:ef03ce1c6c99 32
tomotakaw 22:ef03ce1c6c99 33 GattAttribute::Handle_t getValueHandle() const
tomotakaw 22:ef03ce1c6c99 34 {
tomotakaw 22:ef03ce1c6c99 35 return ledState.getValueHandle();
tomotakaw 22:ef03ce1c6c99 36 }
tomotakaw 22:ef03ce1c6c99 37
tomotakaw 22:ef03ce1c6c99 38 private:
tomotakaw 22:ef03ce1c6c99 39 BLEDevice &ble;
tomotakaw 22:ef03ce1c6c99 40 ReadWriteGattCharacteristic<bool> ledState;
tomotakaw 22:ef03ce1c6c99 41 };
tomotakaw 22:ef03ce1c6c99 42
tomotakaw 22:ef03ce1c6c99 43 #endif /* #ifndef __BLE_LED_SERVICE_H__ */