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.
source/DOORService.h@0:1eec8720727a, 2017-01-16 (annotated)
- Committer:
- sog_yang
- Date:
- Mon Jan 16 14:16:03 2017 +0000
- Revision:
- 0:1eec8720727a
NQ62X BLE DOORCTL 4CH project init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sog_yang | 0:1eec8720727a | 1 | /* mbed Microcontroller Library |
sog_yang | 0:1eec8720727a | 2 | * Copyright (c) 2006-2013 ARM Limited |
sog_yang | 0:1eec8720727a | 3 | * |
sog_yang | 0:1eec8720727a | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
sog_yang | 0:1eec8720727a | 5 | * you may not use this file except in compliance with the License. |
sog_yang | 0:1eec8720727a | 6 | * You may obtain a copy of the License at |
sog_yang | 0:1eec8720727a | 7 | * |
sog_yang | 0:1eec8720727a | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
sog_yang | 0:1eec8720727a | 9 | * |
sog_yang | 0:1eec8720727a | 10 | * Unless required by applicable law or agreed to in writing, software |
sog_yang | 0:1eec8720727a | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
sog_yang | 0:1eec8720727a | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sog_yang | 0:1eec8720727a | 13 | * See the License for the specific language governing permissions and |
sog_yang | 0:1eec8720727a | 14 | * limitations under the License. |
sog_yang | 0:1eec8720727a | 15 | */ |
sog_yang | 0:1eec8720727a | 16 | |
sog_yang | 0:1eec8720727a | 17 | #ifndef __BLE_DOOR_SERVICE_H__ |
sog_yang | 0:1eec8720727a | 18 | #define __BLE_DOOR_SERVICE_H__ |
sog_yang | 0:1eec8720727a | 19 | |
sog_yang | 0:1eec8720727a | 20 | class DOORService { |
sog_yang | 0:1eec8720727a | 21 | public: |
sog_yang | 0:1eec8720727a | 22 | const static uint16_t DOOR_SERVICE_UUID = 0xA000; |
sog_yang | 0:1eec8720727a | 23 | const static uint16_t DOOR_STATE_CHARACTERISTIC_UUID = 0xA001 ; |
sog_yang | 0:1eec8720727a | 24 | |
sog_yang | 0:1eec8720727a | 25 | DOORService(BLEDevice &_ble, uint8_t initialValueForDOORCharacteristic): |
sog_yang | 0:1eec8720727a | 26 | ble(_ble), doorState(DOOR_STATE_CHARACTERISTIC_UUID, &initialValueForDOORCharacteristic) |
sog_yang | 0:1eec8720727a | 27 | { |
sog_yang | 0:1eec8720727a | 28 | GattCharacteristic *charTable[] = {&doorState}; |
sog_yang | 0:1eec8720727a | 29 | GattService doorCTL_Service(DOOR_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); |
sog_yang | 0:1eec8720727a | 30 | ble.addService(doorCTL_Service); |
sog_yang | 0:1eec8720727a | 31 | } |
sog_yang | 0:1eec8720727a | 32 | |
sog_yang | 0:1eec8720727a | 33 | GattAttribute::Handle_t getValueHandle() const { |
sog_yang | 0:1eec8720727a | 34 | return doorState.getValueHandle(); |
sog_yang | 0:1eec8720727a | 35 | } |
sog_yang | 0:1eec8720727a | 36 | |
sog_yang | 0:1eec8720727a | 37 | private: |
sog_yang | 0:1eec8720727a | 38 | BLEDevice &ble; |
sog_yang | 0:1eec8720727a | 39 | ReadWriteGattCharacteristic<uint8_t> doorState; |
sog_yang | 0:1eec8720727a | 40 | }; |
sog_yang | 0:1eec8720727a | 41 | |
sog_yang | 0:1eec8720727a | 42 | #endif /* #ifndef __BLE_LED_SERVICE_H__ */ |