Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
common
utilities
time
l500
get-mfr-ww.cpp
Go to the documentation of this file.
1
4
#include "
get-mfr-ww.h
"
5
#include <string>
6
#include <stdexcept>
7
8
9
namespace
utilities
{
10
namespace
time {
11
namespace
l500 {
12
// The Serial Number format is PYWWXXXX:
13
// P – Site Name(ex.“F” for Fabrinet)
14
// Y – Year(ex.“9” for 2019, "0" for 2020, , "1" for 2021 ..etc)
15
// WW – Work Week
16
// XXXX – Sequential number
17
utilities::time::work_week
get_manufacture_work_week
(
const
std::string
& serial )
18
{
19
if
( serial.size() != 8 )
20
throw
std::runtime_error(
"Invalid serial number \""
+ serial +
"\" length"
);
21
unsigned
Y
= serial[1] -
'0'
;
// Converts char to int, '0'-> 0, '1'-> 1, ...
22
unsigned
man_year = 0;
23
// using Y from serial number to get manufactoring year
24
if
( Y == 9 )
25
man_year = 2019;
26
else
if
( Y < 9 )
27
man_year = 2020 +
Y
;
28
else
29
throw
std::runtime_error(
"Invalid serial number \""
+ serial +
"\" year"
);
30
// using WW from serial number to get manufactoring work week
31
unsigned
WW_tens = serial[2] -
'0'
;
32
unsigned
WW_singles = serial[3] -
'0'
;
33
unsigned
man_ww = ( (WW_tens)*10 ) + WW_singles;
34
if
(man_ww > 53)
35
throw
std::runtime_error(
"Invalid serial number \""
+ serial +
"\" work week"
);
36
return
utilities::time::work_week
( man_year, man_ww );
37
}
38
39
}
// namespace l500
40
}
// namespace time
41
}
// namespace utilities
utilities::time::l500::get_manufacture_work_week
utilities::time::work_week get_manufacture_work_week(const std::string &serial)
Definition:
get-mfr-ww.cpp:17
string
GLsizei const GLchar *const * string
Definition:
glad/glad/glad.h:2862
utilities::time::work_week
Definition:
work_week.h:21
rmse.Y
list Y
Definition:
rmse.py:132
get-mfr-ww.h
utilities
Definition:
wrap.cpp:11
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:47:15