rajarajan elango
/
mbed-os-example-ble-LED
Testing of Onboard Led using nRF control panel app in Android device.
source/LEDService.h@2:864ddfb70a9c, 2016-07-28 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Jul 28 23:14:48 2016 +0100
- Revision:
- 2:864ddfb70a9c
- Parent:
- 0:c6a8f2b3efb6
- Child:
- 74:51fde11a771f
Merge branch 'master' of https://github.com/ARMmbed/mbed-os-example-ble
Commit copied from ./src/github.com/ARMmbed/mbed-os-example-ble
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 2:864ddfb70a9c | 1 | /* mbed Microcontroller Library |
mbed_official | 2:864ddfb70a9c | 2 | * Copyright (c) 2006-2013 ARM Limited |
mbed_official | 2:864ddfb70a9c | 3 | * |
mbed_official | 2:864ddfb70a9c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 2:864ddfb70a9c | 5 | * you may not use this file except in compliance with the License. |
mbed_official | 2:864ddfb70a9c | 6 | * You may obtain a copy of the License at |
mbed_official | 2:864ddfb70a9c | 7 | * |
mbed_official | 2:864ddfb70a9c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 2:864ddfb70a9c | 9 | * |
mbed_official | 2:864ddfb70a9c | 10 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 2:864ddfb70a9c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 2:864ddfb70a9c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 2:864ddfb70a9c | 13 | * See the License for the specific language governing permissions and |
mbed_official | 2:864ddfb70a9c | 14 | * limitations under the License. |
mbed_official | 2:864ddfb70a9c | 15 | */ |
mbed_official | 2:864ddfb70a9c | 16 | |
mbed_official | 2:864ddfb70a9c | 17 | #ifndef __BLE_LED_SERVICE_H__ |
mbed_official | 2:864ddfb70a9c | 18 | #define __BLE_LED_SERVICE_H__ |
mbed_official | 2:864ddfb70a9c | 19 | |
mbed_official | 2:864ddfb70a9c | 20 | class LEDService { |
mbed_official | 2:864ddfb70a9c | 21 | public: |
mbed_official | 2:864ddfb70a9c | 22 | const static uint16_t LED_SERVICE_UUID = 0xA000; |
mbed_official | 2:864ddfb70a9c | 23 | const static uint16_t LED_STATE_CHARACTERISTIC_UUID = 0xA001; |
mbed_official | 2:864ddfb70a9c | 24 | |
mbed_official | 2:864ddfb70a9c | 25 | LEDService(BLEDevice &_ble, bool initialValueForLEDCharacteristic) : |
mbed_official | 2:864ddfb70a9c | 26 | ble(_ble), ledState(LED_STATE_CHARACTERISTIC_UUID, &initialValueForLEDCharacteristic) |
mbed_official | 2:864ddfb70a9c | 27 | { |
mbed_official | 2:864ddfb70a9c | 28 | GattCharacteristic *charTable[] = {&ledState}; |
mbed_official | 2:864ddfb70a9c | 29 | GattService ledService(LED_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); |
mbed_official | 2:864ddfb70a9c | 30 | ble.addService(ledService); |
mbed_official | 2:864ddfb70a9c | 31 | } |
mbed_official | 2:864ddfb70a9c | 32 | |
mbed_official | 2:864ddfb70a9c | 33 | GattAttribute::Handle_t getValueHandle() const |
mbed_official | 2:864ddfb70a9c | 34 | { |
mbed_official | 2:864ddfb70a9c | 35 | return ledState.getValueHandle(); |
mbed_official | 2:864ddfb70a9c | 36 | } |
mbed_official | 2:864ddfb70a9c | 37 | |
mbed_official | 2:864ddfb70a9c | 38 | private: |
mbed_official | 2:864ddfb70a9c | 39 | BLEDevice &ble; |
mbed_official | 2:864ddfb70a9c | 40 | ReadWriteGattCharacteristic<bool> ledState; |
mbed_official | 2:864ddfb70a9c | 41 | }; |
mbed_official | 2:864ddfb70a9c | 42 | |
mbed_official | 2:864ddfb70a9c | 43 | #endif /* #ifndef __BLE_LED_SERVICE_H__ */ |