yes Spada / Mbed OS programme

EnvironmentalService.cpp

Committer:
loicguibert
Date:
2019-04-02
Revision:
14:c5578b5edabe
Child:
15:aac1b3950a9e

File content as of revision 14:c5578b5edabe:

#include "EnvironmentalService.h"

#include "mbed.h"

EnvironmentalService::EnvironmentalService(BLE& ble, Logger& logger)
: m_ble(ble),
  m_serviceAdded(false),
  //m_batteryLevelCharacteristic(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, &m_batteryLevel),
  m_logger(logger) {
}

void EnvironmentalService::addServiceToGattServer(void) {
  // We should only ever need to add the information service once
  if (m_serviceAdded) {
    return;
  }

  //GattCharacteristic *charTable[] = { &m_batteryLevelCharacteristic };
                                      
  //GattService environmentalService(GattService::UUID_ENVIRONMENTAL_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
  //m_ble.gattServer().addService(environmentalService);
  
  m_serviceAdded = true;
  
  m_logger.log("Environmental service added\r\n");
}

 /*void EnvironmentalService::updateEnvironmentalValues(BatteryLevelType_t newBatteryLevelVal) {
  m_batteryLevel = newBatteryLevelVal;
  m_ble.gattServer().write(m_batteryLevelCharacteristic.getValueHandle(), (uint8_t *) &m_batteryLevel, sizeof(BatteryLevelType_t));
}
*/