Skip to content

Commit

Permalink
Limits: create new header for numeric limits
Browse files Browse the repository at this point in the history
Replaces them in `local_msg.hpp` header.
  • Loading branch information
DavidB137 committed Sep 24, 2024
1 parent bd5d712 commit 8ce9a94
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
22 changes: 22 additions & 0 deletions include/kvik/limits.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @file limits.hpp
* @author Dávid Benko (davidbenko@davidbenko.dev)
* @brief Numerical limits
*
* @copyright Copyright (c) 2024
*
*/

#pragma once

#include <climits>
#include <cstdint>

namespace kvik
{
//! Peer preference "unknown" value
constexpr int16_t PREF_UNKNOWN = INT16_MIN;

//! RSSI "unknown" value
constexpr int16_t RSSI_UNKNOWN = INT16_MIN;
} // namespace kvik
8 changes: 3 additions & 5 deletions include/kvik/local_msg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
#include <string>
#include <vector>

#include "kvik/limits.hpp"
#include "kvik/local_addr.hpp"
#include "kvik/node_types.hpp"
#include "kvik/pub_sub_struct.hpp"

namespace kvik
{
//! RSSI "unknown" value
constexpr int16_t MSG_RSSI_UNKNOWN = INT16_MIN;

/**
* @brief Local message types
*/
Expand Down Expand Up @@ -127,7 +125,7 @@ namespace kvik
* in case of to be sent message should contain RSSI of corresponding
* received message so that correct data rate can be chosen.
*/
int16_t rssi = MSG_RSSI_UNKNOWN;
int16_t rssi = RSSI_UNKNOWN;

/**
* @brief Peer preference (weight)
Expand All @@ -139,7 +137,7 @@ namespace kvik
*
* PROBE_RES only.
*/
int16_t pref = INT16_MIN;
int16_t pref = PREF_UNKNOWN;

/**
* @brief Gateway time difference
Expand Down

0 comments on commit 8ce9a94

Please sign in to comment.