]> git.pld-linux.org Git - packages/openhpi.git/blame - openhpi-c++.patch
- updated types patch
[packages/openhpi.git] / openhpi-c++.patch
CommitLineData
36332100
JB
1--- openhpi-2.10.1/cpp/Makefile.am.orig 2007-11-03 23:02:21.142967000 +0100
2+++ openhpi-2.10.1/cpp/Makefile.am 2007-11-04 00:08:36.009482630 +0100
3@@ -75,7 +75,7 @@
4 oSaHpiWatchdogRec.hpp \
5 oSaHpi.hpp
6
7-pkglib_LTLIBRARIES = libosahpi.la
8+lib_LTLIBRARIES = libosahpi.la
9
10 libosahpi_la_LIBADD = -luuid
11 libosahpi_la_SOURCES = oSaHpiAlarm.cpp oSaHpiAlarm.hpp \
12@@ -115,7 +115,7 @@
13 oSaHpiResourceInfo.cpp oSaHpiResourceInfo.hpp \
14 oSaHpiRptEntry.cpp oSaHpiRptEntry.hpp \
15 oSaHpiSensorDataFormat.cpp oSaHpiSensorDataFormat.hpp \
16- oSaHpiSensorEnableChangeEvent.cpp
17+ oSaHpiSensorEnableChangeEvent.cpp \
18 oSaHpiSensorEnableChangeEvent.hpp \
19 oSaHpiSensorEvent.cpp oSaHpiSensorEvent.hpp \
20 oSaHpiSensorRange.cpp oSaHpiSensorRange.hpp \
21--- openhpi-2.10.1/cpp/oSaHpiSensorEvent.cpp.orig 1970-01-01 01:00:00.000000000 +0100
22+++ openhpi-2.10.1/cpp/oSaHpiSensorEvent.cpp 2007-11-04 00:10:30.376000007 +0100
23@@ -0,0 +1,268 @@
24+/* -*- linux-c -*-
25+ *
26+ * (C) Copyright IBM Corp. 2005
27+ *
28+ * This program is distributed in the hope that it will be useful,
29+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
30+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
31+ * file and program are licensed under a BSD style license. See
32+ * the Copying file included with the OpenHPI distribution for
33+ * full licensing terms.
34+ *
35+ * Author(s):
36+ * W. David Ashley <dashley@us.ibm.com>
37+ */
38+
39+
40+#include <stdlib.h>
41+#include <string.h>
42+#include <stdio.h>
43+extern "C"
44+{
45+#include <SaHpi.h>
46+}
47+#include "oSaHpiTypesEnums.hpp"
48+#include "oSaHpiSensorReading.hpp"
49+#include "oSaHpiSensorEvent.hpp"
50+
51+
52+/**
53+ * Default constructor.
54+ */
55+oSaHpiSensorEvent::oSaHpiSensorEvent() {
56+ oSaHpiSensorReading *sr;
57+
58+ SensorNum = 1;
59+ SensorType = SAHPI_TEMPERATURE;
60+ EventCategory = SAHPI_EC_UNSPECIFIED;
61+ Assertion = false;
62+ EventState = SAHPI_ES_UNSPECIFIED;
63+ OptionalDataPresent = (SaHpiSensorOptionalDataT)0;
64+ sr = (oSaHpiSensorReading *)&TriggerReading;
65+ sr->initSensorReading(sr);
66+ sr = (oSaHpiSensorReading *)&TriggerThreshold;
67+ sr->initSensorReading(sr);
68+ PreviousState = SAHPI_ES_UNSPECIFIED;
69+ CurrentState = SAHPI_ES_UNSPECIFIED;
70+ Oem = 0;
71+ SensorSpecific = 0;
72+};
73+
74+
75+/**
76+ * Constructor.
77+ *
78+ * @param buf The reference to the class to be copied.
79+ */
80+oSaHpiSensorEvent::oSaHpiSensorEvent(const oSaHpiSensorEvent& range) {
81+ memcpy(this, &range, sizeof(SaHpiSensorEventT));
82+}
83+
84+
85+/**
86+ * Assign a field in the SaHpiSensorEventT struct a value.
87+ *
88+ * @param field The pointer to the struct (class).
89+ * @param field The field name as a text string (case sensitive).
90+ * @param value The character string value to be assigned to the field. This
91+ * value will be converted as necessary.
92+ *
93+ * @return True if there was an error, otherwise false.
94+ */
95+bool oSaHpiSensorEvent::assignField(SaHpiSensorEventT *ptr,
96+ const char *field,
97+ const char *value) {
98+ if (ptr == NULL || field == NULL || value == NULL) {
99+ return true;
100+ }
101+ if (strcmp(field, "SensorNum") == 0) {
102+ ptr->SensorNum = strtoul(value, NULL, 10);
103+ return false;
104+ }
105+ else if (strcmp(field, "SensorType") == 0) {
106+ ptr->SensorType = oSaHpiTypesEnums::str2sensortype(value);
107+ return false;
108+ }
109+ else if (strcmp(field, "EventCategory") == 0) {
110+ ptr->EventCategory |= oSaHpiTypesEnums::str2eventcategory(value);
111+ return false;
112+ }
113+ else if (strcmp(field, "Assertion") == 0) {
114+ ptr->Assertion = oSaHpiTypesEnums::str2torf(value);
115+ return false;
116+ }
117+ else if (strcmp(field, "EventState") == 0) {
118+ ptr->EventState |= oSaHpiTypesEnums::str2eventstate(value);
119+ return false;
120+ }
121+ else if (strcmp(field, "OptionalDataPresent") == 0) {
122+ ptr->OptionalDataPresent |= oSaHpiTypesEnums::str2sensoroptionaldata(value);
123+ return false;
124+ }
125+ // TriggerReading
126+ // TriggerThreshold
127+ else if (strcmp(field, "PreviousState") == 0) {
128+ ptr->PreviousState |= oSaHpiTypesEnums::str2eventstate(value);
129+ return false;
130+ }
131+ else if (strcmp(field, "CurrentState") == 0) {
132+ ptr->CurrentState |= oSaHpiTypesEnums::str2eventstate(value);
133+ return false;
134+ }
135+ else if (strcmp(field, "Oem") == 0) {
136+ ptr->Oem = strtoul(value, NULL, 10);
137+ return false;
138+ }
139+ else if (strcmp(field, "SensorSpecific") == 0) {
140+ ptr->SensorSpecific = strtoul(value, NULL, 10);
141+ return false;
142+ }
143+ return true;
144+};
145+
146+
147+/**
148+ * Print the contents of the entity.
149+ *
150+ * @param stream Target stream.
151+ * @param buffer Address of the SaHpiSensorEventT struct.
152+ *
153+ * @return True if there was an error, otherwise false.
154+ */
155+bool oSaHpiSensorEvent::fprint(FILE *stream,
156+ const int indent,
157+ const SaHpiSensorEventT *se) {
158+ int i, err = 0;
159+ char indent_buf[indent + 1];
160+ const SaHpiSensorReadingT *sr;
161+
162+ if (stream == NULL || se == NULL) {
163+ return true;
164+ }
165+ for (i = 0; i < indent; i++) {
166+ indent_buf[i] = ' ';
167+ }
168+ indent_buf[indent] = '\0';
169+
170+ err = fprintf(stream, "%s", indent_buf);
171+ if (err < 0) {
172+ return true;
173+ }
174+ err = fprintf(stream, "SensorNum = %u\n", se->SensorNum);
175+ if (err < 0) {
176+ return true;
177+ }
178+ err = fprintf(stream, "%s", indent_buf);
179+ if (err < 0) {
180+ return true;
181+ }
182+ err = fprintf(stream, "SensorType = %s\n", oSaHpiTypesEnums::sensortype2str(se->SensorType));
183+ if (err < 0) {
184+ return true;
185+ }
186+ err = fprintf(stream, "%s", indent_buf);
187+ if (err < 0) {
188+ return true;
189+ }
190+ err = fprintf(stream, "EventCategory = %X\n", se->EventCategory);
191+ if (err < 0) {
192+ return true;
193+ }
194+ err = fprintf(stream, "%s", indent_buf);
195+ if (err < 0) {
196+ return true;
197+ }
198+ err = fprintf(stream, "Assertion = %s\n", oSaHpiTypesEnums::torf2str(se->Assertion));
199+ if (err < 0) {
200+ return true;
201+ }
202+ err = fprintf(stream, "%s", indent_buf);
203+ if (err < 0) {
204+ return true;
205+ }
206+ err = fprintf(stream, "EventState = %X\n", se->EventState);
207+ if (err < 0) {
208+ return true;
209+ }
210+ err = fprintf(stream, "%s", indent_buf);
211+ if (err < 0) {
212+ return true;
213+ }
214+ err = fprintf(stream, "OptionalDataPresent = %X\n", se->OptionalDataPresent);
215+ if (err < 0) {
216+ return true;
217+ }
218+ if (se->OptionalDataPresent && SAHPI_SOD_TRIGGER_READING) {
219+ err = fprintf(stream, "%s", indent_buf);
220+ if (err < 0) {
221+ return true;
222+ }
223+ err = fprintf(stream, "TriggerReading\n");
224+ if (err < 0) {
225+ return true;
226+ }
227+ sr = (const SaHpiSensorReadingT *)&se->TriggerReading;
228+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
229+ if (err < 0) {
230+ return true;
231+ }
232+ }
233+ if (se->OptionalDataPresent && SAHPI_SOD_TRIGGER_THRESHOLD) {
234+ err = fprintf(stream, "%s", indent_buf);
235+ if (err < 0) {
236+ return true;
237+ }
238+ err = fprintf(stream, "TriggerThreshold\n");
239+ if (err < 0) {
240+ return true;
241+ }
242+ sr = (const SaHpiSensorReadingT *)&se->TriggerThreshold;
243+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
244+ if (err < 0) {
245+ return true;
246+ }
247+ }
248+ if (se->OptionalDataPresent && SAHPI_SOD_PREVIOUS_STATE) {
249+ err = fprintf(stream, "%s", indent_buf);
250+ if (err < 0) {
251+ return true;
252+ }
253+ err = fprintf(stream, "PreviousState = %X\n", se->PreviousState);
254+ if (err < 0) {
255+ return true;
256+ }
257+ }
258+ if (se->OptionalDataPresent && SAHPI_SOD_CURRENT_STATE) {
259+ err = fprintf(stream, "%s", indent_buf);
260+ if (err < 0) {
261+ return true;
262+ }
263+ err = fprintf(stream, "CurrentState = %X\n", se->CurrentState);
264+ if (err < 0) {
265+ return true;
266+ }
267+ }
268+ if (se->OptionalDataPresent && SAHPI_SOD_OEM) {
269+ err = fprintf(stream, "%s", indent_buf);
270+ if (err < 0) {
271+ return true;
272+ }
273+ err = fprintf(stream, "Oem = %u\n", se->Oem);
274+ if (err < 0) {
275+ return true;
276+ }
277+ }
278+ if (se->OptionalDataPresent && SAHPI_SOD_SENSOR_SPECIFIC) {
279+ err = fprintf(stream, "%s", indent_buf);
280+ if (err < 0) {
281+ return true;
282+ }
283+ err = fprintf(stream, "SensorSpecific = %u\n", se->SensorSpecific);
284+ if (err < 0) {
285+ return true;
286+ }
287+ }
288+
289+ return false;
290+}
291+
292--- openhpi-2.10.1/cpp/oSaHpiSensorRange.cpp.orig 1970-01-01 01:00:00.000000000 +0100
293+++ openhpi-2.10.1/cpp/oSaHpiSensorRange.cpp 2007-11-04 00:10:30.376000007 +0100
294@@ -0,0 +1,181 @@
295+/* -*- linux-c -*-
296+ *
297+ * (C) Copyright IBM Corp. 2005
298+ *
299+ * This program is distributed in the hope that it will be useful,
300+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
301+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
302+ * file and program are licensed under a BSD style license. See
303+ * the Copying file included with the OpenHPI distribution for
304+ * full licensing terms.
305+ *
306+ * Author(s):
307+ * W. David Ashley <dashley@us.ibm.com>
308+ */
309+
310+
311+#include <stdlib.h>
312+#include <string.h>
313+#include <stdio.h>
314+extern "C"
315+{
316+#include <SaHpi.h>
317+}
318+#include "oSaHpiSensorReading.hpp"
319+#include "oSaHpiSensorRange.hpp"
320+
321+
322+/**
323+ * Default constructor.
324+ */
325+oSaHpiSensorRange::oSaHpiSensorRange() {
326+ oSaHpiSensorReading *sr;
327+
328+ Flags = 0;
329+ sr = (oSaHpiSensorReading *)&Max;
330+ sr->initSensorReading(sr);
331+ sr = (oSaHpiSensorReading *)&Min;
332+ sr->initSensorReading(sr);
333+ sr = (oSaHpiSensorReading *)&Nominal;
334+ sr->initSensorReading(sr);
335+ sr = (oSaHpiSensorReading *)&NormalMax;
336+ sr->initSensorReading(sr);
337+ sr = (oSaHpiSensorReading *)&NormalMin;
338+ sr->initSensorReading(sr);
339+};
340+
341+
342+/**
343+ * Constructor.
344+ *
345+ * @param buf The reference to the class to be copied.
346+ */
347+oSaHpiSensorRange::oSaHpiSensorRange(const oSaHpiSensorRange& range) {
348+ memcpy(this, &range, sizeof(SaHpiSensorRangeT));
349+}
350+
351+
352+/**
353+ * Assign a field in the SaHpiSensorRangeT struct a value.
354+ *
355+ * @param field The pointer to the struct (class).
356+ * @param field The field name as a text string (case sensitive).
357+ * @param value The character string value to be assigned to the field. This
358+ * value will be converted as necessary.
359+ *
360+ * @return True if there was an error, otherwise false.
361+ */
362+bool oSaHpiSensorRange::assignField(SaHpiSensorRangeT *ptr,
363+ const char *field,
364+ const char *value) {
365+ if (ptr == NULL || field == NULL || value == NULL) {
366+ return true;
367+ }
368+ if (strcmp(field, "Flags") == 0) {
369+ ptr->Flags |= (SaHpiSensorRangeFlagsT)atoi(value);
370+ return false;
371+ }
372+ return true;
373+};
374+
375+
376+/**
377+ * Print the contents of the entity.
378+ *
379+ * @param stream Target stream.
380+ * @param buffer Address of the SaHpiSensorReadingT struct.
381+ *
382+ * @return True if there was an error, otherwise false.
383+ */
384+bool oSaHpiSensorRange::fprint(FILE *stream,
385+ const int indent,
386+ const SaHpiSensorRangeT *rg) {
387+ int i, err = 0;
388+ char indent_buf[indent + 1];
389+ const SaHpiSensorReadingT *sr;
390+
391+ if (stream == NULL || rg == NULL) {
392+ return true;
393+ }
394+ for (i = 0; i < indent; i++) {
395+ indent_buf[i] = ' ';
396+ }
397+ indent_buf[indent] = '\0';
398+
399+ err = fprintf(stream, "%s", indent_buf);
400+ if (err < 0) {
401+ return true;
402+ }
403+ err = fprintf(stream, "Flags = %X\n", rg->Flags);
404+ if (err < 0) {
405+ return true;
406+ }
407+ err = fprintf(stream, "%s", indent_buf);
408+ if (err < 0) {
409+ return true;
410+ }
411+ err = fprintf(stream, "Max\n");
412+ if (err < 0) {
413+ return true;
414+ }
415+ sr = (const SaHpiSensorReadingT *)&rg->Max;
416+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
417+ if (err < 0) {
418+ return true;
419+ }
420+ err = fprintf(stream, "%s", indent_buf);
421+ if (err < 0) {
422+ return true;
423+ }
424+ err = fprintf(stream, "Min\n");
425+ if (err < 0) {
426+ return true;
427+ }
428+ sr = (const SaHpiSensorReadingT *)&rg->Min;
429+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
430+ if (err < 0) {
431+ return true;
432+ }
433+ err = fprintf(stream, "%s", indent_buf);
434+ if (err < 0) {
435+ return true;
436+ }
437+ err = fprintf(stream, "Nominal\n");
438+ if (err < 0) {
439+ return true;
440+ }
441+ sr = (const SaHpiSensorReadingT *)&rg->Nominal;
442+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
443+ if (err < 0) {
444+ return true;
445+ }
446+ err = fprintf(stream, "%s", indent_buf);
447+ if (err < 0) {
448+ return true;
449+ }
450+ err = fprintf(stream, "NormalMax\n");
451+ if (err < 0) {
452+ return true;
453+ }
454+ sr = (const SaHpiSensorReadingT *)&rg->NormalMax;
455+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
456+ if (err < 0) {
457+ return true;
458+ }
459+ err = fprintf(stream, "%s", indent_buf);
460+ if (err < 0) {
461+ return true;
462+ }
463+ err = fprintf(stream, "NormalMin\n");
464+ if (err < 0) {
465+ return true;
466+ }
467+ sr = (const SaHpiSensorReadingT *)&rg->NormalMin;
468+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
469+ if (err < 0) {
470+ return true;
471+ }
472+
473+ return false;
474+}
475+
476--- openhpi-2.10.1/cpp/oSaHpiSensorReading.cpp.orig 1970-01-01 01:00:00.000000000 +0100
477+++ openhpi-2.10.1/cpp/oSaHpiSensorReading.cpp 2007-11-04 00:10:30.380000235 +0100
478@@ -0,0 +1,181 @@
479+/* -*- linux-c -*-
480+ *
481+ * (C) Copyright IBM Corp. 2005
482+ *
483+ * This program is distributed in the hope that it will be useful,
484+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
485+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
486+ * file and program are licensed under a BSD style license. See
487+ * the Copying file included with the OpenHPI distribution for
488+ * full licensing terms.
489+ *
490+ * Author(s):
491+ * W. David Ashley <dashley@us.ibm.com>
492+ */
493+
494+
495+#include <stdlib.h>
496+#include <string.h>
497+#include <stdio.h>
498+extern "C"
499+{
500+#include <SaHpi.h>
501+}
502+#include "oSaHpiTypesEnums.hpp"
503+#include "oSaHpiSensorReading.hpp"
504+
505+
506+/**
507+ * Default constructor.
508+ */
509+oSaHpiSensorReading::oSaHpiSensorReading() {
510+ initSensorReading(this);
511+};
512+
513+
514+/**
515+ * Constructor.
516+ *
517+ * @param buf The reference to the class to be copied.
518+ */
519+oSaHpiSensorReading::oSaHpiSensorReading(const oSaHpiSensorReading& ent) {
520+ memcpy(this, &ent, sizeof(SaHpiSensorReadingT));
521+}
522+
523+
524+/**
525+ * Assign a field in the SaHpiSensorReadingT struct a value.
526+ *
527+ * @param field The pointer to the struct (class).
528+ * @param field The field name as a text string (case sensitive).
529+ * @param value The character string value to be assigned to the field. This
530+ * value will be converted as necessary.
531+ *
532+ * @return True if there was an error, otherwise false.
533+ */
534+bool oSaHpiSensorReading::assignField(SaHpiSensorReadingT *ptr,
535+ const char *field,
536+ const char *value) {
537+ if (ptr == NULL || field == NULL || value == NULL) {
538+ return true;
539+ }
540+ if (strcmp(field, "IsSupported") == 0) {
541+ ptr->IsSupported = oSaHpiTypesEnums::str2torf(value);
542+ return false;
543+ }
544+ else if (strcmp(field, "Type") == 0) {
545+ ptr->Type = oSaHpiTypesEnums::str2sensorreadingtype(value);
546+ return false;
547+ }
548+ else if (strcmp(field, "SensorInt64") == 0) {
549+ ptr->Value.SensorInt64 = (SaHpiInt64T)strtoll(value, NULL, 10);
550+ return false;
551+ }
552+ else if (strcmp(field, "SensorUint64") == 0) {
553+ ptr->Value.SensorUint64 = (SaHpiUint64T)strtoull(value, NULL, 10);
554+ return false;
555+ }
556+ else if (strcmp(field, "SensorFloat64") == 0) {
557+ ptr->Value.SensorFloat64 = (SaHpiFloat64T)strtod(value, NULL);
558+ return false;
559+ }
560+ else if (strcmp(field, "SensorBuffer") == 0) {
561+ memset(ptr->Value.SensorBuffer, 0, SAHPI_SENSOR_BUFFER_LENGTH);
562+ memcpy(ptr->Value.SensorBuffer, value, strlen(value));
563+ return false;
564+ }
565+ return true;
566+};
567+
568+
569+/**
570+ * Print the contents of the entity.
571+ *
572+ * @param stream Target stream.
573+ * @param buffer Address of the SaHpiSensorReadingT struct.
574+ *
575+ * @return True if there was an error, otherwise false.
576+ */
577+bool oSaHpiSensorReading::fprint(FILE *stream,
578+ const int indent,
579+ const SaHpiSensorReadingT *sr) {
580+ int i, err = 0;
581+ char indent_buf[indent + 1];
582+
583+ if (stream == NULL || sr == NULL) {
584+ return true;
585+ }
586+ for (i = 0; i < indent; i++) {
587+ indent_buf[i] = ' ';
588+ }
589+ indent_buf[indent] = '\0';
590+
591+ err = fprintf(stream, "%s", indent_buf);
592+ if (err < 0) {
593+ return true;
594+ }
595+ err = fprintf(stream, "IsSupported = %s\n", oSaHpiTypesEnums::torf2str(sr->IsSupported));
596+ if (err < 0) {
597+ return true;
598+ }
599+ err = fprintf(stream, "%s", indent_buf);
600+ if (err < 0) {
601+ return true;
602+ }
603+ switch (sr->Type) {
604+ case SAHPI_SENSOR_READING_TYPE_INT64:
605+ err = fprintf(stream, "Value.SensorInt64 = %lld\n", sr->Value.SensorInt64);
606+ if (err < 0) {
607+ return true;
608+ }
609+ break;
610+ case SAHPI_SENSOR_READING_TYPE_UINT64:
611+ err = fprintf(stream, "Value.SensorUint64 = %llu\n", sr->Value.SensorUint64);
612+ if (err < 0) {
613+ return true;
614+ }
615+ break;
616+ case SAHPI_SENSOR_READING_TYPE_FLOAT64:
617+ err = fprintf(stream, "Value.SensorFloat64 = %f\n", sr->Value.SensorFloat64);
618+ if (err < 0) {
619+ return true;
620+ }
621+ break;
622+ case SAHPI_SENSOR_READING_TYPE_BUFFER:
623+ err = fprintf(stream, "Value.SensorBuffer = %s\n", sr->Value.SensorBuffer);
624+ if (err < 0) {
625+ return true;
626+ }
627+ break;
628+ default:
629+ err = fprintf(stream, "Value = Unknown\n");
630+ if (err < 0) {
631+ return true;
632+ }
633+ break;
634+ }
635+
636+ return false;
637+}
638+
639+
640+void oSaHpiSensorReading::initSensorReading(SaHpiSensorReadingT *reading) {
641+ reading->IsSupported = ISSUPPORTED_DEFAULT;
642+ reading->Type = SAHPISENSORREADINGTYPET_DEFAULT;
643+ switch (reading->Type) {
644+ case SAHPI_SENSOR_READING_TYPE_INT64:
645+ reading->Value.SensorInt64 = 0;
646+ break;
647+ case SAHPI_SENSOR_READING_TYPE_UINT64:
648+ reading->Value.SensorUint64 = 0;
649+ break;
650+ case SAHPI_SENSOR_READING_TYPE_FLOAT64:
651+ reading->Value.SensorFloat64 = 0;
652+ break;
653+ case SAHPI_SENSOR_READING_TYPE_BUFFER:
654+ default:
655+ memset(&reading->Value.SensorBuffer, 0, sizeof(SAHPI_SENSOR_BUFFER_LENGTH));
656+ break;
657+ }
658+}
659+
660--- openhpi-2.10.1/cpp/oSaHpiSensorRec.cpp.orig 1970-01-01 01:00:00.000000000 +0100
661+++ openhpi-2.10.1/cpp/oSaHpiSensorRec.cpp 2007-11-04 00:10:30.380000235 +0100
662@@ -0,0 +1,238 @@
663+/* -*- linux-c -*-
664+ *
665+ * (C) Copyright IBM Corp. 2005
666+ *
667+ * This program is distributed in the hope that it will be useful,
668+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
669+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
670+ * file and program are licensed under a BSD style license. See
671+ * the Copying file included with the OpenHPI distribution for
672+ * full licensing terms.
673+ *
674+ * Author(s):
675+ * W. David Ashley <dashley@us.ibm.com>
676+ */
677+
678+
679+#include <stdlib.h>
680+#include <string.h>
681+#include <stdio.h>
682+extern "C"
683+{
684+#include <SaHpi.h>
685+}
686+#include "oSaHpiTypesEnums.hpp"
687+#include "oSaHpiSensorDataFormat.hpp"
688+#include "oSaHpiSensorThdDefn.hpp"
689+#include "oSaHpiSensorRec.hpp"
690+
691+
692+/**
693+ * Default constructor.
694+ */
695+oSaHpiSensorRec::oSaHpiSensorRec() {
696+ oSaHpiSensorReading *sr;
697+
698+ Num = 0;
699+ Type = SAHPI_TEMPERATURE;
700+ Category = 0;
701+ EnableCtrl = false;
702+ EventCtrl = SAHPI_SEC_PER_EVENT;
703+ Events = 0;
704+ DataFormat.IsSupported = 0;
705+ DataFormat.ReadingType = SAHPI_SENSOR_READING_TYPE_INT64;
706+ DataFormat.BaseUnits = SAHPI_SU_UNSPECIFIED;
707+ DataFormat.ModifierUnits = SAHPI_SU_UNSPECIFIED;
708+ DataFormat.ModifierUse = SAHPI_SMUU_NONE;
709+ DataFormat.Percentage = false;
710+ DataFormat.Range.Flags = 0;
711+ sr = (oSaHpiSensorReading *)&DataFormat.Range.Max;
712+ sr->initSensorReading(sr);
713+ sr = (oSaHpiSensorReading *)&DataFormat.Range.Min;
714+ sr->initSensorReading(sr);
715+ sr = (oSaHpiSensorReading *)&DataFormat.Range.Nominal;
716+ sr->initSensorReading(sr);
717+ sr = (oSaHpiSensorReading *)&DataFormat.Range.NormalMax;
718+ sr->initSensorReading(sr);
719+ sr = (oSaHpiSensorReading *)&DataFormat.Range.NormalMin;
720+ sr->initSensorReading(sr);
721+ DataFormat.AccuracyFactor = 0;
722+ // thd defn
723+ ThresholdDefn.IsAccessible = false;
724+ ThresholdDefn.ReadThold = 0;
725+ ThresholdDefn.WriteThold = 0;
726+ ThresholdDefn.Nonlinear = false;
727+ Oem = 0;
728+};
729+
730+
731+/**
732+ * Constructor.
733+ *
734+ * @param buf The reference to the class to be copied.
735+ */
736+oSaHpiSensorRec::oSaHpiSensorRec(const oSaHpiSensorRec& sr) {
737+ memcpy(this, &sr, sizeof(SaHpiSensorRecT));
738+}
739+
740+
741+/**
742+ * Assign a field in the SaHpiSensorRecT struct a value.
743+ *
744+ * @param field The pointer to the struct (class).
745+ * @param field The field name as a text string (case sensitive).
746+ * @param value The character string value to be assigned to the field. This
747+ * value will be converted as necessary.
748+ *
749+ * @return True if there was an error, otherwise false.
750+ */
751+bool oSaHpiSensorRec::assignField(SaHpiSensorRecT *ptr,
752+ const char *field,
753+ const char *value) {
754+ if (ptr == NULL || field == NULL || value == NULL) {
755+ return true;
756+ }
757+ if (strcmp(field, "Num") == 0) {
758+ ptr->Num = strtoul(value, NULL, 10);
759+ return false;
760+ }
761+ else if (strcmp(field, "Type") == 0) {
762+ ptr->Type = oSaHpiTypesEnums::str2sensortype(value);
763+ return false;
764+ }
765+ else if (strcmp(field, "Category") == 0) {
766+ ptr->Category |= oSaHpiTypesEnums::str2eventcategory(value);
767+ return false;
768+ }
769+ else if (strcmp(field, "EnableCtrl") == 0) {
770+ ptr->EnableCtrl = oSaHpiTypesEnums::str2torf(value);
771+ return false;
772+ }
773+ else if (strcmp(field, "EventCtrl") == 0) {
774+ ptr->EventCtrl = oSaHpiTypesEnums::str2sensoreventctrl(value);
775+ return false;
776+ }
777+ else if (strcmp(field, "Events") == 0) {
778+ ptr->Events |= oSaHpiTypesEnums::str2eventstate(value);
779+ return false;
780+ }
781+ // DataFormat
782+ // ThresholdDefn
783+ else if (strcmp(field, "Oem") == 0) {
784+ ptr->Oem = strtoul(value, NULL, 10);
785+ return false;
786+ }
787+ return true;
788+};
789+
790+
791+/**
792+ * Print the contents of the entity.
793+ *
794+ * @param stream Target stream.
795+ * @param buffer Address of the SaHpiSensorRecT struct.
796+ *
797+ * @return True if there was an error, otherwise false.
798+ */
799+bool oSaHpiSensorRec::fprint(FILE *stream,
800+ const int indent,
801+ const SaHpiSensorRecT *sr) {
802+ int i, err = 0;
803+ char indent_buf[indent + 1];
804+ const SaHpiSensorDataFormatT *df;
805+ const SaHpiSensorThdDefnT *td;
806+
807+ if (stream == NULL) {
808+ return true;
809+ }
810+ for (i = 0; i < indent; i++) {
811+ indent_buf[i] = ' ';
812+ }
813+ indent_buf[indent] = '\0';
814+
815+ err = fprintf(stream, "%s", indent_buf);
816+ if (err < 0) {
817+ return true;
818+ }
819+ err = fprintf(stream, "Num = %d\n", sr->Num);
820+ if (err < 0) {
821+ return true;
822+ }
823+ err = fprintf(stream, "%s", indent_buf);
824+ if (err < 0) {
825+ return true;
826+ }
827+ err = fprintf(stream, "Type = %s\n", oSaHpiTypesEnums::sensortype2str(sr->Type));
828+ if (err < 0) {
829+ return true;
830+ }
831+ err = fprintf(stream, "%s", indent_buf);
832+ if (err < 0) {
833+ return true;
834+ }
835+ err = fprintf(stream, "Category = %X\n", sr->Category);
836+ if (err < 0) {
837+ return true;
838+ }
839+ err = fprintf(stream, "%s", indent_buf);
840+ if (err < 0) {
841+ return true;
842+ }
843+ err = fprintf(stream, "EnableCtrl = %s\n", oSaHpiTypesEnums::torf2str(sr->EnableCtrl));
844+ if (err < 0) {
845+ return true;
846+ }
847+ err = fprintf(stream, "%s", indent_buf);
848+ if (err < 0) {
849+ return true;
850+ }
851+ err = fprintf(stream, "EventCtrl = %s\n", oSaHpiTypesEnums::sensoreventctrl2str(sr->EventCtrl));
852+ if (err < 0) {
853+ return true;
854+ }
855+ err = fprintf(stream, "%s", indent_buf);
856+ if (err < 0) {
857+ return true;
858+ }
859+ err = fprintf(stream, "Events = %X\n", sr->Events);
860+ if (err < 0) {
861+ return true;
862+ }
863+ err = fprintf(stream, "%s", indent_buf);
864+ if (err < 0) {
865+ return true;
866+ }
867+ err = fprintf(stream, "DataFormat\n");
868+ if (err < 0) {
869+ return true;
870+ }
871+ df = (const SaHpiSensorDataFormatT *)&(sr->DataFormat);
872+ err = oSaHpiSensorDataFormat::fprint(stream, indent + 3, df);
873+ if (err < 0) {
874+ return true;
875+ }
876+ err = fprintf(stream, "%s", indent_buf);
877+ if (err < 0) {
878+ return true;
879+ }
880+ err = fprintf(stream, "ThresholdDefn\n");
881+ if (err < 0) {
882+ return true;
883+ }
884+ td = (const SaHpiSensorThdDefnT *)&(sr->ThresholdDefn);
885+ err = oSaHpiSensorThdDefn::fprint(stream, indent + 3, td);
886+ if (err < 0) {
887+ return true;
888+ }
889+ err = fprintf(stream, "%s", indent_buf);
890+ if (err < 0) {
891+ return true;
892+ }
893+ err = fprintf(stream, "Oem = %d\n", sr->Oem);
894+ if (err < 0) {
895+ return true;
896+ }
897+
898+ return false;
899+}
900+
901--- openhpi-2.10.1/cpp/oSaHpiSensorThdDefn.cpp.orig 1970-01-01 01:00:00.000000000 +0100
902+++ openhpi-2.10.1/cpp/oSaHpiSensorThdDefn.cpp 2007-11-04 00:10:30.380000235 +0100
903@@ -0,0 +1,142 @@
904+/* -*- linux-c -*-
905+ *
906+ * (C) Copyright IBM Corp. 2005
907+ *
908+ * This program is distributed in the hope that it will be useful,
909+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
910+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
911+ * file and program are licensed under a BSD style license. See
912+ * the Copying file included with the OpenHPI distribution for
913+ * full licensing terms.
914+ *
915+ * Author(s):
916+ * W. David Ashley <dashley@us.ibm.com>
917+ */
918+
919+
920+#include <stdlib.h>
921+#include <string.h>
922+#include <stdio.h>
923+extern "C"
924+{
925+#include <SaHpi.h>
926+}
927+#include "oSaHpiTypesEnums.hpp"
928+#include "oSaHpiSensorThdDefn.hpp"
929+
930+
931+/**
932+ * Default constructor.
933+ */
934+oSaHpiSensorThdDefn::oSaHpiSensorThdDefn() {
935+ IsAccessible = false;
936+ ReadThold = 0;
937+ WriteThold = 0;
938+ Nonlinear = false;
939+};
940+
941+
942+/**
943+ * Constructor.
944+ *
945+ * @param buf The reference to the class to be copied.
946+ */
947+oSaHpiSensorThdDefn::oSaHpiSensorThdDefn(const oSaHpiSensorThdDefn& df) {
948+ memcpy(this, &df, sizeof(SaHpiSensorThdDefnT));
949+}
950+
951+
952+/**
953+ * Assign a field in the SaHpiSensorThdDefnT struct a value.
954+ *
955+ * @param field The pointer to the struct (class).
956+ * @param field The field name as a text string (case sensitive).
957+ * @param value The character string value to be assigned to the field. This
958+ * value will be converted as necessary.
959+ *
960+ * @return True if there was an error, otherwise false.
961+ */
962+bool oSaHpiSensorThdDefn::assignField(SaHpiSensorThdDefnT *ptr,
963+ const char *field,
964+ const char *value) {
965+ if (ptr == NULL || field == NULL || value == NULL) {
966+ return true;
967+ }
968+ if (strcmp(field, "IsAccessible") == 0) {
969+ ptr->IsAccessible = oSaHpiTypesEnums::str2torf(value);
970+ return false;
971+ }
972+ else if (strcmp(field, "ReadThold") == 0) {
973+ ptr->ReadThold |= oSaHpiTypesEnums::str2sensorthdmask(value);
974+ return false;
975+ }
976+ else if (strcmp(field, "WriteThold") == 0) {
977+ ptr->WriteThold |= oSaHpiTypesEnums::str2sensorthdmask(value);
978+ return false;
979+ }
980+ else if (strcmp(field, "Nonlinear") == 0) {
981+ ptr->Nonlinear = oSaHpiTypesEnums::str2torf(value);
982+ return false;
983+ }
984+ return true;
985+};
986+
987+
988+/**
989+ * Print the contents of the entity.
990+ *
991+ * @param stream Target stream.
992+ * @param buffer Address of the SaHpiSensorReadingT struct.
993+ *
994+ * @return True if there was an error, otherwise false.
995+ */
996+bool oSaHpiSensorThdDefn::fprint(FILE *stream,
997+ const int indent,
998+ const SaHpiSensorThdDefnT *df) {
999+ int i, err = 0;
1000+ char indent_buf[indent + 1];
1001+
1002+ if (stream == NULL) {
1003+ return true;
1004+ }
1005+ for (i = 0; i < indent; i++) {
1006+ indent_buf[i] = ' ';
1007+ }
1008+ indent_buf[indent] = '\0';
1009+
1010+ err = fprintf(stream, "%s", indent_buf);
1011+ if (err < 0) {
1012+ return true;
1013+ }
1014+ err = fprintf(stream, "IsAccessible = %s\n", oSaHpiTypesEnums::torf2str(df->IsAccessible));
1015+ if (err < 0) {
1016+ return true;
1017+ }
1018+ err = fprintf(stream, "%s", indent_buf);
1019+ if (err < 0) {
1020+ return true;
1021+ }
1022+ err = fprintf(stream, "ReadThold = %X\n", df->ReadThold);
1023+ if (err < 0) {
1024+ return true;
1025+ }
1026+ err = fprintf(stream, "%s", indent_buf);
1027+ if (err < 0) {
1028+ return true;
1029+ }
1030+ err = fprintf(stream, "WriteThold = %X\n", df->WriteThold);
1031+ if (err < 0) {
1032+ return true;
1033+ }
1034+ err = fprintf(stream, "%s", indent_buf);
1035+ if (err < 0) {
1036+ return true;
1037+ }
1038+ err = fprintf(stream, "Nonlinear = %s\n", oSaHpiTypesEnums::torf2str(df->Nonlinear));
1039+ if (err < 0) {
1040+ return true;
1041+ }
1042+
1043+ return false;
1044+}
1045+
1046--- openhpi-2.10.1/cpp/oSaHpiSensorThresholds.cpp.orig 1970-01-01 01:00:00.000000000 +0100
1047+++ openhpi-2.10.1/cpp/oSaHpiSensorThresholds.cpp 2007-11-04 00:10:30.380000235 +0100
1048@@ -0,0 +1,193 @@
1049+/* -*- linux-c -*-
1050+ *
1051+ * (C) Copyright IBM Corp. 2005
1052+ *
1053+ * This program is distributed in the hope that it will be useful,
1054+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1055+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
1056+ * file and program are licensed under a BSD style license. See
1057+ * the Copying file included with the OpenHPI distribution for
1058+ * full licensing terms.
1059+ *
1060+ * Author(s):
1061+ * W. David Ashley <dashley@us.ibm.com>
1062+ */
1063+
1064+
1065+#include <stdlib.h>
1066+#include <string.h>
1067+#include <stdio.h>
1068+extern "C"
1069+{
1070+#include <SaHpi.h>
1071+}
1072+#include "oSaHpiSensorReading.hpp"
1073+#include "oSaHpiSensorThresholds.hpp"
1074+
1075+
1076+/**
1077+ * Default constructor.
1078+ */
1079+oSaHpiSensorThresholds::oSaHpiSensorThresholds() {
1080+ oSaHpiSensorReading *sr;
1081+
1082+ sr = (oSaHpiSensorReading *)&LowCritical;
1083+ sr->initSensorReading(sr);
1084+ sr = (oSaHpiSensorReading *)&LowMajor;
1085+ sr->initSensorReading(sr);
1086+ sr = (oSaHpiSensorReading *)&LowMinor;
1087+ sr->initSensorReading(sr);
1088+ sr = (oSaHpiSensorReading *)&UpCritical;
1089+ sr->initSensorReading(sr);
1090+ sr = (oSaHpiSensorReading *)&UpMajor;
1091+ sr->initSensorReading(sr);
1092+ sr = (oSaHpiSensorReading *)&UpMinor;
1093+ sr->initSensorReading(sr);
1094+ sr = (oSaHpiSensorReading *)&PosThdHysteresis;
1095+ sr->initSensorReading(sr);
1096+ sr = (oSaHpiSensorReading *)&NegThdHysteresis;
1097+ sr->initSensorReading(sr);
1098+};
1099+
1100+
1101+/**
1102+ * Constructor.
1103+ *
1104+ * @param buf The reference to the class to be copied.
1105+ */
1106+oSaHpiSensorThresholds::oSaHpiSensorThresholds(const oSaHpiSensorThresholds& th) {
1107+ memcpy(this, &th, sizeof(SaHpiSensorThresholdsT));
1108+}
1109+
1110+
1111+/**
1112+ * Print the contents of the entity.
1113+ *
1114+ * @param stream Target stream.
1115+ * @param buffer Address of the SaHpiSensorReadingT struct.
1116+ *
1117+ * @return True if there was an error, otherwise false.
1118+ */
1119+bool oSaHpiSensorThresholds::fprint(FILE *stream,
1120+ const int indent,
1121+ const SaHpiSensorThresholdsT *st) {
1122+ int i, err = 0;
1123+ char indent_buf[indent + 1];
1124+ const SaHpiSensorReadingT *sr;
1125+
1126+ if (stream == NULL || st == NULL) {
1127+ return true;
1128+ }
1129+ for (i = 0; i < indent; i++) {
1130+ indent_buf[i] = ' ';
1131+ }
1132+ indent_buf[indent] = '\0';
1133+
1134+ err = fprintf(stream, "%s", indent_buf);
1135+ if (err < 0) {
1136+ return true;
1137+ }
1138+ err = fprintf(stream, "LowCritical\n");
1139+ if (err < 0) {
1140+ return true;
1141+ }
1142+ sr = (const SaHpiSensorReadingT *)&st->LowCritical;
1143+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1144+ if (err < 0) {
1145+ return true;
1146+ }
1147+ err = fprintf(stream, "%s", indent_buf);
1148+ if (err < 0) {
1149+ return true;
1150+ }
1151+ err = fprintf(stream, "LowMajor\n");
1152+ if (err < 0) {
1153+ return true;
1154+ }
1155+ sr = (const SaHpiSensorReadingT *)&st->LowMajor;
1156+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1157+ if (err < 0) {
1158+ return true;
1159+ }
1160+ err = fprintf(stream, "%s", indent_buf);
1161+ if (err < 0) {
1162+ return true;
1163+ }
1164+ err = fprintf(stream, "LowMinor\n");
1165+ if (err < 0) {
1166+ return true;
1167+ }
1168+ sr = (const SaHpiSensorReadingT *)&st->LowMinor;
1169+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1170+ if (err < 0) {
1171+ return true;
1172+ }
1173+ err = fprintf(stream, "%s", indent_buf);
1174+ if (err < 0) {
1175+ return true;
1176+ }
1177+ err = fprintf(stream, "UpCritical\n");
1178+ if (err < 0) {
1179+ return true;
1180+ }
1181+ sr = (const SaHpiSensorReadingT *)&st->UpCritical;
1182+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1183+ if (err < 0) {
1184+ return true;
1185+ }
1186+ err = fprintf(stream, "%s", indent_buf);
1187+ if (err < 0) {
1188+ return true;
1189+ }
1190+ err = fprintf(stream, "UpMajor\n");
1191+ if (err < 0) {
1192+ return true;
1193+ }
1194+ sr = (const SaHpiSensorReadingT *)&st->UpMajor;
1195+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1196+ if (err < 0) {
1197+ return true;
1198+ }
1199+ err = fprintf(stream, "%s", indent_buf);
1200+ if (err < 0) {
1201+ return true;
1202+ }
1203+ err = fprintf(stream, "UpMinor\n");
1204+ if (err < 0) {
1205+ return true;
1206+ }
1207+ sr = (const SaHpiSensorReadingT *)&st->UpMinor;
1208+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1209+ if (err < 0) {
1210+ return true;
1211+ }
1212+ err = fprintf(stream, "%s", indent_buf);
1213+ if (err < 0) {
1214+ return true;
1215+ }
1216+ err = fprintf(stream, "PosThdHysteresis\n");
1217+ if (err < 0) {
1218+ return true;
1219+ }
1220+ sr = (const SaHpiSensorReadingT *)&st->PosThdHysteresis;
1221+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1222+ if (err < 0) {
1223+ return true;
1224+ }
1225+ err = fprintf(stream, "%s", indent_buf);
1226+ if (err < 0) {
1227+ return true;
1228+ }
1229+ err = fprintf(stream, "NegThdHysteresis\n");
1230+ if (err < 0) {
1231+ return true;
1232+ }
1233+ sr = (const SaHpiSensorReadingT *)&st->NegThdHysteresis;
1234+ err = oSaHpiSensorReading::fprint(stream, indent + 3, sr);
1235+ if (err < 0) {
1236+ return true;
1237+ }
1238+
1239+ return false;
1240+}
1241+
1242--- openhpi-2.10.1/cpp/oSaHpiTextBuffer.cpp.orig 1970-01-01 01:00:00.000000000 +0100
1243+++ openhpi-2.10.1/cpp/oSaHpiTextBuffer.cpp 2007-11-04 00:10:30.380000235 +0100
1244@@ -0,0 +1,324 @@
1245+/* -*- linux-c -*-
1246+ *
1247+ * (C) Copyright IBM Corp. 2005
1248+ *
1249+ * This program is distributed in the hope that it will be useful,
1250+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1251+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
1252+ * file and program are licensed under a BSD style license. See
1253+ * the Copying file included with the OpenHPI distribution for
1254+ * full licensing terms.
1255+ *
1256+ * Author(s):
1257+ * W. David Ashley <dashley@us.ibm.com>
1258+ */
1259+
1260+
1261+#include <stdlib.h>
1262+#include <string.h>
1263+#include <stdio.h>
1264+extern "C"
1265+{
1266+#include <SaHpi.h>
1267+}
1268+#include "oSaHpiTypesEnums.hpp"
1269+#include "oSaHpiTextBuffer.hpp"
1270+
1271+
1272+/**
1273+ * Default constructor.
1274+ */
1275+oSaHpiTextBuffer::oSaHpiTextBuffer() {
1276+ DataType = SAHPI_TL_TYPE_TEXT;
1277+ Language = SAHPI_LANG_ENGLISH;
1278+ DataLength = 0;
1279+ Data[0] = '\0';
1280+};
1281+
1282+
1283+/**
1284+ * Constructor.
1285+ *
1286+ * @param type The SaHpiTextType for the buffer.
1287+ * @param lang The SaHpiLanguage for the buffer.
1288+ */
1289+oSaHpiTextBuffer::oSaHpiTextBuffer(const SaHpiTextTypeT type,
1290+ const SaHpiLanguageT lang) {
1291+ if (oSaHpiTypesEnums::texttype2str(type)) {
1292+ DataType = type;
1293+ }
1294+ else {
1295+ DataType = SAHPI_TL_TYPE_TEXT;
1296+ }
1297+ if (oSaHpiTypesEnums::language2str(lang)) {
1298+ Language = lang;
1299+ }
1300+ else {
1301+ Language = SAHPI_LANG_ENGLISH;
1302+ }
1303+ Data[0] = '\0';
1304+};
1305+
1306+
1307+/**
1308+ * Constructor.
1309+ *
1310+ * @param type The SaHpiTextType for the buffer.
1311+ * @param lang The SaHpiLanguage for the buffer.
1312+ * @param str The zero-terminated character string to be assigned to the
1313+ * buffer.
1314+ */
1315+oSaHpiTextBuffer::oSaHpiTextBuffer(const SaHpiTextTypeT type,
1316+ const SaHpiLanguageT lang,
1317+ const char *str) {
1318+ if (oSaHpiTypesEnums::texttype2str(type)) {
1319+ DataType = type;
1320+ }
1321+ else {
1322+ DataType = SAHPI_TL_TYPE_TEXT;
1323+ }
1324+ if (oSaHpiTypesEnums::language2str(lang)) {
1325+ Language = lang;
1326+ }
1327+ else {
1328+ Language = SAHPI_LANG_ENGLISH;
1329+ }
1330+ if (str == NULL) {
1331+ Data[0] = '\0';
1332+ DataLength = 0;
1333+ }
1334+ else {
1335+ int str_len = strlen(str);
1336+ if (str_len < SAHPI_MAX_TEXT_BUFFER_LENGTH) {
1337+ strcpy((char *)Data, str);
1338+ DataLength = (SaHpiUint8T)str_len;
1339+ }
1340+ else {
1341+ memcpy(Data, str, SAHPI_MAX_TEXT_BUFFER_LENGTH);
1342+ DataLength = SAHPI_MAX_TEXT_BUFFER_LENGTH;
1343+ }
1344+ }
1345+};
1346+
1347+
1348+/**
1349+ * Constructor.
1350+ *
1351+ * @param type The SaHpiTextType for the buffer.
1352+ * @param lang The SaHpiLanguage for the buffer.
1353+ * @param str The data array to be assigned to the buffer.
1354+ * @param len The length of the data to be assigned to the buffer.
1355+ */
1356+oSaHpiTextBuffer::oSaHpiTextBuffer(const SaHpiTextTypeT type,
1357+ const SaHpiLanguageT lang,
1358+ const void *str,
1359+ const SaHpiUint8T len) {
1360+ if (oSaHpiTypesEnums::texttype2str(type)) {
1361+ DataType = type;
1362+ }
1363+ else {
1364+ DataType = SAHPI_TL_TYPE_TEXT;
1365+ }
1366+ if (oSaHpiTypesEnums::language2str(lang)) {
1367+ Language = lang;
1368+ }
1369+ else {
1370+ Language = SAHPI_LANG_ENGLISH;
1371+ }
1372+ DataLength = len;
1373+ memcpy(Data, str, len);
1374+ if (DataType == SAHPI_TL_TYPE_TEXT &&
1375+ DataLength < SAHPI_MAX_TEXT_BUFFER_LENGTH) {
1376+ Data[len] = '\0';
1377+ }
1378+};
1379+
1380+
1381+/**
1382+ * Constructor.
1383+ *
1384+ * @param buf The reference to the class to be copied.
1385+ */
1386+oSaHpiTextBuffer::oSaHpiTextBuffer(const oSaHpiTextBuffer& buf) {
1387+ DataType = buf.DataType;
1388+ Language = buf.Language;
1389+ DataLength = buf.DataLength;
1390+ memcpy(Data, &buf.Data, SAHPI_MAX_TEXT_BUFFER_LENGTH);
1391+}
1392+
1393+
1394+/**
1395+ * Append a character string to the buffer.
1396+ *
1397+ * @param ptr Pointer to the struct (class).
1398+ * @param str The zero-terminated character string to be appended to the
1399+ * buffer.
1400+ *
1401+ * @return True if there was an error, otherwise false.
1402+ */
1403+bool oSaHpiTextBuffer::append(SaHpiTextBufferT *ptr,
1404+ const char *str) {
1405+ if (ptr == NULL) {
1406+ return true;
1407+ }
1408+ if (str == NULL) {
1409+ return false;
1410+ }
1411+ if (strlen(str) + ptr->DataLength > SAHPI_MAX_TEXT_BUFFER_LENGTH - 1) {
1412+ return true;
1413+ }
1414+ strcat((char *)&ptr->Data[DataLength], str);
1415+ ptr->DataLength = strlen((char *)ptr->Data);
1416+ return false;
1417+};
1418+
1419+
1420+/**
1421+ * Append an array of data to the buffer.
1422+ *
1423+ * @param ptr Pointer to the struct (class).
1424+ * @param str The data to be appended.
1425+ * @param len The length of the data to be appended to the buffer.
1426+ *
1427+ * @return True if there was an error, otherwise false.
1428+ */
1429+bool oSaHpiTextBuffer::append(SaHpiTextBufferT *ptr,
1430+ const void *str,
1431+ const SaHpiUint8T len) {
1432+ if (ptr == NULL) {
1433+ return true;
1434+ }
1435+ if (str == NULL) {
1436+ return false;
1437+ }
1438+ if (ptr->DataLength + len > SAHPI_MAX_TEXT_BUFFER_LENGTH) {
1439+ return true;
1440+ }
1441+ memcpy(&ptr->Data[DataLength], str, (size_t)len);
1442+ ptr->DataLength += len;
1443+ if (ptr->DataType == SAHPI_TL_TYPE_TEXT &&
1444+ ptr->DataLength < SAHPI_MAX_TEXT_BUFFER_LENGTH) {
1445+ ptr->Data[len] = '\0';
1446+ }
1447+ return false;
1448+};
1449+
1450+
1451+
1452+/**
1453+ * Assign a field in the SaHpiTextBufferT struct a value.
1454+ *
1455+ * @param field The pointer to the struct (class).
1456+ * @param field The field name as a text string (case sensitive).
1457+ * @param value The character string value to be assigned to the field. This
1458+ * value will be converted as necessary.
1459+ *
1460+ * @return True if there was an error, otherwise false.
1461+ */
1462+bool oSaHpiTextBuffer::assignField(SaHpiTextBufferT *ptr,
1463+ const char *field,
1464+ const char *value) {
1465+ // note that DataLength cannot be assigned a value using this method
1466+ if (ptr == NULL || field == NULL || value == NULL) {
1467+ return true;
1468+ }
1469+ if (strcmp(field, "DataType") == 0) {
1470+ ptr->DataType = oSaHpiTypesEnums::str2texttype(value);
1471+ return false;
1472+ }
1473+ else if (strcmp(field, "Language") == 0) {
1474+ ptr->Language = oSaHpiTypesEnums::str2language(value);
1475+ return false;
1476+ }
1477+ else if (strcmp(field, "Data") == 0) {
1478+ int str_len = strlen(value);
1479+ if (str_len < SAHPI_MAX_TEXT_BUFFER_LENGTH) {
1480+ strcpy((char *)ptr->Data, value);
1481+ ptr->DataLength = (SaHpiUint8T)str_len;
1482+ }
1483+ else {
1484+ memcpy(ptr->Data, value, SAHPI_MAX_TEXT_BUFFER_LENGTH);
1485+ ptr->DataLength = SAHPI_MAX_TEXT_BUFFER_LENGTH;
1486+ }
1487+ return false;
1488+ }
1489+ return true;
1490+};
1491+
1492+
1493+/**
1494+ * Print the contents of the buffer.
1495+ *
1496+ * @param stream Target stream.
1497+ * @param buffer Address of the SaHpiTextBuferT struct.
1498+ *
1499+ * @return True if there was an error, otherwise false.
1500+ */
1501+bool oSaHpiTextBuffer::fprint(FILE *stream,
1502+ const int indent,
1503+ const SaHpiTextBufferT *buffer) {
1504+ int i, err;
1505+ char indent_buf[indent + 1];
1506+
1507+ if (stream == NULL || buffer == NULL) {
1508+ return true;
1509+ }
1510+ for (i = 0; i < indent; i++) {
1511+ indent_buf[i] = ' ';
1512+ }
1513+ indent_buf[indent] = '\0';
1514+
1515+ err = fprintf(stream, "%s", indent_buf);
1516+ if (err < 0) {
1517+ return true;
1518+ }
1519+ err = fprintf(stream, "DataType = %s\n", oSaHpiTypesEnums::texttype2str(buffer->DataType));
1520+ if (err < 0) {
1521+ return true;
1522+ }
1523+ err = fprintf(stream, "%s", indent_buf);
1524+ if (err < 0) {
1525+ return true;
1526+ }
1527+ err = fprintf(stream, "Language = %s\n", oSaHpiTypesEnums::language2str(buffer->Language));
1528+ if (err < 0) {
1529+ return true;
1530+ }
1531+ err = fprintf(stream, "%s", indent_buf);
1532+ if (err < 0) {
1533+ return true;
1534+ }
1535+ err = fprintf(stream, "DataLength = %d\n", (int)buffer->DataLength);
1536+ if (err < 0) {
1537+ return true;
1538+ }
1539+ err = fprintf(stream, "%s", indent_buf);
1540+ if (err < 0) {
1541+ return true;
1542+ }
1543+ if (buffer->DataType == SAHPI_TL_TYPE_TEXT) {
1544+ err = fprintf(stream, "Data = %s\n", buffer->Data);
1545+ }
1546+ else {
1547+ err = fprintf(stream, "Data = ");
1548+ if (err < 0) {
1549+ return true;
1550+ }
1551+ for (i = 0; i < buffer->DataLength; i++) {
1552+ err = fprintf(stream, "%c", buffer->Data[i]);
1553+ if (err < 0) {
1554+ return true;
1555+ }
1556+ }
1557+ err = fprintf(stream, "\n");
1558+ if (err < 0) {
1559+ return true;
1560+ }
1561+ }
1562+ if (err < 0) {
1563+ return true;
1564+ }
1565+
1566+ return false;
1567+}
1568+
1569--- openhpi-2.10.1/cpp/oSaHpiTypesEnums.cpp.orig 1970-01-01 01:00:00.000000000 +0100
1570+++ openhpi-2.10.1/cpp/oSaHpiTypesEnums.cpp 2007-11-04 00:10:30.384000463 +0100
1571@@ -0,0 +1,2763 @@
1572+/* -*- linux-c -*-
1573+ *
1574+ * (C) Copyright IBM Corp. 2005
1575+ *
1576+ * This program is distributed in the hope that it will be useful,
1577+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1578+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
1579+ * file and program are licensed under a BSD style license. See
1580+ * the Copying file included with the OpenHPI distribution for
1581+ * full licensing terms.
1582+ *
1583+ * Author(s):
1584+ * W. David Ashley <dashley@us.ibm.com>
1585+ */
1586+
1587+
1588+#include <stdlib.h>
1589+#include <string.h>
1590+#include <stdio.h>
1591+extern "C"
1592+{
1593+#include <SaHpi.h>
1594+}
1595+#include "oSaHpiTypesEnums.hpp"
1596+
1597+
1598+/**
1599+ * Translates the boolean true or false into a string.
1600+ *
1601+ * @param f The boolean value.
1602+ *
1603+ * @return "SAHPI_TRUE" if the boolean is true, otherwise returns "SAHPI_FALSE".
1604+ */
1605+const char * oSaHpiTypesEnums::torf2str(SaHpiBoolT f) {
1606+ if (f) {
1607+ return "SAHPI_TRUE";
1608+ }
1609+ return "SAHPI_FALSE";
1610+}
1611+
1612+
1613+/**
1614+ * Translates the string value to true or false.
1615+ *
1616+ * @param str The string to be translated.
1617+ *
1618+ * @return SAHPI_TRUE if the string is true, otherwise returns SAHPI_FALSE.
1619+ */
1620+SaHpiBoolT oSaHpiTypesEnums::str2torf(const char *str) {
1621+ if (strcmp(str, "SAHPI_FALSE") == 0 || strcmp(str, "FALSE") == 0 ||
1622+ strcmp(str, "0") == 0) {
1623+ return SAHPI_FALSE;
1624+ }
1625+ return SAHPI_FALSE;
1626+}
1627+
1628+
1629+static struct language_map {
1630+ SaHpiLanguageT type;
1631+ const char *str;
1632+} language_strings[] = {
1633+ {SAHPI_LANG_UNDEF, "SAHPI_LANG_UNDEF"},
1634+ {SAHPI_LANG_AFAR, "SAHPI_LANG_AFAR"},
1635+ {SAHPI_LANG_ABKHAZIAN, "SAHPI_LANG_ABKHAZIAN"},
1636+ {SAHPI_LANG_AFRIKAANS, "SAHPI_LANG_AFRIKAANS"},
1637+ {SAHPI_LANG_AMHARIC, "SAHPI_LANG_AMHARIC"},
1638+ {SAHPI_LANG_ARABIC, "SAHPI_LANG_ARABIC"},
1639+ {SAHPI_LANG_ASSAMESE, "SAHPI_LANG_ASSAMESE"},
1640+ {SAHPI_LANG_AYMARA, "SAHPI_LANG_AYMARA"},
1641+ {SAHPI_LANG_AZERBAIJANI, "SAHPI_LANG_AZERBAIJANI"},
1642+ {SAHPI_LANG_BASHKIR, "SAHPI_LANG_BASHKIR"},
1643+ {SAHPI_LANG_BYELORUSSIAN, "SAHPI_LANG_BYELORUSSIAN"},
1644+ {SAHPI_LANG_BULGARIAN, "SAHPI_LANG_BULGARIAN"},
1645+ {SAHPI_LANG_BIHARI, "SAHPI_LANG_BIHARI"},
1646+ {SAHPI_LANG_BISLAMA, "SAHPI_LANG_BISLAMA"},
1647+ {SAHPI_LANG_BENGALI, "SAHPI_LANG_BENGALI"},
1648+ {SAHPI_LANG_TIBETAN, "SAHPI_LANG_TIBETAN"},
1649+ {SAHPI_LANG_BRETON, "SAHPI_LANG_BRETON"},
1650+ {SAHPI_LANG_CATALAN, "SAHPI_LANG_CATALAN"},
1651+ {SAHPI_LANG_CORSICAN, "SAHPI_LANG_CORSICAN"},
1652+ {SAHPI_LANG_CZECH, "SAHPI_LANG_CZECH"},
1653+ {SAHPI_LANG_WELSH, "SAHPI_LANG_WELSH"},
1654+ {SAHPI_LANG_DANISH, "SAHPI_LANG_DANISH"},
1655+ {SAHPI_LANG_GERMAN, "SAHPI_LANG_GERMAN"},
1656+ {SAHPI_LANG_BHUTANI, "SAHPI_LANG_BHUTANI"},
1657+ {SAHPI_LANG_GREEK, "SAHPI_LANG_GREEK"},
1658+ {SAHPI_LANG_ENGLISH, "SAHPI_LANG_ENGLISH"},
1659+ {SAHPI_LANG_ESPERANTO, "SAHPI_LANG_ESPERANTO"},
1660+ {SAHPI_LANG_SPANISH, "SAHPI_LANG_SPANISH"},
1661+ {SAHPI_LANG_ESTONIAN, "SAHPI_LANG_ESTONIAN"},
1662+ {SAHPI_LANG_BASQUE, "SAHPI_LANG_BASQUE"},
1663+ {SAHPI_LANG_PERSIAN, "SAHPI_LANG_PERSIAN"},
1664+ {SAHPI_LANG_FINNISH, "SAHPI_LANG_FINNISH"},
1665+ {SAHPI_LANG_FIJI, "SAHPI_LANG_FIJI"},
1666+ {SAHPI_LANG_FAEROESE, "SAHPI_LANG_FAEROESE"},
1667+ {SAHPI_LANG_FRENCH, "SAHPI_LANG_FRENCH"},
1668+ {SAHPI_LANG_FRISIAN, "SAHPI_LANG_FRISIAN"},
1669+ {SAHPI_LANG_IRISH, "SAHPI_LANG_IRISH"},
1670+ {SAHPI_LANG_SCOTSGAELIC, "SAHPI_LANG_SCOTSGAELIC"},
1671+ {SAHPI_LANG_GALICIAN, "SAHPI_LANG_GALICIAN"},
1672+ {SAHPI_LANG_GUARANI, "SAHPI_LANG_GUARANI"},
1673+ {SAHPI_LANG_GUJARATI, "SAHPI_LANG_GUJARATI"},
1674+ {SAHPI_LANG_HAUSA, "SAHPI_LANG_HAUSA"},
1675+ {SAHPI_LANG_HINDI, "SAHPI_LANG_HINDI"},
1676+ {SAHPI_LANG_CROATIAN, "SAHPI_LANG_CROATIAN"},
1677+ {SAHPI_LANG_HUNGARIAN, "SAHPI_LANG_HUNGARIAN"},
1678+ {SAHPI_LANG_ARMENIAN, "SAHPI_LANG_ARMENIAN"},
1679+ {SAHPI_LANG_INTERLINGUA, "SAHPI_LANG_INTERLINGUA"},
1680+ {SAHPI_LANG_INTERLINGUE, "SAHPI_LANG_INTERLINGUE"},
1681+ {SAHPI_LANG_INUPIAK, "SAHPI_LANG_INUPIAK"},
1682+ {SAHPI_LANG_INDONESIAN, "SAHPI_LANG_INDONESIAN"},
1683+ {SAHPI_LANG_ITALIAN, "SAHPI_LANG_ITALIAN"},
1684+ {SAHPI_LANG_HEBREW, "SAHPI_LANG_HEBREW"},
1685+ {SAHPI_LANG_JAPANESE, "SAHPI_LANG_JAPANESE"},
1686+ {SAHPI_LANG_YIDDISH, "SAHPI_LANG_YIDDISH"},
1687+ {SAHPI_LANG_JAVANESE, "SAHPI_LANG_JAVANESE"},
1688+ {SAHPI_LANG_GEORGIAN, "SAHPI_LANG_GEORGIAN"},
1689+ {SAHPI_LANG_KAZAKH, "SAHPI_LANG_KAZAKH"},
1690+ {SAHPI_LANG_GREENLANDIC, "SAHPI_LANG_GREENLANDIC"},
1691+ {SAHPI_LANG_CAMBODIAN, "SAHPI_LANG_CAMBODIAN"},
1692+ {SAHPI_LANG_KANNADA, "SAHPI_LANG_KANNADA"},
1693+ {SAHPI_LANG_KOREAN, "SAHPI_LANG_KOREAN"},
1694+ {SAHPI_LANG_KASHMIRI, "SAHPI_LANG_KASHMIRI"},
1695+ {SAHPI_LANG_KURDISH, "SAHPI_LANG_KURDISH"},
1696+ {SAHPI_LANG_KIRGHIZ, "SAHPI_LANG_KIRGHIZ"},
1697+ {SAHPI_LANG_LATIN, "SAHPI_LANG_LATIN"},
1698+ {SAHPI_LANG_LINGALA, "SAHPI_LANG_LINGALA"},
1699+ {SAHPI_LANG_LAOTHIAN, "SAHPI_LANG_LAOTHIAN"},
1700+ {SAHPI_LANG_LITHUANIAN, "SAHPI_LANG_LITHUANIAN"},
1701+ {SAHPI_LANG_LATVIANLETTISH, "SAHPI_LANG_LATVIANLETTISH"},
1702+ {SAHPI_LANG_MALAGASY, "SAHPI_LANG_MALAGASY"},
1703+ {SAHPI_LANG_MAORI, "SAHPI_LANG_MAORI"},
1704+ {SAHPI_LANG_MACEDONIAN, "SAHPI_LANG_MACEDONIAN"},
1705+ {SAHPI_LANG_MALAYALAM, "SAHPI_LANG_MALAYALAM"},
1706+ {SAHPI_LANG_MONGOLIAN, "SAHPI_LANG_MONGOLIAN"},
1707+ {SAHPI_LANG_MOLDAVIAN, "SAHPI_LANG_MOLDAVIAN"},
1708+ {SAHPI_LANG_MARATHI, "SAHPI_LANG_MARATHI"},
1709+ {SAHPI_LANG_MALAY, "SAHPI_LANG_MALAY"},
1710+ {SAHPI_LANG_MALTESE, "SAHPI_LANG_MALTESE"},
1711+ {SAHPI_LANG_BURMESE, "SAHPI_LANG_BURMESE"},
1712+ {SAHPI_LANG_NAURU, "SAHPI_LANG_NAURU"},
1713+ {SAHPI_LANG_NEPALI, "SAHPI_LANG_NEPALI"},
1714+ {SAHPI_LANG_DUTCH, "SAHPI_LANG_DUTCH"},
1715+ {SAHPI_LANG_NORWEGIAN, "SAHPI_LANG_NORWEGIAN"},
1716+ {SAHPI_LANG_OCCITAN, "SAHPI_LANG_OCCITAN"},
1717+ {SAHPI_LANG_AFANOROMO, "SAHPI_LANG_AFANOROMO"},
1718+ {SAHPI_LANG_ORIYA, "SAHPI_LANG_ORIYA"},
1719+ {SAHPI_LANG_PUNJABI, "SAHPI_LANG_PUNJABI"},
1720+ {SAHPI_LANG_POLISH, "SAHPI_LANG_POLISH"},
1721+ {SAHPI_LANG_PASHTOPUSHTO, "SAHPI_LANG_PASHTOPUSHTO"},
1722+ {SAHPI_LANG_PORTUGUESE, "SAHPI_LANG_PORTUGUESE"},
1723+ {SAHPI_LANG_QUECHUA, "SAHPI_LANG_QUECHUA"},
1724+ {SAHPI_LANG_RHAETOROMANCE, "SAHPI_LANG_RHAETOROMANCE"},
1725+ {SAHPI_LANG_KIRUNDI, "SAHPI_LANG_KIRUNDI"},
1726+ {SAHPI_LANG_ROMANIAN, "SAHPI_LANG_ROMANIAN"},
1727+ {SAHPI_LANG_RUSSIAN, "SAHPI_LANG_RUSSIAN"},
1728+ {SAHPI_LANG_KINYARWANDA, "SAHPI_LANG_KINYARWANDA"},
1729+ {SAHPI_LANG_SANSKRIT, "SAHPI_LANG_SANSKRIT"},
1730+ {SAHPI_LANG_SINDHI, "SAHPI_LANG_SINDHI"},
1731+ {SAHPI_LANG_SANGRO, "SAHPI_LANG_SANGRO"},
1732+ {SAHPI_LANG_SERBOCROATIAN, "SAHPI_LANG_SERBOCROATIAN"},
1733+ {SAHPI_LANG_SINGHALESE, "SAHPI_LANG_SINGHALESE"},
1734+ {SAHPI_LANG_SLOVAK, "SAHPI_LANG_SLOVAK"},
1735+ {SAHPI_LANG_SLOVENIAN, "SAHPI_LANG_SLOVENIAN"},
1736+ {SAHPI_LANG_SAMOAN, "SAHPI_LANG_SAMOAN"},
1737+ {SAHPI_LANG_SHONA, "SAHPI_LANG_SHONA"},
1738+ {SAHPI_LANG_SOMALI, "SAHPI_LANG_SOMALI"},
1739+ {SAHPI_LANG_ALBANIAN, "SAHPI_LANG_ALBANIAN"},
1740+ {SAHPI_LANG_SERBIAN, "SAHPI_LANG_SERBIAN"},
1741+ {SAHPI_LANG_SISWATI, "SAHPI_LANG_SISWATI"},
1742+ {SAHPI_LANG_SESOTHO, "SAHPI_LANG_SESOTHO"},
1743+ {SAHPI_LANG_SUDANESE, "SAHPI_LANG_SUDANESE"},
1744+ {SAHPI_LANG_SWEDISH, "SAHPI_LANG_SWEDISH"},
1745+ {SAHPI_LANG_SWAHILI, "SAHPI_LANG_SWAHILI"},
1746+ {SAHPI_LANG_TAMIL, "SAHPI_LANG_TAMIL"},
1747+ {SAHPI_LANG_TELUGU, "SAHPI_LANG_TELUGU"},
1748+ {SAHPI_LANG_TAJIK, "SAHPI_LANG_TAJIK"},
1749+ {SAHPI_LANG_THAI, "SAHPI_LANG_THAI"},
1750+ {SAHPI_LANG_TIGRINYA, "SAHPI_LANG_TIGRINYA"},
1751+ {SAHPI_LANG_TURKMEN, "SAHPI_LANG_TURKMEN"},
1752+ {SAHPI_LANG_TAGALOG, "SAHPI_LANG_TAGALOG"},
1753+ {SAHPI_LANG_SETSWANA, "SAHPI_LANG_SETSWANA"},
1754+ {SAHPI_LANG_TONGA, "SAHPI_LANG_TONGA"},
1755+ {SAHPI_LANG_TURKISH, "SAHPI_LANG_TURKISH"},
1756+ {SAHPI_LANG_TSONGA, "SAHPI_LANG_TSONGA"},
1757+ {SAHPI_LANG_TATAR, "SAHPI_LANG_TATAR"},
1758+ {SAHPI_LANG_TWI, "SAHPI_LANG_TWI"},
1759+ {SAHPI_LANG_UKRAINIAN, "SAHPI_LANG_UKRAINIAN"},
1760+ {SAHPI_LANG_URDU, "SAHPI_LANG_URDU"},
1761+ {SAHPI_LANG_UZBEK, "SAHPI_LANG_UZBEK"},
1762+ {SAHPI_LANG_VIETNAMESE, "SAHPI_LANG_VIETNAMESE"},
1763+ {SAHPI_LANG_VOLAPUK, "SAHPI_LANG_VOLAPUK"},
1764+ {SAHPI_LANG_WOLOF, "SAHPI_LANG_WOLOF"},
1765+ {SAHPI_LANG_XHOSA, "SAHPI_LANG_XHOSA"},
1766+ {SAHPI_LANG_YORUBA, "SAHPI_LANG_YORUBA"},
1767+ {SAHPI_LANG_CHINESE, "SAHPI_LANG_CHINESE"},
1768+ {SAHPI_LANG_ZULU, "SAHPI_LANG_ZULU"},
1769+ {SAHPI_LANG_UNDEF, NULL}
1770+};
1771+
1772+
1773+/**
1774+ * Translates a string to a valid SaHpiLanguageT type.
1775+ *
1776+ * @param strtype The language type expressed as a string.
1777+ *
1778+ * @return SAHPI_OK on success, otherwise an HPI error code.
1779+ */
1780+SaHpiLanguageT oSaHpiTypesEnums::str2language(const char *strtype) {
1781+ int i;
1782+
1783+ if (strtype == NULL) {
1784+ return SAHPI_LANG_ENGLISH;
1785+ }
1786+ for (i = 0; language_strings[i].str != NULL; i++) {
1787+ if (strcmp(strtype, language_strings[i].str) == 0) {
1788+ return language_strings[i].type;
1789+ }
1790+ }
1791+ return SAHPI_LANG_ENGLISH;
1792+}
1793+
1794+
1795+/**
1796+ * Translates a language type to a string.
1797+ *
1798+ * @param value The SaHpiLanguageT to be converted.
1799+ *
1800+ * @return The string value of the type.
1801+ */
1802+const char * oSaHpiTypesEnums::language2str(SaHpiLanguageT value) {
1803+ int i;
1804+
1805+ for (i = 0; language_strings[i].str != NULL; i++) {
1806+ if (value == language_strings[i].type) {
1807+ return language_strings[i].str;
1808+ }
1809+ }
1810+ return "Unknown";
1811+}
1812+
1813+
1814+static struct texttype_map {
1815+ SaHpiTextTypeT type;
1816+ const char *typestr;
1817+} texttype_strings[] = {
1818+ {SAHPI_TL_TYPE_UNICODE, "SAHPI_TL_TYPE_UNICODE"},
1819+ {SAHPI_TL_TYPE_BCDPLUS, "SAHPI_TL_TYPE_BCDPLUS"},
1820+ {SAHPI_TL_TYPE_ASCII6, "SAHPI_TL_TYPE_ASCII6"},
1821+ {SAHPI_TL_TYPE_TEXT, "SAHPI_TL_TYPE_TEXT"},
1822+ {SAHPI_TL_TYPE_BINARY, "SAHPI_TL_TYPE_BINARY"},
1823+ {SAHPI_TL_TYPE_BINARY, NULL}
1824+};
1825+
1826+
1827+/**
1828+ * Translate a string into a valid SaHpiTextTypeT value.
1829+ *
1830+ * @param type The string to be translated.
1831+ *
1832+ * @return SAHPI_OK on success, otherwise an HPI error code.
1833+ */
1834+SaHpiTextTypeT oSaHpiTypesEnums::str2texttype(const char *type) {
1835+ int i;
1836+
1837+ if (type == NULL) {
1838+ return SAHPI_TL_TYPE_TEXT;
1839+ }
1840+ for (i = 0; texttype_strings[i].typestr != NULL; i++) {
1841+ if (strcmp(type, texttype_strings[i].typestr) == 0) {
1842+ return texttype_strings[i].type;
1843+ }
1844+ }
1845+ return SAHPI_TL_TYPE_TEXT;
1846+}
1847+
1848+
1849+/**
1850+ * Translates a text type to a string.
1851+ *
1852+ * @param value The SaHpiTextType to be converted.
1853+ *
1854+ * @return SAHPI_OK on success, otherwise an HPI error code.
1855+ */
1856+const char * oSaHpiTypesEnums::texttype2str(SaHpiTextTypeT value) {
1857+ int i;
1858+
1859+ for (i = 0; texttype_strings[i].typestr != NULL; i++) {
1860+ if (value == texttype_strings[i].type) {
1861+ return texttype_strings[i].typestr;
1862+ }
1863+ }
1864+ return "Unknown";
1865+}
1866+
1867+
1868+static struct entitytype_map {
1869+ SaHpiEntityTypeT type;
1870+ const char *str;
1871+} entitytype_strings[] = {
1872+ {SAHPI_ENT_UNSPECIFIED, "SAHPI_ENT_UNSPECIFIED"},
1873+ {SAHPI_ENT_OTHER, "SAHPI_ENT_OTHER"},
1874+ {SAHPI_ENT_UNKNOWN, "SAHPI_ENT_UNKNOWN"},
1875+ {SAHPI_ENT_PROCESSOR, "SAHPI_ENT_PROCESSOR"},
1876+ {SAHPI_ENT_DISK_BAY, "SAHPI_ENT_DISK_BAY"},
1877+ {SAHPI_ENT_PERIPHERAL_BAY, "SAHPI_ENT_PERIPHERAL_BAY"},
1878+ {SAHPI_ENT_SYS_MGMNT_MODULE, "SAHPI_ENT_SYS_MGMNT_MODULE"},
1879+ {SAHPI_ENT_SYSTEM_BOARD, "SAHPI_ENT_SYSTEM_BOARD"},
1880+ {SAHPI_ENT_MEMORY_MODULE, "SAHPI_ENT_MEMORY_MODULE"},
1881+ {SAHPI_ENT_PROCESSOR_MODULE, "SAHPI_ENT_PROCESSOR_MODULE"},
1882+ {SAHPI_ENT_POWER_SUPPLY, "SAHPI_ENT_POWER_SUPPLY"},
1883+ {SAHPI_ENT_ADD_IN_CARD, "SAHPI_ENT_ADD_IN_CARD"},
1884+ {SAHPI_ENT_FRONT_PANEL_BOARD, "SAHPI_ENT_FRONT_PANEL_BOARD"},
1885+ {SAHPI_ENT_BACK_PANEL_BOARD, "SAHPI_ENT_BACK_PANEL_BOARD"},
1886+ {SAHPI_ENT_POWER_SYSTEM_BOARD, "SAHPI_ENT_POWER_SYSTEM_BOARD"},
1887+ {SAHPI_ENT_DRIVE_BACKPLANE, "SAHPI_ENT_DRIVE_BACKPLANE"},
1888+ {SAHPI_ENT_SYS_EXPANSION_BOARD, "SAHPI_ENT_SYS_EXPANSION_BOARD"},
1889+ {SAHPI_ENT_OTHER_SYSTEM_BOARD, "SAHPI_ENT_OTHER_SYSTEM_BOARD"},
1890+ {SAHPI_ENT_PROCESSOR_BOARD, "SAHPI_ENT_PROCESSOR_BOARD"},
1891+ {SAHPI_ENT_POWER_UNIT, "SAHPI_ENT_POWER_UNIT"},
1892+ {SAHPI_ENT_POWER_MODULE, "SAHPI_ENT_POWER_MODULE"},
1893+ {SAHPI_ENT_POWER_MGMNT, "SAHPI_ENT_POWER_MGMNT"},
1894+ {SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD, "SAHPI_ENT_CHASSIS_BACK_PANEL_BOARD"},
1895+ {SAHPI_ENT_SYSTEM_CHASSIS, "SAHPI_ENT_SYSTEM_CHASSIS"},
1896+ {SAHPI_ENT_SUB_CHASSIS, "SAHPI_ENT_SUB_CHASSIS"},
1897+ {SAHPI_ENT_OTHER_CHASSIS_BOARD, "SAHPI_ENT_OTHER_CHASSIS_BOARD"},
1898+ {SAHPI_ENT_DISK_DRIVE_BAY, "SAHPI_ENT_DISK_DRIVE_BAY"},
1899+ {SAHPI_ENT_PERIPHERAL_BAY_2, "SAHPI_ENT_PERIPHERAL_BAY_2"},
1900+ {SAHPI_ENT_DEVICE_BAY, "SAHPI_ENT_DEVICE_BAY"},
1901+ {SAHPI_ENT_COOLING_DEVICE, "SAHPI_ENT_COOLING_DEVICE"},
1902+ {SAHPI_ENT_COOLING_UNIT, "SAHPI_ENT_COOLING_UNIT"},
1903+ {SAHPI_ENT_INTERCONNECT, "SAHPI_ENT_INTERCONNECT"},
1904+ {SAHPI_ENT_MEMORY_DEVICE, "SAHPI_ENT_MEMORY_DEVICE"},
1905+ {SAHPI_ENT_SYS_MGMNT_SOFTWARE, "SAHPI_ENT_SYS_MGMNT_SOFTWARE"},
1906+ {SAHPI_ENT_BIOS, "SAHPI_ENT_BIOS"},
1907+ {SAHPI_ENT_OPERATING_SYSTEM, "SAHPI_ENT_OPERATING_SYSTEM"},
1908+ {SAHPI_ENT_SYSTEM_BUS, "SAHPI_ENT_SYSTEM_BUS"},
1909+ {SAHPI_ENT_GROUP, "SAHPI_ENT_GROUP"},
1910+ {SAHPI_ENT_REMOTE, "SAHPI_ENT_REMOTE"},
1911+ {SAHPI_ENT_EXTERNAL_ENVIRONMENT, "SAHPI_ENT_EXTERNAL_ENVIRONMENT"},
1912+ {SAHPI_ENT_BATTERY, "SAHPI_ENT_BATTERY"},
1913+ {SAHPI_ENT_CHASSIS_SPECIFIC, "SAHPI_ENT_CHASSIS_SPECIFIC"},
1914+ {SAHPI_ENT_BOARD_SET_SPECIFIC, "SAHPI_ENT_BOARD_SET_SPECIFIC"},
1915+ {SAHPI_ENT_OEM_SYSINT_SPECIFIC, "SAHPI_ENT_OEM_SYSINT_SPECIFIC"},
1916+ {SAHPI_ENT_ROOT, "SAHPI_ENT_ROOT"},
1917+ {SAHPI_ENT_RACK, "SAHPI_ENT_RACK"},
1918+ {SAHPI_ENT_SUBRACK, "SAHPI_ENT_SUBRACK"},
1919+ {SAHPI_ENT_COMPACTPCI_CHASSIS, "SAHPI_ENT_COMPACTPCI_CHASSIS"},
1920+ {SAHPI_ENT_ADVANCEDTCA_CHASSIS, "SAHPI_ENT_ADVANCEDTCA_CHASSIS"},
1921+ {SAHPI_ENT_RACK_MOUNTED_SERVER, "SAHPI_ENT_RACK_MOUNTED_SERVER"},
1922+ {SAHPI_ENT_SYSTEM_BLADE, "SAHPI_ENT_SYSTEM_BLADE"},
1923+ {SAHPI_ENT_SWITCH, "SAHPI_ENT_SWITCH"},
1924+ {SAHPI_ENT_SWITCH_BLADE, "SAHPI_ENT_SWITCH_BLADE"},
1925+ {SAHPI_ENT_SBC_BLADE, "SAHPI_ENT_SBC_BLADE"},
1926+ {SAHPI_ENT_IO_BLADE, "SAHPI_ENT_IO_BLADE"},
1927+ {SAHPI_ENT_DISK_BLADE, "SAHPI_ENT_DISK_BLADE"},
1928+ {SAHPI_ENT_DISK_DRIVE, "SAHPI_ENT_DISK_DRIVE"},
1929+ {SAHPI_ENT_FAN, "SAHPI_ENT_FAN"},
1930+ {SAHPI_ENT_POWER_DISTRIBUTION_UNIT, "SAHPI_ENT_POWER_DISTRIBUTION_UNIT"},
1931+ {SAHPI_ENT_SPEC_PROC_BLADE, "SAHPI_ENT_SPEC_PROC_BLADE"},
1932+ {SAHPI_ENT_IO_SUBBOARD, "SAHPI_ENT_IO_SUBBOARD"},
1933+ {SAHPI_ENT_SBC_SUBBOARD, "SAHPI_ENT_SBC_SUBBOARD"},
1934+ {SAHPI_ENT_ALARM_MANAGER, "SAHPI_ENT_ALARM_MANAGER"},
1935+ {SAHPI_ENT_SHELF_MANAGER, "SAHPI_ENT_SHELF_MANAGER"},
1936+ {SAHPI_ENT_DISPLAY_PANEL, "SAHPI_ENT_DISPLAY_PANEL"},
1937+ {SAHPI_ENT_SUBBOARD_CARRIER_BLADE, "SAHPI_ENT_SUBBOARD_CARRIER_BLADE"},
1938+ {SAHPI_ENT_PHYSICAL_SLOT, "SAHPI_ENT_PHYSICAL_SLOT"},
1939+ {SAHPI_ENT_ROOT, NULL}
1940+};
1941+
1942+
1943+/**
1944+ * Translates a string to a valid SaHpiEntityTypeT type.
1945+ *
1946+ * @param strtype The entity type expressed as a string.
1947+ *
1948+ * @return SAHPI_OK on success, otherwise an HPI error code.
1949+ */
1950+SaHpiEntityTypeT oSaHpiTypesEnums::str2entitytype(const char *strtype) {
1951+ int i;
1952+
1953+ if (strtype == NULL) {
1954+ return SAHPI_ENT_ROOT;
1955+ }
1956+ for (i = 0; entitytype_strings[i].str != NULL; i++) {
1957+ if (strcmp(strtype, entitytype_strings[i].str) == 0) {
1958+ return entitytype_strings[i].type;
1959+ }
1960+ }
1961+ return SAHPI_ENT_ROOT;
1962+}
1963+
1964+
1965+/**
1966+ * Translates an entity type to a string.
1967+ *
1968+ * @param value The SaHpiEntityTypeT to be converted.
1969+ *
1970+ * @return The string value of the type.
1971+ */
1972+const char * oSaHpiTypesEnums::entitytype2str(SaHpiEntityTypeT value) {
1973+ int i;
1974+
1975+ for (i = 0; entitytype_strings[i].str != NULL; i++) {
1976+ if (value == entitytype_strings[i].type) {
1977+ return entitytype_strings[i].str;
1978+ }
1979+ }
1980+ return "Unknown";
1981+}
1982+
1983+
1984+static struct sensorreadingtype_map {
1985+ SaHpiSensorReadingTypeT type;
1986+ const char *str;
1987+} sensorreadingtype_strings[] = {
1988+ {SAHPI_SENSOR_READING_TYPE_INT64, "SAHPI_SENSOR_READING_TYPE_INT64"},
1989+ {SAHPI_SENSOR_READING_TYPE_UINT64, "SAHPI_SENSOR_READING_TYPE_UINT64"},
1990+ {SAHPI_SENSOR_READING_TYPE_FLOAT64, "SAHPI_SENSOR_READING_TYPE_FLOAT64"},
1991+ {SAHPI_SENSOR_READING_TYPE_BUFFER, "SAHPI_SENSOR_READING_TYPE_BUFFER"},
1992+ {SAHPI_SENSOR_READING_TYPE_BUFFER, NULL},
1993+};
1994+
1995+
1996+/**
1997+ * Translates a string to a valid SaHpiSensorReadingTypeT type.
1998+ *
1999+ * @param strtype The entity type expressed as a string.
2000+ *
2001+ * @return SAHPI_OK on success, otherwise an HPI error code.
2002+ */
2003+SaHpiSensorReadingTypeT oSaHpiTypesEnums::str2sensorreadingtype(const char *strtype) {
2004+ int i;
2005+
2006+ if (strtype == NULL) {
2007+ return SAHPI_SENSOR_READING_TYPE_INT64;
2008+ }
2009+ for (i = 0; sensorreadingtype_strings[i].str != NULL; i++) {
2010+ if (strcmp(strtype, sensorreadingtype_strings[i].str) == 0) {
2011+ return sensorreadingtype_strings[i].type;
2012+ }
2013+ }
2014+ return SAHPI_SENSOR_READING_TYPE_INT64;
2015+}
2016+
2017+
2018+/**
2019+ * Translates an sensor reading type to a string.
2020+ *
2021+ * @param value The SaHpiSensorReadingTypeT to be converted.
2022+ *
2023+ * @return The string value of the type.
2024+ */
2025+const char * oSaHpiTypesEnums::sensorreadingtype2str(SaHpiSensorReadingTypeT value) {
2026+ int i;
2027+
2028+ for (i = 0; sensorreadingtype_strings[i].str != NULL; i++) {
2029+ if (value == sensorreadingtype_strings[i].type) {
2030+ return sensorreadingtype_strings[i].str;
2031+ }
2032+ }
2033+ return "Unknown";
2034+}
2035+
2036+
2037+static struct sensorunits_map {
2038+ SaHpiSensorUnitsT type;
2039+ const char *str;
2040+} sensorunits_strings[] = {
2041+ {SAHPI_SU_UNSPECIFIED, "SAHPI_SU_UNSPECIFIED"},
2042+ {SAHPI_SU_DEGREES_C, "SAHPI_SU_DEGREES_C"},
2043+ {SAHPI_SU_DEGREES_F, "SAHPI_SU_DEGREES_F"},
2044+ {SAHPI_SU_DEGREES_K, "SAHPI_SU_DEGREES_K"},
2045+ {SAHPI_SU_VOLTS, "SAHPI_SU_VOLTS"},
2046+ {SAHPI_SU_AMPS, "SAHPI_SU_AMPS"},
2047+ {SAHPI_SU_WATTS, "SAHPI_SU_WATTS"},
2048+ {SAHPI_SU_JOULES, "SAHPI_SU_JOULES"},
2049+ {SAHPI_SU_COULOMBS, "SAHPI_SU_COULOMBS"},
2050+ {SAHPI_SU_VA, "SAHPI_SU_VA"},
2051+ {SAHPI_SU_NITS, "SAHPI_SU_NITS"},
2052+ {SAHPI_SU_LUMEN, "SAHPI_SU_LUMEN"},
2053+ {SAHPI_SU_LUX, "SAHPI_SU_LUX"},
2054+ {SAHPI_SU_CANDELA, "SAHPI_SU_CANDELA"},
2055+ {SAHPI_SU_KPA, "SAHPI_SU_KPA"},
2056+ {SAHPI_SU_PSI, "SAHPI_SU_PSI"},
2057+ {SAHPI_SU_NEWTON, "SAHPI_SU_NEWTON"},
2058+ {SAHPI_SU_CFM, "SAHPI_SU_CFM"},
2059+ {SAHPI_SU_RPM, "SAHPI_SU_RPM"},
2060+ {SAHPI_SU_HZ, "SAHPI_SU_HZ"},
2061+ {SAHPI_SU_MICROSECOND, "SAHPI_SU_MICROSECOND"},
2062+ {SAHPI_SU_MILLISECOND, "SAHPI_SU_MILLISECOND"},
2063+ {SAHPI_SU_SECOND, "SAHPI_SU_SECOND"},
2064+ {SAHPI_SU_MINUTE, "SAHPI_SU_MINUTE"},
2065+ {SAHPI_SU_HOUR, "SAHPI_SU_HOUR"},
2066+ {SAHPI_SU_DAY, "SAHPI_SU_DAY"},
2067+ {SAHPI_SU_WEEK, "SAHPI_SU_WEEK"},
2068+ {SAHPI_SU_MIL, "SAHPI_SU_MIL"},
2069+ {SAHPI_SU_INCHES, "SAHPI_SU_INCHES"},
2070+ {SAHPI_SU_FEET, "SAHPI_SU_FEET"},
2071+ {SAHPI_SU_CU_IN, "SAHPI_SU_CU_IN"},
2072+ {SAHPI_SU_CU_FEET, "SAHPI_SU_CU_FEET"},
2073+ {SAHPI_SU_MM, "SAHPI_SU_MM"},
2074+ {SAHPI_SU_CM, "SAHPI_SU_CM"},
2075+ {SAHPI_SU_M, "SAHPI_SU_M"},
2076+ {SAHPI_SU_CU_CM, "SAHPI_SU_CU_CM"},
2077+ {SAHPI_SU_CU_M, "SAHPI_SU_CU_M"},
2078+ {SAHPI_SU_LITERS, "SAHPI_SU_LITERS"},
2079+ {SAHPI_SU_FLUID_OUNCE, "SAHPI_SU_FLUID_OUNCE"},
2080+ {SAHPI_SU_RADIANS, "SAHPI_SU_RADIANS"},
2081+ {SAHPI_SU_STERADIANS, "SAHPI_SU_STERADIANS"},
2082+ {SAHPI_SU_REVOLUTIONS, "SAHPI_SU_REVOLUTIONS"},
2083+ {SAHPI_SU_CYCLES, "SAHPI_SU_CYCLES"},
2084+ {SAHPI_SU_GRAVITIES, "SAHPI_SU_GRAVITIES"},
2085+ {SAHPI_SU_OUNCE, "SAHPI_SU_OUNCE"},
2086+ {SAHPI_SU_POUND, "SAHPI_SU_POUND"},
2087+ {SAHPI_SU_FT_LB, "SAHPI_SU_FT_LB"},
2088+ {SAHPI_SU_OZ_IN, "SAHPI_SU_OZ_IN"},
2089+ {SAHPI_SU_GAUSS, "SAHPI_SU_GAUSS"},
2090+ {SAHPI_SU_GILBERTS, "SAHPI_SU_GILBERTS"},
2091+ {SAHPI_SU_HENRY, "SAHPI_SU_HENRY"},
2092+ {SAHPI_SU_MILLIHENRY, "SAHPI_SU_MILLIHENRY"},
2093+ {SAHPI_SU_FARAD, "SAHPI_SU_FARAD"},
2094+ {SAHPI_SU_MICROFARAD, "SAHPI_SU_MICROFARAD"},
2095+ {SAHPI_SU_OHMS, "SAHPI_SU_OHMS"},
2096+ {SAHPI_SU_SIEMENS, "SAHPI_SU_SIEMENS"},
2097+ {SAHPI_SU_MOLE, "SAHPI_SU_MOLE"},
2098+ {SAHPI_SU_BECQUEREL, "SAHPI_SU_BECQUEREL"},
2099+ {SAHPI_SU_PPM, "SAHPI_SU_PPM"},
2100+ {SAHPI_SU_RESERVED, "SAHPI_SU_RESERVED"},
2101+ {SAHPI_SU_DECIBELS, "SAHPI_SU_DECIBELS"},
2102+ {SAHPI_SU_DBA, "SAHPI_SU_DBA"},
2103+ {SAHPI_SU_DBC, "SAHPI_SU_DBC"},
2104+ {SAHPI_SU_GRAY, "SAHPI_SU_GRAY"},
2105+ {SAHPI_SU_SIEVERT, "SAHPI_SU_SIEVERT"},
2106+ {SAHPI_SU_COLOR_TEMP_DEG_K, "SAHPI_SU_COLOR_TEMP_DEG_K"},
2107+ {SAHPI_SU_BIT, "SAHPI_SU_BIT"},
2108+ {SAHPI_SU_KILOBIT, "SAHPI_SU_KILOBIT"},
2109+ {SAHPI_SU_MEGABIT, "SAHPI_SU_MEGABIT"},
2110+ {SAHPI_SU_GIGABIT, "SAHPI_SU_GIGABIT"},
2111+ {SAHPI_SU_BYTE, "SAHPI_SU_BYTE"},
2112+ {SAHPI_SU_KILOBYTE, "SAHPI_SU_KILOBYTE"},
2113+ {SAHPI_SU_MEGABYTE, "SAHPI_SU_MEGABYTE"},
2114+ {SAHPI_SU_GIGABYTE, "SAHPI_SU_GIGABYTE"},
2115+ {SAHPI_SU_WORD, "SAHPI_SU_WORD"},
2116+ {SAHPI_SU_DWORD, "SAHPI_SU_DWORD"},
2117+ {SAHPI_SU_QWORD, "SAHPI_SU_QWORD"},
2118+ {SAHPI_SU_LINE, "SAHPI_SU_LINE"},
2119+ {SAHPI_SU_HIT, "SAHPI_SU_HIT"},
2120+ {SAHPI_SU_MISS, "SAHPI_SU_MISS"},
2121+ {SAHPI_SU_RETRY, "SAHPI_SU_RETRY"},
2122+ {SAHPI_SU_RESET, "SAHPI_SU_RESET"},
2123+ {SAHPI_SU_OVERRUN, "SAHPI_SU_OVERRUN"},
2124+ {SAHPI_SU_UNDERRUN, "SAHPI_SU_UNDERRUN"},
2125+ {SAHPI_SU_COLLISION, "SAHPI_SU_COLLISION"},
2126+ {SAHPI_SU_PACKETS, "SAHPI_SU_PACKETS"},
2127+ {SAHPI_SU_MESSAGES, "SAHPI_SU_MESSAGES"},
2128+ {SAHPI_SU_CHARACTERS, "SAHPI_SU_CHARACTERS"},
2129+ {SAHPI_SU_ERRORS, "SAHPI_SU_ERRORS"},
2130+ {SAHPI_SU_CORRECTABLE_ERRORS, "SAHPI_SU_CORRECTABLE_ERRORS"},
2131+ {SAHPI_SU_UNCORRECTABLE_ERRORS, "SAHPI_SU_UNCORRECTABLE_ERRORS"},
2132+ {SAHPI_SU_UNSPECIFIED, NULL}
2133+};
2134+
2135+
2136+/**
2137+ * Translates a string to a valid SaHpiSensorUnitsT type.
2138+ *
2139+ * @param strtype The entity type expressed as a string.
2140+ *
2141+ * @return SAHPI_OK on success, otherwise an HPI error code.
2142+ */
2143+SaHpiSensorUnitsT oSaHpiTypesEnums::str2sensorunits(const char *strtype) {
2144+ int i;
2145+
2146+ if (strtype == NULL) {
2147+ return SAHPI_SU_UNSPECIFIED;
2148+ }
2149+ for (i = 0; sensorunits_strings[i].str != NULL; i++) {
2150+ if (strcmp(strtype, sensorunits_strings[i].str) == 0) {
2151+ return sensorunits_strings[i].type;
2152+ }
2153+ }
2154+ return SAHPI_SU_UNSPECIFIED;
2155+}
2156+
2157+
2158+/**
2159+ * Translates an sensor reading type to a string.
2160+ *
2161+ * @param value The SaHpiSensorUnitsT to be converted.
2162+ *
2163+ * @return The string value of the type.
2164+ */
2165+const char * oSaHpiTypesEnums::sensorunits2str(SaHpiSensorUnitsT value) {
2166+ int i;
2167+
2168+ for (i = 0; sensorunits_strings[i].str != NULL; i++) {
2169+ if (value == sensorunits_strings[i].type) {
2170+ return sensorunits_strings[i].str;
2171+ }
2172+ }
2173+ return "Unknown";
2174+}
2175+
2176+
2177+static struct sensormodunituse_map {
2178+ SaHpiSensorModUnitUseT type;
2179+ const char *str;
2180+} sensormodunituse_strings[] = {
2181+ {SAHPI_SMUU_NONE, "SAHPI_SMUU_NONE"},
2182+ {SAHPI_SMUU_BASIC_OVER_MODIFIER, "SAHPI_SMUU_BASIC_OVER_MODIFIER"},
2183+ {SAHPI_SMUU_BASIC_TIMES_MODIFIER, "SAHPI_SMUU_BASIC_TIMES_MODIFIER"},
2184+ {SAHPI_SMUU_NONE, NULL}
2185+};
2186+
2187+
2188+/**
2189+ * Translates a string to a valid SaHpiSensorModUnitsUseT type.
2190+ *
2191+ * @param strtype The entity type expressed as a string.
2192+ *
2193+ * @return SAHPI_OK on success, otherwise an HPI error code.
2194+ */
2195+SaHpiSensorModUnitUseT oSaHpiTypesEnums::str2sensoruse(const char *strtype) {
2196+ int i;
2197+
2198+ if (strtype == NULL) {
2199+ return SAHPI_SMUU_NONE;
2200+ }
2201+ for (i = 0; sensormodunituse_strings[i].str != NULL; i++) {
2202+ if (strcmp(strtype, sensormodunituse_strings[i].str) == 0) {
2203+ return sensormodunituse_strings[i].type;
2204+ }
2205+ }
2206+ return SAHPI_SMUU_NONE;
2207+}
2208+
2209+
2210+/**
2211+ * Translates an sensor reading type to a string.
2212+ *
2213+ * @param value The SaHpiSensorModUnitUseT to be converted.
2214+ *
2215+ * @return The string value of the type.
2216+ */
2217+const char * oSaHpiTypesEnums::sensoruse2str(SaHpiSensorModUnitUseT value) {
2218+ int i;
2219+
2220+ for (i = 0; sensormodunituse_strings[i].str != NULL; i++) {
2221+ if (value == sensormodunituse_strings[i].type) {
2222+ return sensormodunituse_strings[i].str;
2223+ }
2224+ }
2225+ return "Unknown";
2226+}
2227+
2228+
2229+static struct sensorthdmasktype_map {
2230+ SaHpiSensorThdMaskT type;
2231+ const char *str;
2232+} sensorthdmask_strings[] = {
2233+ {SAHPI_STM_LOW_MINOR, "SAHPI_STM_LOW_MINOR"},
2234+ {SAHPI_STM_LOW_MAJOR, "SAHPI_STM_LOW_MAJOR"},
2235+ {SAHPI_STM_LOW_CRIT, "SAHPI_STM_LOW_CRIT"},
2236+ {SAHPI_STM_UP_MAJOR, "SAHPI_STM_UP_MAJOR"},
2237+ {SAHPI_STM_UP_MINOR, "SAHPI_STM_UP_MINOR"},
2238+ {SAHPI_STM_UP_CRIT, "SAHPI_STM_UP_CRIT"},
2239+ {SAHPI_STM_UP_HYSTERESIS, "SAHPI_STM_UP_HYSTERESIS"},
2240+ {SAHPI_STM_LOW_HYSTERESIS, "SAHPI_STM_LOW_HYSTERESIS"},
2241+ {0, NULL},
2242+};
2243+
2244+
2245+/**
2246+ * Translates a string to a valid SaHpiSensorThdMaskT type.
2247+ *
2248+ * @param strtype The entity type expressed as a string.
2249+ *
2250+ * @return SAHPI_OK on success, otherwise an HPI error code.
2251+ */
2252+SaHpiSensorThdMaskT oSaHpiTypesEnums::str2sensorthdmask(const char *strtype) {
2253+ int i;
2254+
2255+ if (strtype == NULL) {
2256+ return 0;
2257+ }
2258+ for (i = 0; sensorthdmask_strings[i].str != NULL; i++) {
2259+ if (strcmp(strtype, sensorthdmask_strings[i].str) == 0) {
2260+ return sensorthdmask_strings[i].type;
2261+ }
2262+ }
2263+ return 0;
2264+}
2265+
2266+
2267+/**
2268+ * Translates an sensor reading type to a string.
2269+ *
2270+ * @param value The SaHpiSensorThdMaskT to be converted.
2271+ *
2272+ * @return The string value of the type.
2273+ */
2274+const char * oSaHpiTypesEnums::sensorthdmask2str(SaHpiSensorThdMaskT value) {
2275+ int i;
2276+
2277+ for (i = 0; sensorthdmask_strings[i].str != NULL; i++) {
2278+ if (value == sensorthdmask_strings[i].type) {
2279+ return sensorthdmask_strings[i].str;
2280+ }
2281+ }
2282+ return "Unknown";
2283+}
2284+
2285+
2286+static struct sensoreventctrl_map {
2287+ SaHpiSensorEventCtrlT type;
2288+ const char *str;
2289+} sensoreventctrl_strings[] = {
2290+ {SAHPI_SEC_PER_EVENT, "SAHPI_SEC_PER_EVENT"},
2291+ {SAHPI_SEC_READ_ONLY_MASKS, "SAHPI_SEC_READ_ONLY_MASKS"},
2292+ {SAHPI_SEC_READ_ONLY, "SAHPI_SEC_READ_ONLY"},
2293+ {SAHPI_SEC_READ_ONLY, NULL}
2294+};
2295+
2296+
2297+/**
2298+ * Translates a string to a valid SaHpiSensorEventCtrlT type.
2299+ *
2300+ * @param strtype The entity type expressed as a string.
2301+ *
2302+ * @return SAHPI_OK on success, otherwise an HPI error code.
2303+ */
2304+SaHpiSensorEventCtrlT oSaHpiTypesEnums::str2sensoreventctrl(const char *strtype) {
2305+ int i;
2306+
2307+ if (strtype == NULL) {
2308+ return SAHPI_SEC_PER_EVENT;
2309+ }
2310+ for (i = 0; sensoreventctrl_strings[i].str != NULL; i++) {
2311+ if (strcmp(strtype, sensoreventctrl_strings[i].str) == 0) {
2312+ return sensoreventctrl_strings[i].type;
2313+ }
2314+ }
2315+ return SAHPI_SEC_PER_EVENT;
2316+}
2317+
2318+
2319+/**
2320+ * Translates an sensor reading type to a string.
2321+ *
2322+ * @param value The SaHpiSensorEventCtrlT to be converted.
2323+ *
2324+ * @return The string value of the type.
2325+ */
2326+const char * oSaHpiTypesEnums::sensoreventctrl2str(SaHpiSensorEventCtrlT value) {
2327+ int i;
2328+
2329+ for (i = 0; sensoreventctrl_strings[i].str != NULL; i++) {
2330+ if (value == sensoreventctrl_strings[i].type) {
2331+ return sensoreventctrl_strings[i].str;
2332+ }
2333+ }
2334+ return "Unknown";
2335+}
2336+
2337+
2338+static struct sensortype_map {
2339+ SaHpiSensorTypeT type;
2340+ const char *str;
2341+} sensortype_strings[] = {
2342+ {SAHPI_TEMPERATURE, "SAHPI_TEMPERATURE"},
2343+ {SAHPI_VOLTAGE, "SAHPI_VOLTAGE"},
2344+ {SAHPI_CURRENT, "SAHPI_CURRENT"},
2345+ {SAHPI_FAN, "SAHPI_FAN"},
2346+ {SAHPI_PHYSICAL_SECURITY, "SAHPI_PHYSICAL_SECURITY"},
2347+ {SAHPI_PLATFORM_VIOLATION, "SAHPI_PLATFORM_VIOLATION"},
2348+ {SAHPI_PROCESSOR, "SAHPI_PROCESSOR"},
2349+ {SAHPI_POWER_SUPPLY, "SAHPI_POWER_SUPPLY"},
2350+ {SAHPI_POWER_UNIT, "SAHPI_POWER_UNIT"},
2351+ {SAHPI_COOLING_DEVICE, "SAHPI_COOLING_DEVICE"},
2352+ {SAHPI_OTHER_UNITS_BASED_SENSOR, "SAHPI_OTHER_UNITS_BASED_SENSOR"},
2353+ {SAHPI_MEMORY, "SAHPI_MEMORY"},
2354+ {SAHPI_DRIVE_SLOT, "SAHPI_DRIVE_SLOT"},
2355+ {SAHPI_POST_MEMORY_RESIZE, "SAHPI_POST_MEMORY_RESIZE"},
2356+ {SAHPI_SYSTEM_FW_PROGRESS, "SAHPI_SYSTEM_FW_PROGRESS"},
2357+ {SAHPI_EVENT_LOGGING_DISABLED, "SAHPI_EVENT_LOGGING_DISABLED"},
2358+ {SAHPI_RESERVED1, "SAHPI_RESERVED1"},
2359+ {SAHPI_SYSTEM_EVENT, "SAHPI_SYSTEM_EVENT"},
2360+ {SAHPI_CRITICAL_INTERRUPT, "SAHPI_CRITICAL_INTERRUPT"},
2361+ {SAHPI_BUTTON, "SAHPI_BUTTON"},
2362+ {SAHPI_MODULE_BOARD, "SAHPI_MODULE_BOARD"},
2363+ {SAHPI_MICROCONTROLLER_COPROCESSOR, "SAHPI_MICROCONTROLLER_COPROCESSOR"},
2364+ {SAHPI_ADDIN_CARD, "SAHPI_ADDIN_CARD"},
2365+ {SAHPI_CHASSIS, "SAHPI_CHASSIS"},
2366+ {SAHPI_CHIP_SET, "SAHPI_CHIP_SET"},
2367+ {SAHPI_OTHER_FRU, "SAHPI_OTHER_FRU"},
2368+ {SAHPI_CABLE_INTERCONNECT, "SAHPI_CABLE_INTERCONNECT"},
2369+ {SAHPI_TERMINATOR, "SAHPI_TERMINATOR"},
2370+ {SAHPI_SYSTEM_BOOT_INITIATED, "SAHPI_SYSTEM_BOOT_INITIATED"},
2371+ {SAHPI_BOOT_ERROR, "SAHPI_BOOT_ERROR"},
2372+ {SAHPI_OS_BOOT, "SAHPI_OS_BOOT"},
2373+ {SAHPI_OS_CRITICAL_STOP, "SAHPI_OS_CRITICAL_STOP"},
2374+ {SAHPI_SLOT_CONNECTOR, "SAHPI_SLOT_CONNECTOR"},
2375+ {SAHPI_SYSTEM_ACPI_POWER_STATE, "SAHPI_SYSTEM_ACPI_POWER_STATE"},
2376+ {SAHPI_RESERVED2, "SAHPI_RESERVED2"},
2377+ {SAHPI_PLATFORM_ALERT, "SAHPI_PLATFORM_ALERT"},
2378+ {SAHPI_ENTITY_PRESENCE, "SAHPI_ENTITY_PRESENCE"},
2379+ {SAHPI_MONITOR_ASIC_IC, "SAHPI_MONITOR_ASIC_IC"},
2380+ {SAHPI_LAN, "SAHPI_LAN"},
2381+ {SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH, "SAHPI_MANAGEMENT_SUBSYSTEM_HEALTH"},
2382+ {SAHPI_BATTERY, "SAHPI_BATTERY"},
2383+ {SAHPI_OPERATIONAL, "SAHPI_OPERATIONAL"},
2384+ {SAHPI_OEM_SENSOR, "SAHPI_OEM_SENSOR"},
2385+ {SAHPI_OEM_SENSOR, NULL}
2386+};
2387+
2388+
2389+/**
2390+ * Translates a string to a valid SaHpiSensorTypeT type.
2391+ *
2392+ * @param strtype The entity type expressed as a string.
2393+ *
2394+ * @return SAHPI_OK on success, otherwise an HPI error code.
2395+ */
2396+SaHpiSensorTypeT oSaHpiTypesEnums::str2sensortype(const char *strtype) {
2397+ int i;
2398+
2399+ if (strtype == NULL) {
2400+ return SAHPI_TEMPERATURE;
2401+ }
2402+ for (i = 0; sensortype_strings[i].str != NULL; i++) {
2403+ if (strcmp(strtype, sensortype_strings[i].str) == 0) {
2404+ return sensortype_strings[i].type;
2405+ }
2406+ }
2407+ return SAHPI_TEMPERATURE;
2408+}
2409+
2410+
2411+/**
2412+ * Translates an sensor reading type to a string.
2413+ *
2414+ * @param value The SaHpiSensorTypeT to be converted.
2415+ *
2416+ * @return The string value of the type.
2417+ */
2418+const char * oSaHpiTypesEnums::sensortype2str(SaHpiSensorTypeT value) {
2419+ int i;
2420+
2421+ for (i = 0; sensortype_strings[i].str != NULL; i++) {
2422+ if (value == sensortype_strings[i].type) {
2423+ return sensortype_strings[i].str;
2424+ }
2425+ }
2426+ return "Unknown";
2427+}
2428+
2429+
2430+static struct eventcategory_map {
2431+ SaHpiEventCategoryT type;
2432+ const char *str;
2433+} eventcategory_strings[] = {
2434+ {SAHPI_EC_UNSPECIFIED, "SAHPI_EC_UNSPECIFIED"},
2435+ {SAHPI_EC_THRESHOLD, "SAHPI_EC_THRESHOLD"},
2436+ {SAHPI_EC_USAGE, "SAHPI_EC_USAGE"},
2437+ {SAHPI_EC_STATE, "SAHPI_EC_STATE"},
2438+ {SAHPI_EC_PRED_FAIL, "SAHPI_EC_PRED_FAIL"},
2439+ {SAHPI_EC_LIMIT, "SAHPI_EC_LIMIT"},
2440+ {SAHPI_EC_PERFORMANCE, "SAHPI_EC_PERFORMANCE"},
2441+ {SAHPI_EC_SEVERITY, "SAHPI_EC_SEVERITY"},
2442+ {SAHPI_EC_PRESENCE, "SAHPI_EC_PRESENCE"},
2443+ {SAHPI_EC_ENABLE, "SAHPI_EC_ENABLE"},
2444+ {SAHPI_EC_AVAILABILITY, "SAHPI_EC_AVAILABILITY"},
2445+ {SAHPI_EC_REDUNDANCY, "SAHPI_EC_REDUNDANCY"},
2446+ {SAHPI_EC_SENSOR_SPECIFIC, "SAHPI_EC_SENSOR_SPECIFIC"},
2447+ {SAHPI_EC_GENERIC, "SAHPI_EC_GENERIC"},
2448+ {SAHPI_EC_GENERIC, NULL},
2449+};
2450+
2451+
2452+/**
2453+ * Translates a string to a valid SaHpiEventCategoryT type.
2454+ *
2455+ * @param strtype The entity type expressed as a string.
2456+ *
2457+ * @return SAHPI_OK on success, otherwise an HPI error code.
2458+ */
2459+SaHpiEventCategoryT oSaHpiTypesEnums::str2eventcategory(const char *strtype) {
2460+ int i;
2461+
2462+ if (strtype == NULL) {
2463+ return SAHPI_EC_UNSPECIFIED;
2464+ }
2465+ for (i = 0; eventcategory_strings[i].str != NULL; i++) {
2466+ if (strcmp(strtype, eventcategory_strings[i].str) == 0) {
2467+ return eventcategory_strings[i].type;
2468+ }
2469+ }
2470+ return SAHPI_EC_UNSPECIFIED;
2471+}
2472+
2473+
2474+/**
2475+ * Translates an sensor reading type to a string.
2476+ *
2477+ * @param value The SaHpiEventCategoryT to be converted.
2478+ *
2479+ * @return The string value of the type.
2480+ */
2481+const char * oSaHpiTypesEnums::eventcategory2str(SaHpiEventCategoryT value) {
2482+ int i;
2483+
2484+ for (i = 0; eventcategory_strings[i].str != NULL; i++) {
2485+ if (value == eventcategory_strings[i].type) {
2486+ return eventcategory_strings[i].str;
2487+ }
2488+ }
2489+ return "Unknown";
2490+}
2491+
2492+
2493+static struct eventstate_map {
2494+ SaHpiEventStateT type;
2495+ const char *str;
2496+} eventstate_strings[] = {
2497+ {SAHPI_ES_UNSPECIFIED, "SAHPI_ES_UNSPECIFIED"},
2498+ {SAHPI_ES_LOWER_MINOR, "SAHPI_ES_LOWER_MINOR"},
2499+ {SAHPI_ES_LOWER_MAJOR, "SAHPI_ES_LOWER_MAJOR"},
2500+ {SAHPI_ES_LOWER_CRIT, "SAHPI_ES_LOWER_CRIT"},
2501+ {SAHPI_ES_UPPER_MINOR, "SAHPI_ES_UPPER_MINOR"},
2502+ {SAHPI_ES_UPPER_MAJOR, "SAHPI_ES_UPPER_MAJOR"},
2503+ {SAHPI_ES_UPPER_CRIT, "SAHPI_ES_UPPER_CRIT"},
2504+ {SAHPI_ES_IDLE, "SAHPI_ES_IDLE"},
2505+ {SAHPI_ES_ACTIVE, "SAHPI_ES_ACTIVE"},
2506+ {SAHPI_ES_BUSY, "SAHPI_ES_BUSY"},
2507+ {SAHPI_ES_STATE_DEASSERTED, "SAHPI_ES_STATE_DEASSERTED"},
2508+ {SAHPI_ES_STATE_ASSERTED, "SAHPI_ES_STATE_ASSERTED"},
2509+ {SAHPI_ES_PRED_FAILURE_DEASSERT, "SAHPI_ES_PRED_FAILURE_DEASSERT"},
2510+ {SAHPI_ES_PRED_FAILURE_ASSERT, "SAHPI_ES_PRED_FAILURE_ASSERT"},
2511+ {SAHPI_ES_LIMIT_NOT_EXCEEDED, "SAHPI_ES_LIMIT_NOT_EXCEEDED"},
2512+ {SAHPI_ES_LIMIT_EXCEEDED, "SAHPI_ES_LIMIT_EXCEEDED"},
2513+ {SAHPI_ES_PERFORMANCE_MET, "SAHPI_ES_PERFORMANCE_MET"},
2514+ {SAHPI_ES_PERFORMANCE_LAGS, "SAHPI_ES_PERFORMANCE_LAGS"},
2515+ {SAHPI_ES_OK, "SAHPI_ES_OK"},
2516+ {SAHPI_ES_MINOR_FROM_OK, "SAHPI_ES_MINOR_FROM_OK"},
2517+ {SAHPI_ES_MAJOR_FROM_LESS, "SAHPI_ES_MAJOR_FROM_LESS"},
2518+ {SAHPI_ES_CRITICAL_FROM_LESS, "SAHPI_ES_CRITICAL_FROM_LESS"},
2519+ {SAHPI_ES_MINOR_FROM_MORE, "SAHPI_ES_MINOR_FROM_MORE"},
2520+ {SAHPI_ES_MAJOR_FROM_CRITICAL, "SAHPI_ES_MAJOR_FROM_CRITICAL"},
2521+ {SAHPI_ES_CRITICAL, "SAHPI_ES_CRITICAL"},
2522+ {SAHPI_ES_MONITOR, "SAHPI_ES_MONITOR"},
2523+ {SAHPI_ES_INFORMATIONAL, "SAHPI_ES_INFORMATIONAL"},
2524+ {SAHPI_ES_ABSENT, "SAHPI_ES_ABSENT"},
2525+ {SAHPI_ES_PRESENT, "SAHPI_ES_PRESENT"},
2526+ {SAHPI_ES_DISABLED, "SAHPI_ES_DISABLED"},
2527+ {SAHPI_ES_ENABLED, "SAHPI_ES_ENABLED"},
2528+ {SAHPI_ES_RUNNING, "SAHPI_ES_RUNNING"},
2529+ {SAHPI_ES_TEST, "SAHPI_ES_TEST"},
2530+ {SAHPI_ES_POWER_OFF, "SAHPI_ES_POWER_OFF"},
2531+ {SAHPI_ES_ON_LINE, "SAHPI_ES_ON_LINE"},
2532+ {SAHPI_ES_OFF_LINE, "SAHPI_ES_OFF_LINE"},
2533+ {SAHPI_ES_OFF_DUTY, "SAHPI_ES_OFF_DUTY"},
2534+ {SAHPI_ES_DEGRADED, "SAHPI_ES_DEGRADED"},
2535+ {SAHPI_ES_POWER_SAVE, "SAHPI_ES_POWER_SAVE"},
2536+ {SAHPI_ES_INSTALL_ERROR, "SAHPI_ES_INSTALL_ERROR"},
2537+ {SAHPI_ES_FULLY_REDUNDANT, "SAHPI_ES_FULLY_REDUNDANT"},
2538+ {SAHPI_ES_REDUNDANCY_LOST, "SAHPI_ES_REDUNDANCY_LOST"},
2539+ {SAHPI_ES_REDUNDANCY_DEGRADED, "SAHPI_ES_REDUNDANCY_DEGRADED"},
2540+ {SAHPI_ES_REDUNDANCY_LOST_SUFFICIENT_RESOURCES, "SAHPI_ES_REDUNDANCY_LOST_SUFFICIENT_RESOURCES"},
2541+ {SAHPI_ES_NON_REDUNDANT_SUFFICIENT_RESOURCES, "SAHPI_ES_NON_REDUNDANT_SUFFICIENT_RESOURCES"},
2542+ {SAHPI_ES_NON_REDUNDANT_INSUFFICIENT_RESOURCES, "SAHPI_ES_NON_REDUNDANT_INSUFFICIENT_RESOURCES"},
2543+ {SAHPI_ES_REDUNDANCY_DEGRADED_FROM_FULL, "SAHPI_ES_REDUNDANCY_DEGRADED_FROM_FULL"},
2544+ {SAHPI_ES_REDUNDANCY_DEGRADED_FROM_NON, "SAHPI_ES_REDUNDANCY_DEGRADED_FROM_NON"},
2545+ {SAHPI_ES_STATE_00, "SAHPI_ES_STATE_00"},
2546+ {SAHPI_ES_STATE_01, "SAHPI_ES_STATE_01"},
2547+ {SAHPI_ES_STATE_02, "SAHPI_ES_STATE_02"},
2548+ {SAHPI_ES_STATE_03, "SAHPI_ES_STATE_03"},
2549+ {SAHPI_ES_STATE_04, "SAHPI_ES_STATE_04"},
2550+ {SAHPI_ES_STATE_05, "SAHPI_ES_STATE_05"},
2551+ {SAHPI_ES_STATE_06, "SAHPI_ES_STATE_06"},
2552+ {SAHPI_ES_STATE_07, "SAHPI_ES_STATE_07"},
2553+ {SAHPI_ES_STATE_08, "SAHPI_ES_STATE_08"},
2554+ {SAHPI_ES_STATE_09, "SAHPI_ES_STATE_09"},
2555+ {SAHPI_ES_STATE_10, "SAHPI_ES_STATE_10"},
2556+ {SAHPI_ES_STATE_11, "SAHPI_ES_STATE_11"},
2557+ {SAHPI_ES_STATE_12, "SAHPI_ES_STATE_12"},
2558+ {SAHPI_ES_STATE_13, "SAHPI_ES_STATE_13"},
2559+ {SAHPI_ES_STATE_14, "SAHPI_ES_STATE_14"},
2560+ {SAHPI_ES_STATE_14, NULL}
2561+};
2562+
2563+
2564+/**
2565+ * Translates a string to a valid SaHpiEventStateT type.
2566+ *
2567+ * @param strtype The entity type expressed as a string.
2568+ *
2569+ * @return SAHPI_OK on success, otherwise an HPI error code.
2570+ */
2571+SaHpiEventStateT oSaHpiTypesEnums::str2eventstate(const char *strtype) {
2572+ int i;
2573+
2574+ if (strtype == NULL) {
2575+ return SAHPI_ES_UNSPECIFIED;
2576+ }
2577+ for (i = 0; eventstate_strings[i].str != NULL; i++) {
2578+ if (strcmp(strtype, eventstate_strings[i].str) == 0) {
2579+ return eventstate_strings[i].type;
2580+ }
2581+ }
2582+ return SAHPI_ES_UNSPECIFIED;
2583+}
2584+
2585+
2586+/**
2587+ * Translates an sensor reading type to a string.
2588+ *
2589+ * @param value The SaHpiEventStateT to be converted.
2590+ *
2591+ * @return The string value of the type.
2592+ */
2593+const char * oSaHpiTypesEnums::eventstate2str(SaHpiEventStateT value) {
2594+ int i;
2595+
2596+ for (i = 0; eventstate_strings[i].str != NULL; i++) {
2597+ if (value == eventstate_strings[i].type) {
2598+ return eventstate_strings[i].str;
2599+ }
2600+ }
2601+ return "Unknown";
2602+}
2603+
2604+
2605+static struct ctrltype_map {
2606+ SaHpiCtrlTypeT type;
2607+ const char *str;
2608+} ctrltype_strings[] = {
2609+ {SAHPI_CTRL_TYPE_DIGITAL, "SAHPI_CTRL_TYPE_DIGITAL"},
2610+ {SAHPI_CTRL_TYPE_DISCRETE, "SAHPI_CTRL_TYPE_DISCRETE"},
2611+ {SAHPI_CTRL_TYPE_ANALOG, "SAHPI_CTRL_TYPE_ANALOG"},
2612+ {SAHPI_CTRL_TYPE_STREAM, "SAHPI_CTRL_TYPE_STREAM"},
2613+ {SAHPI_CTRL_TYPE_TEXT, "SAHPI_CTRL_TYPE_TEXT"},
2614+ {SAHPI_CTRL_TYPE_OEM, "SAHPI_CTRL_TYPE_OEM"},
2615+ {SAHPI_CTRL_TYPE_OEM, NULL}
2616+};
2617+
2618+
2619+/**
2620+ * Translates a string to a valid SaHpiCtrlTypeT type.
2621+ *
2622+ * @param strtype The entity type expressed as a string.
2623+ *
2624+ * @return SAHPI_OK on success, otherwise an HPI error code.
2625+ */
2626+SaHpiCtrlTypeT oSaHpiTypesEnums::str2ctrltype(const char *strtype) {
2627+ int i;
2628+
2629+ if (strtype == NULL) {
2630+ return SAHPI_CTRL_TYPE_DIGITAL;
2631+ }
2632+ for (i = 0; ctrltype_strings[i].str != NULL; i++) {
2633+ if (strcmp(strtype, ctrltype_strings[i].str) == 0) {
2634+ return ctrltype_strings[i].type;
2635+ }
2636+ }
2637+ return SAHPI_CTRL_TYPE_DIGITAL;
2638+}
2639+
2640+
2641+/**
2642+ * Translates an sensor reading type to a string.
2643+ *
2644+ * @param value The SaHpiCtrlTypeT to be converted.
2645+ *
2646+ * @return The string value of the type.
2647+ */
2648+const char * oSaHpiTypesEnums::ctrltype2str(SaHpiCtrlTypeT value) {
2649+ int i;
2650+
2651+ for (i = 0; ctrltype_strings[i].str != NULL; i++) {
2652+ if (value == ctrltype_strings[i].type) {
2653+ return ctrltype_strings[i].str;
2654+ }
2655+ }
2656+ return "Unknown";
2657+}
2658+
2659+
2660+static struct ctrlstatedigital_map {
2661+ SaHpiCtrlStateDigitalT type;
2662+ const char *str;
2663+} ctrlstatedigital_strings[] = {
2664+ {SAHPI_CTRL_STATE_OFF, "SAHPI_CTRL_STATE_OFF"},
2665+ {SAHPI_CTRL_STATE_ON, "SAHPI_CTRL_STATE_ON"},
2666+ {SAHPI_CTRL_STATE_PULSE_OFF, "SAHPI_CTRL_STATE_PULSE_OFF"},
2667+ {SAHPI_CTRL_STATE_PULSE_ON, "SAHPI_CTRL_STATE_PULSE_ON"},
2668+ {SAHPI_CTRL_STATE_PULSE_ON, NULL}
2669+};
2670+
2671+
2672+/**
2673+ * Translates a string to a valid SaHpiCtrlStateDigitalT type.
2674+ *
2675+ * @param strtype The entity type expressed as a string.
2676+ *
2677+ * @return SAHPI_OK on success, otherwise an HPI error code.
2678+ */
2679+SaHpiCtrlStateDigitalT oSaHpiTypesEnums::str2ctrlstatedigital(const char *strtype) {
2680+ int i;
2681+
2682+ if (strtype == NULL) {
2683+ return SAHPI_CTRL_STATE_OFF;
2684+ }
2685+ for (i = 0; ctrlstatedigital_strings[i].str != NULL; i++) {
2686+ if (strcmp(strtype, ctrlstatedigital_strings[i].str) == 0) {
2687+ return ctrlstatedigital_strings[i].type;
2688+ }
2689+ }
2690+ return SAHPI_CTRL_STATE_OFF;
2691+}
2692+
2693+
2694+/**
2695+ * Translates an sensor reading type to a string.
2696+ *
2697+ * @param value The SaHpiCtrlStateDigitalT to be converted.
2698+ *
2699+ * @return The string value of the type.
2700+ */
2701+const char * oSaHpiTypesEnums::ctrlstatedigital2str(SaHpiCtrlStateDigitalT value) {
2702+ int i;
2703+
2704+ for (i = 0; ctrlstatedigital_strings[i].str != NULL; i++) {
2705+ if (value == ctrlstatedigital_strings[i].type) {
2706+ return ctrlstatedigital_strings[i].str;
2707+ }
2708+ }
2709+ return "Unknown";
2710+}
2711+
2712+
2713+static struct aggregatestatus_map {
2714+ SaHpiUint32T type;
2715+ const char *str;
2716+} aggregatestatus_strings[] = {
2717+ {SAHPI_DEFAGSENS_OPER, "SAHPI_DEFAGSENS_OPRR"},
2718+ {SAHPI_DEFAGSENS_PWR, "SAHPI_DEFAGSENS_PWR"},
2719+ {SAHPI_DEFAGSENS_TEMP, "SAHPI_DEFAGSENS_TEMP"},
2720+ {SAHPI_DEFAGSENS_MIN, "SAHPI_DEFAGSENS_MIN"},
2721+ {SAHPI_DEFAGSENS_MAX, "SAHPI_DEFAGSENS_MAX"},
2722+ {SAHPI_DEFAGSENS_MAX, NULL}
2723+};
2724+
2725+
2726+/**
2727+ * Translates a string to a valid SaHpiUint32T type.
2728+ *
2729+ * @param strtype The entity type expressed as a string.
2730+ *
2731+ * @return SAHPI_OK on success, otherwise an HPI error code.
2732+ */
2733+SaHpiUint32T oSaHpiTypesEnums::str2aggregatestatus(const char *strtype) {
2734+ int i;
2735+
2736+ if (strtype == NULL) {
2737+ return 0;
2738+ }
2739+ for (i = 0; aggregatestatus_strings[i].str != NULL; i++) {
2740+ if (strcmp(strtype, aggregatestatus_strings[i].str) == 0) {
2741+ return aggregatestatus_strings[i].type;
2742+ }
2743+ }
2744+ return 0;
2745+}
2746+
2747+
2748+/**
2749+ * Translates an sensor aggregate status type to a string.
2750+ *
2751+ * @param value The SaHpiUint32T to be converted.
2752+ *
2753+ * @return The string value of the type.
2754+ */
2755+const char * oSaHpiTypesEnums::aggregatestatus2str(SaHpiUint32T value) {
2756+ int i;
2757+
2758+ for (i = 0; aggregatestatus_strings[i].str != NULL; i++) {
2759+ if (value == aggregatestatus_strings[i].type) {
2760+ return aggregatestatus_strings[i].str;
2761+ }
2762+ }
2763+ return "Unknown";
2764+}
2765+
2766+
2767+static struct ctrloutputtype_map {
2768+ SaHpiCtrlOutputTypeT type;
2769+ const char *str;
2770+} ctrloutputtype_strings[] = {
2771+ {SAHPI_CTRL_GENERIC, "SAHPI_CTRL_GENERIC"},
2772+ {SAHPI_CTRL_LED, "SAHPI_CTRL_LED"},
2773+ {SAHPI_CTRL_FAN_SPEED, "SAHPI_CTRL_FAN_SPEED"},
2774+ {SAHPI_CTRL_DRY_CONTACT_CLOSURE, "SAHPI_CTRL_DRY_CONTACT_CLOSURE"},
2775+ {SAHPI_CTRL_POWER_SUPPLY_INHIBIT, "SAHPI_CTRL_POWER_SUPPLY_INHIBIT"},
2776+ {SAHPI_CTRL_AUDIBLE, "SAHPI_CTRL_AUDIBLE"},
2777+ {SAHPI_CTRL_FRONT_PANEL_LOCKOUT, "SAHPI_CTRL_FRONT_PANEL_LOCKOUT"},
2778+ {SAHPI_CTRL_POWER_INTERLOCK, "SAHPI_CTRL_POWER_INTERLOCK"},
2779+ {SAHPI_CTRL_POWER_STATE, "SAHPI_CTRL_POWER_STATE"},
2780+ {SAHPI_CTRL_LCD_DISPLAY, "SAHPI_CTRL_LCD_DISPLAY"},
2781+ {SAHPI_CTRL_OEM, "SAHPI_CTRL_OEM"},
2782+ {SAHPI_CTRL_OEM, NULL}
2783+};
2784+
2785+
2786+/**
2787+ * Translates a string to a valid SaHpiCtrlOutputTypeT type.
2788+ *
2789+ * @param strtype The entity type expressed as a string.
2790+ *
2791+ * @return SAHPI_OK on success, otherwise an HPI error code.
2792+ */
2793+SaHpiCtrlOutputTypeT oSaHpiTypesEnums::str2ctrloutputtype(const char *strtype) {
2794+ int i;
2795+
2796+ if (strtype == NULL) {
2797+ return SAHPI_CTRL_GENERIC;
2798+ }
2799+ for (i = 0; ctrloutputtype_strings[i].str != NULL; i++) {
2800+ if (strcmp(strtype, ctrloutputtype_strings[i].str) == 0) {
2801+ return ctrloutputtype_strings[i].type;
2802+ }
2803+ }
2804+ return SAHPI_CTRL_GENERIC;
2805+}
2806+
2807+
2808+/**
2809+ * Translates an sensor aggregate status type to a string.
2810+ *
2811+ * @param value The SaHpiCtrlOutputTypeT to be converted.
2812+ *
2813+ * @return The string value of the type.
2814+ */
2815+const char * oSaHpiTypesEnums::ctrloutputtype2str(SaHpiCtrlOutputTypeT value) {
2816+ int i;
2817+
2818+ for (i = 0; ctrloutputtype_strings[i].str != NULL; i++) {
2819+ if (value == ctrloutputtype_strings[i].type) {
2820+ return ctrloutputtype_strings[i].str;
2821+ }
2822+ }
2823+ return "Unknown";
2824+}
2825+
2826+
2827+static struct ctrlmode_map {
2828+ SaHpiCtrlModeT type;
2829+ const char *str;
2830+} ctrlmode_strings[] = {
2831+ {SAHPI_CTRL_MODE_AUTO, "SAHPI_CTRL_MODE_AUTO"},
2832+ {SAHPI_CTRL_MODE_MANUAL, "SAHPI_CTRL_MODE_MANUAL"},
2833+ {SAHPI_CTRL_MODE_MANUAL, NULL}
2834+};
2835+
2836+
2837+/**
2838+ * Translates a string to a valid SaHpiCtrlModeT type.
2839+ *
2840+ * @param strtype The entity type expressed as a string.
2841+ *
2842+ * @return SAHPI_OK on success, otherwise an HPI error code.
2843+ */
2844+SaHpiCtrlModeT oSaHpiTypesEnums::str2ctrlmode(const char *strtype) {
2845+ int i;
2846+
2847+ if (strtype == NULL) {
2848+ return SAHPI_CTRL_MODE_AUTO;
2849+ }
2850+ for (i = 0; ctrlmode_strings[i].str != NULL; i++) {
2851+ if (strcmp(strtype, ctrlmode_strings[i].str) == 0) {
2852+ return ctrlmode_strings[i].type;
2853+ }
2854+ }
2855+ return SAHPI_CTRL_MODE_AUTO;
2856+}
2857+
2858+
2859+/**
2860+ * Translates an sensor aggregate status type to a string.
2861+ *
2862+ * @param value The SaHpiCtrlModeT to be converted.
2863+ *
2864+ * @return The string value of the type.
2865+ */
2866+const char * oSaHpiTypesEnums::ctrlmode2str(SaHpiCtrlModeT value) {
2867+ int i;
2868+
2869+ for (i = 0; ctrlmode_strings[i].str != NULL; i++) {
2870+ if (value == ctrlmode_strings[i].type) {
2871+ return ctrlmode_strings[i].str;
2872+ }
2873+ }
2874+ return "Unknown";
2875+}
2876+
2877+
2878+static struct idrareatype_map {
2879+ SaHpiIdrAreaTypeT type;
2880+ const char *str;
2881+} idrareatype_strings[] = {
2882+ {SAHPI_IDR_AREATYPE_INTERNAL_USE, "SAHPI_IDR_AREATYPE_INTERNAL_USE"},
2883+ {SAHPI_IDR_AREATYPE_CHASSIS_INFO, "SAHPI_IDR_AREATYPE_CHASSIS_INFO"},
2884+ {SAHPI_IDR_AREATYPE_BOARD_INFO, "SAHPI_IDR_AREATYPE_BOARD_INFO"},
2885+ {SAHPI_IDR_AREATYPE_PRODUCT_INFO, "SAHPI_IDR_AREATYPE_PRODUCT_INFO"},
2886+ {SAHPI_IDR_AREATYPE_OEM, "SAHPI_IDR_AREATYPE_OEM"},
2887+ {SAHPI_IDR_AREATYPE_UNSPECIFIED, "SAHPI_IDR_AREATYPE_UNSPECIFIED"},
2888+ {SAHPI_IDR_AREATYPE_UNSPECIFIED, NULL}
2889+};
2890+
2891+
2892+/**
2893+ * Translates a string to a valid SaHpiIdrAreaTypeT type.
2894+ *
2895+ * @param strtype The entity type expressed as a string.
2896+ *
2897+ * @return SAHPI_OK on success, otherwise an HPI error code.
2898+ */
2899+SaHpiIdrAreaTypeT oSaHpiTypesEnums::str2idrareatype(const char *strtype) {
2900+ int i;
2901+
2902+ if (strtype == NULL) {
2903+ return SAHPI_IDR_AREATYPE_UNSPECIFIED;
2904+ }
2905+ for (i = 0; idrareatype_strings[i].str != NULL; i++) {
2906+ if (strcmp(strtype, idrareatype_strings[i].str) == 0) {
2907+ return idrareatype_strings[i].type;
2908+ }
2909+ }
2910+ return SAHPI_IDR_AREATYPE_UNSPECIFIED;
2911+}
2912+
2913+
2914+/**
2915+ * Translates an sensor aggregate status type to a string.
2916+ *
2917+ * @param value The SaHpiIdrAreaTypeT to be converted.
2918+ *
2919+ * @return The string value of the type.
2920+ */
2921+const char * oSaHpiTypesEnums::idrareatype2str(SaHpiIdrAreaTypeT value) {
2922+ int i;
2923+
2924+ for (i = 0; idrareatype_strings[i].str != NULL; i++) {
2925+ if (value == idrareatype_strings[i].type) {
2926+ return idrareatype_strings[i].str;
2927+ }
2928+ }
2929+ return "Unknown";
2930+}
2931+
2932+
2933+static struct idrfieldtype_map {
2934+ SaHpiIdrFieldTypeT type;
2935+ const char *str;
2936+} idrfieldtype_strings[] = {
2937+ {SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE, "SAHPI_IDR_FIELDTYPE_CHASSIS_TYPE"},
2938+ {SAHPI_IDR_FIELDTYPE_MFG_DATETIME, "SAHPI_IDR_FIELDTYPE_MFG_DATETIME"},
2939+ {SAHPI_IDR_FIELDTYPE_MANUFACTURER, "SAHPI_IDR_FIELDTYPE_MANUFACTURER"},
2940+ {SAHPI_IDR_FIELDTYPE_PRODUCT_NAME, "SAHPI_IDR_FIELDTYPE_PRODUCT_NAME"},
2941+ {SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION, "SAHPI_IDR_FIELDTYPE_PRODUCT_VERSION"},
2942+ {SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER, "SAHPI_IDR_FIELDTYPE_SERIAL_NUMBER"},
2943+ {SAHPI_IDR_FIELDTYPE_PART_NUMBER, "SAHPI_IDR_FIELDTYPE_PART_NUMBER"},
2944+ {SAHPI_IDR_FIELDTYPE_FILE_ID, "SAHPI_IDR_FIELDTYPE_FILE_ID"},
2945+ {SAHPI_IDR_FIELDTYPE_ASSET_TAG, "SAHPI_IDR_FIELDTYPE_ASSET_TAG"},
2946+ {SAHPI_IDR_FIELDTYPE_CUSTOM, "SAHPI_IDR_FIELDTYPE_CUSTOM"},
2947+ {SAHPI_IDR_FIELDTYPE_UNSPECIFIED, "SAHPI_IDR_FIELDTYPE_UNSPECIFIED"},
2948+ {SAHPI_IDR_FIELDTYPE_UNSPECIFIED, NULL}
2949+};
2950+
2951+
2952+/**
2953+ * Translates a string to a valid SaHpiIdrFieldTypeT type.
2954+ *
2955+ * @param strtype The entity type expressed as a string.
2956+ *
2957+ * @return SAHPI_OK on success, otherwise an HPI error code.
2958+ */
2959+SaHpiIdrFieldTypeT oSaHpiTypesEnums::str2idrfieldtype(const char *strtype) {
2960+ int i;
2961+
2962+ if (strtype == NULL) {
2963+ return SAHPI_IDR_FIELDTYPE_UNSPECIFIED;
2964+ }
2965+ for (i = 0; idrfieldtype_strings[i].str != NULL; i++) {
2966+ if (strcmp(strtype, idrfieldtype_strings[i].str) == 0) {
2967+ return idrfieldtype_strings[i].type;
2968+ }
2969+ }
2970+ return SAHPI_IDR_FIELDTYPE_UNSPECIFIED;
2971+}
2972+
2973+
2974+/**
2975+ * Translates an sensor aggregate status type to a string.
2976+ *
2977+ * @param value The SaHpiIdrFieldTypeT to be converted.
2978+ *
2979+ * @return The string value of the type.
2980+ */
2981+const char * oSaHpiTypesEnums::idrfieldtype2str(SaHpiIdrFieldTypeT value) {
2982+ int i;
2983+
2984+ for (i = 0; idrfieldtype_strings[i].str != NULL; i++) {
2985+ if (value == idrfieldtype_strings[i].type) {
2986+ return idrfieldtype_strings[i].str;
2987+ }
2988+ }
2989+ return "Unknown";
2990+}
2991+
2992+
2993+static struct watchdogaction_map {
2994+ SaHpiWatchdogActionT type;
2995+ const char *str;
2996+} watchdogaction_strings[] = {
2997+ {SAHPI_WA_NO_ACTION, "SAHPI_WA_NO_ACTION"},
2998+ {SAHPI_WA_RESET, "SAHPI_WA_RESET"},
2999+ {SAHPI_WA_POWER_DOWN, "SAHPI_WA_POWER_DOWN"},
3000+ {SAHPI_WA_POWER_CYCLE, "SAHPI_WA_POWER_CYCLE"},
3001+ {SAHPI_WA_POWER_CYCLE, NULL}
3002+};
3003+
3004+
3005+/**
3006+ * Translates a string to a valid SaHpiWatchdogActionT type.
3007+ *
3008+ * @param strtype The entity type expressed as a string.
3009+ *
3010+ * @return SAHPI_OK on success, otherwise an HPI error code.
3011+ */
3012+SaHpiWatchdogActionT oSaHpiTypesEnums::str2watchdogaction(const char *strtype) {
3013+ int i;
3014+
3015+ if (strtype == NULL) {
3016+ return SAHPI_WA_NO_ACTION;
3017+ }
3018+ for (i = 0; watchdogaction_strings[i].str != NULL; i++) {
3019+ if (strcmp(strtype, watchdogaction_strings[i].str) == 0) {
3020+ return watchdogaction_strings[i].type;
3021+ }
3022+ }
3023+ return SAHPI_WA_NO_ACTION;
3024+}
3025+
3026+
3027+/**
3028+ * Translates an sensor aggregate status type to a string.
3029+ *
3030+ * @param value The SaHpiWatchdogActionT to be converted.
3031+ *
3032+ * @return The string value of the type.
3033+ */
3034+const char * oSaHpiTypesEnums::watchdogaction2str(SaHpiWatchdogActionT value) {
3035+ int i;
3036+
3037+ for (i = 0; watchdogaction_strings[i].str != NULL; i++) {
3038+ if (value == watchdogaction_strings[i].type) {
3039+ return watchdogaction_strings[i].str;
3040+ }
3041+ }
3042+ return "Unknown";
3043+}
3044+
3045+
3046+static struct watchdogactionevent_map {
3047+ SaHpiWatchdogActionEventT type;
3048+ const char *str;
3049+} watchdogactionevent_strings[] = {
3050+ {SAHPI_WAE_NO_ACTION, "SAHPI_WAE_NO_ACTION"},
3051+ {SAHPI_WAE_RESET, "SAHPI_WAE_RESET"},
3052+ {SAHPI_WAE_POWER_DOWN, "SAHPI_WAE_POWER_DOWN"},
3053+ {SAHPI_WAE_POWER_CYCLE, "SAHPI_WAE_POWER_CYCLE"},
3054+ {SAHPI_WAE_TIMER_INT, "SAHPI_WAE_TIMER_INT"},
3055+ {SAHPI_WAE_TIMER_INT, NULL}
3056+};
3057+
3058+
3059+/**
3060+ * Translates a string to a valid SaHpiWatchdogActionEventT type.
3061+ *
3062+ * @param strtype The entity type expressed as a string.
3063+ *
3064+ * @return SAHPI_OK on success, otherwise an HPI error code.
3065+ */
3066+SaHpiWatchdogActionEventT oSaHpiTypesEnums::str2watchdogactionevent(const char *strtype) {
3067+ int i;
3068+
3069+ if (strtype == NULL) {
3070+ return SAHPI_WAE_NO_ACTION;
3071+ }
3072+ for (i = 0; watchdogactionevent_strings[i].str != NULL; i++) {
3073+ if (strcmp(strtype, watchdogactionevent_strings[i].str) == 0) {
3074+ return watchdogactionevent_strings[i].type;
3075+ }
3076+ }
3077+ return SAHPI_WAE_NO_ACTION;
3078+}
3079+
3080+
3081+/**
3082+ * Translates an sensor aggregate status type to a string.
3083+ *
3084+ * @param value The SaHpiWatchdogActionEventT to be converted.
3085+ *
3086+ * @return The string value of the type.
3087+ */
3088+const char * oSaHpiTypesEnums::watchdogactionevent2str(SaHpiWatchdogActionEventT value) {
3089+ int i;
3090+
3091+ for (i = 0; watchdogactionevent_strings[i].str != NULL; i++) {
3092+ if (value == watchdogactionevent_strings[i].type) {
3093+ return watchdogactionevent_strings[i].str;
3094+ }
3095+ }
3096+ return "Unknown";
3097+}
3098+
3099+
3100+static struct watchdogpretimerinterrupt_map {
3101+ SaHpiWatchdogPretimerInterruptT type;
3102+ const char *str;
3103+} watchdogpretimerinterrupt_strings[] = {
3104+ {SAHPI_WPI_NONE, "SAHPI_WPI_NONE"},
3105+ {SAHPI_WPI_SMI, "SAHPI_WPI_SMI"},
3106+ {SAHPI_WPI_NMI, "SAHPI_WPI_NMI"},
3107+ {SAHPI_WPI_MESSAGE_INTERRUPT, "SAHPI_WPI_MESSAGE_INTERRUPT"},
3108+ {SAHPI_WPI_OEM, "SAHPI_WPI_OEM"},
3109+ {SAHPI_WPI_OEM, NULL}
3110+};
3111+
3112+
3113+/**
3114+ * Translates a string to a valid SaHpiWatchdogPretimerInterruptT type.
3115+ *
3116+ * @param strtype The entity type expressed as a string.
3117+ *
3118+ * @return SAHPI_OK on success, otherwise an HPI error code.
3119+ */
3120+SaHpiWatchdogPretimerInterruptT oSaHpiTypesEnums::str2watchdogpretimerinterrupt(const char *strtype) {
3121+ int i;
3122+
3123+ if (strtype == NULL) {
3124+ return SAHPI_WPI_NONE;
3125+ }
3126+ for (i = 0; watchdogpretimerinterrupt_strings[i].str != NULL; i++) {
3127+ if (strcmp(strtype, watchdogpretimerinterrupt_strings[i].str) == 0) {
3128+ return watchdogpretimerinterrupt_strings[i].type;
3129+ }
3130+ }
3131+ return SAHPI_WPI_NONE;
3132+}
3133+
3134+
3135+/**
3136+ * Translates an sensor aggregate status type to a string.
3137+ *
3138+ * @param value The SaHpiWatchdogPretimerInterruptT to be converted.
3139+ *
3140+ * @return The string value of the type.
3141+ */
3142+const char * oSaHpiTypesEnums::watchdogpretimerinterrupt2str(SaHpiWatchdogPretimerInterruptT value) {
3143+ int i;
3144+
3145+ for (i = 0; watchdogpretimerinterrupt_strings[i].str != NULL; i++) {
3146+ if (value == watchdogpretimerinterrupt_strings[i].type) {
3147+ return watchdogpretimerinterrupt_strings[i].str;
3148+ }
3149+ }
3150+ return "Unknown";
3151+}
3152+
3153+
3154+static struct watchdogtimeruse_map {
3155+ SaHpiWatchdogTimerUseT type;
3156+ const char *str;
3157+} watchdogtimeruse_strings[] = {
3158+ {SAHPI_WTU_NONE, "SAHPI_WTU_NONE"},
3159+ {SAHPI_WTU_BIOS_FRB2, "SAHPI_WTU_BIOS_FRB2"},
3160+ {SAHPI_WTU_BIOS_POST, "SAHPI_WTU_BIOS_POST"},
3161+ {SAHPI_WTU_OS_LOAD, "SAHPI_WTU_OS_LOAD"},
3162+ {SAHPI_WTU_SMS_OS, "SAHPI_WTU_SMS_OS"},
3163+ {SAHPI_WTU_OEM, "SAHPI_WTU_OEM"},
3164+ {SAHPI_WTU_UNSPECIFIED, "SAHPI_WTU_UNSPECIFIED"},
3165+ {SAHPI_WTU_UNSPECIFIED, NULL}
3166+};
3167+
3168+
3169+/**
3170+ * Translates a string to a valid SaHpiWatchdogTimerUseT type.
3171+ *
3172+ * @param strtype The entity type expressed as a string.
3173+ *
3174+ * @return SAHPI_OK on success, otherwise an HPI error code.
3175+ */
3176+SaHpiWatchdogTimerUseT oSaHpiTypesEnums::str2watchdogtimeruse(const char *strtype) {
3177+ int i;
3178+
3179+ if (strtype == NULL) {
3180+ return SAHPI_WTU_NONE;
3181+ }
3182+ for (i = 0; watchdogtimeruse_strings[i].str != NULL; i++) {
3183+ if (strcmp(strtype, watchdogtimeruse_strings[i].str) == 0) {
3184+ return watchdogtimeruse_strings[i].type;
3185+ }
3186+ }
3187+ return SAHPI_WTU_NONE;
3188+}
3189+
3190+
3191+/**
3192+ * Translates an sensor aggregate status type to a string.
3193+ *
3194+ * @param value The SaHpiWatchdogTimerUseT to be converted.
3195+ *
3196+ * @return The string value of the type.
3197+ */
3198+const char * oSaHpiTypesEnums::watchdogtimeruse2str(SaHpiWatchdogTimerUseT value) {
3199+ int i;
3200+
3201+ for (i = 0; watchdogtimeruse_strings[i].str != NULL; i++) {
3202+ if (value == watchdogtimeruse_strings[i].type) {
3203+ return watchdogtimeruse_strings[i].str;
3204+ }
3205+ }
3206+ return "Unknown";
3207+}
3208+
3209+
3210+static struct watchdogexpflags_map {
3211+ SaHpiWatchdogExpFlagsT type;
3212+ const char *str;
3213+} watchdogexpflags_strings[] = {
3214+ {SAHPI_WATCHDOG_EXP_BIOS_FRB2, "SAHPI_WATCHDOG_EXP_BIOS_FRB2"},
3215+ {SAHPI_WATCHDOG_EXP_BIOS_POST, "SAHPI_WATCHDOG_EXP_BIOS_POST"},
3216+ {SAHPI_WATCHDOG_EXP_OS_LOAD, "SAHPI_WATCHDOG_EXP_OS_LOAD"},
3217+ {SAHPI_WATCHDOG_EXP_SMS_OS, "SAHPI_WATCHDOG_EXP_SMS_OS"},
3218+ {SAHPI_WATCHDOG_EXP_OEM, "SAHPI_WATCHDOG_EXP_OEM"},
3219+ {SAHPI_WATCHDOG_EXP_OEM, NULL}
3220+};
3221+
3222+
3223+/**
3224+ * Translates a string to a valid SaHpiWatchdogExpFlagsT type.
3225+ *
3226+ * @param strtype The entity type expressed as a string.
3227+ *
3228+ * @return SAHPI_OK on success, otherwise an HPI error code.
3229+ */
3230+SaHpiWatchdogExpFlagsT oSaHpiTypesEnums::str2watchdogexpflags(const char *strtype) {
3231+ int i;
3232+
3233+ if (strtype == NULL) {
3234+ return SAHPI_WTU_NONE;
3235+ }
3236+ for (i = 0; watchdogexpflags_strings[i].str != NULL; i++) {
3237+ if (strcmp(strtype, watchdogexpflags_strings[i].str) == 0) {
3238+ return watchdogexpflags_strings[i].type;
3239+ }
3240+ }
3241+ return SAHPI_WTU_NONE;
3242+}
3243+
3244+
3245+/**
3246+ * Translates an sensor aggregate status type to a string.
3247+ *
3248+ * @param value The SaHpiWatchdogExpFlagsT to be converted.
3249+ *
3250+ * @return The string value of the type.
3251+ */
3252+const char * oSaHpiTypesEnums::watchdogexpflags2str(SaHpiWatchdogExpFlagsT value) {
3253+ int i;
3254+
3255+ for (i = 0; watchdogexpflags_strings[i].str != NULL; i++) {
3256+ if (value == watchdogexpflags_strings[i].type) {
3257+ return watchdogexpflags_strings[i].str;
3258+ }
3259+ }
3260+ return "Unknown";
3261+}
3262+
3263+
3264+static struct statuscondtype_map {
3265+ SaHpiStatusCondTypeT type;
3266+ const char *str;
3267+} statuscondtype_strings[] = {
3268+ {SAHPI_STATUS_COND_TYPE_SENSOR, "SAHPI_STATUS_COND_TYPE_SENSOR"},
3269+ {SAHPI_STATUS_COND_TYPE_RESOURCE, "SAHPI_STATUS_COND_TYPE_RESOURCE"},
3270+ {SAHPI_STATUS_COND_TYPE_OEM, "SAHPI_STATUS_COND_TYPE_OEM"},
3271+ {SAHPI_STATUS_COND_TYPE_USER, "SAHPI_STATUS_COND_TYPE_USER"},
3272+ {SAHPI_STATUS_COND_TYPE_USER, NULL}
3273+};
3274+
3275+
3276+/**
3277+ * Translates a string to a valid SaHpiStatusCondTypeT type.
3278+ *
3279+ * @param strtype The entity type expressed as a string.
3280+ *
3281+ * @return SAHPI_OK on success, otherwise an HPI error code.
3282+ */
3283+SaHpiStatusCondTypeT oSaHpiTypesEnums::str2statuscondtype(const char *strtype) {
3284+ int i;
3285+
3286+ if (strtype == NULL) {
3287+ return SAHPI_STATUS_COND_TYPE_SENSOR;
3288+ }
3289+ for (i = 0; statuscondtype_strings[i].str != NULL; i++) {
3290+ if (strcmp(strtype, statuscondtype_strings[i].str) == 0) {
3291+ return statuscondtype_strings[i].type;
3292+ }
3293+ }
3294+ return SAHPI_STATUS_COND_TYPE_SENSOR;
3295+}
3296+
3297+
3298+/**
3299+ * Translates an sensor aggregate status type to a string.
3300+ *
3301+ * @param value The SaHpiStatusCondTypeT to be converted.
3302+ *
3303+ * @return The string value of the type.
3304+ */
3305+const char * oSaHpiTypesEnums::statuscondtype2str(SaHpiStatusCondTypeT value) {
3306+ int i;
3307+
3308+ for (i = 0; statuscondtype_strings[i].str != NULL; i++) {
3309+ if (value == statuscondtype_strings[i].type) {
3310+ return statuscondtype_strings[i].str;
3311+ }
3312+ }
3313+ return "Unknown";
3314+}
3315+
3316+
3317+static struct annunciatormode_map {
3318+ SaHpiAnnunciatorModeT type;
3319+ const char *str;
3320+} annunciatormode_strings[] = {
3321+ {SAHPI_ANNUNCIATOR_MODE_AUTO, "SAHPI_ANNUNCIATOR_MODE_AUTO"},
3322+ {SAHPI_ANNUNCIATOR_MODE_USER, "SAHPI_ANNUNCIATOR_MODE_USER"},
3323+ {SAHPI_ANNUNCIATOR_MODE_SHARED, "SAHPI_ANNUNCIATOR_MODE_SHARED"},
3324+ {SAHPI_ANNUNCIATOR_MODE_SHARED, NULL}
3325+};
3326+
3327+
3328+/**
3329+ * Translates a string to a valid SaHpiAnnunciatorModeT type.
3330+ *
3331+ * @param strtype The entity type expressed as a string.
3332+ *
3333+ * @return SAHPI_OK on success, otherwise an HPI error code.
3334+ */
3335+SaHpiAnnunciatorModeT oSaHpiTypesEnums::str2annunciatormode(const char *strtype) {
3336+ int i;
3337+
3338+ if (strtype == NULL) {
3339+ return SAHPI_ANNUNCIATOR_MODE_AUTO;
3340+ }
3341+ for (i = 0; annunciatormode_strings[i].str != NULL; i++) {
3342+ if (strcmp(strtype, annunciatormode_strings[i].str) == 0) {
3343+ return annunciatormode_strings[i].type;
3344+ }
3345+ }
3346+ return SAHPI_ANNUNCIATOR_MODE_AUTO;
3347+}
3348+
3349+
3350+/**
3351+ * Translates an sensor aggregate status type to a string.
3352+ *
3353+ * @param value The SaHpiAnnunciatorModeT to be converted.
3354+ *
3355+ * @return The string value of the type.
3356+ */
3357+const char * oSaHpiTypesEnums::annunciatormode2str(SaHpiAnnunciatorModeT value) {
3358+ int i;
3359+
3360+ for (i = 0; annunciatormode_strings[i].str != NULL; i++) {
3361+ if (value == annunciatormode_strings[i].type) {
3362+ return annunciatormode_strings[i].str;
3363+ }
3364+ }
3365+ return "Unknown";
3366+}
3367+
3368+
3369+static struct severity_map {
3370+ SaHpiSeverityT type;
3371+ const char *str;
3372+} severity_strings[] = {
3373+ {SAHPI_CRITICAL, "SAHPI_CRITICAL"},
3374+ {SAHPI_MAJOR, "SAHPI_MAJOR"},
3375+ {SAHPI_MINOR, "SAHPI_MINOR"},
3376+ {SAHPI_INFORMATIONAL, "SAHPI_INFORMATIONAL"},
3377+ {SAHPI_OK, "SAHPI_OK"},
3378+ {SAHPI_DEBUG, "SAHPI_DEBUG"},
3379+ {SAHPI_ALL_SEVERITIES, "SAHPI_ALL_SEVERITIES"},
3380+ {SAHPI_ALL_SEVERITIES, NULL}
3381+};
3382+
3383+
3384+/**
3385+ * Translates a string to a valid SaHpiSeverityT type.
3386+ *
3387+ * @param strtype The entity type expressed as a string.
3388+ *
3389+ * @return SAHPI_OK on success, otherwise an HPI error code.
3390+ */
3391+SaHpiSeverityT oSaHpiTypesEnums::str2severity(const char *strtype) {
3392+ int i;
3393+
3394+ if (strtype == NULL) {
3395+ return SAHPI_OK;
3396+ }
3397+ for (i = 0; severity_strings[i].str != NULL; i++) {
3398+ if (strcmp(strtype, severity_strings[i].str) == 0) {
3399+ return severity_strings[i].type;
3400+ }
3401+ }
3402+ return SAHPI_OK;
3403+}
3404+
3405+
3406+/**
3407+ * Translates an sensor aggregate status type to a string.
3408+ *
3409+ * @param value The SaHpiSeverityT to be converted.
3410+ *
3411+ * @return The string value of the type.
3412+ */
3413+const char * oSaHpiTypesEnums::severity2str(SaHpiSeverityT value) {
3414+ int i;
3415+
3416+ for (i = 0; severity_strings[i].str != NULL; i++) {
3417+ if (value == severity_strings[i].type) {
3418+ return severity_strings[i].str;
3419+ }
3420+ }
3421+ return "Unknown";
3422+}
3423+
3424+
3425+static struct annunciatortype_map {
3426+ SaHpiAnnunciatorTypeT type;
3427+ const char *str;
3428+} annunciatortype_strings[] = {
3429+ {SAHPI_ANNUNCIATOR_TYPE_LED, "SAHPI_ANNUNCIATOR_TYPE_LED"},
3430+ {SAHPI_ANNUNCIATOR_TYPE_DRY_CONTACT_CLOSURE, "SAHPI_ANNUNCIATOR_TYPE_DRY_CONTACT_CLOSURE"},
3431+ {SAHPI_ANNUNCIATOR_TYPE_AUDIBLE, "SAHPI_ANNUNCIATOR_TYPE_AUDIBLE"},
3432+ {SAHPI_ANNUNCIATOR_TYPE_LCD_DISPLAY, "SAHPI_ANNUNCIATOR_TYPE_LCD_DISPLAY"},
3433+ {SAHPI_ANNUNCIATOR_TYPE_MESSAGE, "SAHPI_ANNUNCIATOR_TYPE_MESSAGE"},
3434+ {SAHPI_ANNUNCIATOR_TYPE_COMPOSITE, "SAHPI_ANNUNCIATOR_TYPE_COMPOSITE"},
3435+ {SAHPI_ANNUNCIATOR_TYPE_OEM, "SAHPI_ANNUNCIATOR_TYPE_OEM"},
3436+ {SAHPI_ANNUNCIATOR_TYPE_OEM, NULL}
3437+};
3438+
3439+
3440+/**
3441+ * Translates a string to a valid SaHpiAnnunciatorTypeT type.
3442+ *
3443+ * @param strtype The entity type expressed as a string.
3444+ *
3445+ * @return SAHPI_OK on success, otherwise an HPI error code.
3446+ */
3447+SaHpiAnnunciatorTypeT oSaHpiTypesEnums::str2annunciatortype(const char *strtype) {
3448+ int i;
3449+
3450+ if (strtype == NULL) {
3451+ return SAHPI_ANNUNCIATOR_TYPE_LED;
3452+ }
3453+ for (i = 0; annunciatortype_strings[i].str != NULL; i++) {
3454+ if (strcmp(strtype, annunciatortype_strings[i].str) == 0) {
3455+ return annunciatortype_strings[i].type;
3456+ }
3457+ }
3458+ return SAHPI_ANNUNCIATOR_TYPE_LED;
3459+}
3460+
3461+
3462+/**
3463+ * Translates an sensor aggregate status type to a string.
3464+ *
3465+ * @param value The SaHpiAnnunciatorTypeT to be converted.
3466+ *
3467+ * @return The string value of the type.
3468+ */
3469+const char * oSaHpiTypesEnums::annunciatortype2str(SaHpiAnnunciatorTypeT value) {
3470+ int i;
3471+
3472+ for (i = 0; annunciatortype_strings[i].str != NULL; i++) {
3473+ if (value == annunciatortype_strings[i].type) {
3474+ return annunciatortype_strings[i].str;
3475+ }
3476+ }
3477+ return "Unknown";
3478+}
3479+
3480+
3481+static struct rdrtype_map {
3482+ SaHpiRdrTypeT type;
3483+ const char *str;
3484+} rdrtype_strings[] = {
3485+ {SAHPI_NO_RECORD, "SAHPI_NO_RECORD"},
3486+ {SAHPI_CTRL_RDR, "SAHPI_CTRL_RDR"},
3487+ {SAHPI_SENSOR_RDR, "SAHPI_SENSOR_RDR"},
3488+ {SAHPI_INVENTORY_RDR, "SAHPI_INVENTORY_RDR"},
3489+ {SAHPI_WATCHDOG_RDR, "SAHPI_WATCHDOG_RDR"},
3490+ {SAHPI_ANNUNCIATOR_RDR, "SAHPI_ANNUNCIATOR_RDR"},
3491+ {SAHPI_ANNUNCIATOR_RDR, NULL}
3492+};
3493+
3494+
3495+/**
3496+ * Translates a string to a valid SaHpiRdrTypeT type.
3497+ *
3498+ * @param strtype The entity type expressed as a string.
3499+ *
3500+ * @return SAHPI_OK on success, otherwise an HPI error code.
3501+ */
3502+SaHpiRdrTypeT oSaHpiTypesEnums::str2rdrtype(const char *strtype) {
3503+ int i;
3504+
3505+ if (strtype == NULL) {
3506+ return SAHPI_NO_RECORD;
3507+ }
3508+ for (i = 0; rdrtype_strings[i].str != NULL; i++) {
3509+ if (strcmp(strtype, rdrtype_strings[i].str) == 0) {
3510+ return rdrtype_strings[i].type;
3511+ }
3512+ }
3513+ return SAHPI_NO_RECORD;
3514+}
3515+
3516+
3517+/**
3518+ * Translates an sensor aggregate status type to a string.
3519+ *
3520+ * @param value The SaHpiRdrTypeT to be converted.
3521+ *
3522+ * @return The string value of the type.
3523+ */
3524+const char * oSaHpiTypesEnums::rdrtype2str(SaHpiRdrTypeT value) {
3525+ int i;
3526+
3527+ for (i = 0; rdrtype_strings[i].str != NULL; i++) {
3528+ if (value == rdrtype_strings[i].type) {
3529+ return rdrtype_strings[i].str;
3530+ }
3531+ }
3532+ return "Unknown";
3533+}
3534+
3535+
3536+static struct hsindicatorstate_map {
3537+ SaHpiHsIndicatorStateT type;
3538+ const char *str;
3539+} hsindicatorstate_strings[] = {
3540+ {SAHPI_HS_INDICATOR_OFF, "SAHPI_HS_INDICATOR_OFF"},
3541+ {SAHPI_HS_INDICATOR_ON, "SAHPI_HS_INDICATOR_ON"},
3542+ {SAHPI_HS_INDICATOR_ON, NULL}
3543+};
3544+
3545+
3546+/**
3547+ * Translates a string to a valid SaHpiHsIndicatorStateT type.
3548+ *
3549+ * @param strtype The entity type expressed as a string.
3550+ *
3551+ * @return SAHPI_OK on success, otherwise an HPI error code.
3552+ */
3553+SaHpiHsIndicatorStateT oSaHpiTypesEnums::str2hsindicatorstate(const char *strtype) {
3554+ int i;
3555+
3556+ if (strtype == NULL) {
3557+ return SAHPI_HS_INDICATOR_OFF;
3558+ }
3559+ for (i = 0; hsindicatorstate_strings[i].str != NULL; i++) {
3560+ if (strcmp(strtype, hsindicatorstate_strings[i].str) == 0) {
3561+ return hsindicatorstate_strings[i].type;
3562+ }
3563+ }
3564+ return SAHPI_HS_INDICATOR_OFF;
3565+}
3566+
3567+
3568+/**
3569+ * Translates an sensor aggregate status type to a string.
3570+ *
3571+ * @param value The SaHpiHsIndicatorStateT to be converted.
3572+ *
3573+ * @return The string value of the type.
3574+ */
3575+const char * oSaHpiTypesEnums::hsindicatorstate2str(SaHpiHsIndicatorStateT value) {
3576+ int i;
3577+
3578+ for (i = 0; hsindicatorstate_strings[i].str != NULL; i++) {
3579+ if (value == hsindicatorstate_strings[i].type) {
3580+ return hsindicatorstate_strings[i].str;
3581+ }
3582+ }
3583+ return "Unknown";
3584+}
3585+
3586+
3587+static struct hsaction_map {
3588+ SaHpiHsActionT type;
3589+ const char *str;
3590+} hsaction_strings[] = {
3591+ {SAHPI_HS_ACTION_INSERTION, "SAHPI_HS_ACTION_INSERTION"},
3592+ {SAHPI_HS_ACTION_EXTRACTION, "SAHPI_HS_ACTION_EXTRACTION"},
3593+ {SAHPI_HS_ACTION_EXTRACTION, NULL}
3594+};
3595+
3596+
3597+/**
3598+ * Translates a string to a valid SaHpiHsActionT type.
3599+ *
3600+ * @param strtype The entity type expressed as a string.
3601+ *
3602+ * @return SAHPI_OK on success, otherwise an HPI error code.
3603+ */
3604+SaHpiHsActionT oSaHpiTypesEnums::str2hsaction(const char *strtype) {
3605+ int i;
3606+
3607+ if (strtype == NULL) {
3608+ return SAHPI_HS_ACTION_INSERTION;
3609+ }
3610+ for (i = 0; hsaction_strings[i].str != NULL; i++) {
3611+ if (strcmp(strtype, hsaction_strings[i].str) == 0) {
3612+ return hsaction_strings[i].type;
3613+ }
3614+ }
3615+ return SAHPI_HS_ACTION_INSERTION;
3616+}
3617+
3618+
3619+/**
3620+ * Translates an sensor aggregate status type to a string.
3621+ *
3622+ * @param value The SaHpiHsActionT to be converted.
3623+ *
3624+ * @return The string value of the type.
3625+ */
3626+const char * oSaHpiTypesEnums::hsaction2str(SaHpiHsActionT value) {
3627+ int i;
3628+
3629+ for (i = 0; hsaction_strings[i].str != NULL; i++) {
3630+ if (value == hsaction_strings[i].type) {
3631+ return hsaction_strings[i].str;
3632+ }
3633+ }
3634+ return "Unknown";
3635+}
3636+
3637+
3638+static struct hsstate_map {
3639+ SaHpiHsStateT type;
3640+ const char *str;
3641+} hsstate_strings[] = {
3642+ {SAHPI_HS_STATE_INACTIVE, "SAHPI_HS_STATE_INACTIVE"},
3643+ {SAHPI_HS_STATE_INSERTION_PENDING, "SAHPI_HS_STATE_INSERTION_PENDING"},
3644+ {SAHPI_HS_STATE_ACTIVE, "SAHPI_HS_STATE_ACTIVE"},
3645+ {SAHPI_HS_STATE_EXTRACTION_PENDING, "SAHPI_HS_STATE_EXTRACTION_PENDING"},
3646+ {SAHPI_HS_STATE_NOT_PRESENT, "SAHPI_HS_STATE_NOT_PRESENT"},
3647+ {SAHPI_HS_STATE_NOT_PRESENT, NULL}
3648+};
3649+
3650+
3651+/**
3652+ * Translates a string to a valid SaHpiHsStateT type.
3653+ *
3654+ * @param strtype The entity type expressed as a string.
3655+ *
3656+ * @return SAHPI_OK on success, otherwise an HPI error code.
3657+ */
3658+SaHpiHsStateT oSaHpiTypesEnums::str2hsstate(const char *strtype) {
3659+ int i;
3660+
3661+ if (strtype == NULL) {
3662+ return SAHPI_HS_STATE_INACTIVE;
3663+ }
3664+ for (i = 0; hsstate_strings[i].str != NULL; i++) {
3665+ if (strcmp(strtype, hsstate_strings[i].str) == 0) {
3666+ return hsstate_strings[i].type;
3667+ }
3668+ }
3669+ return SAHPI_HS_STATE_INACTIVE;
3670+}
3671+
3672+
3673+/**
3674+ * Translates an sensor aggregate status type to a string.
3675+ *
3676+ * @param value The SaHpiHsStateT to be converted.
3677+ *
3678+ * @return The string value of the type.
3679+ */
3680+const char * oSaHpiTypesEnums::hsstate2str(SaHpiHsStateT value) {
3681+ int i;
3682+
3683+ for (i = 0; hsstate_strings[i].str != NULL; i++) {
3684+ if (value == hsstate_strings[i].type) {
3685+ return hsstate_strings[i].str;
3686+ }
3687+ }
3688+ return "Unknown";
3689+}
3690+
3691+
3692+static struct resourceeventtype_map {
3693+ SaHpiResourceEventTypeT type;
3694+ const char *str;
3695+} resourceeventtype_strings[] = {
3696+ {SAHPI_RESE_RESOURCE_FAILURE, "SAHPI_RESE_RESOURCE_FAILURE"},
3697+ {SAHPI_RESE_RESOURCE_RESTORED, "SAHPI_RESE_RESOURCE_RESTORED"},
3698+ {SAHPI_RESE_RESOURCE_ADDED, "SAHPI_RESE_RESOURCE_ADDED"},
3699+ {SAHPI_RESE_RESOURCE_ADDED, NULL}
3700+};
3701+
3702+
3703+/**
3704+ * Translates a string to a valid SaHpiResourceEventTypeT type.
3705+ *
3706+ * @param strtype The entity type expressed as a string.
3707+ *
3708+ * @return SAHPI_OK on success, otherwise an HPI error code.
3709+ */
3710+SaHpiResourceEventTypeT oSaHpiTypesEnums::str2resourceeventtype(const char *strtype) {
3711+ int i;
3712+
3713+ if (strtype == NULL) {
3714+ return SAHPI_RESE_RESOURCE_FAILURE;
3715+ }
3716+ for (i = 0; resourceeventtype_strings[i].str != NULL; i++) {
3717+ if (strcmp(strtype, resourceeventtype_strings[i].str) == 0) {
3718+ return resourceeventtype_strings[i].type;
3719+ }
3720+ }
3721+ return SAHPI_RESE_RESOURCE_FAILURE;
3722+}
3723+
3724+
3725+/**
3726+ * Translates an sensor aggregate status type to a string.
3727+ *
3728+ * @param value The SaHpiResourceEventTypeT to be converted.
3729+ *
3730+ * @return The string value of the type.
3731+ */
3732+const char * oSaHpiTypesEnums::resourceeventtype2str(SaHpiResourceEventTypeT value) {
3733+ int i;
3734+
3735+ for (i = 0; resourceeventtype_strings[i].str != NULL; i++) {
3736+ if (value == resourceeventtype_strings[i].type) {
3737+ return resourceeventtype_strings[i].str;
3738+ }
3739+ }
3740+ return "Unknown";
3741+}
3742+
3743+
3744+static struct domaineventtype_map {
3745+ SaHpiDomainEventTypeT type;
3746+ const char *str;
3747+} domaineventtype_strings[] = {
3748+ {SAHPI_DOMAIN_REF_ADDED, "SAHPI_DOMAIN_REF_ADDED"},
3749+ {SAHPI_DOMAIN_REF_REMOVED, "SAHPI_DOMAIN_REF_REMOVED"},
3750+ {SAHPI_DOMAIN_REF_REMOVED, NULL}
3751+};
3752+
3753+
3754+/**
3755+ * Translates a string to a valid SaHpiDomainEventTypeT type.
3756+ *
3757+ * @param strtype The entity type expressed as a string.
3758+ *
3759+ * @return SAHPI_OK on success, otherwise an HPI error code.
3760+ */
3761+SaHpiDomainEventTypeT oSaHpiTypesEnums::str2domaineventtype(const char *strtype) {
3762+ int i;
3763+
3764+ if (strtype == NULL) {
3765+ return SAHPI_DOMAIN_REF_ADDED;
3766+ }
3767+ for (i = 0; domaineventtype_strings[i].str != NULL; i++) {
3768+ if (strcmp(strtype, domaineventtype_strings[i].str) == 0) {
3769+ return domaineventtype_strings[i].type;
3770+ }
3771+ }
3772+ return SAHPI_DOMAIN_REF_ADDED;
3773+}
3774+
3775+
3776+/**
3777+ * Translates an sensor aggregate status type to a string.
3778+ *
3779+ * @param value The SaHpiDomainEventTypeT to be converted.
3780+ *
3781+ * @return The string value of the type.
3782+ */
3783+const char * oSaHpiTypesEnums::domaineventtype2str(SaHpiDomainEventTypeT value) {
3784+ int i;
3785+
3786+ for (i = 0; domaineventtype_strings[i].str != NULL; i++) {
3787+ if (value == domaineventtype_strings[i].type) {
3788+ return domaineventtype_strings[i].str;
3789+ }
3790+ }
3791+ return "Unknown";
3792+}
3793+
3794+
3795+static struct sensoroptionaldata_map {
3796+ SaHpiSensorOptionalDataT type;
3797+ const char *str;
3798+} sensoroptionaldata_strings[] = {
3799+ {SAHPI_SOD_TRIGGER_READING, "SAHPI_SOD_TRIGGER_READING"},
3800+ {SAHPI_SOD_TRIGGER_THRESHOLD, "SAHPI_SOD_TRIGGER_THRESHOLD"},
3801+ {SAHPI_SOD_OEM, "SAHPI_SOD_OEM"},
3802+ {SAHPI_SOD_PREVIOUS_STATE, "SAHPI_SOD_PREVIOUS_STATE"},
3803+ {SAHPI_SOD_CURRENT_STATE, "SAHPI_SOD_CURRENT_STATE"},
3804+ {SAHPI_SOD_SENSOR_SPECIFIC, "SAHPI_SOD_SENSOR_SPECIFIC"},
3805+ {SAHPI_SOD_SENSOR_SPECIFIC, NULL}
3806+};
3807+
3808+
3809+/**
3810+ * Translates a string to a valid SaHpiSensorOptionalDataT type.
3811+ *
3812+ * @param strtype The entity type expressed as a string.
3813+ *
3814+ * @return SAHPI_OK on success, otherwise an HPI error code.
3815+ */
3816+SaHpiSensorOptionalDataT oSaHpiTypesEnums::str2sensoroptionaldata(const char *strtype) {
3817+ int i;
3818+
3819+ if (strtype == NULL) {
3820+ return (SaHpiSensorOptionalDataT)0;
3821+ }
3822+ for (i = 0; sensoroptionaldata_strings[i].str != NULL; i++) {
3823+ if (strcmp(strtype, sensoroptionaldata_strings[i].str) == 0) {
3824+ return sensoroptionaldata_strings[i].type;
3825+ }
3826+ }
3827+ return (SaHpiSensorOptionalDataT)0;
3828+}
3829+
3830+
3831+/**
3832+ * Translates an sensor aggregate status type to a string.
3833+ *
3834+ * @param value The SaHpiSensorOptionalDataT to be converted.
3835+ *
3836+ * @return The string value of the type.
3837+ */
3838+const char * oSaHpiTypesEnums::sensoroptionaldata2str(SaHpiSensorOptionalDataT value) {
3839+ int i;
3840+
3841+ for (i = 0; sensoroptionaldata_strings[i].str != NULL; i++) {
3842+ if (value == sensoroptionaldata_strings[i].type) {
3843+ return sensoroptionaldata_strings[i].str;
3844+ }
3845+ }
3846+ return "Unknown";
3847+}
3848+
3849+
3850+static struct sweventtype_map {
3851+ SaHpiSwEventTypeT type;
3852+ const char *str;
3853+} sweventtype_strings[] = {
3854+ {SAHPI_HPIE_AUDIT, "SAHPI_HPIE_AUDIT"},
3855+ {SAHPI_HPIE_STARTUP, "SAHPI_HPIE_STARTUP"},
3856+ {SAHPI_HPIE_OTHER, "SAHPI_HPIE_OTHER"},
3857+ {SAHPI_HPIE_OTHER, NULL}
3858+};
3859+
3860+
3861+/**
3862+ * Translates a string to a valid SaHpiSwEventTypeT type.
3863+ *
3864+ * @param strtype The entity type expressed as a string.
3865+ *
3866+ * @return SAHPI_OK on success, otherwise an HPI error code.
3867+ */
3868+SaHpiSwEventTypeT oSaHpiTypesEnums::str2sweventtype(const char *strtype) {
3869+ int i;
3870+
3871+ if (strtype == NULL) {
3872+ return SAHPI_HPIE_AUDIT;
3873+ }
3874+ for (i = 0; sweventtype_strings[i].str != NULL; i++) {
3875+ if (strcmp(strtype, sweventtype_strings[i].str) == 0) {
3876+ return sweventtype_strings[i].type;
3877+ }
3878+ }
3879+ return SAHPI_HPIE_AUDIT;
3880+}
3881+
3882+
3883+/**
3884+ * Translates an sensor aggregate status type to a string.
3885+ *
3886+ * @param value The SaHpiSwEventTypeT to be converted.
3887+ *
3888+ * @return The string value of the type.
3889+ */
3890+const char * oSaHpiTypesEnums::sweventtype2str(SaHpiSwEventTypeT value) {
3891+ int i;
3892+
3893+ for (i = 0; sweventtype_strings[i].str != NULL; i++) {
3894+ if (value == sweventtype_strings[i].type) {
3895+ return sweventtype_strings[i].str;
3896+ }
3897+ }
3898+ return "Unknown";
3899+}
3900+
3901+
3902+static struct eventtype_map {
3903+ SaHpiEventTypeT type;
3904+ const char *str;
3905+} eventtype_strings[] = {
3906+ {SAHPI_ET_RESOURCE, "SAHPI_ET_RESOURCE"},
3907+ {SAHPI_ET_DOMAIN, "SAHPI_ET_DOMAIN"},
3908+ {SAHPI_ET_SENSOR, "SAHPI_ET_SENSOR"},
3909+ {SAHPI_ET_SENSOR_ENABLE_CHANGE, "SAHPI_ET_SENSOR_ENABLE_CHANGE"},
3910+ {SAHPI_ET_HOTSWAP, "SAHPI_ET_HOTSWAP"},
3911+ {SAHPI_ET_WATCHDOG, "SAHPI_ET_WATCHDOG"},
3912+ {SAHPI_ET_HPI_SW, "SAHPI_ET_HPI_SW"},
3913+ {SAHPI_ET_OEM, "SAHPI_ET_OEM"},
3914+ {SAHPI_ET_USER, "SAHPI_ET_USER"},
3915+ {SAHPI_ET_USER, NULL}
3916+};
3917+
3918+
3919+/**
3920+ * Translates a string to a valid SaHpiEventTypeT type.
3921+ *
3922+ * @param strtype The entity type expressed as a string.
3923+ *
3924+ * @return SAHPI_OK on success, otherwise an HPI error code.
3925+ */
3926+SaHpiEventTypeT oSaHpiTypesEnums::str2eventtype(const char *strtype) {
3927+ int i;
3928+
3929+ if (strtype == NULL) {
3930+ return SAHPI_ET_RESOURCE;
3931+ }
3932+ for (i = 0; eventtype_strings[i].str != NULL; i++) {
3933+ if (strcmp(strtype, eventtype_strings[i].str) == 0) {
3934+ return eventtype_strings[i].type;
3935+ }
3936+ }
3937+ return SAHPI_ET_RESOURCE;
3938+}
3939+
3940+
3941+/**
3942+ * Translates an sensor aggregate status type to a string.
3943+ *
3944+ * @param value The SaHpiEventTypeT to be converted.
3945+ *
3946+ * @return The string value of the type.
3947+ */
3948+const char * oSaHpiTypesEnums::eventtype2str(SaHpiEventTypeT value) {
3949+ int i;
3950+
3951+ for (i = 0; eventtype_strings[i].str != NULL; i++) {
3952+ if (value == eventtype_strings[i].type) {
3953+ return eventtype_strings[i].str;
3954+ }
3955+ }
3956+ return "Unknown";
3957+}
3958+
3959+
3960+static struct parmaction_map {
3961+ SaHpiParmActionT type;
3962+ const char *str;
3963+} parmaction_strings[] = {
3964+ {SAHPI_DEFAULT_PARM, "SAHPI_DEFAULT_PARM"},
3965+ {SAHPI_SAVE_PARM, "SAHPI_SAVE_PARM"},
3966+ {SAHPI_RESTORE_PARM, "SAHPI_RESTORE_PARM"},
3967+ {SAHPI_RESTORE_PARM, NULL}
3968+};
3969+
3970+
3971+/**
3972+ * Translates a string to a valid SaHpiParmActionT type.
3973+ *
3974+ * @param strtype The entity type expressed as a string.
3975+ *
3976+ * @return SAHPI_OK on success, otherwise an HPI error code.
3977+ */
3978+SaHpiParmActionT oSaHpiTypesEnums::str2parmaction(const char *strtype) {
3979+ int i;
3980+
3981+ if (strtype == NULL) {
3982+ return SAHPI_DEFAULT_PARM;
3983+ }
3984+ for (i = 0; parmaction_strings[i].str != NULL; i++) {
3985+ if (strcmp(strtype, parmaction_strings[i].str) == 0) {
3986+ return parmaction_strings[i].type;
3987+ }
3988+ }
3989+ return SAHPI_DEFAULT_PARM;
3990+}
3991+
3992+
3993+/**
3994+ * Translates an sensor aggregate status type to a string.
3995+ *
3996+ * @param value The SaHpiParmActionT to be converted.
3997+ *
3998+ * @return The string value of the type.
3999+ */
4000+const char * oSaHpiTypesEnums::parmaction2str(SaHpiParmActionT value) {
4001+ int i;
4002+
4003+ for (i = 0; parmaction_strings[i].str != NULL; i++) {
4004+ if (value == parmaction_strings[i].type) {
4005+ return parmaction_strings[i].str;
4006+ }
4007+ }
4008+ return "Unknown";
4009+}
4010+
4011+
4012+static struct resetaction_map {
4013+ SaHpiResetActionT type;
4014+ const char *str;
4015+} resetaction_strings[] = {
4016+ {SAHPI_COLD_RESET, "SAHPI_COLD_RESET"},
4017+ {SAHPI_WARM_RESET, "SAHPI_WARM_RESET"},
4018+ {SAHPI_RESET_ASSERT, "SAHPI_RESET_ASSERT"},
4019+ {SAHPI_RESET_DEASSERT, "SAHPI_RESET_DEASSERT"},
4020+ {SAHPI_RESET_DEASSERT, NULL}
4021+};
4022+
4023+
4024+/**
4025+ * Translates a string to a valid SaHpiResetActionT type.
4026+ *
4027+ * @param strtype The entity type expressed as a string.
4028+ *
4029+ * @return SAHPI_OK on success, otherwise an HPI error code.
4030+ */
4031+SaHpiResetActionT oSaHpiTypesEnums::str2resetaction(const char *strtype) {
4032+ int i;
4033+
4034+ if (strtype == NULL) {
4035+ return SAHPI_COLD_RESET;
4036+ }
4037+ for (i = 0; resetaction_strings[i].str != NULL; i++) {
4038+ if (strcmp(strtype, resetaction_strings[i].str) == 0) {
4039+ return resetaction_strings[i].type;
4040+ }
4041+ }
4042+ return SAHPI_COLD_RESET;
4043+}
4044+
4045+
4046+/**
4047+ * Translates an sensor aggregate status type to a string.
4048+ *
4049+ * @param value The SaHpiResetActionT to be converted.
4050+ *
4051+ * @return The string value of the type.
4052+ */
4053+const char * oSaHpiTypesEnums::resetaction2str(SaHpiResetActionT value) {
4054+ int i;
4055+
4056+ for (i = 0; resetaction_strings[i].str != NULL; i++) {
4057+ if (value == resetaction_strings[i].type) {
4058+ return resetaction_strings[i].str;
4059+ }
4060+ }
4061+ return "Unknown";
4062+}
4063+
4064+
4065+static struct powerstate_map {
4066+ SaHpiPowerStateT type;
4067+ const char *str;
4068+} powerstate_strings[] = {
4069+ {SAHPI_POWER_OFF, "SAHPI_OFF"},
4070+ {SAHPI_POWER_ON, "SAHPI_ON"},
4071+ {SAHPI_POWER_CYCLE, "SAHPI_CYCLE"},
4072+ {SAHPI_POWER_CYCLE, NULL}
4073+};
4074+
4075+
4076+/**
4077+ * Translates a string to a valid SaHpiPowerStateT type.
4078+ *
4079+ * @param strtype The entity type expressed as a string.
4080+ *
4081+ * @return SAHPI_OK on success, otherwise an HPI error code.
4082+ */
4083+SaHpiPowerStateT oSaHpiTypesEnums::str2powerstate(const char *strtype) {
4084+ int i;
4085+
4086+ if (strtype == NULL) {
4087+ return SAHPI_POWER_OFF;
4088+ }
4089+ for (i = 0; powerstate_strings[i].str != NULL; i++) {
4090+ if (strcmp(strtype, powerstate_strings[i].str) == 0) {
4091+ return powerstate_strings[i].type;
4092+ }
4093+ }
4094+ return SAHPI_POWER_OFF;
4095+}
4096+
4097+
4098+/**
4099+ * Translates an sensor aggregate status type to a string.
4100+ *
4101+ * @param value The SaHpiPowerStateT to be converted.
4102+ *
4103+ * @return The string value of the type.
4104+ */
4105+const char * oSaHpiTypesEnums::powerstate2str(SaHpiPowerStateT value) {
4106+ int i;
4107+
4108+ for (i = 0; powerstate_strings[i].str != NULL; i++) {
4109+ if (value == powerstate_strings[i].type) {
4110+ return powerstate_strings[i].str;
4111+ }
4112+ }
4113+ return "Unknown";
4114+}
4115+
4116+
4117+static struct capabilities_map {
4118+ SaHpiCapabilitiesT type;
4119+ const char *str;
4120+} capabilities_strings[] = {
4121+ {SAHPI_CAPABILITY_RESOURCE, "SAHPI_CAPABILITY_RESOURCE"},
4122+ {SAHPI_CAPABILITY_EVT_DEASSERTS, "SAHPI_CAPABILITY_EVT_DEASSERTS"},
4123+ {SAHPI_CAPABILITY_AGGREGATE_STATUS, "SAHPI_CAPABILITY_AGGREGATE_STATUS"},
4124+ {SAHPI_CAPABILITY_CONFIGURATION, "SAHPI_CAPABILITY_CONFIGURATION"},
4125+ {SAHPI_CAPABILITY_MANAGED_HOTSWAP, "SAHPI_CAPABILITY_MANAGED_HOTSWAP"},
4126+ {SAHPI_CAPABILITY_WATCHDOG, "SAHPI_CAPABILITY_WATCHDOG"},
4127+ {SAHPI_CAPABILITY_CONTROL, "SAHPI_CAPABILITY_CONTROL"},
4128+ {SAHPI_CAPABILITY_FRU, "SAHPI_CAPABILITY_FRU"},
4129+ {SAHPI_CAPABILITY_ANNUNCIATOR, "SAHPI_CAPABILITY_ANNUNCIATOR"},
4130+ {SAHPI_CAPABILITY_POWER, "SAHPI_CAPABILITY_POWER"},
4131+ {SAHPI_CAPABILITY_RESET, "SAHPI_CAPABILITY_RESET"},
4132+ {SAHPI_CAPABILITY_INVENTORY_DATA, "SAHPI_CAPABILITY_INVENTORY_DATA"},
4133+ {SAHPI_CAPABILITY_EVENT_LOG, "SAHPI_CAPABILITY_EVENT_LOG"},
4134+ {SAHPI_CAPABILITY_RDR, "SAHPI_CAPABILITY_RDR"},
4135+ {SAHPI_CAPABILITY_SENSOR, "SAHPI_CAPABILITY_SENSOR"},
4136+ {SAHPI_CAPABILITY_SENSOR, NULL}
4137+};
4138+
4139+
4140+/**
4141+ * Translates a string to a valid SaHpiCapabilitiesT type.
4142+ *
4143+ * @param strtype The entity type expressed as a string.
4144+ *
4145+ * @return SAHPI_OK on success, otherwise an HPI error code.
4146+ */
4147+SaHpiCapabilitiesT oSaHpiTypesEnums::str2capabilities(const char *strtype) {
4148+ int i;
4149+
4150+ if (strtype == NULL) {
4151+ return (SaHpiCapabilitiesT)0;
4152+ }
4153+ for (i = 0; capabilities_strings[i].str != NULL; i++) {
4154+ if (strcmp(strtype, capabilities_strings[i].str) == 0) {
4155+ return capabilities_strings[i].type;
4156+ }
4157+ }
4158+ return (SaHpiCapabilitiesT)0;
4159+}
4160+
4161+
4162+/**
4163+ * Translates an sensor aggregate status type to a string.
4164+ *
4165+ * @param value The SaHpiCapabilitiesT to be converted.
4166+ *
4167+ * @return The string value of the type.
4168+ */
4169+const char * oSaHpiTypesEnums::capabilities2str(SaHpiCapabilitiesT value) {
4170+ int i;
4171+
4172+ for (i = 0; capabilities_strings[i].str != NULL; i++) {
4173+ if (value == capabilities_strings[i].type) {
4174+ return capabilities_strings[i].str;
4175+ }
4176+ }
4177+ return "Unknown";
4178+}
4179+
4180+
4181+static struct hscapabilities_map {
4182+ SaHpiHsCapabilitiesT type;
4183+ const char *str;
4184+} hscapabilities_strings[] = {
4185+ {SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY, "SAHPI_HS_CAPABILITY_AUTOEXTRACT_READ_ONLY_SUPPORTED"},
4186+ {SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED, "SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED"},
4187+ {SAHPI_HS_CAPABILITY_INDICATOR_SUPPORTED, NULL}
4188+};
4189+
4190+
4191+/**
4192+ * Translates a string to a valid SaHpiHsCapabilitiesT type.
4193+ *
4194+ * @param strtype The entity type expressed as a string.
4195+ *
4196+ * @return SAHPI_OK on success, otherwise an HPI error code.
4197+ */
4198+SaHpiHsCapabilitiesT oSaHpiTypesEnums::str2hscapabilities(const char *strtype) {
4199+ int i;
4200+
4201+ if (strtype == NULL) {
4202+ return (SaHpiHsCapabilitiesT)0;
4203+ }
4204+ for (i = 0; hscapabilities_strings[i].str != NULL; i++) {
4205+ if (strcmp(strtype, hscapabilities_strings[i].str) == 0) {
4206+ return hscapabilities_strings[i].type;
4207+ }
4208+ }
4209+ return (SaHpiHsCapabilitiesT)0;
4210+}
4211+
4212+
4213+/**
4214+ * Translates an sensor aggregate status type to a string.
4215+ *
4216+ * @param value The SaHpiHsCapabilitiesT to be converted.
4217+ *
4218+ * @return The string value of the type.
4219+ */
4220+const char * oSaHpiTypesEnums::hscapabilities2str(SaHpiHsCapabilitiesT value) {
4221+ int i;
4222+
4223+ for (i = 0; hscapabilities_strings[i].str != NULL; i++) {
4224+ if (value == hscapabilities_strings[i].type) {
4225+ return hscapabilities_strings[i].str;
4226+ }
4227+ }
4228+ return "Unknown";
4229+}
4230+
4231+
4232+static struct eventlogoverflowaction_map {
4233+ SaHpiEventLogOverflowActionT type;
4234+ const char *str;
4235+} eventlogoverflowaction_strings[] = {
4236+ {SAHPI_EL_OVERFLOW_DROP, "SAHPI_EL_OVERFLOW_DROP"},
4237+ {SAHPI_EL_OVERFLOW_OVERWRITE, "SAHPI_EL_OVERFLOW_OVERWRITE"},
4238+ {SAHPI_EL_OVERFLOW_OVERWRITE, NULL}
4239+};
4240+
4241+
4242+/**
4243+ * Translates a string to a valid SaHpiEventLogOverflowActionT type.
4244+ *
4245+ * @param strtype The entity type expressed as a string.
4246+ *
4247+ * @return SAHPI_OK on success, otherwise an HPI error code.
4248+ */
4249+SaHpiEventLogOverflowActionT oSaHpiTypesEnums::str2eventlogoverflowaction(const char *strtype) {
4250+ int i;
4251+
4252+ if (strtype == NULL) {
4253+ return SAHPI_EL_OVERFLOW_DROP;
4254+ }
4255+ for (i = 0; eventlogoverflowaction_strings[i].str != NULL; i++) {
4256+ if (strcmp(strtype, eventlogoverflowaction_strings[i].str) == 0) {
4257+ return eventlogoverflowaction_strings[i].type;
4258+ }
4259+ }
4260+ return SAHPI_EL_OVERFLOW_DROP;
4261+}
4262+
4263+
4264+/**
4265+ * Translates an sensor aggregate status type to a string.
4266+ *
4267+ * @param value The SaHpiEventLogOverflowActionT to be converted.
4268+ *
4269+ * @return The string value of the type.
4270+ */
4271+const char * oSaHpiTypesEnums::eventlogoverflowaction2str(SaHpiEventLogOverflowActionT value) {
4272+ int i;
4273+
4274+ for (i = 0; eventlogoverflowaction_strings[i].str != NULL; i++) {
4275+ if (value == eventlogoverflowaction_strings[i].type) {
4276+ return eventlogoverflowaction_strings[i].str;
4277+ }
4278+ }
4279+ return "Unknown";
4280+}
4281+
4282+
4283+static struct eventlogentryid_map {
4284+ SaHpiEventLogEntryIdT type;
4285+ const char *str;
4286+} eventlogentryid_strings[] = {
4287+ {SAHPI_OLDEST_ENTRY, "SAHPI_OLDEST_ENTRY"},
4288+ {SAHPI_NEWEST_ENTRY, "SAHPI_NEWEST_ENTRY"},
4289+ {SAHPI_NO_MORE_ENTRIES, "SAHPI_NO_MORE_ENTRIES"},
4290+ {SAHPI_NO_MORE_ENTRIES, NULL}
4291+};
4292+
4293+
4294+/**
4295+ * Translates a string to a valid SaHpiEventLogEntryIdT type.
4296+ *
4297+ * @param strtype The entity type expressed as a string.
4298+ *
4299+ * @return SAHPI_OK on success, otherwise an HPI error code.
4300+ */
4301+SaHpiEventLogEntryIdT oSaHpiTypesEnums::str2eventlogentryid(const char *strtype) {
4302+ int i;
4303+
4304+ if (strtype == NULL) {
4305+ return SAHPI_OLDEST_ENTRY;
4306+ }
4307+ for (i = 0; eventlogentryid_strings[i].str != NULL; i++) {
4308+ if (strcmp(strtype, eventlogentryid_strings[i].str) == 0) {
4309+ return eventlogentryid_strings[i].type;
4310+ }
4311+ }
4312+ return SAHPI_OLDEST_ENTRY;
4313+}
4314+
4315+
4316+/**
4317+ * Translates an sensor aggregate status type to a string.
4318+ *
4319+ * @param value The SaHpiEventLogEntryIdT to be converted.
4320+ *
4321+ * @return The string value of the type.
4322+ */
4323+const char * oSaHpiTypesEnums::eventlogentryid2str(SaHpiEventLogEntryIdT value) {
4324+ int i;
4325+
4326+ for (i = 0; eventlogentryid_strings[i].str != NULL; i++) {
4327+ if (value == eventlogentryid_strings[i].type) {
4328+ return eventlogentryid_strings[i].str;
4329+ }
4330+ }
4331+ return "Unknown";
4332+}
4333+
4334+
4335--- openhpi-2.10.1/cpp/oSaHpiUserEvent.cpp.orig 1970-01-01 01:00:00.000000000 +0100
4336+++ openhpi-2.10.1/cpp/oSaHpiUserEvent.cpp 2007-11-04 00:10:30.388000690 +0100
4337@@ -0,0 +1,110 @@
4338+/* -*- linux-c -*-
4339+ *
4340+ * (C) Copyright IBM Corp. 2005
4341+ *
4342+ * This program is distributed in the hope that it will be useful,
4343+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4344+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
4345+ * file and program are licensed under a BSD style license. See
4346+ * the Copying file included with the OpenHPI distribution for
4347+ * full licensing terms.
4348+ *
4349+ * Author(s):
4350+ * W. David Ashley <dashley@us.ibm.com>
4351+ */
4352+
4353+
4354+#include <stdlib.h>
4355+#include <string.h>
4356+#include <stdio.h>
4357+extern "C"
4358+{
4359+#include <SaHpi.h>
4360+}
4361+#include "oSaHpiTypesEnums.hpp"
4362+#include "oSaHpiTextBuffer.hpp"
4363+#include "oSaHpiUserEvent.hpp"
4364+
4365+
4366+/**
4367+ * Default constructor.
4368+ */
4369+oSaHpiUserEvent::oSaHpiUserEvent() {
4370+ UserEventData.DataType = SAHPI_TL_TYPE_TEXT;
4371+ UserEventData.Language = SAHPI_LANG_ENGLISH;
4372+ UserEventData.DataLength = 0;
4373+ UserEventData.Data[0] = '\0';
4374+};
4375+
4376+
4377+/**
4378+ * Constructor.
4379+ *
4380+ * @param buf The reference to the class to be copied.
4381+ */
4382+oSaHpiUserEvent::oSaHpiUserEvent(const oSaHpiUserEvent& buf) {
4383+ memcpy(this, &buf, sizeof(SaHpiUserEventT));
4384+}
4385+
4386+
4387+
4388+/**
4389+ * Assign a field in the SaHpiUserEventT struct a value.
4390+ *
4391+ * @param field The pointer to the struct (class).
4392+ * @param field The field name as a text string (case sensitive).
4393+ * @param value The character string value to be assigned to the field. This
4394+ * value will be converted as necessary.
4395+ *
4396+ * @return True if there was an error, otherwise false.
4397+ */
4398+bool oSaHpiUserEvent::assignField(SaHpiUserEventT *ptr,
4399+ const char *field,
4400+ const char *value) {
4401+ if (ptr == NULL || field == NULL || value == NULL) {
4402+ return true;
4403+ }
4404+ // UserEventData
4405+ return true;
4406+};
4407+
4408+
4409+/**
4410+ * Print the contents of the buffer.
4411+ *
4412+ * @param stream Target stream.
4413+ * @param buffer Address of the SaHpiUserEventT struct.
4414+ *
4415+ * @return True if there was an error, otherwise false.
4416+ */
4417+bool oSaHpiUserEvent::fprint(FILE *stream,
4418+ const int indent,
4419+ const SaHpiUserEventT *buffer) {
4420+ int i, err;
4421+ char indent_buf[indent + 1];
4422+
4423+ if (stream == NULL || buffer == NULL) {
4424+ return true;
4425+ }
4426+ for (i = 0; i < indent; i++) {
4427+ indent_buf[i] = ' ';
4428+ }
4429+ indent_buf[indent] = '\0';
4430+
4431+ err = fprintf(stream, "%s", indent_buf);
4432+ if (err < 0) {
4433+ return true;
4434+ }
4435+ err = fprintf(stream, "UserEventData\n");
4436+ if (err < 0) {
4437+ return true;
4438+ }
4439+ const SaHpiTextBufferT *tb = (const SaHpiTextBufferT *)&buffer->UserEventData;
4440+ err = oSaHpiTextBuffer::fprint(stream, indent + 3, tb);
4441+ if (err < 0) {
4442+ return true;
4443+ }
4444+
4445+ return false;
4446+}
4447+
4448--- openhpi-2.10.1/cpp/oSaHpiWatchdog.cpp.orig 1970-01-01 01:00:00.000000000 +0100
4449+++ openhpi-2.10.1/cpp/oSaHpiWatchdog.cpp 2007-11-04 00:10:30.388000690 +0100
4450@@ -0,0 +1,208 @@
4451+/* -*- linux-c -*-
4452+ *
4453+ * (C) Copyright IBM Corp. 2005
4454+ *
4455+ * This program is distributed in the hope that it will be useful,
4456+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4457+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
4458+ * file and program are licensed under a BSD style license. See
4459+ * the Copying file included with the OpenHPI distribution for
4460+ * full licensing terms.
4461+ *
4462+ * Author(s):
4463+ * W. David Ashley <dashley@us.ibm.com>
4464+ */
4465+
4466+
4467+#include <stdlib.h>
4468+#include <string.h>
4469+#include <stdio.h>
4470+extern "C"
4471+{
4472+#include <SaHpi.h>
4473+}
4474+#include "oSaHpiTypesEnums.hpp"
4475+#include "oSaHpiWatchdog.hpp"
4476+
4477+
4478+/**
4479+ * Default constructor.
4480+ */
4481+oSaHpiWatchdog::oSaHpiWatchdog() {
4482+ Log = false;
4483+ Running = false;
4484+ TimerUse = SAHPI_WTU_NONE;
4485+ TimerAction = SAHPI_WA_NO_ACTION;
4486+ PretimerInterrupt = SAHPI_WPI_NONE;
4487+ PreTimeoutInterval = 0;
4488+ TimerUseExpFlags = 0;
4489+ InitialCount = 0;
4490+ PresentCount = 0;
4491+};
4492+
4493+
4494+/**
4495+ * Constructor.
4496+ *
4497+ * @param buf The reference to the class to be copied.
4498+ */
4499+oSaHpiWatchdog::oSaHpiWatchdog(const oSaHpiWatchdog& buf) {
4500+ memcpy(this, &buf, sizeof(SaHpiWatchdogT));
4501+}
4502+
4503+
4504+
4505+/**
4506+ * Assign a field in the SaHpiWatchdogT struct a value.
4507+ *
4508+ * @param field The pointer to the struct (class).
4509+ * @param field The field name as a text string (case sensitive).
4510+ * @param value The character string value to be assigned to the field. This
4511+ * value will be converted as necessary.
4512+ *
4513+ * @return True if there was an error, otherwise false.
4514+ */
4515+bool oSaHpiWatchdog::assignField(SaHpiWatchdogT *ptr,
4516+ const char *field,
4517+ const char *value) {
4518+ if (ptr == NULL || field == NULL || value == NULL) {
4519+ return true;
4520+ }
4521+ if (strcmp(field, "Log") == 0) {
4522+ ptr->Log = oSaHpiTypesEnums::str2torf(value);
4523+ return false;
4524+ }
4525+ else if (strcmp(field, "Running") == 0) {
4526+ ptr->Running = oSaHpiTypesEnums::str2torf(value);
4527+ return false;
4528+ }
4529+ else if (strcmp(field, "TimerUse") == 0) {
4530+ ptr->TimerUse = oSaHpiTypesEnums::str2watchdogtimeruse(value);
4531+ return false;
4532+ }
4533+ else if (strcmp(field, "TimerAction") == 0) {
4534+ ptr->TimerAction = oSaHpiTypesEnums::str2watchdogaction(value);
4535+ return false;
4536+ }
4537+ else if (strcmp(field, "PretimerInterrupt") == 0) {
4538+ ptr->PretimerInterrupt = oSaHpiTypesEnums::str2watchdogpretimerinterrupt(value);
4539+ return false;
4540+ }
4541+ else if (strcmp(field, "PreTimeoutInterval") == 0) {
4542+ ptr->PreTimeoutInterval = strtoul(value, NULL, 10);
4543+ return false;
4544+ }
4545+ else if (strcmp(field, "TimerUseExpFlags") == 0) {
4546+ ptr->TimerUseExpFlags |= oSaHpiTypesEnums::str2watchdogexpflags(value);
4547+ return false;
4548+ }
4549+ else if (strcmp(field, "InitialCount") == 0) {
4550+ ptr->InitialCount = strtoul(value, NULL, 10);
4551+ return false;
4552+ }
4553+ else if (strcmp(field, "PresentCount") == 0) {
4554+ ptr->PresentCount = strtoul(value, NULL, 10);
4555+ return false;
4556+ }
4557+ return true;
4558+};
4559+
4560+
4561+/**
4562+ * Print the contents of the buffer.
4563+ *
4564+ * @param stream Target stream.
4565+ * @param buffer Address of the SaHpiWatchdogT struct.
4566+ *
4567+ * @return True if there was an error, otherwise false.
4568+ */
4569+bool oSaHpiWatchdog::fprint(FILE *stream,
4570+ const int indent,
4571+ const SaHpiWatchdogT *buffer) {
4572+ int i, err;
4573+ char indent_buf[indent + 1];
4574+
4575+ if (stream == NULL || buffer == NULL) {
4576+ return true;
4577+ }
4578+ for (i = 0; i < indent; i++) {
4579+ indent_buf[i] = ' ';
4580+ }
4581+ indent_buf[indent] = '\0';
4582+
4583+ err = fprintf(stream, "%s", indent_buf);
4584+ if (err < 0) {
4585+ return true;
4586+ }
4587+ err = fprintf(stream, "Log = %s\n", oSaHpiTypesEnums::torf2str(buffer->Log));
4588+ if (err < 0) {
4589+ return true;
4590+ }
4591+ err = fprintf(stream, "%s", indent_buf);
4592+ if (err < 0) {
4593+ return true;
4594+ }
4595+ err = fprintf(stream, "Running = %s\n", oSaHpiTypesEnums::torf2str(buffer->Running));
4596+ if (err < 0) {
4597+ return true;
4598+ }
4599+ err = fprintf(stream, "%s", indent_buf);
4600+ if (err < 0) {
4601+ return true;
4602+ }
4603+ err = fprintf(stream, "TimerUse = %s\n", oSaHpiTypesEnums::watchdogtimeruse2str(buffer->TimerUse));
4604+ if (err < 0) {
4605+ return true;
4606+ }
4607+ err = fprintf(stream, "%s", indent_buf);
4608+ if (err < 0) {
4609+ return true;
4610+ }
4611+ err = fprintf(stream, "TimerAction = %s\n", oSaHpiTypesEnums::watchdogaction2str(buffer->TimerAction));
4612+ if (err < 0) {
4613+ return true;
4614+ }
4615+ err = fprintf(stream, "%s", indent_buf);
4616+ if (err < 0) {
4617+ return true;
4618+ }
4619+ err = fprintf(stream, "PreTimerInterrupt = %s\n", oSaHpiTypesEnums::watchdogpretimerinterrupt2str(buffer->PretimerInterrupt));
4620+ if (err < 0) {
4621+ return true;
4622+ }
4623+ err = fprintf(stream, "%s", indent_buf);
4624+ if (err < 0) {
4625+ return true;
4626+ }
4627+ err = fprintf(stream, "PreTimeoutInterval = %u\n", buffer->PreTimeoutInterval);
4628+ if (err < 0) {
4629+ return true;
4630+ }
4631+ err = fprintf(stream, "%s", indent_buf);
4632+ if (err < 0) {
4633+ return true;
4634+ }
4635+ err = fprintf(stream, "TimerUseExpFlags = %X\n", buffer->TimerUseExpFlags);
4636+ if (err < 0) {
4637+ return true;
4638+ }
4639+ err = fprintf(stream, "%s", indent_buf);
4640+ if (err < 0) {
4641+ return true;
4642+ }
4643+ err = fprintf(stream, "InitialCount = %u\n", buffer->InitialCount);
4644+ if (err < 0) {
4645+ return true;
4646+ }
4647+ err = fprintf(stream, "%s", indent_buf);
4648+ if (err < 0) {
4649+ return true;
4650+ }
4651+ err = fprintf(stream, "PresentCount = %u\n", buffer->PresentCount);
4652+ if (err < 0) {
4653+ return true;
4654+ }
4655+
4656+ return false;
4657+}
4658+
4659--- openhpi-2.10.1/cpp/oSaHpiWatchdogEvent.cpp.orig 1970-01-01 01:00:00.000000000 +0100
4660+++ openhpi-2.10.1/cpp/oSaHpiWatchdogEvent.cpp 2007-11-04 00:10:30.388000690 +0100
4661@@ -0,0 +1,142 @@
4662+/* -*- linux-c -*-
4663+ *
4664+ * (C) Copyright IBM Corp. 2005
4665+ *
4666+ * This program is distributed in the hope that it will be useful,
4667+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4668+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
4669+ * file and program are licensed under a BSD style license. See
4670+ * the Copying file included with the OpenHPI distribution for
4671+ * full licensing terms.
4672+ *
4673+ * Author(s):
4674+ * W. David Ashley <dashley@us.ibm.com>
4675+ */
4676+
4677+
4678+#include <stdlib.h>
4679+#include <string.h>
4680+#include <stdio.h>
4681+extern "C"
4682+{
4683+#include <SaHpi.h>
4684+}
4685+#include "oSaHpiTypesEnums.hpp"
4686+#include "oSaHpiWatchdogEvent.hpp"
4687+
4688+
4689+/**
4690+ * Default constructor.
4691+ */
4692+oSaHpiWatchdogEvent::oSaHpiWatchdogEvent() {
4693+ WatchdogNum = 1;
4694+ WatchdogAction = SAHPI_WAE_NO_ACTION;
4695+ WatchdogPreTimerAction = SAHPI_WPI_NONE;
4696+ WatchdogUse = SAHPI_WTU_NONE;
4697+};
4698+
4699+
4700+/**
4701+ * Constructor.
4702+ *
4703+ * @param buf The reference to the class to be copied.
4704+ */
4705+oSaHpiWatchdogEvent::oSaHpiWatchdogEvent(const oSaHpiWatchdogEvent& range) {
4706+ memcpy(this, &range, sizeof(SaHpiWatchdogEventT));
4707+}
4708+
4709+
4710+/**
4711+ * Assign a field in the SaHpiWatchdogEventT struct a value.
4712+ *
4713+ * @param field The pointer to the struct (class).
4714+ * @param field The field name as a text string (case sensitive).
4715+ * @param value The character string value to be assigned to the field. This
4716+ * value will be converted as necessary.
4717+ *
4718+ * @return True if there was an error, otherwise false.
4719+ */
4720+bool oSaHpiWatchdogEvent::assignField(SaHpiWatchdogEventT *ptr,
4721+ const char *field,
4722+ const char *value) {
4723+ if (ptr == NULL || field == NULL || value == NULL) {
4724+ return true;
4725+ }
4726+ if (strcmp(field, "WatchdogNum") == 0) {
4727+ ptr->WatchdogNum = strtoul(value, NULL, 10);
4728+ return false;
4729+ }
4730+ else if (strcmp(field, "WatchdogAction") == 0) {
4731+ ptr->WatchdogAction = oSaHpiTypesEnums::str2watchdogactionevent(value);
4732+ return false;
4733+ }
4734+ else if (strcmp(field, "WatchdogPreTimeAction") == 0) {
4735+ ptr->WatchdogPreTimerAction = oSaHpiTypesEnums::str2watchdogpretimerinterrupt(value);
4736+ return false;
4737+ }
4738+ else if (strcmp(field, "WatchdogUse") == 0) {
4739+ ptr->WatchdogUse = oSaHpiTypesEnums::str2watchdogtimeruse(value);
4740+ return false;
4741+ }
4742+ return true;
4743+};
4744+
4745+
4746+/**
4747+ * Print the contents of the entity.
4748+ *
4749+ * @param stream Target stream.
4750+ * @param buffer Address of the SaHpiWatchdogEventT struct.
4751+ *
4752+ * @return True if there was an error, otherwise false.
4753+ */
4754+bool oSaHpiWatchdogEvent::fprint(FILE *stream,
4755+ const int indent,
4756+ const SaHpiWatchdogEventT *we) {
4757+ int i, err = 0;
4758+ char indent_buf[indent + 1];
4759+
4760+ if (stream == NULL || we == NULL) {
4761+ return true;
4762+ }
4763+ for (i = 0; i < indent; i++) {
4764+ indent_buf[i] = ' ';
4765+ }
4766+ indent_buf[indent] = '\0';
4767+
4768+ err = fprintf(stream, "%s", indent_buf);
4769+ if (err < 0) {
4770+ return true;
4771+ }
4772+ err = fprintf(stream, "WatchdogNum = %u\n", we->WatchdogNum);
4773+ if (err < 0) {
4774+ return true;
4775+ }
4776+ err = fprintf(stream, "%s", indent_buf);
4777+ if (err < 0) {
4778+ return true;
4779+ }
4780+ err = fprintf(stream, "WatchdogAction = %s\n", oSaHpiTypesEnums::watchdogactionevent2str(we->WatchdogAction));
4781+ if (err < 0) {
4782+ return true;
4783+ }
4784+ err = fprintf(stream, "%s", indent_buf);
4785+ if (err < 0) {
4786+ return true;
4787+ }
4788+ err = fprintf(stream, "WatchdogPreTimerAction = %s\n", oSaHpiTypesEnums::watchdogpretimerinterrupt2str(we->WatchdogPreTimerAction));
4789+ if (err < 0) {
4790+ return true;
4791+ }
4792+ err = fprintf(stream, "%s", indent_buf);
4793+ if (err < 0) {
4794+ return true;
4795+ }
4796+ err = fprintf(stream, "WatchdogUse = %s\n", oSaHpiTypesEnums::watchdogtimeruse2str(we->WatchdogUse));
4797+ if (err < 0) {
4798+ return true;
4799+ }
4800+
4801+ return false;
4802+}
4803+
4804--- openhpi-2.10.1/cpp/oSaHpiWatchdogRec.cpp.orig 1970-01-01 01:00:00.000000000 +0100
4805+++ openhpi-2.10.1/cpp/oSaHpiWatchdogRec.cpp 2007-11-04 00:10:30.388000690 +0100
4806@@ -0,0 +1,117 @@
4807+/* -*- linux-c -*-
4808+ *
4809+ * (C) Copyright IBM Corp. 2005
4810+ *
4811+ * This program is distributed in the hope that it will be useful,
4812+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4813+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
4814+ * file and program are licensed under a BSD style license. See
4815+ * the Copying file included with the OpenHPI distribution for
4816+ * full licensing terms.
4817+ *
4818+ * Author(s):
4819+ * W. David Ashley <dashley@us.ibm.com>
4820+ */
4821+
4822+
4823+#include <stdlib.h>
4824+#include <string.h>
4825+#include <stdio.h>
4826+extern "C"
4827+{
4828+#include <SaHpi.h>
4829+}
4830+#include "oSaHpiTypesEnums.hpp"
4831+#include "oSaHpiWatchdogRec.hpp"
4832+
4833+
4834+/**
4835+ * Default constructor.
4836+ */
4837+oSaHpiWatchdogRec::oSaHpiWatchdogRec() {
4838+ WatchdogNum = 1;
4839+ Oem = 0;
4840+};
4841+
4842+
4843+/**
4844+ * Constructor.
4845+ *
4846+ * @param buf The reference to the class to be copied.
4847+ */
4848+oSaHpiWatchdogRec::oSaHpiWatchdogRec(const oSaHpiWatchdogRec& buf) {
4849+ memcpy(this, &buf, sizeof(SaHpiWatchdogRecT));
4850+}
4851+
4852+
4853+
4854+/**
4855+ * Assign a field in the SaHpiWatchdogRecT struct a value.
4856+ *
4857+ * @param field The pointer to the struct (class).
4858+ * @param field The field name as a text string (case sensitive).
4859+ * @param value The character string value to be assigned to the field. This
4860+ * value will be converted as necessary.
4861+ *
4862+ * @return True if there was an error, otherwise false.
4863+ */
4864+bool oSaHpiWatchdogRec::assignField(SaHpiWatchdogRecT *ptr,
4865+ const char *field,
4866+ const char *value) {
4867+ if (ptr == NULL || field == NULL || value == NULL) {
4868+ return true;
4869+ }
4870+ if (strcmp(field, "WatchdogNum") == 0) {
4871+ ptr->WatchdogNum = strtoul(value, NULL, 10);
4872+ return false;
4873+ }
4874+ else if (strcmp(field, "Oem") == 0) {
4875+ ptr->Oem = strtoul(value, NULL, 10);
4876+ return false;
4877+ }
4878+ return true;
4879+};
4880+
4881+
4882+/**
4883+ * Print the contents of the buffer.
4884+ *
4885+ * @param stream Target stream.
4886+ * @param buffer Address of the SaHpiWatchdogRecT struct.
4887+ *
4888+ * @return True if there was an error, otherwise false.
4889+ */
4890+bool oSaHpiWatchdogRec::fprint(FILE *stream,
4891+ const int indent,
4892+ const SaHpiWatchdogRecT *buffer) {
4893+ int i, err;
4894+ char indent_buf[indent + 1];
4895+
4896+ if (stream == NULL || buffer == NULL) {
4897+ return true;
4898+ }
4899+ for (i = 0; i < indent; i++) {
4900+ indent_buf[i] = ' ';
4901+ }
4902+ indent_buf[indent] = '\0';
4903+
4904+ err = fprintf(stream, "%s", indent_buf);
4905+ if (err < 0) {
4906+ return true;
4907+ }
4908+ err = fprintf(stream, "WatchdogNum = %u\n", buffer->WatchdogNum);
4909+ if (err < 0) {
4910+ return true;
4911+ }
4912+ err = fprintf(stream, "%s", indent_buf);
4913+ if (err < 0) {
4914+ return true;
4915+ }
4916+ err = fprintf(stream, "Oem = %u\n", buffer->Oem);
4917+ if (err < 0) {
4918+ return true;
4919+ }
4920+
4921+ return false;
4922+}
4923+
This page took 0.629917 seconds and 4 git commands to generate.