USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
UHD and USRP Manual
database.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2020 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
9 #include <uhd/config.hpp>
10 #include <cstdint>
11 #include <functional>
12 #include <string>
13 #include <vector>
14 
15 namespace uhd { namespace usrp { namespace cal {
16 
23 enum class source {
24  NONE,
25  ANY,
26  RC,
27  FLASH,
28  FILESYSTEM,
29  USER
30 };
31 
68 {
69 public:
87  static std::vector<uint8_t> read_cal_data(const std::string& key,
88  const std::string& serial,
89  const source source_type = source::ANY);
90 
109  static bool has_cal_data(const std::string& key,
110  const std::string& serial,
111  const source source_type = source::ANY);
112 
132  static void write_cal_data(const std::string& key,
133  const std::string& serial,
134  const std::vector<uint8_t>& cal_data,
135  const std::string& backup_ext = "");
136 
138  using has_data_fn_type = std::function<bool(const std::string&, const std::string&)>;
139 
147  std::function<std::vector<uint8_t>(const std::string&, const std::string&)>;
148 
157  static void register_lookup(has_data_fn_type has_cal_data,
158  get_data_fn_type get_cal_data,
159  const source source_type = source::FLASH);
160 };
161 
162 
163 }}} // namespace uhd::usrp::cal
Definition: database.hpp:68
static void register_lookup(has_data_fn_type has_cal_data, get_data_fn_type get_cal_data, const source source_type=source::FLASH)
Register a lookup function for cal data.
static bool has_cal_data(const std::string &key, const std::string &serial, const source source_type=source::ANY)
Check if calibration data exists for a given source type.
static std::vector< uint8_t > read_cal_data(const std::string &key, const std::string &serial, const source source_type=source::ANY)
Return a calibration data set as a serialized string.
std::function< std::vector< uint8_t >(const std::string &, const std::string &)> get_data_fn_type
Function type to return serialized cal data key and serial.
Definition: database.hpp:147
std::function< bool(const std::string &, const std::string &)> has_data_fn_type
Function type to look up if there is cal data given a key and serial.
Definition: database.hpp:138
static void write_cal_data(const std::string &key, const std::string &serial, const std::vector< uint8_t > &cal_data, const std::string &backup_ext="")
Store calibration data to the local filesystem database.
#define UHD_API
Definition: config.h:87
source
Identify the source of calibration data, i.e., where was it stored.
Definition: database.hpp:23
@ FLASH
Stored on device flash memory, e.g. EEPROM.
@ USER
Provided by the user.
@ RC
Internal Resource Compiler (i.e., hard-coded within UHD)
@ FILESYSTEM
Stored on the local filesystem.
@ ANY
Undefined source.
@ NONE
No calibration data available.
Definition: build_info.hpp:12