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/
Diff: mbed-client/mbed-client-mbed-tls/source/m2mconnectionsecurity.cpp
- Revision:
- 0:29983394c6b6
diff -r 000000000000 -r 29983394c6b6 mbed-client/mbed-client-mbed-tls/source/m2mconnectionsecurity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-client/mbed-client-mbed-tls/source/m2mconnectionsecurity.cpp Thu Apr 13 04:48:11 2017 +0000 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2015 ARM Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <string.h> +#include "mbed-client/m2mconnectionhandler.h" +#include "mbed-client/m2mconnectionsecurity.h" +#include "mbed-client/m2mtimer.h" +#include "mbed-client/m2msecurity.h" +#include "mbed-client-mbedtls/m2mconnectionsecuritypimpl.h" + +M2MConnectionSecurity::M2MConnectionSecurity(SecurityMode mode) +{ + _private_impl = new M2MConnectionSecurityPimpl(mode); +} + +M2MConnectionSecurity::~M2MConnectionSecurity(){ + delete _private_impl; +} + +void M2MConnectionSecurity::reset(){ + _private_impl->reset(); +} + +int M2MConnectionSecurity::init(const M2MSecurity *security){ + return _private_impl->init(security); +} + +int M2MConnectionSecurity::start_connecting_non_blocking(M2MConnectionHandler* connHandler) +{ + return _private_impl->start_connecting_non_blocking(connHandler); +} + +int M2MConnectionSecurity::continue_connecting() +{ + return _private_impl->continue_connecting(); +} + +int M2MConnectionSecurity::connect(M2MConnectionHandler* connHandler){ + return _private_impl->connect(connHandler); +} + +int M2MConnectionSecurity::send_message(unsigned char *message, int len){ + return _private_impl->send_message(message, len); +} + +int M2MConnectionSecurity::read(unsigned char* buffer, uint16_t len){ + return _private_impl->read(buffer, len); +} + +void M2MConnectionSecurity::set_random_number_callback(random_number_cb callback) +{ + _private_impl->set_random_number_callback(callback); +} + +void M2MConnectionSecurity::set_entropy_callback(entropy_cb callback) +{ + _private_impl->set_entropy_callback(callback); +}