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/
mbed-client/source/include/eventdata.h@2:b894b3508057, 2017-09-05 (annotated)
- Committer:
- Ren Boting
- Date:
- Tue Sep 05 11:56:13 2017 +0900
- Revision:
- 2:b894b3508057
- Parent:
- 0:29983394c6b6
Update all libraries and reform main.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
edamame22 | 0:29983394c6b6 | 1 | /* |
edamame22 | 0:29983394c6b6 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
edamame22 | 0:29983394c6b6 | 3 | * SPDX-License-Identifier: Apache-2.0 |
edamame22 | 0:29983394c6b6 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
edamame22 | 0:29983394c6b6 | 5 | * 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, WITHOUT |
edamame22 | 0:29983394c6b6 | 12 | * 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 | #ifndef EVENT_DATA_H |
edamame22 | 0:29983394c6b6 | 17 | #define EVENT_DATA_H |
edamame22 | 0:29983394c6b6 | 18 | |
edamame22 | 0:29983394c6b6 | 19 | #include "mbed-client/m2mvector.h" |
edamame22 | 0:29983394c6b6 | 20 | |
edamame22 | 0:29983394c6b6 | 21 | //FORWARD DECLARATION |
edamame22 | 0:29983394c6b6 | 22 | class M2MObject; |
edamame22 | 0:29983394c6b6 | 23 | |
edamame22 | 0:29983394c6b6 | 24 | |
edamame22 | 0:29983394c6b6 | 25 | typedef Vector<M2MObject *> M2MObjectList; |
edamame22 | 0:29983394c6b6 | 26 | |
edamame22 | 0:29983394c6b6 | 27 | class M2MSecurity; |
edamame22 | 0:29983394c6b6 | 28 | |
edamame22 | 0:29983394c6b6 | 29 | class EventData |
edamame22 | 0:29983394c6b6 | 30 | { |
edamame22 | 0:29983394c6b6 | 31 | public: |
edamame22 | 0:29983394c6b6 | 32 | virtual ~EventData() {} |
edamame22 | 0:29983394c6b6 | 33 | }; |
edamame22 | 0:29983394c6b6 | 34 | |
edamame22 | 0:29983394c6b6 | 35 | class M2MSecurityData : public EventData |
edamame22 | 0:29983394c6b6 | 36 | { |
edamame22 | 0:29983394c6b6 | 37 | public: |
edamame22 | 0:29983394c6b6 | 38 | M2MSecurityData() |
edamame22 | 0:29983394c6b6 | 39 | :_object(NULL){} |
edamame22 | 0:29983394c6b6 | 40 | virtual ~M2MSecurityData() {} |
edamame22 | 0:29983394c6b6 | 41 | M2MSecurity *_object; |
edamame22 | 0:29983394c6b6 | 42 | }; |
edamame22 | 0:29983394c6b6 | 43 | |
edamame22 | 0:29983394c6b6 | 44 | class ResolvedAddressData : public EventData |
edamame22 | 0:29983394c6b6 | 45 | { |
edamame22 | 0:29983394c6b6 | 46 | public: |
edamame22 | 0:29983394c6b6 | 47 | ResolvedAddressData() |
edamame22 | 0:29983394c6b6 | 48 | :_address(NULL), |
edamame22 | 0:29983394c6b6 | 49 | _port(0){} |
edamame22 | 0:29983394c6b6 | 50 | virtual ~ResolvedAddressData() {} |
edamame22 | 0:29983394c6b6 | 51 | const M2MConnectionObserver::SocketAddress *_address; |
edamame22 | 0:29983394c6b6 | 52 | uint16_t _port; |
edamame22 | 0:29983394c6b6 | 53 | }; |
edamame22 | 0:29983394c6b6 | 54 | |
edamame22 | 0:29983394c6b6 | 55 | class ReceivedData : public EventData |
edamame22 | 0:29983394c6b6 | 56 | { |
edamame22 | 0:29983394c6b6 | 57 | public: |
edamame22 | 0:29983394c6b6 | 58 | ReceivedData() |
edamame22 | 0:29983394c6b6 | 59 | :_data(NULL), |
edamame22 | 0:29983394c6b6 | 60 | _size(0), |
edamame22 | 0:29983394c6b6 | 61 | _port(0), |
edamame22 | 0:29983394c6b6 | 62 | _address(NULL){} |
edamame22 | 0:29983394c6b6 | 63 | virtual ~ReceivedData() {} |
edamame22 | 0:29983394c6b6 | 64 | uint8_t *_data; |
edamame22 | 0:29983394c6b6 | 65 | uint16_t _size; |
edamame22 | 0:29983394c6b6 | 66 | uint16_t _port; |
edamame22 | 0:29983394c6b6 | 67 | const M2MConnectionObserver::SocketAddress *_address; |
edamame22 | 0:29983394c6b6 | 68 | }; |
edamame22 | 0:29983394c6b6 | 69 | |
edamame22 | 0:29983394c6b6 | 70 | class M2MRegisterData : public EventData |
edamame22 | 0:29983394c6b6 | 71 | { |
edamame22 | 0:29983394c6b6 | 72 | public: |
edamame22 | 0:29983394c6b6 | 73 | M2MRegisterData() |
edamame22 | 0:29983394c6b6 | 74 | :_object(NULL){} |
edamame22 | 0:29983394c6b6 | 75 | virtual ~M2MRegisterData() {} |
edamame22 | 0:29983394c6b6 | 76 | M2MSecurity *_object; |
edamame22 | 0:29983394c6b6 | 77 | M2MObjectList _object_list; |
edamame22 | 0:29983394c6b6 | 78 | }; |
edamame22 | 0:29983394c6b6 | 79 | |
edamame22 | 0:29983394c6b6 | 80 | class M2MUpdateRegisterData : public EventData |
edamame22 | 0:29983394c6b6 | 81 | { |
edamame22 | 0:29983394c6b6 | 82 | public: |
edamame22 | 0:29983394c6b6 | 83 | M2MUpdateRegisterData() |
edamame22 | 0:29983394c6b6 | 84 | :_object(NULL), |
edamame22 | 0:29983394c6b6 | 85 | _lifetime(0){} |
edamame22 | 0:29983394c6b6 | 86 | virtual ~M2MUpdateRegisterData() {} |
edamame22 | 0:29983394c6b6 | 87 | M2MSecurity *_object; |
edamame22 | 0:29983394c6b6 | 88 | uint32_t _lifetime; |
edamame22 | 0:29983394c6b6 | 89 | M2MObjectList _object_list; |
edamame22 | 0:29983394c6b6 | 90 | }; |
edamame22 | 0:29983394c6b6 | 91 | |
edamame22 | 0:29983394c6b6 | 92 | |
edamame22 | 0:29983394c6b6 | 93 | #endif //EVENT_DATA_H |
edamame22 | 0:29983394c6b6 | 94 |