foxBMS  1.2.1
The foxBMS Battery Management System API Documentation
database_helper.h File Reference

Database module header. More...

#include "database_cfg.h"
Include dependency graph for database_helper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool DATA_DatabaseEntryUpdatedAtLeastOnce (DATA_BLOCK_HEADER_s dataBlockHeader)
 Checks if passed database entry has been updated at least once. More...
 
bool DATA_EntryUpdatedWithinInterval (DATA_BLOCK_HEADER_s dataBlockHeader, uint32_t timeInterval)
 Checks if passed database entry has been updated within the last time interval. More...
 
bool DATA_EntryUpdatedPeriodicallyWithinInterval (DATA_BLOCK_HEADER_s dataBlockHeader, uint32_t timeInterval)
 Checks if passed database entry has been periodically updated within the time interval. More...
 
uint8_t DATA_GetStringNumberFromVoltageIndex (uint16_t cellIndex)
 Returns string number of passed cell index. More...
 
uint8_t DATA_GetModuleNumberFromVoltageIndex (uint16_t cellIndex)
 Returns module number of passed cell index. More...
 
uint8_t DATA_GetCellNumberFromVoltageIndex (uint16_t cellIndex)
 Returns cell number of passed cell index. More...
 
uint8_t DATA_GetStringNumberFromTemperatureIndex (uint16_t sensorIndex)
 Returns string number of passed temperature sensor index. More...
 
uint8_t DATA_GetModuleNumberFromTemperatureIndex (uint16_t sensorIndex)
 Returns module number of passed temperature sensor index. More...
 
uint8_t DATA_GetSensorNumberFromTemperatureIndex (uint16_t sensorIndex)
 Returns sensor number of passed temperature sensor index. More...
 

Detailed Description

Database module header.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2021-05-05 (date of creation)
Updated
2021-05-05 (date of last update)
Prefix
DATA

Provides helper function to handle database entries

Definition in file database_helper.h.

Function Documentation

◆ DATA_DatabaseEntryUpdatedAtLeastOnce()

bool DATA_DatabaseEntryUpdatedAtLeastOnce ( DATA_BLOCK_HEADER_s  dataBlockHeader)

Checks if passed database entry has been updated at least once.

Parameters
[in]dataBlockHeaderheader of database entry
Returns
true if database entry has been updated at least once, otherwise false

Definition at line 73 of file database_helper.c.

◆ DATA_EntryUpdatedPeriodicallyWithinInterval()

bool DATA_EntryUpdatedPeriodicallyWithinInterval ( DATA_BLOCK_HEADER_s  dataBlockHeader,
uint32_t  timeInterval 
)

Checks if passed database entry has been periodically updated within the time interval.

Checks if the last update timestamp is not older than time interval and if the difference between previous timestamp and timestamp is smaller than time interval

Parameters
[in]dataBlockHeaderheader of database entry
[in]timeIntervalin systicks (type: uint32_t)
Returns
true if database entry has been periodically updated within the time interval, otherwise false

Definition at line 100 of file database_helper.c.

Here is the call graph for this function:

◆ DATA_EntryUpdatedWithinInterval()

bool DATA_EntryUpdatedWithinInterval ( DATA_BLOCK_HEADER_s  dataBlockHeader,
uint32_t  timeInterval 
)

Checks if passed database entry has been updated within the last time interval.

Parameters
[in]dataBlockHeaderheader of database entry
[in]timeIntervalin systicks (type: uint32_t)
Returns
true if database entry has been updated within the time interval, otherwise false

Definition at line 84 of file database_helper.c.

Here is the call graph for this function:

◆ DATA_GetCellNumberFromVoltageIndex()

uint8_t DATA_GetCellNumberFromVoltageIndex ( uint16_t  cellIndex)

Returns cell number of passed cell index.

Parameters
[in]cellIndexindex of cell in starting by 0
Returns
cell number of passed cell index

Definition at line 129 of file database_helper.c.

◆ DATA_GetModuleNumberFromTemperatureIndex()

uint8_t DATA_GetModuleNumberFromTemperatureIndex ( uint16_t  sensorIndex)

Returns module number of passed temperature sensor index.

Parameters
[in]sensorIndexindex of sensor starting by 0
Returns
module number of passed temperature sensor index

Definition at line 139 of file database_helper.c.

Here is the call graph for this function:

◆ DATA_GetModuleNumberFromVoltageIndex()

uint8_t DATA_GetModuleNumberFromVoltageIndex ( uint16_t  cellIndex)

Returns module number of passed cell index.

Parameters
[in]cellIndexindex of cell starting by 0
Returns
module number of passed cell index

Definition at line 122 of file database_helper.c.

Here is the call graph for this function:

◆ DATA_GetSensorNumberFromTemperatureIndex()

uint8_t DATA_GetSensorNumberFromTemperatureIndex ( uint16_t  sensorIndex)

Returns sensor number of passed temperature sensor index.

Parameters
[in]sensorIndexindex of sensorstarting by 0
Returns
temperature sensor number of passed sensor index

Definition at line 147 of file database_helper.c.

◆ DATA_GetStringNumberFromTemperatureIndex()

uint8_t DATA_GetStringNumberFromTemperatureIndex ( uint16_t  sensorIndex)

Returns string number of passed temperature sensor index.

Parameters
[in]sensorIndexindex of sensor starting by 0
Returns
string number of passed temperature sensor index

Definition at line 134 of file database_helper.c.

◆ DATA_GetStringNumberFromVoltageIndex()

uint8_t DATA_GetStringNumberFromVoltageIndex ( uint16_t  cellIndex)

Returns string number of passed cell index.

Parameters
[in]cellIndexindex of cell starting by 0
Returns
string number of passed cell index

Definition at line 117 of file database_helper.c.