Motion and Environmental sensor reader application connected via BLE to ST BlueMS iOS/Android application.

Dependencies:   HTS221 LIS3MDL LPS22HB LSM303AGR LSM6DSL

Fork of MOTENV_Mbed by ST Expansion SW Team

This application supports three different sets of ST hardware boards:

  • STEVAL-STLKT01V1 (aka SensorTile)
  • X-NUCLEO-IDB05A1 and X-NUCLEO-IKS01A2 expansion boards
  • B-L475E-IOT01A IoT Discovery board

    and runs over four different target configurations:

  • Nucleo F401RE + X-NUCLEO-IDB05A1 + X-NUCLEO-IKS01A2 (set target NUCLEO_F401RE)
  • DISCO_L475VG_IOT01A (set target DISCO_L475VG_IOT01A)
  • Nucleo L476RG + CRADLE + SENSORTILE (set compile target NUCLEO_L476RG)
  • Nucleo L476RG + CRADLE_EXPANSION_BOARD + SENSORTILE (set compile target NUCLEO_L476RG, remove macro MINI_CRADLE from mbed_app.json)

The first 2 configurations do not require any HW modifications (just use the above indicated targets).

Third configuration (CRADLE ) only requires to remove the two ST-LINK jumpers and JP6 from the Nucleo L476RG board in order to allow flashing the SensorTile through the Nucleo Jtag controller. Once flashed, if the battery is properly plugged and charged, the SensorTile could be mounted in the plastic enclosure being able to run as a small stand alone wearable device. Please note that this configuration do not provide a serial console for printf.

To enable last configuration (CRADLE_EXPANSION_BOARD), follow the steps below:

  • On Nucleo L476RG
    • open the two "ST-LINK" jumpers
    • open the MCU power supply jumper JP6
    • close the solder bridges SB63 and SB62 (to enable the serial console)
  • On SensorTile Arduino Cradle close the solder bridges SB21 and SB10 (to enable the serial console) and move the jumper J2 to the 5V position
  • Plug the Sensor Tile on the Arduino Cradle
  • Plug the Cradle on the Nucleo Arduino connector and connect the debug flat cable between Cradle and Nucleo Jtag connector (the cradle pin1 -identified by a dot- must be connected to the Nucleo pin1 (dot) of SWD CN4 jtag connector)
  • Plug the Nucleo USB cable on PC (a new COM port should appear); no need to plug the micro USB cable on the cradle.
  • Open a PC terminal to see the messages
  • Compile from mbed CLI or on-line compiler removing macro MINI_CRADLE from mbed_app.json file and selecting NUCLEO_ L476RG target
  • Flash the board with the binary

For all configurations on an Android or iOS device download and open the ST BlueMS application and connect to "MotEnvMbedOS" BLE device to see the sensor data.

For all configurations is also possible to add a 9 axis MotionFX sensor fusion library, which is part of the X-CUBE-MEMS package at this link.
The library comes in three flavours, choose your preferred according to the toolchain used (IAR, Keil or GC, Keil version should be used for the online compiler) and copy it in the Middlewares\ST\STM32_MotionFX_Library\Lib directory changing the file extension according to the toolchain used (.a for GCC, .ar for Keil).
In the file mbed_app.json add the macro definition "USE_SENSOR_FUSION_LIB" to the chosen target.
If compiling from CLI and using GCC_ARM toolchain option, in the file \mbed-os\tools\toolchains\gcc.py change the compiling option from

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")

to

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=hard")

and compile.

