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