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:
Thu Oct 19 07:43:37 2017 +0000
Revision:
36:7abc45e9b0a5
Parent:
27:dccb3b0fae57
Updated libs

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 27:dccb3b0fae57 46 //#define DISAGGREGATED_ENV_CHAR // uncomment to enable the disaggregated environmental temp,hum,pres characteristics, attention because of BLE mem limitations // the maximum number of characteristics is limited check BLUENRG_STACK_MODE
mapellil 27:dccb3b0fae57 47 //#define DISAGGREGATED_MOT_CHAR // " motion acc, gyro, mag "
mapellil 27:dccb3b0fae57 48
mapellil 20:b97e14ade434 49 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 50 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 20:b97e14ade434 51 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 52 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 53 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 54 #endif
mapellil 27:dccb3b0fae57 55 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 20:b97e14ade434 56 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 57 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 58 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 27:dccb3b0fae57 59 #endif
mapellil 20:b97e14ade434 60 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 61 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 62
mapellil 0:e93a11b4e044 63
mapellil 0:e93a11b4e044 64 #define TEMP_DATA_LEN 2+2
mapellil 0:e93a11b4e044 65 #define HUM_DATA_LEN 2+2
mapellil 0:e93a11b4e044 66 #define PRES_DATA_LEN 2+4
mapellil 11:ff82699c696e 67 #define ACC_DATA_LEN 6+2
mapellil 0:e93a11b4e044 68 #define MAG_DATA_LEN 6+2
mapellil 20:b97e14ade434 69 #define GYRO_DATA_LEN 6+2
mapellil 0:e93a11b4e044 70 #define ACCGYROMAG_DATA_LEN 2+3*3*2
mapellil 20:b97e14ade434 71 #define PRESHUMTEMP_DATA_LEN 2+4+2+2
mapellil 0:e93a11b4e044 72
mapellil 0:e93a11b4e044 73 /* Custom Sensors Service */
mapellil 11:ff82699c696e 74 class CustomSensorService
mapellil 11:ff82699c696e 75 {
mapellil 0:e93a11b4e044 76 public:
mapellil 9:2693f9ef8ff7 77 CustomSensorService(BLE &_ble) :
mapellil 0:e93a11b4e044 78 ble(_ble),
mapellil 20:b97e14ade434 79 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 80 envTemperatureCharacteristic(SENS_TEMP_CHAR_UUID_128,envTemperature, TEMP_DATA_LEN, TEMP_DATA_LEN,
mapellil 11:ff82699c696e 81 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 82 envHumidityCharacteristic(SENS_HUMI_CHAR_UUID_128, envHumidity, HUM_DATA_LEN, HUM_DATA_LEN,
mapellil 11:ff82699c696e 83 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 84 envPressureCharacteristic(SENS_PRES_CHAR_UUID_128, envPressure, PRES_DATA_LEN, PRES_DATA_LEN,
mapellil 11:ff82699c696e 85 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 27:dccb3b0fae57 86 #endif
mapellil 27:dccb3b0fae57 87 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 11:ff82699c696e 88 envMagnetometerCharacteristic(SENS_MAGN_CHAR_UUID_128,envMagn, MAG_DATA_LEN, MAG_DATA_LEN,
mapellil 11:ff82699c696e 89 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 90 envAccelerometerCharacteristic(SENS_ACCE_CHAR_UUID_128,envAcce, ACC_DATA_LEN, ACC_DATA_LEN,
mapellil 11:ff82699c696e 91 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 11:ff82699c696e 92 envGyroCharacteristic(SENS_GYRO_CHAR_UUID_128,envGyro, GYRO_DATA_LEN, GYRO_DATA_LEN,
mapellil 11:ff82699c696e 93 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 27:dccb3b0fae57 94 #endif
mapellil 11:ff82699c696e 95 envAccGyroMagCharacteristic(SENS_ACC_GYRO_MAG_CHAR_UUID_128,envAccGyroMag, ACCGYROMAG_DATA_LEN, ACCGYROMAG_DATA_LEN,
mapellil 20:b97e14ade434 96 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
mapellil 20:b97e14ade434 97 envPresHumTempCharacteristic(SENS_PRES_HUM_TEMP_CHAR_UUID_128,envPresHumTemp, PRESHUMTEMP_DATA_LEN, PRESHUMTEMP_DATA_LEN,
mapellil 20:b97e14ade434 98 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
mapellil 20:b97e14ade434 99 {
mapellil 11:ff82699c696e 100
mapellil 0:e93a11b4e044 101 static bool serviceAdded = false; /* We should only ever need to add the env service once. */
mapellil 0:e93a11b4e044 102 if (serviceAdded) {
mapellil 0:e93a11b4e044 103 return;
mapellil 0:e93a11b4e044 104 }
mapellil 8:b042fe719f51 105
mapellil 20:b97e14ade434 106 GattCharacteristic *charTable[] = {
mapellil 20:b97e14ade434 107 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 20:b97e14ade434 108 &envTemperatureCharacteristic, &envHumidityCharacteristic, &envPressureCharacteristic,
mapellil 27:dccb3b0fae57 109 #endif
mapellil 20:b97e14ade434 110 &envPresHumTempCharacteristic,
mapellil 27:dccb3b0fae57 111 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 20:b97e14ade434 112 &envMagnetometerCharacteristic, &envAccelerometerCharacteristic, &envGyroCharacteristic,
mapellil 27:dccb3b0fae57 113 #endif
mapellil 20:b97e14ade434 114 &envAccGyroMagCharacteristic
mapellil 11:ff82699c696e 115 };
mapellil 11:ff82699c696e 116
mapellil 11:ff82699c696e 117 GattService envService(SENS_SERVICE_UUID_128, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
mapellil 11:ff82699c696e 118
mapellil 11:ff82699c696e 119 ble.gattServer().addService(envService);
mapellil 0:e93a11b4e044 120
mapellil 20:b97e14ade434 121 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 122 isEnabledTempNotify = false;
mapellil 0:e93a11b4e044 123 isEnabledHumNotify = false;
mapellil 0:e93a11b4e044 124 isEnabledPresNotify = false;
mapellil 27:dccb3b0fae57 125 #endif
mapellil 27:dccb3b0fae57 126 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 127 isEnabledGyroNotify = false;
mapellil 0:e93a11b4e044 128 isEnabledAccNotify = false;
mapellil 0:e93a11b4e044 129 isEnabledMagNotify = false;
mapellil 27:dccb3b0fae57 130 #endif
mapellil 11:ff82699c696e 131 isEnabledAccGyroMagNotify = false;
mapellil 20:b97e14ade434 132 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 133
mapellil 0:e93a11b4e044 134 isTempCalibrated = false;
mapellil 0:e93a11b4e044 135 isHumCalibrated = false;
mapellil 11:ff82699c696e 136 isPresCalibrated = false;
mapellil 0:e93a11b4e044 137 isMagCalibrated = false;
mapellil 11:ff82699c696e 138 isAccCalibrated = false;
mapellil 11:ff82699c696e 139 isAGyroCalibrated = false;
mapellil 0:e93a11b4e044 140
mapellil 20:b97e14ade434 141 memset (pastenvTemperature, 0, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 142 memset (pastenvHumidity, 0, HUM_DATA_LEN);
mapellil 11:ff82699c696e 143 memset (pastenvPressure, 0, PRES_DATA_LEN);
mapellil 11:ff82699c696e 144
mapellil 11:ff82699c696e 145 isBTLEConnected = DISCONNECTED;
mapellil 11:ff82699c696e 146 serviceAdded = true;
mapellil 0:e93a11b4e044 147 }
mapellil 20:b97e14ade434 148 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 8:b042fe719f51 149 uint32_t sendEnvTemperature (int16_t Temp, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 150 STORE_LE_16(envTemperature,TimeStamp);
mapellil 11:ff82699c696e 151 STORE_LE_16(envTemperature+2,Temp);
mapellil 11:ff82699c696e 152 memcpy (pastenvTemperature, envTemperature, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 153 return ble.gattServer().write(envTemperatureCharacteristic.getValueAttribute().getHandle(), envTemperature, TEMP_DATA_LEN, 0);
mapellil 11:ff82699c696e 154 }
mapellil 11:ff82699c696e 155
mapellil 0:e93a11b4e044 156 /**
mapellil 0:e93a11b4e044 157 * Update the temperature with a new value. Valid values range from
mapellil 0:e93a11b4e044 158 * 0..100. Anything outside this range will be ignored.
mapellil 0:e93a11b4e044 159 * @param newLevel New level. */
mapellil 8:b042fe719f51 160 uint32_t updateEnvTemperature (int16_t Temp, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 161 if (memcmp (&pastenvTemperature[2], &Temp, 2) != 0) {
mapellil 11:ff82699c696e 162 return sendEnvTemperature (Temp, TimeStamp);
mapellil 0:e93a11b4e044 163 }
mapellil 11:ff82699c696e 164 return 0;
mapellil 11:ff82699c696e 165 }
mapellil 11:ff82699c696e 166
mapellil 11:ff82699c696e 167 uint32_t sendEnvHumidity(uint16_t Hum, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 168 STORE_LE_16(envHumidity,TimeStamp);
mapellil 11:ff82699c696e 169 STORE_LE_16(envHumidity+2,Hum);
mapellil 11:ff82699c696e 170 memcpy (pastenvHumidity, envHumidity, HUM_DATA_LEN);
mapellil 11:ff82699c696e 171 return ble.gattServer().write(envHumidityCharacteristic.getValueAttribute().getHandle(), envHumidity, HUM_DATA_LEN, 0);
mapellil 11:ff82699c696e 172 }
mapellil 11:ff82699c696e 173
mapellil 8:b042fe719f51 174 uint32_t updateEnvHumidity(uint16_t Hum, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 175 if (memcmp (&pastenvHumidity[2], &Hum, 2) != 0) {
mapellil 11:ff82699c696e 176 return sendEnvHumidity(Hum, TimeStamp);
mapellil 11:ff82699c696e 177 }
mapellil 11:ff82699c696e 178 return 0;
mapellil 11:ff82699c696e 179 }
mapellil 11:ff82699c696e 180
mapellil 8:b042fe719f51 181 uint32_t sendEnvPressure(uint32_t Press, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 182 STORE_LE_16(envPressure,TimeStamp);
mapellil 11:ff82699c696e 183 STORE_LE_32(envPressure+2,Press);
mapellil 11:ff82699c696e 184 memcpy (pastenvPressure, envPressure, PRES_DATA_LEN);
mapellil 11:ff82699c696e 185 return ble.gattServer().write(envPressureCharacteristic.getValueAttribute().getHandle(), envPressure, PRES_DATA_LEN, 0);
mapellil 11:ff82699c696e 186 }
mapellil 11:ff82699c696e 187
mapellil 8:b042fe719f51 188 uint32_t updateEnvPressure(uint32_t Press, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 189 if (memcmp (&pastenvPressure[2], &Press, 2) != 0) {
mapellil 11:ff82699c696e 190 return sendEnvPressure(Press, TimeStamp);
mapellil 11:ff82699c696e 191 }
mapellil 11:ff82699c696e 192 return 0;
mapellil 11:ff82699c696e 193 }
mapellil 20:b97e14ade434 194 #endif
mapellil 11:ff82699c696e 195
mapellil 20:b97e14ade434 196 uint32_t sendEnvPresHumTemp(uint32_t Press, uint16_t Hum, int16_t Temp, uint16_t TimeStamp) {
mapellil 20:b97e14ade434 197 STORE_LE_16(envPressure,TimeStamp);
mapellil 20:b97e14ade434 198 STORE_LE_32(envPressure+2,Press);
mapellil 20:b97e14ade434 199 memcpy (pastenvPressure, envPressure, PRES_DATA_LEN);
mapellil 20:b97e14ade434 200 STORE_LE_16(envHumidity,TimeStamp);
mapellil 20:b97e14ade434 201 STORE_LE_16(envHumidity+2,Hum);
mapellil 20:b97e14ade434 202 memcpy (pastenvHumidity, envHumidity, HUM_DATA_LEN);
mapellil 20:b97e14ade434 203 STORE_LE_16(envTemperature,TimeStamp);
mapellil 20:b97e14ade434 204 STORE_LE_16(envTemperature+2,Temp);
mapellil 20:b97e14ade434 205 memcpy (pastenvTemperature, envTemperature, TEMP_DATA_LEN);
mapellil 20:b97e14ade434 206 STORE_LE_16(envPresHumTemp, TimeStamp);
mapellil 20:b97e14ade434 207 memcpy (envPresHumTemp+2, envPressure+2, 4);
mapellil 20:b97e14ade434 208 memcpy (envPresHumTemp+2+4, envHumidity+2, 2);
mapellil 20:b97e14ade434 209 memcpy (envPresHumTemp+2+4+2, envTemperature+2, 2);
mapellil 20:b97e14ade434 210 return ble.gattServer().write(envPresHumTempCharacteristic.getValueAttribute().getHandle(), envPresHumTemp, PRESHUMTEMP_DATA_LEN, 0);
mapellil 20:b97e14ade434 211 }
mapellil 20:b97e14ade434 212
mapellil 20:b97e14ade434 213 uint32_t updateEnvPresHumTemp(uint32_t Press, uint16_t Hum, int16_t Temp, uint16_t TimeStamp) {
mapellil 20:b97e14ade434 214 if ((memcmp (&pastenvPressure[2], &Press, 2) != 0) ||
mapellil 20:b97e14ade434 215 (memcmp (&pastenvHumidity[2], &Hum, 2) != 0) ||
mapellil 20:b97e14ade434 216 (memcmp (&pastenvTemperature[2], &Temp, 2) != 0)) {
mapellil 20:b97e14ade434 217 return sendEnvPresHumTemp (Press, Hum, Temp, TimeStamp);
mapellil 20:b97e14ade434 218 }
mapellil 20:b97e14ade434 219 return 0;
mapellil 20:b97e14ade434 220 }
mapellil 27:dccb3b0fae57 221 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 20:b97e14ade434 222 uint32_t sendEnvMagnetometer(AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 223 STORE_LE_16(envMagn,TimeStamp);
mapellil 20:b97e14ade434 224 STORE_LE_16(envMagn+2,(Magn->AXIS_X - magOffset->magOffX));
mapellil 20:b97e14ade434 225 STORE_LE_16(envMagn+4,(Magn->AXIS_Y - magOffset->magOffY));
mapellil 20:b97e14ade434 226 STORE_LE_16(envMagn+6,(Magn->AXIS_Z - magOffset->magOffZ));
mapellil 11:ff82699c696e 227 return ble.gattServer().write(envMagnetometerCharacteristic.getValueAttribute().getHandle(), envMagn, MAG_DATA_LEN, 0);
mapellil 11:ff82699c696e 228 }
mapellil 11:ff82699c696e 229
mapellil 20:b97e14ade434 230 uint32_t updateEnvMagnetometer(AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 231 if (isMagNotificationEn()) return sendEnvMagnetometer(Magn, TimeStamp, magOffset);
mapellil 11:ff82699c696e 232 return 0;
mapellil 0:e93a11b4e044 233 }
mapellil 11:ff82699c696e 234
mapellil 11:ff82699c696e 235 uint32_t sendEnvAccelerometer (AxesRaw_TypeDef *Acc, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 236 STORE_LE_16(envAcce,TimeStamp);
mapellil 11:ff82699c696e 237 STORE_LE_16(envAcce+2,Acc->AXIS_X);
mapellil 11:ff82699c696e 238 STORE_LE_16(envAcce+4,Acc->AXIS_Y);
mapellil 11:ff82699c696e 239 STORE_LE_16(envAcce+6,Acc->AXIS_Z);
mapellil 11:ff82699c696e 240 return ble.gattServer().write(envAccelerometerCharacteristic.getValueAttribute().getHandle(), envAcce, ACC_DATA_LEN, 0);
mapellil 11:ff82699c696e 241 }
mapellil 11:ff82699c696e 242
mapellil 11:ff82699c696e 243 uint32_t updateEnvAccelerometer (AxesRaw_TypeDef *Acc, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 244 if (isAccNotificationEn()) return sendEnvAccelerometer (Acc, TimeStamp);
mapellil 11:ff82699c696e 245 return 0;
mapellil 0:e93a11b4e044 246 }
mapellil 0:e93a11b4e044 247
mapellil 11:ff82699c696e 248 uint32_t sendEnvGyroscope (AxesRaw_TypeDef *Gyro, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 249 STORE_LE_16(envGyro,TimeStamp);
mapellil 11:ff82699c696e 250 STORE_LE_16(envGyro+2,Gyro->AXIS_X);
mapellil 11:ff82699c696e 251 STORE_LE_16(envGyro+4,Gyro->AXIS_Y);
mapellil 11:ff82699c696e 252 STORE_LE_16(envGyro+6,Gyro->AXIS_Z);
mapellil 11:ff82699c696e 253 return ble.gattServer().write(envGyroCharacteristic.getValueAttribute().getHandle(), envGyro, GYRO_DATA_LEN, 0);
mapellil 11:ff82699c696e 254 }
mapellil 11:ff82699c696e 255
mapellil 11:ff82699c696e 256 uint32_t updateEnvGyroscope (AxesRaw_TypeDef *Gyro, uint16_t TimeStamp) {
mapellil 11:ff82699c696e 257 if (isGyroNotificationEn()) return sendEnvGyroscope (Gyro, TimeStamp);
mapellil 11:ff82699c696e 258 return 0;
mapellil 11:ff82699c696e 259 }
mapellil 27:dccb3b0fae57 260 #endif
mapellil 20:b97e14ade434 261 uint32_t sendEnvAccGyroMag (AxesRaw_TypeDef *Acc, AxesRaw_TypeDef *Gyro, AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 262 STORE_LE_16(envAccGyroMag,TimeStamp);
mapellil 11:ff82699c696e 263 STORE_LE_16(envAccGyroMag+2,Acc->AXIS_X);
mapellil 11:ff82699c696e 264 STORE_LE_16(envAccGyroMag+4,Acc->AXIS_Y);
mapellil 11:ff82699c696e 265 STORE_LE_16(envAccGyroMag+6,Acc->AXIS_Z);
mapellil 11:ff82699c696e 266
mapellil 11:ff82699c696e 267 STORE_LE_16(envAccGyroMag+8,Gyro->AXIS_X);
mapellil 11:ff82699c696e 268 STORE_LE_16(envAccGyroMag+10,Gyro->AXIS_Y);
mapellil 11:ff82699c696e 269 STORE_LE_16(envAccGyroMag+12,Gyro->AXIS_Z);
mapellil 11:ff82699c696e 270
mapellil 20:b97e14ade434 271 STORE_LE_16(envAccGyroMag+14,(Magn->AXIS_X - magOffset->magOffX));
mapellil 20:b97e14ade434 272 STORE_LE_16(envAccGyroMag+16,(Magn->AXIS_Y - magOffset->magOffY));
mapellil 20:b97e14ade434 273 STORE_LE_16(envAccGyroMag+18,(Magn->AXIS_Z - magOffset->magOffZ));
mapellil 11:ff82699c696e 274 return ble.gattServer().write(envAccGyroMagCharacteristic.getValueAttribute().getHandle(), envAccGyroMag, ACCGYROMAG_DATA_LEN, 0);
mapellil 11:ff82699c696e 275 }
mapellil 11:ff82699c696e 276
mapellil 20:b97e14ade434 277 uint32_t updateEnvAccGyroMag (AxesRaw_TypeDef *Acc, AxesRaw_TypeDef *Gyro, AxesRaw_TypeDef *Magn, uint16_t TimeStamp, osxMFX_calibFactor *magOffset) {
mapellil 11:ff82699c696e 278 if (isAccGyroMagNotificationEn()) return sendEnvAccGyroMag (Acc, Gyro, Magn, TimeStamp, magOffset);
mapellil 11:ff82699c696e 279 return 0;
mapellil 0:e93a11b4e044 280 }
mapellil 12:baf8b5294320 281 void enNotify (Gap::Handle_t a_handle) {
mapellil 13:d00147d01d4e 282 Gap::Handle_t handle = a_handle - BLE_HANDLE_EN_DIS_OFFSET;
mapellil 20:b97e14ade434 283 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 284 if (isTempHandle(handle)) {
mapellil 11:ff82699c696e 285 isEnabledTempNotify = true;
mapellil 11:ff82699c696e 286 memset(pastenvTemperature,0,TEMP_DATA_LEN);
mapellil 20:b97e14ade434 287 printf ("isTempHandle en\n\r");
mapellil 11:ff82699c696e 288 return;
mapellil 11:ff82699c696e 289 }
mapellil 11:ff82699c696e 290 if (isHumHandle(handle)) {
mapellil 11:ff82699c696e 291 isEnabledHumNotify = true;
mapellil 11:ff82699c696e 292 memset(pastenvHumidity,0,HUM_DATA_LEN);
mapellil 20:b97e14ade434 293 printf ("isHumHandle en\n\r");
mapellil 11:ff82699c696e 294 return;
mapellil 11:ff82699c696e 295 }
mapellil 11:ff82699c696e 296 if (isPresHandle(handle)) {
mapellil 11:ff82699c696e 297 isEnabledPresNotify = true;
mapellil 11:ff82699c696e 298 memset(pastenvPressure,0,PRES_DATA_LEN);
mapellil 20:b97e14ade434 299 printf ("isPresHandle en\n\r");
mapellil 11:ff82699c696e 300 return;
mapellil 11:ff82699c696e 301 }
mapellil 27:dccb3b0fae57 302 #endif
mapellil 27:dccb3b0fae57 303 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 304 if (isGyroHandle(handle)) {
mapellil 11:ff82699c696e 305 isEnabledGyroNotify = true;
mapellil 20:b97e14ade434 306 printf ("isGyroHandle en\n\r");
mapellil 11:ff82699c696e 307 return;
mapellil 11:ff82699c696e 308 }
mapellil 11:ff82699c696e 309 if (isAccHandle(handle)) {
mapellil 11:ff82699c696e 310 isEnabledAccNotify = true;
mapellil 20:b97e14ade434 311 printf ("isAccHandle en\n\r");
mapellil 11:ff82699c696e 312 return;
mapellil 11:ff82699c696e 313 }
mapellil 11:ff82699c696e 314 if (isMagHandle(handle)) {
mapellil 11:ff82699c696e 315 isEnabledMagNotify = true;
mapellil 20:b97e14ade434 316 printf ("isMagHandle en\n\r");
mapellil 11:ff82699c696e 317 return;
mapellil 11:ff82699c696e 318 }
mapellil 27:dccb3b0fae57 319 #endif
mapellil 11:ff82699c696e 320 if (isAccGyroMagHandle(handle)) {
mapellil 11:ff82699c696e 321 isEnabledAccGyroMagNotify = true;
mapellil 20:b97e14ade434 322 printf ("isAccGyroMagHandle en\n\r");
mapellil 11:ff82699c696e 323 return;
mapellil 11:ff82699c696e 324 }
mapellil 20:b97e14ade434 325 if (isPresHumTempHandle(handle)) {
mapellil 20:b97e14ade434 326 isEnabledPresHumTempNotify = true;
mapellil 20:b97e14ade434 327 printf ("isPresHumTempHandle en\n\r");
mapellil 20:b97e14ade434 328 return;
mapellil 20:b97e14ade434 329 }
mapellil 0:e93a11b4e044 330 }
mapellil 0:e93a11b4e044 331
mapellil 12:baf8b5294320 332 void disNotify (Gap::Handle_t a_handle) {
mapellil 13:d00147d01d4e 333 Gap::Handle_t handle = a_handle - BLE_HANDLE_EN_DIS_OFFSET;
mapellil 20:b97e14ade434 334 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 13:d00147d01d4e 335 if (isTempHandle(handle)) {
mapellil 11:ff82699c696e 336 isEnabledTempNotify = false;
mapellil 11:ff82699c696e 337 memset(pastenvTemperature,0,TEMP_DATA_LEN);
mapellil 20:b97e14ade434 338 printf ("isTempHandle dis\n\r");
mapellil 11:ff82699c696e 339 return;
mapellil 20:b97e14ade434 340 }
mapellil 11:ff82699c696e 341 if (isHumHandle(handle)) {
mapellil 11:ff82699c696e 342 isEnabledHumNotify = false;
mapellil 11:ff82699c696e 343 memset(pastenvHumidity,0,HUM_DATA_LEN);
mapellil 20:b97e14ade434 344 printf ("isHumHandle dis\n\r");
mapellil 11:ff82699c696e 345 return;
mapellil 11:ff82699c696e 346 }
mapellil 11:ff82699c696e 347 if (isPresHandle(handle)) {
mapellil 11:ff82699c696e 348 isEnabledPresNotify = false;
mapellil 11:ff82699c696e 349 memset(pastenvPressure,0,PRES_DATA_LEN);
mapellil 20:b97e14ade434 350 printf ("isPresHandle dis\n\r");
mapellil 11:ff82699c696e 351 return;
mapellil 11:ff82699c696e 352 }
mapellil 27:dccb3b0fae57 353 #endif
mapellil 27:dccb3b0fae57 354 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 355 if (isGyroHandle(handle)) {
mapellil 11:ff82699c696e 356 isEnabledGyroNotify = false;
mapellil 20:b97e14ade434 357 printf ("isGyroHandle dis\n\r");
mapellil 11:ff82699c696e 358 return;
mapellil 11:ff82699c696e 359 }
mapellil 11:ff82699c696e 360 if (isAccHandle(handle)) {
mapellil 11:ff82699c696e 361 isEnabledAccNotify = false;
mapellil 20:b97e14ade434 362 printf ("isAccHandle dis\n\r");
mapellil 11:ff82699c696e 363 return;
mapellil 11:ff82699c696e 364 }
mapellil 13:d00147d01d4e 365 if (isMagHandle(handle)) {
mapellil 11:ff82699c696e 366 isEnabledMagNotify = false;
mapellil 20:b97e14ade434 367 printf ("isMagHandle dis\n\r");
mapellil 11:ff82699c696e 368 return;
mapellil 11:ff82699c696e 369 }
mapellil 27:dccb3b0fae57 370 #endif
mapellil 11:ff82699c696e 371 if (isAccGyroMagHandle(handle)) {
mapellil 11:ff82699c696e 372 isEnabledAccGyroMagNotify = false;
mapellil 20:b97e14ade434 373 printf ("isAccGyroMagHandle dis\n\r");
mapellil 11:ff82699c696e 374 return;
mapellil 11:ff82699c696e 375 }
mapellil 20:b97e14ade434 376 if (isPresHumTempHandle(handle)) {
mapellil 20:b97e14ade434 377 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 378 printf ("isPresHumTempHandle dis\n\r");
mapellil 20:b97e14ade434 379 return;
mapellil 20:b97e14ade434 380 }
mapellil 0:e93a11b4e044 381 }
mapellil 20:b97e14ade434 382 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 383 bool isTempNotificationEn (void) {
mapellil 11:ff82699c696e 384 return isEnabledTempNotify;
mapellil 0:e93a11b4e044 385 }
mapellil 11:ff82699c696e 386
mapellil 0:e93a11b4e044 387 bool isHumNotificationEn (void) {
mapellil 11:ff82699c696e 388 return isEnabledHumNotify;
mapellil 0:e93a11b4e044 389 }
mapellil 0:e93a11b4e044 390
mapellil 0:e93a11b4e044 391 bool isPresNotificationEn (void) {
mapellil 11:ff82699c696e 392 return isEnabledPresNotify;
mapellil 0:e93a11b4e044 393 }
mapellil 20:b97e14ade434 394 #endif
mapellil 27:dccb3b0fae57 395 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 0:e93a11b4e044 396 bool isGyroNotificationEn (void) {
mapellil 11:ff82699c696e 397 return isEnabledGyroNotify;
mapellil 11:ff82699c696e 398 }
mapellil 0:e93a11b4e044 399
mapellil 0:e93a11b4e044 400 bool isAccNotificationEn (void) {
mapellil 11:ff82699c696e 401 return isEnabledAccNotify;
mapellil 11:ff82699c696e 402 }
mapellil 11:ff82699c696e 403
mapellil 0:e93a11b4e044 404 bool isMagNotificationEn (void) {
mapellil 11:ff82699c696e 405 return isEnabledMagNotify;
mapellil 11:ff82699c696e 406 }
mapellil 27:dccb3b0fae57 407 #endif
mapellil 0:e93a11b4e044 408 bool isAccGyroMagNotificationEn (void) {
mapellil 11:ff82699c696e 409 return isEnabledAccGyroMagNotify;
mapellil 11:ff82699c696e 410 }
mapellil 20:b97e14ade434 411
mapellil 20:b97e14ade434 412 bool isPresHumTempNotificationEn (void) {
mapellil 20:b97e14ade434 413 return isEnabledPresHumTempNotify;
mapellil 20:b97e14ade434 414 }
mapellil 20:b97e14ade434 415 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 416 bool isTempHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 417 if (handle == envTemperatureCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 418 return false;
mapellil 0:e93a11b4e044 419 }
mapellil 0:e93a11b4e044 420
mapellil 0:e93a11b4e044 421 bool isHumHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 422 if (handle == envHumidityCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 423 return false;
mapellil 0:e93a11b4e044 424 }
mapellil 11:ff82699c696e 425
mapellil 0:e93a11b4e044 426 bool isPresHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 427 if (handle == envPressureCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 428 return false;
mapellil 11:ff82699c696e 429 }
mapellil 20:b97e14ade434 430 #endif
mapellil 27:dccb3b0fae57 431 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 0:e93a11b4e044 432 bool isMagHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 433 if (handle == envMagnetometerCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 434 return false;
mapellil 0:e93a11b4e044 435 }
mapellil 0:e93a11b4e044 436 bool isAccHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 437 if (handle == envAccelerometerCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 438 return false;
mapellil 0:e93a11b4e044 439 }
mapellil 0:e93a11b4e044 440 bool isGyroHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 441 if (handle == envGyroCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 442 return false;
mapellil 0:e93a11b4e044 443 }
mapellil 27:dccb3b0fae57 444 #endif
mapellil 0:e93a11b4e044 445 bool isAccGyroMagHandle (Gap::Handle_t handle) {
mapellil 13:d00147d01d4e 446 if (handle == envAccGyroMagCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 11:ff82699c696e 447 return false;
mapellil 0:e93a11b4e044 448 }
mapellil 20:b97e14ade434 449 bool isPresHumTempHandle (Gap::Handle_t handle) {
mapellil 20:b97e14ade434 450 if (handle == envPresHumTempCharacteristic.getValueAttribute().getHandle() - BLE_HANDLE_VALUE_OFFSET) return true;
mapellil 20:b97e14ade434 451 return false;
mapellil 20:b97e14ade434 452 }
mapellil 20:b97e14ade434 453
mapellil 11:ff82699c696e 454
mapellil 11:ff82699c696e 455 void updateConnectionStatus(ConnectionStatus_t status) {
mapellil 20:b97e14ade434 456 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 457 isEnabledTempNotify = false;
mapellil 11:ff82699c696e 458 isEnabledHumNotify = false;
mapellil 11:ff82699c696e 459 isEnabledPresNotify = false;
mapellil 27:dccb3b0fae57 460 #endif
mapellil 27:dccb3b0fae57 461 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 11:ff82699c696e 462 isEnabledGyroNotify = false;
mapellil 11:ff82699c696e 463 isEnabledAccNotify = false;
mapellil 11:ff82699c696e 464 isEnabledMagNotify = false;
mapellil 27:dccb3b0fae57 465 #endif
mapellil 20:b97e14ade434 466 isEnabledPresHumTempNotify = false;
mapellil 20:b97e14ade434 467 isEnabledAccGyroMagNotify = false;
mapellil 11:ff82699c696e 468
mapellil 11:ff82699c696e 469 isTempCalibrated = false;
mapellil 11:ff82699c696e 470 isHumCalibrated = false;
mapellil 11:ff82699c696e 471 isPresCalibrated = false;
mapellil 11:ff82699c696e 472 isMagCalibrated = false;
mapellil 11:ff82699c696e 473 isAccCalibrated = false;
mapellil 11:ff82699c696e 474 isAGyroCalibrated = false;
mapellil 11:ff82699c696e 475
mapellil 11:ff82699c696e 476 memset (pastenvTemperature, 0, TEMP_DATA_LEN);
mapellil 11:ff82699c696e 477 memset (pastenvHumidity, 0, HUM_DATA_LEN);
mapellil 11:ff82699c696e 478 memset (pastenvPressure, 0, PRES_DATA_LEN);
mapellil 11:ff82699c696e 479 isBTLEConnected = status;
mapellil 0:e93a11b4e044 480 }
mapellil 11:ff82699c696e 481
mapellil 11:ff82699c696e 482
mapellil 0:e93a11b4e044 483 private:
mapellil 9:2693f9ef8ff7 484 BLE &ble;
mapellil 0:e93a11b4e044 485 uint8_t envTemperature [TEMP_DATA_LEN]; /* in C */
mapellil 11:ff82699c696e 486 uint8_t pastenvTemperature [TEMP_DATA_LEN];
mapellil 0:e93a11b4e044 487 uint8_t envHumidity [HUM_DATA_LEN]; /* in % */
mapellil 11:ff82699c696e 488 uint8_t pastenvHumidity [HUM_DATA_LEN];
mapellil 0:e93a11b4e044 489 uint8_t envPressure [PRES_DATA_LEN]; /* in mBar */
mapellil 11:ff82699c696e 490 uint8_t pastenvPressure [PRES_DATA_LEN];
mapellil 11:ff82699c696e 491 uint8_t envMagn [MAG_DATA_LEN];
mapellil 0:e93a11b4e044 492 uint8_t envGyro [GYRO_DATA_LEN];
mapellil 0:e93a11b4e044 493 uint8_t envAcce [ACC_DATA_LEN];
mapellil 0:e93a11b4e044 494 uint8_t envAccGyroMag [ACCGYROMAG_DATA_LEN];
mapellil 20:b97e14ade434 495 uint8_t envPresHumTemp [PRESHUMTEMP_DATA_LEN];
mapellil 20:b97e14ade434 496 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 11:ff82699c696e 497 GattCharacteristic envTemperatureCharacteristic;
mapellil 11:ff82699c696e 498 GattCharacteristic envHumidityCharacteristic;
mapellil 0:e93a11b4e044 499 GattCharacteristic envPressureCharacteristic;
mapellil 27:dccb3b0fae57 500 #endif
mapellil 27:dccb3b0fae57 501 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 0:e93a11b4e044 502 GattCharacteristic envMagnetometerCharacteristic;
mapellil 0:e93a11b4e044 503 GattCharacteristic envAccelerometerCharacteristic;
mapellil 0:e93a11b4e044 504 GattCharacteristic envGyroCharacteristic;
mapellil 27:dccb3b0fae57 505 #endif
mapellil 0:e93a11b4e044 506 GattCharacteristic envAccGyroMagCharacteristic;
mapellil 20:b97e14ade434 507 GattCharacteristic envPresHumTempCharacteristic;
mapellil 0:e93a11b4e044 508
mapellil 0:e93a11b4e044 509 ConnectionStatus_t isBTLEConnected;
mapellil 20:b97e14ade434 510 #ifdef DISAGGREGATED_ENV_CHAR
mapellil 0:e93a11b4e044 511 bool isEnabledTempNotify;
mapellil 0:e93a11b4e044 512 bool isEnabledHumNotify;
mapellil 0:e93a11b4e044 513 bool isEnabledPresNotify;
mapellil 20:b97e14ade434 514 #endif
mapellil 27:dccb3b0fae57 515 #ifdef DISAGGREGATED_MOT_CHAR
mapellil 11:ff82699c696e 516 bool isEnabledGyroNotify;
mapellil 0:e93a11b4e044 517 bool isEnabledAccNotify;
mapellil 0:e93a11b4e044 518 bool isEnabledMagNotify;
mapellil 27:dccb3b0fae57 519 #endif
mapellil 11:ff82699c696e 520 bool isEnabledAccGyroMagNotify;
mapellil 20:b97e14ade434 521 bool isEnabledPresHumTempNotify;
mapellil 11:ff82699c696e 522
mapellil 0:e93a11b4e044 523 bool isTempCalibrated;
mapellil 0:e93a11b4e044 524 bool isHumCalibrated;
mapellil 11:ff82699c696e 525 bool isPresCalibrated;
mapellil 0:e93a11b4e044 526 bool isMagCalibrated;
mapellil 11:ff82699c696e 527 bool isAccCalibrated;
mapellil 11:ff82699c696e 528 bool isAGyroCalibrated;
mapellil 0:e93a11b4e044 529 };
mapellil 0:e93a11b4e044 530
mapellil 0:e93a11b4e044 531 #endif /* #ifndef __CUSTOM_BLE_SENSORS_SERVICE_H__*/