Committer:
mapellil
Date:
Wed Sep 20 17:08:56 2017 +0200
Revision:
20:b97e14ade434
Parent:
13:d00147d01d4e
Child:
27:dccb3b0fae57
Updated mbed-os to 5.5 (w SPI3W), updated BLE, updated IKS (now allocating directly sensors),
added sensor fusion support, added env cumulative BLE characteristic.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mapellil 9:2693f9ef8ff7 1 /**
mapellil 9:2693f9ef8ff7 2 ******************************************************************************
mapellil 9:2693f9ef8ff7 3 * @file CustomSensorService.h
mapellil 9:2693f9ef8ff7 4 * @author Central Labs / AST
mapellil 9:2693f9ef8ff7 5 * @version V0.9.0
mapellil 9:2693f9ef8ff7 6 * @date 23-Dec-2015
mapellil 9:2693f9ef8ff7 7 * @brief BLE MEMS and environmental sensors service
mapellil 9:2693f9ef8ff7 8 ******************************************************************************
mapellil 9:2693f9ef8ff7 9 * @attention
mapellil 9:2693f9ef8ff7 10 *
mapellil 9:2693f9ef8ff7 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mapellil 9:2693f9ef8ff7 12 *
mapellil 9:2693f9ef8ff7 13 * Redistribution and use in source and binary forms, with or without modification,
mapellil 9:2693f9ef8ff7 14 * are permitted provided that the following conditions are met:
mapellil 9:2693f9ef8ff7 15 * 1. Redistributions of source code must retain the above copyright notice,
mapellil 9:2693f9ef8ff7 16 * this list of conditions and the following disclaimer.
mapellil 9:2693f9ef8ff7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mapellil 9:2693f9ef8ff7 18 * this list of conditions and the following disclaimer in the documentation
mapellil 9:2693f9ef8ff7 19 * and/or other materials provided with the distribution.
mapellil 9:2693f9ef8ff7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mapellil 9:2693f9ef8ff7 21 * may be used to endorse or promote products derived from this software
mapellil 9:2693f9ef8ff7 22 * without specific prior written permission.
mapellil 9:2693f9ef8ff7 23 *
mapellil 9:2693f9ef8ff7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mapellil 9:2693f9ef8ff7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mapellil 9:2693f9ef8ff7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mapellil 9:2693f9ef8ff7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mapellil 9:2693f9ef8ff7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mapellil 9:2693f9ef8ff7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mapellil 9:2693f9ef8ff7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mapellil 9:2693f9ef8ff7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mapellil 9:2693f9ef8ff7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mapellil 9:2693f9ef8ff7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mapellil 9:2693f9ef8ff7 34 *
mapellil 9:2693f9ef8ff7 35 ******************************************************************************
mapellil 9:2693f9ef8ff7 36 */
mapellil 0:e93a11b4e044 37
mapellil 0:e93a11b4e044 38 #ifndef __CUSTOM_BLE_SENSORS_SERVICE_H__
mapellil 0:e93a11b4e044 39 #define __CUSTOM_BLE_SENSORS_SERVICE_H__
mapellil 0:e93a11b4e044 40
mapellil 0:e93a11b4e044 41 #include "BLE.h"
mapellil 20:b97e14ade434 42 #include "ble_utils.h"
mapellil 20:b97e14ade434 43 #include "ble_debug.h"
mapellil 20:b97e14ade434 44 #include "UUID.h"
mapellil 0:e93a11b4e044 45
mapellil 20:b97e14ade434 46 //#define DISAGGREGATED_ENV_CHAR // uncomment to enable the disaggregated environmental temp,hum,pres characteristics, attention because of mem limitations
mapellil 20:b97e14ade434 47 // the maximum number of characteristics is limited check BLUENRG_STACK_MODE
mapellil 20:b97e14ade434 48 const UUID::LongUUIDBytes_t SENS_SERVICE_UUID_128 = { 0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0x9a,0xb4,0x00,0x02,0xa5,0xd5,0xc5,0x1b }; // temp, pressure, humidity,
mapellil 20:b97e14ade434 49 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 20:b97e14ade434 50 const UUID::LongUUIDBytes_t SENS_TEMP_CHAR_UUID_128 = { 0x00,0x04,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 51 const UUID::LongUUIDBytes_t SENS_HUMI_CHAR_UUID_128 = { 0x00,0x08,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 52 const UUID::LongUUIDBytes_t SENS_PRES_CHAR_UUID_128 = { 0x00,0x10,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 53 #endif
mapellil 20:b97e14ade434 54 const UUID::LongUUIDBytes_t SENS_MAGN_CHAR_UUID_128 = { 0x00,0x20,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 55 const UUID::LongUUIDBytes_t SENS_GYRO_CHAR_UUID_128 = { 0x00,0x40,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 56 const UUID::LongUUIDBytes_t SENS_ACCE_CHAR_UUID_128 = { 0x00,0x80,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 57 const UUID::LongUUIDBytes_t SENS_ACC_GYRO_MAG_CHAR_UUID_128 = { 0x00,0xE0,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 20:b97e14ade434 58 const UUID::LongUUIDBytes_t SENS_PRES_HUM_TEMP_CHAR_UUID_128= { 0x00,0x1C,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b };
mapellil 8:b042fe719f51 59
mapellil 0:e93a11b4e044 60
mapellil 0:e93a11b4e044 61 #define TEMP_DATA_LEN 2+2
mapellil 0:e93a11b4e044 62 #define HUM_DATA_LEN 2+2
mapellil 0:e93a11b4e044 63 #define PRES_DATA_LEN 2+4
mapellil 11:ff82699c696e 64 #define ACC_DATA_LEN 6+2
mapellil 0:e93a11b4e044 65 #define MAG_DATA_LEN 6+2
mapellil 20:b97e14ade434 66 #define GYRO_DATA_LEN 6+2
mapellil 0:e93a11b4e044 67 #define ACCGYROMAG_DATA_LEN 2+3*3*2
mapellil 20:b97e14ade434 68 #define PRESHUMTEMP_DATA_LEN 2+4+2+2
mapellil 0:e93a11b4e044 69
mapellil 0:e93a11b4e044 70 /* Custom Sensors Service */
mapellil 11:ff82699c696e 71 class CustomSensorService
mapellil 11:ff82699c696e 72 {
mapellil 0:e93a11b4e044 73 public:
mapellil 9:2693f9ef8ff7 74 CustomSensorService(BLE &_ble) :
mapellil 0:e93a11b4e044 75 ble(_ble),
mapellil 20:b97e14ade434 76 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 77 envTemperatureCharacteristic(SENS_TEMP_CHAR_UUID_128,envTemperature, TEMP_DATA_LEN, TEMP_DATA_LEN,
mapellil 11:ff82699c696e 78 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 79 envHumidityCharacteristic(SENS_HUMI_CHAR_UUID_128, envHumidity, HUM_DATA_LEN, HUM_DATA_LEN,
mapellil 11:ff82699c696e 80 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 81 envPressureCharacteristic(SENS_PRES_CHAR_UUID_128, envPressure, PRES_DATA_LEN, PRES_DATA_LEN,
mapellil 11:ff82699c696e 82 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 20:b97e14ade434 83 #endif
mapellil 11:ff82699c696e 84 envMagnetometerCharacteristic(SENS_MAGN_CHAR_UUID_128,envMagn, MAG_DATA_LEN, MAG_DATA_LEN,
mapellil 11:ff82699c696e 85 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 86 envAccelerometerCharacteristic(SENS_ACCE_CHAR_UUID_128,envAcce, ACC_DATA_LEN, ACC_DATA_LEN,
mapellil 11:ff82699c696e 87 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 88 envGyroCharacteristic(SENS_GYRO_CHAR_UUID_128,envGyro, GYRO_DATA_LEN, GYRO_DATA_LEN,
mapellil 11:ff82699c696e 89 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 90 envAccGyroMagCharacteristic(SENS_ACC_GYRO_MAG_CHAR_UUID_128,envAccGyroMag, ACCGYROMAG_DATA_LEN, ACCGYROMAG_DATA_LEN,
mapellil 20:b97e14ade434 91 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 20:b97e14ade434 92 envPresHumTempCharacteristic(SENS_PRES_HUM_TEMP_CHAR_UUID_128,envPresHumTemp, PRESHUMTEMP_DATA_LEN, PRESHUMTEMP_DATA_LEN,
mapellil 20:b97e14ade434 93 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
mapellil 20:b97e14ade434 94 {
mapellil 11:ff82699c696e 95
mapellil 0:e93a11b4e044 96 static bool serviceAdded = false; /* We should only ever need to add the env service once. */
mapellil 0:e93a11b4e044 97 if (serviceAdded) {
mapellil 0:e93a11b4e044 98 return;
mapellil 0:e93a11b4e044 99 }
mapellil 8:b042fe719f51 100
mapellil 20:b97e14ade434 101 GattCharacteristic *charTable[] = {
mapellil 20:b97e14ade434 102 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 20:b97e14ade434 103 &envTemperatureCharacteristic, &envHumidityCharacteristic, &envPressureCharacteristic,
mapellil 20:b97e14ade434 104 #else
mapellil 20:b97e14ade434 105 &envPresHumTempCharacteristic,
mapellil 20:b97e14ade434 106 #endif
mapellil 20:b97e14ade434 107 &envMagnetometerCharacteristic, &envAccelerometerCharacteristic, &envGyroCharacteristic,
mapellil 20:b97e14ade434 108 &envAccGyroMagCharacteristic
mapellil 11:ff82699c696e 109 };
mapellil 11:ff82699c696e 110
mapellil 11:ff82699c696e 111 GattService envService(SENS_SERVICE_UUID_128, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
mapellil 11:ff82699c696e 112
mapellil 11:ff82699c696e 113 ble.gattServer().addService(envService);
mapellil 0:e93a11b4e044 114
mapellil 20:b97e14ade434 115 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 116 isEnabledTempNotify = false;
mapellil 0:e93a11b4e044 117 isEnabledHumNotify = false;
mapellil 0:e93a11b4e044 118 isEnabledPresNotify = false;
mapellil 20:b97e14ade434 119 #endif
mapellil 11:ff82699c696e 120 isEnabledGyroNotify = false;
mapellil 0:e93a11b4e044 121 isEnabledAccNotify = false;
mapellil 0:e93a11b4e044 122 isEnabledMagNotify = false;
mapellil 11:ff82699c696e 123 isEnabledAccGyroMagNotify = false;
mapellil 20:b97e14ade434 124 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 125
mapellil 0:e93a11b4e044 126 isTempCalibrated = false;
mapellil 0:e93a11b4e044 127 isHumCalibrated = false;
mapellil 11:ff82699c696e 128 isPresCalibrated = false;
mapellil 0:e93a11b4e044 129 isMagCalibrated = false;
mapellil 11:ff82699c696e 130 isAccCalibrated = false;
mapellil 11:ff82699c696e 131 isAGyroCalibrated = false;
mapellil 0:e93a11b4e044 132
mapellil 20:b97e14ade434 133 memset (pastenvTemperature, 0, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 134 memset (pastenvHumidity, 0, HUM_DATA_LEN);
mapellil 11:ff82699c696e 135 memset (pastenvPressure, 0, PRES_DATA_LEN);
mapellil 11:ff82699c696e 136
mapellil 11:ff82699c696e 137 isBTLEConnected = DISCONNECTED;
mapellil 11:ff82699c696e 138 serviceAdded = true;
mapellil 0:e93a11b4e044 139 }
mapellil 20:b97e14ade434 140 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 8:b042fe719f51 141 uint32_t sendEnvTemperature (int16_t Temp, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 142 STORE_LE_16(envTemperature,TimeStamp);
mapellil 11:ff82699c696e 143 STORE_LE_16(envTemperature+2,Temp);
mapellil 11:ff82699c696e 144 memcpy (pastenvTemperature, envTemperature, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 145 return ble.gattServer().write(envTemperatureCharacteristic.getValueAttribute().getHandle(), envTemperature, TEMP_DATA_LEN, 0);
mapellil 11:ff82699c696e 146 }
mapellil 11:ff82699c696e 147
mapellil 0:e93a11b4e044 148 /**
mapellil 0:e93a11b4e044 149 * Update the temperature with a new value. Valid values range from
mapellil 0:e93a11b4e044 150 * 0..100. Anything outside this range will be ignored.
mapellil 0:e93a11b4e044 151 * @param newLevel New level. */
mapellil 8:b042fe719f51 152 uint32_t updateEnvTemperature (int16_t Temp, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 153 if (memcmp (&pastenvTemperature[2], &Temp, 2) != 0) {
mapellil 11:ff82699c696e 154 return sendEnvTemperature (Temp, TimeStamp);
mapellil 0:e93a11b4e044 155 }
mapellil 11:ff82699c696e 156 return 0;
mapellil 11:ff82699c696e 157 }
mapellil 11:ff82699c696e 158
mapellil 11:ff82699c696e 159 uint32_t sendEnvHumidity(uint16_t Hum, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 160 STORE_LE_16(envHumidity,TimeStamp);
mapellil 11:ff82699c696e 161 STORE_LE_16(envHumidity+2,Hum);
mapellil 11:ff82699c696e 162 memcpy (pastenvHumidity, envHumidity, HUM_DATA_LEN);
mapellil 11:ff82699c696e 163 return ble.gattServer().write(envHumidityCharacteristic.getValueAttribute().getHandle(), envHumidity, HUM_DATA_LEN, 0);
mapellil 11:ff82699c696e 164 }
mapellil 11:ff82699c696e 165
mapellil 8:b042fe719f51 166 uint32_t updateEnvHumidity(uint16_t Hum, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 167 if (memcmp (&pastenvHumidity[2], &Hum, 2) != 0) {
mapellil 11:ff82699c696e 168 return sendEnvHumidity(Hum, TimeStamp);
mapellil 11:ff82699c696e 169 }
mapellil 11:ff82699c696e 170 return 0;
mapellil 11:ff82699c696e 171 }
mapellil 11:ff82699c696e 172
mapellil 8:b042fe719f51 173 uint32_t sendEnvPressure(uint32_t Press, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 174 STORE_LE_16(envPressure,TimeStamp);
mapellil 11:ff82699c696e 175 STORE_LE_32(envPressure+2,Press);
mapellil 11:ff82699c696e 176 memcpy (pastenvPressure, envPressure, PRES_DATA_LEN);
mapellil 11:ff82699c696e 177 return ble.gattServer().write(envPressureCharacteristic.getValueAttribute().getHandle(), envPressure, PRES_DATA_LEN, 0);
mapellil 11:ff82699c696e 178 }
mapellil 11:ff82699c696e 179
mapellil 8:b042fe719f51 180 uint32_t updateEnvPressure(uint32_t Press, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 181 if (memcmp (&pastenvPressure[2], &Press, 2) != 0) {
mapellil 11:ff82699c696e 182 return sendEnvPressure(Press, TimeStamp);
mapellil 11:ff82699c696e 183 }
mapellil 11:ff82699c696e 184 return 0;
mapellil 11:ff82699c696e 185 }
mapellil 20:b97e14ade434 186 #endif
mapellil 11:ff82699c696e 187
mapellil 20:b97e14ade434 188 uint32_t sendEnvPresHumTemp(uint32_t Press, uint16_t Hum, int16_t Temp, uint16_t TimeStamp) {
mapellil 20:b97e14ade434 189 STORE_LE_16(envPressure,TimeStamp);
mapellil 20:b97e14ade434 190 STORE_LE_32(envPressure+2,Press);
mapellil 20:b97e14ade434 191 memcpy (pastenvPressure, envPressure, PRES_DATA_LEN);
mapellil 20:b97e14ade434 192 STORE_LE_16(envHumidity,TimeStamp);
mapellil 20:b97e14ade434 193 STORE_LE_16(envHumidity+2,Hum);
mapellil 20:b97e14ade434 194 memcpy (pastenvHumidity, envHumidity, HUM_DATA_LEN);
mapellil 20:b97e14ade434 195 STORE_LE_16(envTemperature,TimeStamp);
mapellil 20:b97e14ade434 196 STORE_LE_16(envTemperature+2,Temp);
mapellil 20:b97e14ade434 197 memcpy (pastenvTemperature, envTemperature, TEMP_DATA_LEN);
mapellil 20:b97e14ade434 198 STORE_LE_16(envPresHumTemp, TimeStamp);
mapellil 20:b97e14ade434 199 memcpy (envPresHumTemp+2, envPressure+2, 4);
mapellil 20:b97e14ade434 200 memcpy (envPresHumTemp+2+4, envHumidity+2, 2);
mapellil 20:b97e14ade434 201 memcpy (envPresHumTemp+2+4+2, envTemperature+2, 2);
mapellil 20:b97e14ade434 202 return ble.gattServer().write(envPresHumTempCharacteristic.getValueAttribute().getHandle(), envPresHumTemp, PRESHUMTEMP_DATA_LEN, 0);
mapellil 20:b97e14ade434 203 }
mapellil 20:b97e14ade434 204
mapellil 20:b97e14ade434 205 uint32_t updateEnvPresHumTemp(uint32_t Press, uint16_t Hum, int16_t Temp, uint16_t TimeStamp) {
mapellil 20:b97e14ade434 206 if ((memcmp (&pastenvPressure[2], &Press, 2) != 0) ||
mapellil 20:b97e14ade434 207 (memcmp (&pastenvHumidity[2], &Hum, 2) != 0) ||
mapellil 20:b97e14ade434 208 (memcmp (&pastenvTemperature[2], &Temp, 2) != 0)) {
mapellil 20:b97e14ade434 209 return sendEnvPresHumTemp (Press, Hum, Temp, TimeStamp);
mapellil 20:b97e14ade434 210 }
mapellil 20:b97e14ade434 211 return 0;
mapellil 20:b97e14ade434 212 }
mapellil 20:b97e14ade434 213
mapellil 20:b97e14ade434 214 uint32_t sendEnvMagnetometer(AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 215 STORE_LE_16(envMagn,TimeStamp);
mapellil 20:b97e14ade434 216 STORE_LE_16(envMagn+2,(Magn->AXIS_X - magOffset->magOffX));
mapellil 20:b97e14ade434 217 STORE_LE_16(envMagn+4,(Magn->AXIS_Y - magOffset->magOffY));
mapellil 20:b97e14ade434 218 STORE_LE_16(envMagn+6,(Magn->AXIS_Z - magOffset->magOffZ));
mapellil 11:ff82699c696e 219 return ble.gattServer().write(envMagnetometerCharacteristic.getValueAttribute().getHandle(), envMagn, MAG_DATA_LEN, 0);
mapellil 11:ff82699c696e 220 }
mapellil 11:ff82699c696e 221
mapellil 20:b97e14ade434 222 uint32_t updateEnvMagnetometer(AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 223 if (isMagNotificationEn()) return sendEnvMagnetometer(Magn, TimeStamp, magOffset);
mapellil 11:ff82699c696e 224 return 0;
mapellil 0:e93a11b4e044 225 }
mapellil 11:ff82699c696e 226
mapellil 11:ff82699c696e 227 uint32_t sendEnvAccelerometer (AxesRaw_TypeDef *Acc, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 228 STORE_LE_16(envAcce,TimeStamp);
mapellil 11:ff82699c696e 229 STORE_LE_16(envAcce+2,Acc->AXIS_X);
mapellil 11:ff82699c696e 230 STORE_LE_16(envAcce+4,Acc->AXIS_Y);
mapellil 11:ff82699c696e 231 STORE_LE_16(envAcce+6,Acc->AXIS_Z);
mapellil 11:ff82699c696e 232 return ble.gattServer().write(envAccelerometerCharacteristic.getValueAttribute().getHandle(), envAcce, ACC_DATA_LEN, 0);
mapellil 11:ff82699c696e 233 }
mapellil 11:ff82699c696e 234
mapellil 11:ff82699c696e 235 uint32_t updateEnvAccelerometer (AxesRaw_TypeDef *Acc, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 236 if (isAccNotificationEn()) return sendEnvAccelerometer (Acc, TimeStamp);
mapellil 11:ff82699c696e 237 return 0;
mapellil 0:e93a11b4e044 238 }
mapellil 0:e93a11b4e044 239
mapellil 11:ff82699c696e 240 uint32_t sendEnvGyroscope (AxesRaw_TypeDef *Gyro, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 241 STORE_LE_16(envGyro,TimeStamp);
mapellil 11:ff82699c696e 242 STORE_LE_16(envGyro+2,Gyro->AXIS_X);
mapellil 11:ff82699c696e 243 STORE_LE_16(envGyro+4,Gyro->AXIS_Y);
mapellil 11:ff82699c696e 244 STORE_LE_16(envGyro+6,Gyro->AXIS_Z);
mapellil 11:ff82699c696e 245 return ble.gattServer().write(envGyroCharacteristic.getValueAttribute().getHandle(), envGyro, GYRO_DATA_LEN, 0);
mapellil 11:ff82699c696e 246 }
mapellil 11:ff82699c696e 247
mapellil 11:ff82699c696e 248 uint32_t updateEnvGyroscope (AxesRaw_TypeDef *Gyro, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 249 if (isGyroNotificationEn()) return sendEnvGyroscope (Gyro, TimeStamp);
mapellil 11:ff82699c696e 250 return 0;
mapellil 11:ff82699c696e 251 }
mapellil 0:e93a11b4e044 252
mapellil 20:b97e14ade434 253 uint32_t sendEnvAccGyroMag (AxesRaw_TypeDef *Acc, AxesRaw_TypeDef *Gyro, AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 254 STORE_LE_16(envAccGyroMag,TimeStamp);
mapellil 11:ff82699c696e 255 STORE_LE_16(envAccGyroMag+2,Acc->AXIS_X);
mapellil 11:ff82699c696e 256 STORE_LE_16(envAccGyroMag+4,Acc->AXIS_Y);
mapellil 11:ff82699c696e 257 STORE_LE_16(envAccGyroMag+6,Acc->AXIS_Z);
mapellil 11:ff82699c696e 258
mapellil 11:ff82699c696e 259 STORE_LE_16(envAccGyroMag+8,Gyro->AXIS_X);
mapellil 11:ff82699c696e 260 STORE_LE_16(envAccGyroMag+10,Gyro->AXIS_Y);
mapellil 11:ff82699c696e 261 STORE_LE_16(envAccGyroMag+12,Gyro->AXIS_Z);
mapellil 11:ff82699c696e 262
mapellil 20:b97e14ade434 263 STORE_LE_16(envAccGyroMag+14,(Magn->AXIS_X - magOffset->magOffX));
mapellil 20:b97e14ade434 264 STORE_LE_16(envAccGyroMag+16,(Magn->AXIS_Y - magOffset->magOffY));
mapellil 20:b97e14ade434 265 STORE_LE_16(envAccGyroMag+18,(Magn->AXIS_Z - magOffset->magOffZ));
mapellil 11:ff82699c696e 266 return ble.gattServer().write(envAccGyroMagCharacteristic.getValueAttribute().getHandle(), envAccGyroMag, ACCGYROMAG_DATA_LEN, 0);
mapellil 11:ff82699c696e 267 }
mapellil 11:ff82699c696e 268
mapellil 20:b97e14ade434 269 uint32_t updateEnvAccGyroMag (AxesRaw_TypeDef *Acc, AxesRaw_TypeDef *Gyro, AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 270 if (isAccGyroMagNotificationEn()) return sendEnvAccGyroMag (Acc, Gyro, Magn, TimeStamp, magOffset);
mapellil 11:ff82699c696e 271 return 0;
mapellil 0:e93a11b4e044 272 }
mapellil 12:baf8b5294320 273 void enNotify (Gap::Handle_t a_handle) {
mapellil 13:d00147d01d4e 274 Gap::Handle_t handle = a_handle - BLE_HANDLE_EN_DIS_OFFSET;
mapellil 20:b97e14ade434 275 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 276 if (isTempHandle(handle)) {
mapellil 11:ff82699c696e 277 isEnabledTempNotify = true;
mapellil 11:ff82699c696e 278 memset(pastenvTemperature,0,TEMP_DATA_LEN);
mapellil 20:b97e14ade434 279 printf ("isTempHandle en\n\r");
mapellil 11:ff82699c696e 280 return;
mapellil 11:ff82699c696e 281 }
mapellil 11:ff82699c696e 282 if (isHumHandle(handle)) {
mapellil 11:ff82699c696e 283 isEnabledHumNotify = true;
mapellil 11:ff82699c696e 284 memset(pastenvHumidity,0,HUM_DATA_LEN);
mapellil 20:b97e14ade434 285 printf ("isHumHandle en\n\r");
mapellil 11:ff82699c696e 286 return;
mapellil 11:ff82699c696e 287 }
mapellil 11:ff82699c696e 288 if (isPresHandle(handle)) {
mapellil 11:ff82699c696e 289 isEnabledPresNotify = true;
mapellil 11:ff82699c696e 290 memset(pastenvPressure,0,PRES_DATA_LEN);
mapellil 20:b97e14ade434 291 printf ("isPresHandle en\n\r");
mapellil 11:ff82699c696e 292 return;
mapellil 11:ff82699c696e 293 }
mapellil 20:b97e14ade434 294 #endif
mapellil 11:ff82699c696e 295 if (isGyroHandle(handle)) {
mapellil 11:ff82699c696e 296 isEnabledGyroNotify = true;
mapellil 20:b97e14ade434 297 printf ("isGyroHandle en\n\r");
mapellil 11:ff82699c696e 298 return;
mapellil 11:ff82699c696e 299 }
mapellil 11:ff82699c696e 300 if (isAccHandle(handle)) {
mapellil 11:ff82699c696e 301 isEnabledAccNotify = true;
mapellil 20:b97e14ade434 302 printf ("isAccHandle en\n\r");
mapellil 11:ff82699c696e 303 return;
mapellil 11:ff82699c696e 304 }
mapellil 11:ff82699c696e 305 if (isMagHandle(handle)) {
mapellil 11:ff82699c696e 306 isEnabledMagNotify = true;
mapellil 20:b97e14ade434 307 printf ("isMagHandle en\n\r");
mapellil 11:ff82699c696e 308 return;
mapellil 11:ff82699c696e 309 }
mapellil 11:ff82699c696e 310 if (isAccGyroMagHandle(handle)) {
mapellil 11:ff82699c696e 311 isEnabledAccGyroMagNotify = true;
mapellil 20:b97e14ade434 312 printf ("isAccGyroMagHandle en\n\r");
mapellil 11:ff82699c696e 313 return;
mapellil 11:ff82699c696e 314 }
mapellil 20:b97e14ade434 315 if (isPresHumTempHandle(handle)) {
mapellil 20:b97e14ade434 316 isEnabledPresHumTempNotify = true;
mapellil 20:b97e14ade434 317 printf ("isPresHumTempHandle en\n\r");
mapellil 20:b97e14ade434 318 return;
mapellil 20:b97e14ade434 319 }
mapellil 0:e93a11b4e044 320 }
mapellil 0:e93a11b4e044 321
mapellil 12:baf8b5294320 322 void disNotify (Gap::Handle_t a_handle) {
mapellil 13:d00147d01d4e 323 Gap::Handle_t handle = a_handle - BLE_HANDLE_EN_DIS_OFFSET;
mapellil 20:b97e14ade434 324 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 13:d00147d01d4e 325 if (isTempHandle(handle)) {
mapellil 11:ff82699c696e 326 isEnabledTempNotify = false;
mapellil 11:ff82699c696e 327 memset(pastenvTemperature,0,TEMP_DATA_LEN);
mapellil 20:b97e14ade434 328 printf ("isTempHandle dis\n\r");
mapellil 11:ff82699c696e 329 return;
mapellil 20:b97e14ade434 330 }
mapellil 11:ff82699c696e 331 if (isHumHandle(handle)) {
mapellil 11:ff82699c696e 332 isEnabledHumNotify = false;
mapellil 11:ff82699c696e 333 memset(pastenvHumidity,0,HUM_DATA_LEN);
mapellil 20:b97e14ade434 334 printf ("isHumHandle dis\n\r");
mapellil 11:ff82699c696e 335 return;
mapellil 11:ff82699c696e 336 }
mapellil 11:ff82699c696e 337 if (isPresHandle(handle)) {
mapellil 11:ff82699c696e 338 isEnabledPresNotify = false;
mapellil 11:ff82699c696e 339 memset(pastenvPressure,0,PRES_DATA_LEN);
mapellil 20:b97e14ade434 340 printf ("isPresHandle dis\n\r");
mapellil 11:ff82699c696e 341 return;
mapellil 11:ff82699c696e 342 }
mapellil 20:b97e14ade434 343 #endif
mapellil 11:ff82699c696e 344 if (isGyroHandle(handle)) {
mapellil 11:ff82699c696e 345 isEnabledGyroNotify = false;
mapellil 20:b97e14ade434 346 printf ("isGyroHandle dis\n\r");
mapellil 11:ff82699c696e 347 return;
mapellil 11:ff82699c696e 348 }
mapellil 11:ff82699c696e 349 if (isAccHandle(handle)) {
mapellil 11:ff82699c696e 350 isEnabledAccNotify = false;
mapellil 20:b97e14ade434 351 printf ("isAccHandle dis\n\r");
mapellil 11:ff82699c696e 352 return;
mapellil 11:ff82699c696e 353 }
mapellil 13:d00147d01d4e 354 if (isMagHandle(handle)) {
mapellil 11:ff82699c696e 355 isEnabledMagNotify = false;
mapellil 20:b97e14ade434 356 printf ("isMagHandle dis\n\r");
mapellil 11:ff82699c696e 357 return;
mapellil 11:ff82699c696e 358 }
mapellil 11:ff82699c696e 359 if (isAccGyroMagHandle(handle)) {
mapellil 11:ff82699c696e 360 isEnabledAccGyroMagNotify = false;
mapellil 20:b97e14ade434 361 printf ("isAccGyroMagHandle dis\n\r");
mapellil 11:ff82699c696e 362 return;
mapellil 11:ff82699c696e 363 }
mapellil 20:b97e14ade434 364 if (isPresHumTempHandle(handle)) {
mapellil 20:b97e14ade434 365 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 366 printf ("isPresHumTempHandle dis\n\r");
mapellil 20:b97e14ade434 367 return;
mapellil 20:b97e14ade434 368 }
mapellil 0:e93a11b4e044 369 }
mapellil 20:b97e14ade434 370 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 371 bool isTempNotificationEn (void) {
mapellil 11:ff82699c696e 372 return isEnabledTempNotify;
mapellil 0:e93a11b4e044 373 }
mapellil 11:ff82699c696e 374
mapellil 0:e93a11b4e044 375 bool isHumNotificationEn (void) {
mapellil 11:ff82699c696e 376 return isEnabledHumNotify;
mapellil 0:e93a11b4e044 377 }
mapellil 0:e93a11b4e044 378
mapellil 0:e93a11b4e044 379 bool isPresNotificationEn (void) {
mapellil 11:ff82699c696e 380 return isEnabledPresNotify;
mapellil 0:e93a11b4e044 381 }
mapellil 20:b97e14ade434 382 #endif
mapellil 0:e93a11b4e044 383 bool isGyroNotificationEn (void) {
mapellil 11:ff82699c696e 384 return isEnabledGyroNotify;
mapellil 11:ff82699c696e 385 }
mapellil 0:e93a11b4e044 386
mapellil 0:e93a11b4e044 387 bool isAccNotificationEn (void) {
mapellil 11:ff82699c696e 388 return isEnabledAccNotify;
mapellil 11:ff82699c696e 389 }
mapellil 11:ff82699c696e 390
mapellil 0:e93a11b4e044 391 bool isMagNotificationEn (void) {
mapellil 11:ff82699c696e 392 return isEnabledMagNotify;
mapellil 11:ff82699c696e 393 }
mapellil 11:ff82699c696e 394
mapellil 0:e93a11b4e044 395 bool isAccGyroMagNotificationEn (void) {
mapellil 11:ff82699c696e 396 return isEnabledAccGyroMagNotify;
mapellil 11:ff82699c696e 397 }
mapellil 20:b97e14ade434 398
mapellil 20:b97e14ade434 399 bool isPresHumTempNotificationEn (void) {
mapellil 20:b97e14ade434 400 return isEnabledPresHumTempNotify;
mapellil 20:b97e14ade434 401 }
mapellil 20:b97e14ade434 402 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 403 bool isTempHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 404 if (handle == envTemperatureCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 405 return false;
mapellil 0:e93a11b4e044 406 }
mapellil 0:e93a11b4e044 407
mapellil 0:e93a11b4e044 408 bool isHumHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 409 if (handle == envHumidityCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 410 return false;
mapellil 0:e93a11b4e044 411 }
mapellil 11:ff82699c696e 412
mapellil 0:e93a11b4e044 413 bool isPresHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 414 if (handle == envPressureCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 415 return false;
mapellil 11:ff82699c696e 416 }
mapellil 20:b97e14ade434 417 #endif
mapellil 0:e93a11b4e044 418 bool isMagHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 419 if (handle == envMagnetometerCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 420 return false;
mapellil 0:e93a11b4e044 421 }
mapellil 0:e93a11b4e044 422 bool isAccHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 423 if (handle == envAccelerometerCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 424 return false;
mapellil 0:e93a11b4e044 425 }
mapellil 0:e93a11b4e044 426 bool isGyroHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 427 if (handle == envGyroCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 428 return false;
mapellil 0:e93a11b4e044 429 }
mapellil 0:e93a11b4e044 430 bool isAccGyroMagHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 431 if (handle == envAccGyroMagCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 432 return false;
mapellil 0:e93a11b4e044 433 }
mapellil 20:b97e14ade434 434 bool isPresHumTempHandle (Gap::Handle_t handle) {
mapellil 20:b97e14ade434 435 if (handle == envPresHumTempCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 20:b97e14ade434 436 return false;
mapellil 20:b97e14ade434 437 }
mapellil 20:b97e14ade434 438
mapellil 11:ff82699c696e 439
mapellil 11:ff82699c696e 440 void updateConnectionStatus(ConnectionStatus_t status) {
mapellil 20:b97e14ade434 441 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 442 isEnabledTempNotify = false;
mapellil 11:ff82699c696e 443 isEnabledHumNotify = false;
mapellil 11:ff82699c696e 444 isEnabledPresNotify = false;
mapellil 20:b97e14ade434 445 #endif
mapellil 11:ff82699c696e 446 isEnabledGyroNotify = false;
mapellil 11:ff82699c696e 447 isEnabledAccNotify = false;
mapellil 11:ff82699c696e 448 isEnabledMagNotify = false;
mapellil 20:b97e14ade434 449 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 450 isEnabledAccGyroMagNotify = false;
mapellil 11:ff82699c696e 451
mapellil 11:ff82699c696e 452 isTempCalibrated = false;
mapellil 11:ff82699c696e 453 isHumCalibrated = false;
mapellil 11:ff82699c696e 454 isPresCalibrated = false;
mapellil 11:ff82699c696e 455 isMagCalibrated = false;
mapellil 11:ff82699c696e 456 isAccCalibrated = false;
mapellil 11:ff82699c696e 457 isAGyroCalibrated = false;
mapellil 11:ff82699c696e 458
mapellil 11:ff82699c696e 459 memset (pastenvTemperature, 0, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 460 memset (pastenvHumidity, 0, HUM_DATA_LEN);
mapellil 11:ff82699c696e 461 memset (pastenvPressure, 0, PRES_DATA_LEN);
mapellil 11:ff82699c696e 462 isBTLEConnected = status;
mapellil 0:e93a11b4e044 463 }
mapellil 11:ff82699c696e 464
mapellil 11:ff82699c696e 465
mapellil 0:e93a11b4e044 466 private:
mapellil 9:2693f9ef8ff7 467 BLE &ble;
mapellil 0:e93a11b4e044 468 uint8_t envTemperature [TEMP_DATA_LEN]; /* in C */
mapellil 11:ff82699c696e 469 uint8_t pastenvTemperature [TEMP_DATA_LEN];
mapellil 0:e93a11b4e044 470 uint8_t envHumidity [HUM_DATA_LEN]; /* in % */
mapellil 11:ff82699c696e 471 uint8_t pastenvHumidity [HUM_DATA_LEN];
mapellil 0:e93a11b4e044 472 uint8_t envPressure [PRES_DATA_LEN]; /* in mBar */
mapellil 11:ff82699c696e 473 uint8_t pastenvPressure [PRES_DATA_LEN];
mapellil 11:ff82699c696e 474 uint8_t envMagn [MAG_DATA_LEN];
mapellil 0:e93a11b4e044 475 uint8_t envGyro [GYRO_DATA_LEN];
mapellil 0:e93a11b4e044 476 uint8_t envAcce [ACC_DATA_LEN];
mapellil 0:e93a11b4e044 477 uint8_t envAccGyroMag [ACCGYROMAG_DATA_LEN];
mapellil 20:b97e14ade434 478 uint8_t envPresHumTemp [PRESHUMTEMP_DATA_LEN];
mapellil 20:b97e14ade434 479 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 480 GattCharacteristic envTemperatureCharacteristic;
mapellil 11:ff82699c696e 481 GattCharacteristic envHumidityCharacteristic;
mapellil 0:e93a11b4e044 482 GattCharacteristic envPressureCharacteristic;
mapellil 20:b97e14ade434 483 #endif
mapellil 0:e93a11b4e044 484 GattCharacteristic envMagnetometerCharacteristic;
mapellil 0:e93a11b4e044 485 GattCharacteristic envAccelerometerCharacteristic;
mapellil 0:e93a11b4e044 486 GattCharacteristic envGyroCharacteristic;
mapellil 0:e93a11b4e044 487 GattCharacteristic envAccGyroMagCharacteristic;
mapellil 20:b97e14ade434 488 GattCharacteristic envPresHumTempCharacteristic;
mapellil 0:e93a11b4e044 489
mapellil 0:e93a11b4e044 490 ConnectionStatus_t isBTLEConnected;
mapellil 20:b97e14ade434 491 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 492 bool isEnabledTempNotify;
mapellil 0:e93a11b4e044 493 bool isEnabledHumNotify;
mapellil 0:e93a11b4e044 494 bool isEnabledPresNotify;
mapellil 20:b97e14ade434 495 #endif
mapellil 11:ff82699c696e 496 bool isEnabledGyroNotify;
mapellil 0:e93a11b4e044 497 bool isEnabledAccNotify;
mapellil 0:e93a11b4e044 498 bool isEnabledMagNotify;
mapellil 11:ff82699c696e 499 bool isEnabledAccGyroMagNotify;
mapellil 20:b97e14ade434 500 bool isEnabledPresHumTempNotify;
mapellil 11:ff82699c696e 501
mapellil 0:e93a11b4e044 502 bool isTempCalibrated;
mapellil 0:e93a11b4e044 503 bool isHumCalibrated;
mapellil 11:ff82699c696e 504 bool isPresCalibrated;
mapellil 0:e93a11b4e044 505 bool isMagCalibrated;
mapellil 11:ff82699c696e 506 bool isAccCalibrated;
mapellil 11:ff82699c696e 507 bool isAGyroCalibrated;
mapellil 0:e93a11b4e044 508 };
mapellil 0:e93a11b4e044 509
mapellil 0:e93a11b4e044 510 #endif /* #ifndef __CUSTOM_BLE_SENSORS_SERVICE_H__*/