This is an example of BLE GATT Client, which receives broadcast data from BLE_Server_BME280 ( a GATT server) , then transfers values up to mbed Device Connector (cloud).
Please refer details about BLEClient_mbedDevConn below. https://github.com/soramame21/BLEClient_mbedDevConn
The location of required BLE GATT server, BLE_Server_BME280, is at here. https://developer.mbed.org/users/edamame22/code/BLE_Server_BME280/
shields/TARGET_ST_BLUENRG/source/BlueNRGDiscoveredCharacteristic.cpp@0:29983394c6b6, 2017-04-13 (annotated)
- Committer:
- edamame22
- Date:
- Thu Apr 13 04:48:11 2017 +0000
- Revision:
- 0:29983394c6b6
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
edamame22 | 0:29983394c6b6 | 1 | /* mbed Microcontroller Library |
edamame22 | 0:29983394c6b6 | 2 | * Copyright (c) 2006-2013 ARM Limited |
edamame22 | 0:29983394c6b6 | 3 | * |
edamame22 | 0:29983394c6b6 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
edamame22 | 0:29983394c6b6 | 5 | * you may not use this file except in compliance with the License. |
edamame22 | 0:29983394c6b6 | 6 | * You may obtain a copy of the License at |
edamame22 | 0:29983394c6b6 | 7 | * |
edamame22 | 0:29983394c6b6 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
edamame22 | 0:29983394c6b6 | 9 | * |
edamame22 | 0:29983394c6b6 | 10 | * Unless required by applicable law or agreed to in writing, software |
edamame22 | 0:29983394c6b6 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
edamame22 | 0:29983394c6b6 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
edamame22 | 0:29983394c6b6 | 13 | * See the License for the specific language governing permissions and |
edamame22 | 0:29983394c6b6 | 14 | * limitations under the License. |
edamame22 | 0:29983394c6b6 | 15 | */ |
edamame22 | 0:29983394c6b6 | 16 | |
edamame22 | 0:29983394c6b6 | 17 | #include "BlueNRGDiscoveredCharacteristic.h" |
edamame22 | 0:29983394c6b6 | 18 | #include "BlueNRGGattClient.h" |
edamame22 | 0:29983394c6b6 | 19 | |
edamame22 | 0:29983394c6b6 | 20 | void BlueNRGDiscoveredCharacteristic::setup(BlueNRGGattClient *gattcIn, |
edamame22 | 0:29983394c6b6 | 21 | Gap::Handle_t connectionHandleIn, |
edamame22 | 0:29983394c6b6 | 22 | DiscoveredCharacteristic::Properties_t propsIn, |
edamame22 | 0:29983394c6b6 | 23 | GattAttribute::Handle_t declHandleIn, |
edamame22 | 0:29983394c6b6 | 24 | GattAttribute::Handle_t valueHandleIn, |
edamame22 | 0:29983394c6b6 | 25 | GattAttribute::Handle_t lastHandleIn) |
edamame22 | 0:29983394c6b6 | 26 | { |
edamame22 | 0:29983394c6b6 | 27 | gattc = gattcIn; |
edamame22 | 0:29983394c6b6 | 28 | connHandle = connectionHandleIn; |
edamame22 | 0:29983394c6b6 | 29 | declHandle = declHandleIn; |
edamame22 | 0:29983394c6b6 | 30 | valueHandle = valueHandleIn; |
edamame22 | 0:29983394c6b6 | 31 | lastHandle = lastHandleIn; |
edamame22 | 0:29983394c6b6 | 32 | |
edamame22 | 0:29983394c6b6 | 33 | props._broadcast = propsIn.broadcast(); |
edamame22 | 0:29983394c6b6 | 34 | props._read = propsIn.read(); |
edamame22 | 0:29983394c6b6 | 35 | props._writeWoResp = propsIn.writeWoResp(); |
edamame22 | 0:29983394c6b6 | 36 | props._write = propsIn.write(); |
edamame22 | 0:29983394c6b6 | 37 | props._notify = propsIn.notify(); |
edamame22 | 0:29983394c6b6 | 38 | props._indicate = propsIn.indicate(); |
edamame22 | 0:29983394c6b6 | 39 | props._authSignedWrite = propsIn.authSignedWrite(); |
edamame22 | 0:29983394c6b6 | 40 | } |
edamame22 | 0:29983394c6b6 | 41 | |
edamame22 | 0:29983394c6b6 | 42 | void BlueNRGDiscoveredCharacteristic::setup(BlueNRGGattClient *gattcIn, |
edamame22 | 0:29983394c6b6 | 43 | Gap::Handle_t connectionHandleIn, |
edamame22 | 0:29983394c6b6 | 44 | UUID uuidIn, |
edamame22 | 0:29983394c6b6 | 45 | DiscoveredCharacteristic::Properties_t propsIn, |
edamame22 | 0:29983394c6b6 | 46 | GattAttribute::Handle_t declHandleIn, |
edamame22 | 0:29983394c6b6 | 47 | GattAttribute::Handle_t valueHandleIn, |
edamame22 | 0:29983394c6b6 | 48 | GattAttribute::Handle_t lastHandleIn) |
edamame22 | 0:29983394c6b6 | 49 | { |
edamame22 | 0:29983394c6b6 | 50 | gattc = gattcIn; |
edamame22 | 0:29983394c6b6 | 51 | connHandle = connectionHandleIn; |
edamame22 | 0:29983394c6b6 | 52 | uuid = uuidIn; |
edamame22 | 0:29983394c6b6 | 53 | declHandle = declHandleIn; |
edamame22 | 0:29983394c6b6 | 54 | valueHandle = valueHandleIn; |
edamame22 | 0:29983394c6b6 | 55 | lastHandle = lastHandleIn; |
edamame22 | 0:29983394c6b6 | 56 | |
edamame22 | 0:29983394c6b6 | 57 | props._broadcast = propsIn.broadcast(); |
edamame22 | 0:29983394c6b6 | 58 | props._read = propsIn.read(); |
edamame22 | 0:29983394c6b6 | 59 | props._writeWoResp = propsIn.writeWoResp(); |
edamame22 | 0:29983394c6b6 | 60 | props._write = propsIn.write(); |
edamame22 | 0:29983394c6b6 | 61 | props._notify = propsIn.notify(); |
edamame22 | 0:29983394c6b6 | 62 | props._indicate = propsIn.indicate(); |
edamame22 | 0:29983394c6b6 | 63 | props._authSignedWrite = propsIn.authSignedWrite(); |
edamame22 | 0:29983394c6b6 | 64 | } |
edamame22 | 0:29983394c6b6 | 65 | |
edamame22 | 0:29983394c6b6 | 66 | void BlueNRGDiscoveredCharacteristic::setLastHandle(GattAttribute::Handle_t lastHandleIn) { |
edamame22 | 0:29983394c6b6 | 67 | lastHandle = lastHandleIn; |
edamame22 | 0:29983394c6b6 | 68 | } |