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/version_check.sh@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 | #!/bin/bash |
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 | echo |
edamame22 | 0:29983394c6b6 | 17 | echo "Check version in module json" |
edamame22 | 0:29983394c6b6 | 18 | echo |
edamame22 | 0:29983394c6b6 | 19 | echo $1 |
edamame22 | 0:29983394c6b6 | 20 | echo $2 |
edamame22 | 0:29983394c6b6 | 21 | |
edamame22 | 0:29983394c6b6 | 22 | function version_gt() { |
edamame22 | 0:29983394c6b6 | 23 | test "$(echo "$@" | tr " " "\n" | sort -V | tail -n 1)" == "$1"; |
edamame22 | 0:29983394c6b6 | 24 | } |
edamame22 | 0:29983394c6b6 | 25 | |
edamame22 | 0:29983394c6b6 | 26 | git clone $1 $PWD/master |
edamame22 | 0:29983394c6b6 | 27 | git clone $1 $PWD/pull_req |
edamame22 | 0:29983394c6b6 | 28 | pushd $PWD/pull_req |
edamame22 | 0:29983394c6b6 | 29 | git checkout $2 |
edamame22 | 0:29983394c6b6 | 30 | popd |
edamame22 | 0:29983394c6b6 | 31 | if [ ! -e "$PWD/master/module.json" ] |
edamame22 | 0:29983394c6b6 | 32 | then |
edamame22 | 0:29983394c6b6 | 33 | echo "$PWD/master/module.json not found." |
edamame22 | 0:29983394c6b6 | 34 | exit 1 |
edamame22 | 0:29983394c6b6 | 35 | fi |
edamame22 | 0:29983394c6b6 | 36 | if [ ! -e "$PWD/pull_req/module.json" ] |
edamame22 | 0:29983394c6b6 | 37 | then |
edamame22 | 0:29983394c6b6 | 38 | echo "$PWD/pull_req/module.json not found." |
edamame22 | 0:29983394c6b6 | 39 | exit 1 |
edamame22 | 0:29983394c6b6 | 40 | fi |
edamame22 | 0:29983394c6b6 | 41 | |
edamame22 | 0:29983394c6b6 | 42 | OLD_VERSION=`sed -n 's#version##p' master/module.json | sed 's|[^0-9]*\([0-9\.]*\)|\1 |g'` |
edamame22 | 0:29983394c6b6 | 43 | NEW_VERSION=`sed -n 's#version##p' pull_req/module.json | sed 's|[^0-9]*\([0-9\.]*\)|\1 |g'` |
edamame22 | 0:29983394c6b6 | 44 | |
edamame22 | 0:29983394c6b6 | 45 | echo "Version in master branch: $OLD_VERSION" |
edamame22 | 0:29983394c6b6 | 46 | echo "New version: $NEW_VERSION" |
edamame22 | 0:29983394c6b6 | 47 | |
edamame22 | 0:29983394c6b6 | 48 | if [[ "$OLD_VERSION" != "$NEW_VERSION" ]]; then |
edamame22 | 0:29983394c6b6 | 49 | if version_gt $NEW_VERSION $OLD_VERSION; then |
edamame22 | 0:29983394c6b6 | 50 | exit 0 |
edamame22 | 0:29983394c6b6 | 51 | else |
edamame22 | 0:29983394c6b6 | 52 | echo "Update version in module.json!" |
edamame22 | 0:29983394c6b6 | 53 | exit 1 |
edamame22 | 0:29983394c6b6 | 54 | fi |
edamame22 | 0:29983394c6b6 | 55 | else |
edamame22 | 0:29983394c6b6 | 56 | echo "Update version in module.json!" |
edamame22 | 0:29983394c6b6 | 57 | exit 1 |
edamame22 | 0:29983394c6b6 | 58 | fi |