aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/utils/serial_number.hpp
blob: 230f9657d893f62705760bdd75b83e41887a669e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// Copyright 2020 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//

#ifndef INCLUDED_UHDLIB_UTILS_SERIAL_NUMBER_HPP
#    define INCLUDED_UHDLIB_UTILS_SERIAL_NUMBER_HPP

#include <string>

namespace uhd { namespace utils {

/*! Convenience function to determine whether two serial numbers refer to the
 * same device. Serial numbers are case-insensitive and ignore leading zeros,
 * so e.g. the strings "0123abcd" and "123ABCD" are considered the same serial
 * number.
 *
 * Serial numbers cannot be longer than 8 characters or have characters outside
 * the range 0-9a-fA-F.
 *
 * \param serial_a The first serial number to compare
 * \param serial_b The second serial number to compare
 */
bool serial_numbers_match(const std::string& serial_a, const std::string& serial_b);

}}

#endif /* INCLUDED_UHDLIB_UTILS_SERIAL_NUMBER_HPP */