10 #include <unordered_map>
34 kSingleContinuous = 1,
37 kSwitchedContinuous = 4,
49 static const size_t SN_LEN = 3;
50 static const size_t IDENTIFICATION_LEN =
sizeof(U16) +
sizeof(U8) +
sizeof(U16) + SN_LEN +
sizeof(U32);
58 static const U16 VERSION = 0x0001;
59 static const size_t DATE_LEN = 10;
60 static const size_t HEADER_LEN =
sizeof(U16) +
sizeof(U16) +
sizeof(U16) + DATE_LEN + sIdentification::IDENTIFICATION_LEN +
sizeof(U8);
65 char ROMProgrammingDate[DATE_LEN];
71 static const U16 VERSION = 0x0002;
72 static const size_t DATE_LEN = 10;
73 static const size_t HEADER_LEN =
sizeof(U16) +
sizeof(U16) +
sizeof(U16) + DATE_LEN +
sizeof(U8);
78 char ROMProgrammingDate[DATE_LEN];
84 static const size_t PARM_INFO_LEN =
sizeof(U8) +
sizeof(U16);
108 static const U32 MAX_CURVE_SIZE = 128;
109 static const U16 HANDLED_PWP_PHYSICAL_INFORMATION_VERSION = 0x0001;
115 std::vector<sPwPhysicalInformation*> pPhysInfoList;
118 typedef std::vector<sPwPhysicalInformation*>::size_type
size_type;
122 for (std::vector<sPwPhysicalInformation*>::iterator it = pPhysInfoList.begin(); it != pPhysInfoList.end(); it++)
123 (*it)->~sPwPhysicalInformation();
127 pPhysInfoList.push_back(pPwPhysInfo);
131 return pPhysInfoList.size();
135 assert(Index < pPhysInfoList.size());
136 return *(pPhysInfoList[Index]);
140 assert(Index < pPhysInfoList.size());
141 return *(pPhysInfoList[Index]);
150 : NMRTransTime_us(0), ExtNMRTransTime_us(0)
153 : NMRTransTime_us(Short_us), ExtNMRTransTime_us(Extended_us)
168 : MinFreq(0), MaxFreq(0), MinIF(0), MaxIF(0), FreqMultiplier(1), VoltageNoise(0)
171 static const U16 HANDLED_PW_FCA_PHYSICAL_INFORMATION_VERSION = 0x0001;
179 static const U16 SIZE = 3;
187 static const U16 STRUCT_VERSION = 0x0002;
202 : HeadNumber(HeadNum), PhysInfoSetIndex(PhysInfInd)
205 #define HEAD_DEF_SIZE 2
222 static const U16 HANDLED_PW_CAM_PHYSICAL_INFORMATION_VERSION = 0x0002;
229 static const U16 STRUCT_VERSION = 0x0002;
246 : B0X(32768), B0Y(32768), B0Z(32768), G0X(1), G0Y(1), G0Z(1), T0(0), CT0X(0), CT0Y(0), CT0Z(0), CTGX(0), CTGY(0), CTGZ(0)
249 static F32
RawBtoB(
const U16 & rRawB,
const U16 & rRawT,
const U16 & rB0,
const F32 & rG0,
const U16 & rT0,
const F32 & rCT0,
const F32 & rCTG)
251 I32 l_BOffsetless = (I32)rRawB - (I32)rB0;
252 I32 l_TOffsetless = (I32)rRawT - (I32)rT0;
253 F32 l_TOffsetCorrected = l_TOffsetless * rCT0;
254 F32 l_TGainCorrected = l_TOffsetless * rCTG;
255 F32 l_Gain = rG0 + l_TGainCorrected;
256 F32 l_BCorrected_T = (l_BOffsetless - l_TOffsetCorrected) * l_Gain;
257 return l_BCorrected_T;
260 static F32
Norm(
const F32 & rBx,
const F32 & rBy,
const F32 & rBz)
262 return sqrt(rBx*rBx + rBy * rBy + rBz * rBz);
265 void Calibrate(
const U16 & rRawBx,
const U16 & rRawBy,
const U16 & rRawBz,
const U16 & rRawT,
266 F32 & rBx_T, F32 & rBy_T, F32 & rBz_T, F32 & rNorm_T)
268 F32 Bx_T = RawBtoB(rRawBx, rRawT, B0X, G0X, T0, CT0X, CTGX);
269 F32 By_T = RawBtoB(rRawBy, rRawT, B0Y, G0Y, T0, CT0Y, CTGY);
270 F32 Bz_T = RawBtoB(rRawBz, rRawT, B0Z, G0Z, T0, CT0Z, CTGZ);
271 rNorm_T = Norm(Bx_T, By_T, Bz_T);
292 kManufactureInformation = 0,
293 kPwPhysicalInformation = 1,
297 kManufactureInformation = 0,
298 kMultiHeadInformation = 1,
301 kPwCamPhysicalInformation = 4,
302 kPwPhysicalInformationSet = 5
316 const std::vector<U8>::const_iterator m_beg, m_end;
326 bool l_ParseIdentification(
sIdentification & rId, std::vector<U8>::const_iterator Id_beg, std::vector<U8>::const_iterator Id_end);
327 bool l_HeaderVersion(U16 & rVersion);
330 bool l_ParseParmInfo(
size_t HeaderLen,
CParmInfoMap & rParmInfoMap);
336 Parser(std::vector<U8>::const_iterator beg, std::vector<U8>::const_iterator end)
337 : m_beg(beg), m_end(end)
343 bool ParmAddress(U8 ParmNo, U16 & rParmAddress);
348 bool ParseMultiHeadInfo(
size_t ParmAddress,
sMultiHeadInfo & rMultiHeadInfo);
349 bool ParseHeadList(
size_t ParmAddress,
tHeadList & rHeadList);
351 bool ParsePwPhysicalInfo(
size_t ParmAddress,
sPwPhysicalInformation & rPhysInfo, std::vector<U8>::const_iterator & rpBuffer);
353 bool ParsePwFcaPhysInfo(
size_t ParmAddress,
sPwFCAPhysInfo & rPhysInfo);
377 static std::vector<U8> l_Raw(
const CParmInfoMap & rParmInfo);
379 template <
typename HeaderType>
380 static std::vector<U8> l_BuildROM(HeaderType Header,
const tParmContentInfo & rParmContent);
395 static void Build1226ROM( std::vector<U8> & rOutputROM,
399 static void Build9046ROM( std::vector<U8> & rOutputROM,