Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

381 lines
9.8 KiB

  1. #include "stdafx.h"
  2. #include "misccell.h"
  3. using namespace std;
  4. string CBDAMiscellaneous::m_FECMethodString[] = {
  5. "METHOD_NOT_SET",
  6. "METHOD_NOT_DEFINED",
  7. "VITERBI", // FEC is a Viterbi Binary Convolution.
  8. "RS_204_188", // The FEC is Reed-Solomon 204/188 (outer FEC).
  9. "MAX"
  10. };
  11. string CBDAMiscellaneous::m_BinaryConvolutionCodeRateString[] = {
  12. "NOT_SET",
  13. "NOT_DEFINED",
  14. "1/2",
  15. "2/3",
  16. "3/4",
  17. "3/5",
  18. "4/5",
  19. "5/6",
  20. "5/11",
  21. "7/8",
  22. "BDA_BCC_RATE_MAX"
  23. };
  24. string CBDAMiscellaneous::m_ModulationTypeString[] = {
  25. "NOT_SET",
  26. "NOT_DEFINED",
  27. "16QAM",
  28. "32QAM",
  29. "64QAM",
  30. "80QAM",
  31. "96QAM",
  32. "112QAM",
  33. "128QAM",
  34. "160QAM",
  35. "192QAM",
  36. "224QAM",
  37. "256QAM",
  38. "320QAM",
  39. "384QAM",
  40. "448QAM",
  41. "512QAM",
  42. "640QAM",
  43. "768QAM",
  44. "896QAM",
  45. "1024QAM",
  46. "QPSK",
  47. "BPSK",
  48. "OQPSK",
  49. "8VSB",
  50. "16VSB",
  51. "ANALOG_AMPLITUDE",
  52. "ANALOG_FREQUENCY",
  53. "MAX"
  54. } ;
  55. string CBDAMiscellaneous::m_TunerInputTypeString[] = {
  56. "TunerInputCable",
  57. "TunerInputAntenna"
  58. };
  59. string CBDAMiscellaneous::m_PolarisationString[] = {
  60. "NOT_SET",
  61. "NOT_DEFINED",
  62. "LINEAR_H",
  63. "LINEAR_V",
  64. "CIRCULAR_L",
  65. "CIRCULAR_R",
  66. "MAX"
  67. };
  68. string CBDAMiscellaneous::m_SpectralInversionString[] = {
  69. "NOT_SET",// = -1,
  70. "NOT_DEFINED",// = 0,
  71. "AUTOMATIC",// = 1,
  72. "NORMAL",
  73. "INVERTED",
  74. "MAX"
  75. };
  76. //and the values
  77. FECMethod CBDAMiscellaneous::m_FECMethodValues [] = {
  78. BDA_FEC_METHOD_NOT_SET,// = -1,
  79. BDA_FEC_METHOD_NOT_DEFINED,// = 0,
  80. BDA_FEC_VITERBI,// = 1, // FEC is a Viterbi Binary Convolution.
  81. BDA_FEC_RS_204_188,//The FEC is Reed-Solomon 204/188 (outer FEC).
  82. BDA_FEC_MAX
  83. };
  84. BinaryConvolutionCodeRate CBDAMiscellaneous::m_BinaryConvolutionCodeRateValues[] = {
  85. BDA_BCC_RATE_NOT_SET,// = -1,
  86. BDA_BCC_RATE_NOT_DEFINED,// = 0,
  87. BDA_BCC_RATE_1_2,// = 1,
  88. BDA_BCC_RATE_2_3,// = 2,
  89. BDA_BCC_RATE_3_4,// = 3,
  90. BDA_BCC_RATE_3_5,// = 4,
  91. BDA_BCC_RATE_4_5,// = 5,
  92. BDA_BCC_RATE_5_6,// = 6,
  93. BDA_BCC_RATE_5_11,// = 7,
  94. BDA_BCC_RATE_7_8,// = 8,
  95. BDA_BCC_RATE_MAX// = 9
  96. };
  97. ModulationType CBDAMiscellaneous::m_ModulationTypeValues[] = {
  98. BDA_MOD_NOT_SET,// = -1,
  99. BDA_MOD_NOT_DEFINED,// = 0,
  100. BDA_MOD_16QAM,// = 1,
  101. BDA_MOD_32QAM,// = 2,
  102. BDA_MOD_64QAM,// = 3,
  103. BDA_MOD_80QAM,// = 4,
  104. BDA_MOD_96QAM,// = 5,
  105. BDA_MOD_112QAM,// = 6,
  106. BDA_MOD_128QAM,// = 7,
  107. BDA_MOD_160QAM,// = 8,
  108. BDA_MOD_192QAM,// = 9,
  109. BDA_MOD_224QAM,// = 10,
  110. BDA_MOD_256QAM,// = 11,
  111. BDA_MOD_320QAM,// = 12,
  112. BDA_MOD_384QAM,// = 13,
  113. BDA_MOD_448QAM,// = 14,
  114. BDA_MOD_512QAM,// = 15,
  115. BDA_MOD_640QAM,// = 16,
  116. BDA_MOD_768QAM,// = 17,
  117. BDA_MOD_896QAM,// = 18,
  118. BDA_MOD_1024QAM,// = 19,
  119. BDA_MOD_QPSK,// = 20,
  120. BDA_MOD_BPSK,// = 21,
  121. BDA_MOD_OQPSK,// = 22,
  122. BDA_MOD_8VSB,// = 23,
  123. BDA_MOD_16VSB,// = 24,
  124. BDA_MOD_ANALOG_AMPLITUDE,// = 25,
  125. BDA_MOD_ANALOG_FREQUENCY,// = 26,
  126. BDA_MOD_MAX// = 27
  127. };
  128. TunerInputType CBDAMiscellaneous::m_TunerInputTypeValues[] = {
  129. TunerInputCable,
  130. TunerInputAntenna
  131. };
  132. Polarisation CBDAMiscellaneous::m_PolarisationValues[] = {
  133. BDA_POLARISATION_NOT_SET,// = -1,
  134. BDA_POLARISATION_NOT_DEFINED,// = 0,
  135. BDA_POLARISATION_LINEAR_H,// = 1,
  136. BDA_POLARISATION_LINEAR_V,// = 2,
  137. BDA_POLARISATION_CIRCULAR_L,// = 3,
  138. BDA_POLARISATION_CIRCULAR_R,// = 4,
  139. BDA_POLARISATION_MAX// = 5
  140. };
  141. SpectralInversion CBDAMiscellaneous::m_SpectralInversionValues[] = {
  142. BDA_SPECTRAL_INVERSION_NOT_SET, // = -1,
  143. BDA_SPECTRAL_INVERSION_NOT_DEFINED, // = 0,
  144. BDA_SPECTRAL_INVERSION_AUTOMATIC, // = 1,
  145. BDA_SPECTRAL_INVERSION_NORMAL,
  146. BDA_SPECTRAL_INVERSION_INVERTED,
  147. BDA_SPECTRAL_INVERSION_MAX
  148. };
  149. CBDAMiscellaneous::CBDAMiscellaneous ()
  150. {
  151. //let's build the maps
  152. int nLen = sizeof (m_FECMethodValues)/sizeof (m_FECMethodValues[0]);
  153. for (int i=0;i<nLen;i++)
  154. m_FECMethodMap.insert (
  155. MAP_FECMethod::value_type (
  156. m_FECMethodString[i], m_FECMethodValues[i]
  157. )
  158. );
  159. nLen = sizeof (m_BinaryConvolutionCodeRateValues)/sizeof (m_BinaryConvolutionCodeRateValues[0]);
  160. for (i=0;i<nLen;i++)
  161. m_BinaryConvolutionCodeRateMap.insert (
  162. MAP_BinaryConvolutionCodeRate::value_type (
  163. m_BinaryConvolutionCodeRateString[i],
  164. m_BinaryConvolutionCodeRateValues[i]
  165. )
  166. );
  167. nLen = sizeof (m_ModulationTypeValues)/sizeof (m_ModulationTypeValues[0]);
  168. for (i=0;i<nLen;i++)
  169. m_ModulationTypeMap.insert (
  170. MAP_ModulationType::value_type (
  171. m_ModulationTypeString[i],
  172. m_ModulationTypeValues[i]
  173. )
  174. );
  175. nLen = sizeof (m_TunerInputTypeValues)/sizeof (m_TunerInputTypeValues[0]);
  176. for (i=0;i<nLen;i++)
  177. m_TunerInputTypeMap.insert (
  178. MAP_TunerInputType::value_type (
  179. m_TunerInputTypeString[i],
  180. m_TunerInputTypeValues[i]
  181. )
  182. );
  183. nLen = sizeof (m_PolarisationValues)/sizeof (m_PolarisationValues[0]);
  184. for (i=0;i<nLen;i++)
  185. m_PolarisationMap.insert (
  186. MAP_Polarisation::value_type (
  187. m_PolarisationString[i],
  188. m_PolarisationValues[i]
  189. )
  190. );
  191. nLen = sizeof (m_SpectralInversionValues)/sizeof (m_SpectralInversionValues[0]);
  192. for (i=0;i<nLen;i++)
  193. m_SpectralInversionMap.insert (
  194. MAP_SpectralInversion::value_type (
  195. m_SpectralInversionString[i],
  196. m_SpectralInversionValues[i]
  197. )
  198. );
  199. }
  200. CComBSTR
  201. CBDAMiscellaneous::ConvertFECMethodToString (FECMethod method)
  202. {
  203. //the map is not used for this
  204. //we're using map only for coverting from
  205. //a string to a integer representation
  206. MAP_FECMethod::iterator it;
  207. for (it = m_FECMethodMap.begin();it != m_FECMethodMap.end ();it++)
  208. {
  209. if ((*it).second == method)
  210. return (*it).first.c_str ();
  211. }
  212. ASSERT (FALSE);
  213. return _T("");
  214. }
  215. CComBSTR
  216. CBDAMiscellaneous::ConvertInnerFECRateToString (BinaryConvolutionCodeRate method)
  217. {
  218. //the map is not used for this
  219. //we're using map only for coverting from
  220. //a string to a integer representation
  221. MAP_BinaryConvolutionCodeRate::iterator it;
  222. for (it = m_BinaryConvolutionCodeRateMap.begin();it != m_BinaryConvolutionCodeRateMap.end ();it++)
  223. {
  224. if ((*it).second == method)
  225. return (*it).first.c_str ();
  226. }
  227. ASSERT (FALSE);
  228. return _T("");
  229. }
  230. CComBSTR
  231. CBDAMiscellaneous::ConvertModulationToString (ModulationType method)
  232. {
  233. //the map is not used for this
  234. //we're using map only for coverting from
  235. //a string to a integer representation
  236. MAP_ModulationType::iterator it;
  237. for (it = m_ModulationTypeMap.begin();it != m_ModulationTypeMap.end ();it++)
  238. {
  239. if ((*it).second == method)
  240. return (*it).first.c_str ();
  241. }
  242. ASSERT (FALSE);
  243. return _T("");
  244. }
  245. CComBSTR
  246. CBDAMiscellaneous::ConvertTunerInputTypeToString (TunerInputType method)
  247. {
  248. //the map is not used for this
  249. //we're using map only for coverting from
  250. //a string to a integer representation
  251. MAP_TunerInputType::iterator it;
  252. for (it = m_TunerInputTypeMap.begin();it != m_TunerInputTypeMap.end ();it++)
  253. {
  254. if ((*it).second == method)
  255. return (*it).first.c_str ();
  256. }
  257. ASSERT (FALSE);
  258. return _T("");
  259. }
  260. CComBSTR
  261. CBDAMiscellaneous::ConvertPolarisationToString (Polarisation method)
  262. {
  263. //the map is not used for this
  264. //we're using map only for coverting from
  265. //a string to a integer representation
  266. MAP_Polarisation::iterator it;
  267. for (it = m_PolarisationMap.begin();it != m_PolarisationMap.end ();it++)
  268. {
  269. if ((*it).second == method)
  270. return (*it).first.c_str ();
  271. }
  272. ASSERT (FALSE);
  273. return _T("");
  274. }
  275. CComBSTR
  276. CBDAMiscellaneous::ConvertSpectralInversionToString (SpectralInversion method)
  277. {
  278. //the map is not used for this
  279. //we're using map only for coverting from
  280. //a string to a integer representation
  281. MAP_SpectralInversion::iterator it;
  282. for (it = m_SpectralInversionMap.begin();it != m_SpectralInversionMap.end ();it++)
  283. {
  284. if ((*it).second == method)
  285. return (*it).first.c_str ();
  286. }
  287. ASSERT (FALSE);
  288. return _T("");
  289. }
  290. //and the map methods
  291. FECMethod
  292. CBDAMiscellaneous::ConvertStringToFECMethod (string str)
  293. {
  294. MAP_FECMethod::iterator it =
  295. m_FECMethodMap.find (str);
  296. ASSERT (it != m_FECMethodMap.end());
  297. if (it == m_FECMethodMap.end())
  298. return BDA_FEC_METHOD_NOT_SET;
  299. return (*it).second;
  300. }
  301. BinaryConvolutionCodeRate
  302. CBDAMiscellaneous::ConvertStringToBinConvol (string str)
  303. {
  304. MAP_BinaryConvolutionCodeRate::iterator it =
  305. m_BinaryConvolutionCodeRateMap.find (str);
  306. ASSERT (it != m_BinaryConvolutionCodeRateMap.end());
  307. if (it == m_BinaryConvolutionCodeRateMap.end())
  308. return BDA_BCC_RATE_NOT_SET;
  309. return (*it).second;
  310. }
  311. ModulationType
  312. CBDAMiscellaneous::ConvertStringToModulation (string str)
  313. {
  314. MAP_ModulationType::iterator it =
  315. m_ModulationTypeMap.find (str);
  316. ASSERT (it != m_ModulationTypeMap.end());
  317. if (it == m_ModulationTypeMap.end())
  318. return BDA_MOD_NOT_SET;
  319. return (*it).second;
  320. }
  321. TunerInputType
  322. CBDAMiscellaneous::ConvertStringToTunerInputType (string str)
  323. {
  324. MAP_TunerInputType::iterator it =
  325. m_TunerInputTypeMap.find (str);
  326. ASSERT (it != m_TunerInputTypeMap.end());
  327. if (it == m_TunerInputTypeMap.end())
  328. return TunerInputCable;
  329. return (*it).second;
  330. }
  331. Polarisation
  332. CBDAMiscellaneous::ConvertStringToPolarisation (string str)
  333. {
  334. MAP_Polarisation::iterator it =
  335. m_PolarisationMap.find (str);
  336. ASSERT (it != m_PolarisationMap.end());
  337. if (it == m_PolarisationMap.end())
  338. return BDA_POLARISATION_NOT_SET;
  339. return (*it).second;
  340. }
  341. SpectralInversion
  342. CBDAMiscellaneous::ConvertStringToSpectralInversion (string str)
  343. {
  344. MAP_SpectralInversion::iterator it =
  345. m_SpectralInversionMap.find (str);
  346. ASSERT (it != m_SpectralInversionMap.end());
  347. if (it == m_SpectralInversionMap.end())
  348. return BDA_SPECTRAL_INVERSION_NOT_SET;
  349. return (*it).second;
  350. }