Macroize desc parser

This commit is contained in:
Andrew J. Kroll 2013-12-04 21:55:24 -05:00
parent f38a0f6515
commit ac12126477
3 changed files with 88 additions and 194 deletions

View file

@ -821,5 +821,4 @@ MAKE_PIN(P33, CORE_PIN33_PORTREG, CORE_PIN33_BIT, CORE_PIN33_CONFIG);
#endif // __arm__ #endif // __arm__
#define output_pgm_message(wa, fp, mp , el) wa = &mp, fp((char *)pgm_read_pointer(wa), el)
#endif //_avrpins_h_ #endif //_avrpins_h_

View file

@ -1216,16 +1216,21 @@ ReportDescParserBase::UsagePageFunc ReportDescParserBase::usagePageFunctions[] /
void ReportDescParserBase::SetUsagePage(uint16_t page) { void ReportDescParserBase::SetUsagePage(uint16_t page) {
pfUsage = NULL; pfUsage = NULL;
if (page > 0x00 && page < 0x11) if (VALUE_BETWEEN(page, 0x00, 0x11))
pfUsage = /*(UsagePageFunc)pgm_read_pointer*/(usagePageFunctions[page - 1]); pfUsage = (usagePageFunctions[page - 1]);
//else if (page > 0x7f && page < 0x84)
// E_Notify(pstrUsagePageMonitor); // Dead code...
//else if (page > 0x83 && page < 0x8c) //
// E_Notify(pstrUsagePagePower); // pfUsage = (UsagePageFunc)pgm_read_pointer(usagePageFunctions[page - 1]);
//else if (page > 0x8b && page < 0x92) //else if (page > 0x7f && page < 0x84)
// E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c])); // E_Notify(pstrUsagePageMonitor);
//else if (page > 0xfeff && page <= 0xffff) //else if (page > 0x83 && page < 0x8c)
// E_Notify(pstrUsagePageVendorDefined); // E_Notify(pstrUsagePagePower);
//else if (page > 0x8b && page < 0x92)
// E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]));
//else if (page > 0xfeff && page <= 0xffff)
// E_Notify(pstrUsagePageVendorDefined);
//
else else
switch (page) { switch (page) {
case 0x14: case 0x14:
@ -1241,17 +1246,13 @@ void ReportDescParserBase::PrintUsagePage(uint16_t page) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (page > 0x00 && page < 0x11) output_if_between(page, 0x00, 0x11, w, E_Notify, usagePageTitles0[page - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&usagePageTitles0[page - 1]), 0x80); else output_if_between(page, 0x8b, 0x92, w, E_Notify, usagePageTitles1[page - 0x8c], 0x80)
output_pgm_message(w, E_Notify, usagePageTitles0[page - 1], 0x80); else if (VALUE_BETWEEN(page, 0x7f, 0x84))
else if (page > 0x7f && page < 0x84)
E_Notify(pstrUsagePageMonitor, 0x80); E_Notify(pstrUsagePageMonitor, 0x80);
else if (page > 0x83 && page < 0x8c) else if (VALUE_BETWEEN(page, 0x83, 0x8c))
E_Notify(pstrUsagePagePower, 0x80); E_Notify(pstrUsagePagePower, 0x80);
else if (page > 0x8b && page < 0x92) else if (page > 0xfeff /* && page <= 0xffff */)
//E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]), 0x80);
output_pgm_message(w, E_Notify, usagePageTitles1[page - 0x8c], 0x80);
else if (page > 0xfeff && page <= 0xffff)
E_Notify(pstrUsagePageVendorDefined, 0x80); E_Notify(pstrUsagePageVendorDefined, 0x80);
else else
switch (page) { switch (page) {
@ -1287,247 +1288,136 @@ void ReportDescParserBase::PrintGenericDesktopPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0a) output_if_between(usage, 0x00, 0x0a, w, E_Notify, genDesktopTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&genDesktopTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x2f, 0x49, w, E_Notify, genDesktopTitles1[usage - 0x30], 0x80)
output_pgm_message(w, E_Notify, genDesktopTitles0[usage - 1], 0x80); else output_if_between(usage, 0x7f, 0x94, w, E_Notify, genDesktopTitles2[usage - 0x80], 0x80)
else if (usage > 0x2f && usage < 0x49) else output_if_between(usage, 0x9f, 0xa9, w, E_Notify, genDesktopTitles3[usage - 0xa0], 0x80)
//E_Notify((char*)pgm_read_pointer(&genDesktopTitles1[usage - 0x30]), 0x80); else output_if_between(usage, 0xaf, 0xb8, w, E_Notify, genDesktopTitles4[usage - 0xb0], 0x80)
output_pgm_message(w, E_Notify, genDesktopTitles1[usage - 0x30], 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
else if (usage > 0x7f && usage < 0x94)
//E_Notify((char*)pgm_read_pointer(&genDesktopTitles2[usage - 0x80]), 0x80);
output_pgm_message(w, E_Notify, genDesktopTitles2[usage - 0x80], 0x80);
else if (usage > 0x9f && usage < 0xa9)
//E_Notify((char*)pgm_read_pointer(&genDesktopTitles3[usage - 0xa0]), 0x80);
output_pgm_message(w, E_Notify, genDesktopTitles3[usage - 0xa0], 0x80);
else if (usage > 0xaf && usage < 0xb8)
//E_Notify((char*)pgm_read_pointer(&genDesktopTitles4[usage - 0xb0]), 0x80);
output_pgm_message(w, E_Notify, genDesktopTitles4[usage - 0xb0], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintSimulationControlsPageUsage(uint16_t usage) { void ReportDescParserBase::PrintSimulationControlsPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0d) output_if_between(usage, 0x00, 0x0d, w, E_Notify, simuTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&simuTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x26, w, E_Notify, simuTitles1[usage - 0x20], 0x80)
output_pgm_message(w, E_Notify, simuTitles0[usage - 1], 0x80); else output_if_between(usage, 0xaf, 0xd1, w, E_Notify, simuTitles2[usage - 0xb0], 0x80)
else if (usage > 0x1f && usage < 0x26) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&simuTitles1[usage - 0x20]), 0x80);
output_pgm_message(w, E_Notify, simuTitles1[usage - 0x20], 0x80);
else if (usage > 0xaf && usage < 0xd1)
//E_Notify((char*)pgm_read_pointer(&simuTitles2[usage - 0xb0]), 0x80);
output_pgm_message(w, E_Notify, simuTitles2[usage - 0xb0], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintVRControlsPageUsage(uint16_t usage) { void ReportDescParserBase::PrintVRControlsPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0b) output_if_between(usage, 0x00, 0x0b, w, E_Notify, vrTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&vrTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x22, w, E_Notify, vrTitles1[usage - 0x20], 0x80)
output_pgm_message(w, E_Notify, vrTitles0[usage - 1], 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
else if (usage > 0x1f && usage < 0x22)
//E_Notify((char*)pgm_read_pointer(&vrTitles1[usage - 0x20]), 0x80);
output_pgm_message(w, E_Notify, vrTitles1[usage - 0x20], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintSportsControlsPageUsage(uint16_t usage) { void ReportDescParserBase::PrintSportsControlsPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x05) output_if_between(usage, 0x00, 0x05, w, E_Notify, sportsCtrlTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x2f, 0x3a, w, E_Notify, sportsCtrlTitles1[usage - 0x30], 0x80)
output_pgm_message(w, E_Notify, sportsCtrlTitles0[usage - 1], 0x80); else output_if_between(usage, 0x4f, 0x64, w, E_Notify, sportsCtrlTitles2[usage - 0x50], 0x80)
else if (usage > 0x2f && usage < 0x3a) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles1[usage - 0x30]), 0x80);
output_pgm_message(w, E_Notify, sportsCtrlTitles1[usage - 0x30], 0x80);
else if (usage > 0x4f && usage < 0x64)
//E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles2[usage - 0x50]), 0x80);
output_pgm_message(w, E_Notify, sportsCtrlTitles2[usage - 0x50], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintGameControlsPageUsage(uint16_t usage) { void ReportDescParserBase::PrintGameControlsPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x04) output_if_between(usage, 0x00, 0x04, w, E_Notify, gameTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&gameTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x3a, w, E_Notify, gameTitles1[usage - 0x20], 0x80)
output_pgm_message(w, E_Notify, gameTitles0[usage - 1], 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
else if (usage > 0x1f && usage < 0x3a)
//E_Notify((char*)pgm_read_pointer(&gameTitles1[usage - 0x20]), 0x80);
output_pgm_message(w, E_Notify, gameTitles1[usage - 0x20], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintGenericDeviceControlsPageUsage(uint16_t usage) { void ReportDescParserBase::PrintGenericDeviceControlsPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x1f && usage < 0x27) output_if_between(usage, 0x1f, 0x27, w, E_Notify, genDevCtrlTitles[usage - 0x20], 0x80)
//E_Notify((char*)pgm_read_pointer(&genDevCtrlTitles[usage - 0x20]), 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
output_pgm_message(w, E_Notify, genDevCtrlTitles[usage - 0x20], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintLEDPageUsage(uint16_t usage) { void ReportDescParserBase::PrintLEDPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x4e) output_if_between(usage, 0x00, 0x4e, w, E_Notify, ledTitles[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&ledTitles[usage - 1]), 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
output_pgm_message(w, E_Notify, ledTitles[usage - 1], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintTelephonyPageUsage(uint16_t usage) { void ReportDescParserBase::PrintTelephonyPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x08) output_if_between(usage, 0x00, 0x08, w, E_Notify, telTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&telTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x32, w, E_Notify, telTitles1[usage - 0x1f], 0x80)
output_pgm_message(w, E_Notify, telTitles0[usage - 1], 0x80); else output_if_between(usage, 0x4f, 0x54, w, E_Notify, telTitles2[usage - 0x4f], 0x80)
else if (usage > 0x1f && usage < 0x32) else output_if_between(usage, 0x6f, 0x75, w, E_Notify, telTitles3[usage - 0x6f], 0x80)
//E_Notify((char*)pgm_read_pointer(&telTitles1[usage - 0x1f]), 0x80); else output_if_between(usage, 0x8f, 0x9f, w, E_Notify, telTitles4[usage - 0x8f], 0x80)
output_pgm_message(w, E_Notify, telTitles1[usage - 0x1f], 0x80); else output_if_between(usage, 0xaf, 0xc0, w, E_Notify, telTitles5[usage - 0xaf], 0x80)
else if (usage > 0x4f && usage < 0x54) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&telTitles2[usage - 0x4f]), 0x80);
output_pgm_message(w, E_Notify, telTitles2[usage - 0x4f], 0x80);
else if (usage > 0x6f && usage < 0x75)
//E_Notify((char*)pgm_read_pointer(&telTitles3[usage - 0x6f]), 0x80);
output_pgm_message(w, E_Notify, telTitles3[usage - 0x6f], 0x80);
else if (usage > 0x8f && usage < 0x9f)
//E_Notify((char*)pgm_read_pointer(&telTitles4[usage - 0x8f]), 0x80);
output_pgm_message(w, E_Notify, telTitles4[usage - 0x8f], 0x80);
else if (usage > 0xaf && usage < 0xc0)
//E_Notify((char*)pgm_read_pointer(&telTitles5[usage - 0xaf]), 0x80);
output_pgm_message(w, E_Notify, telTitles5[usage - 0xaf], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintConsumerPageUsage(uint16_t usage) { void ReportDescParserBase::PrintConsumerPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x07) output_if_between(usage, 0x00, 0x07, w, E_Notify, consTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&consTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x23, w, E_Notify, consTitles1[usage - 0x1f], 0x80)
output_pgm_message(w, E_Notify, consTitles0[usage - 1], 0x80); else output_if_between(usage, 0x2f, 0x37, w, E_Notify, consTitles2[usage - 0x2f], 0x80)
else if (usage > 0x1f && usage < 0x23) else output_if_between(usage, 0x3f, 0x49, w, E_Notify, consTitles3[usage - 0x3f], 0x80)
//E_Notify((char*)pgm_read_pointer(&consTitles1[usage - 0x1f]), 0x80); else output_if_between(usage, 0x5f, 0x67, w, E_Notify, consTitles4[usage - 0x5f], 0x80)
output_pgm_message(w, E_Notify, consTitles1[usage - 0x1f], 0x80); else output_if_between(usage, 0x7f, 0xa5, w, E_Notify, consTitles5[usage - 0x7f], 0x80)
else if (usage > 0x2f && usage < 0x37) else output_if_between(usage, 0xaf, 0xcf, w, E_Notify, consTitles6[usage - 0xaf], 0x80)
//E_Notify((char*)pgm_read_pointer(&consTitles2[usage - 0x2f]), 0x80); else output_if_between(usage, 0xdf, 0xeb, w, E_Notify, consTitles7[usage - 0xdf], 0x80)
output_pgm_message(w, E_Notify, consTitles2[usage - 0x2f], 0x80); else output_if_between(usage, 0xef, 0xf6, w, E_Notify, consTitles8[usage - 0xef], 0x80)
else if (usage > 0x3f && usage < 0x49) else output_if_between(usage, 0xff, 0x10e, w, E_Notify, consTitles9[usage - 0xff], 0x80)
//E_Notify((char*)pgm_read_pointer(&consTitles3[usage - 0x3f]), 0x80); else output_if_between(usage, 0x14f, 0x156, w, E_Notify, consTitlesA[usage - 0x14f], 0x80)
output_pgm_message(w, E_Notify, consTitles3[usage - 0x3f], 0x80); else output_if_between(usage, 0x15f, 0x16b, w, E_Notify, consTitlesB[usage - 0x15f], 0x80)
else if (usage > 0x5f && usage < 0x67) else output_if_between(usage, 0x16f, 0x175, w, E_Notify, consTitlesC[usage - 0x16f], 0x80)
//E_Notify((char*)pgm_read_pointer(&consTitles4[usage - 0x5f]), 0x80); else output_if_between(usage, 0x17f, 0x1c8, w, E_Notify, consTitlesD[usage - 0x17f], 0x80)
output_pgm_message(w, E_Notify, consTitles4[usage - 0x5f], 0x80); else output_if_between(usage, 0x1ff, 0x29d, w, E_Notify, consTitlesE[usage - 0x1ff], 0x80)
else if (usage > 0x7f && usage < 0xa5) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&consTitles5[usage - 0x7f]), 0x80);
output_pgm_message(w, E_Notify, consTitles5[usage - 0x7f], 0x80);
else if (usage > 0xaf && usage < 0xcf)
//E_Notify((char*)pgm_read_pointer(&consTitles6[usage - 0xaf]), 0x80);
output_pgm_message(w, E_Notify, consTitles6[usage - 0xaf], 0x80);
else if (usage > 0xdf && usage < 0xeb)
//E_Notify((char*)pgm_read_pointer(&consTitles7[usage - 0xdf]), 0x80);
output_pgm_message(w, E_Notify, consTitles7[usage - 0xdf], 0x80);
else if (usage > 0xef && usage < 0xf6)
//E_Notify((char*)pgm_read_pointer(&consTitles8[usage - 0xef]), 0x80);
output_pgm_message(w, E_Notify, consTitles8[usage - 0xef], 0x80);
else if (usage > 0xff && usage < 0x10e)
//E_Notify((char*)pgm_read_pointer(&consTitles9[usage - 0xff]), 0x80);
output_pgm_message(w, E_Notify, consTitles9[usage - 0xff], 0x80);
else if (usage > 0x14f && usage < 0x156)
//E_Notify((char*)pgm_read_pointer(&consTitlesA[usage - 0x14f]), 0x80);
output_pgm_message(w, E_Notify, consTitlesA[usage - 0x14f], 0x80);
else if (usage > 0x15f && usage < 0x16b)
//E_Notify((char*)pgm_read_pointer(&consTitlesB[usage - 0x15f]), 0x80);
output_pgm_message(w, E_Notify, consTitlesB[usage - 0x15f], 0x80);
else if (usage > 0x16f && usage < 0x175)
//E_Notify((char*)pgm_read_pointer(&consTitlesC[usage - 0x16f]), 0x80);
output_pgm_message(w, E_Notify, consTitlesC[usage - 0x16f], 0x80);
else if (usage > 0x17f && usage < 0x1c8)
//E_Notify((char*)pgm_read_pointer(&consTitlesD[usage - 0x17f]), 0x80);
output_pgm_message(w, E_Notify, consTitlesD[usage - 0x17f], 0x80);
else if (usage > 0x1ff && usage < 0x29d)
//E_Notify((char*)pgm_read_pointer(&consTitlesE[usage - 0x1ff]), 0x80);
output_pgm_message(w, E_Notify, consTitlesE[usage - 0x1ff], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintDigitizerPageUsage(uint16_t usage) { void ReportDescParserBase::PrintDigitizerPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0e) output_if_between(usage, 0x00, 0x0e, w, E_Notify, digitTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&digitTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x23, w, E_Notify, digitTitles1[usage - 0x1f], 0x80)
output_pgm_message(w, E_Notify, digitTitles0[usage - 1], 0x80); else output_if_between(usage, 0x2f, 0x47, w, E_Notify, digitTitles2[usage - 0x2f], 0x80)
else if (usage > 0x1f && usage < 0x23) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&digitTitles1[usage - 0x1f]), 0x80);
output_pgm_message(w, E_Notify, digitTitles1[usage - 0x1f], 0x80);
else if (usage > 0x2f && usage < 0x47)
//E_Notify((char*)pgm_read_pointer(&digitTitles2[usage - 0x2f]), 0x80);
output_pgm_message(w, E_Notify, digitTitles2[usage - 0x2f], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintAlphanumDisplayPageUsage(uint16_t usage) { void ReportDescParserBase::PrintAlphanumDisplayPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x03) output_if_between(usage, 0x00, 0x03, w, E_Notify, aplphanumTitles0[usage - 1], 0x80)
//E_Notify((char*)pgm_read_pointer(&aplphanumTitles0[usage - 1]), 0x80); else output_if_between(usage, 0x1f, 0x4e, w, E_Notify, aplphanumTitles1[usage - 0x1f], 0x80)
output_pgm_message(w, E_Notify, aplphanumTitles0[usage - 1], 0x80); else output_if_between(usage, 0x7f, 0x96, w, E_Notify, digitTitles2[usage - 0x80], 0x80)
else if (usage > 0x1f && usage < 0x4e) else E_Notify(pstrUsagePageUndefined, 0x80);
//E_Notify((char*)pgm_read_pointer(&aplphanumTitles1[usage - 0x1f]), 0x80);
output_pgm_message(w, E_Notify, aplphanumTitles1[usage - 0x1f], 0x80);
else if (usage > 0x7f && usage < 0x96)
//E_Notify((char*)pgm_read_pointer(&digitTitles2[usage - 0x80]), 0x80);
output_pgm_message(w, E_Notify, digitTitles2[usage - 0x80], 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) { void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) {
const char * const * w; const char * const * w;
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
//output_pgm_message(w, E_Notify, , 0x80);
if (usage == 1) if (usage == 1) E_Notify(pstrUsageMedicalUltrasound, 0x80);
E_Notify(pstrUsageMedicalUltrasound, 0x80);
else if (usage > 0x1f && usage < 0x28)
//E_Notify((char*)pgm_read_pointer(&medInstrTitles0[usage - 0x1f]), 0x80);
output_pgm_message(w, E_Notify, medInstrTitles0[usage - 0x1f], 0x80);
else if (usage > 0x3f && usage < 0x45)
//E_Notify((char*)pgm_read_pointer(&medInstrTitles1[usage - 0x40]), 0x80);
output_pgm_message(w, E_Notify, medInstrTitles1[usage - 0x40], 0x80);
else if (usage > 0x5f && usage < 0x62)
//E_Notify((char*)pgm_read_pointer(&medInstrTitles2[usage - 0x60]), 0x80);
output_pgm_message(w, E_Notify, medInstrTitles2[usage - 0x60], 0x80);
else if (usage == 0x70) else if (usage == 0x70)
E_Notify(pstrUsageDepthGainCompensation, 0x80); E_Notify(pstrUsageDepthGainCompensation, 0x80);
else if (usage > 0x7f && usage < 0x8a) else output_if_between(usage, 0x1f, 0x28, w, E_Notify, medInstrTitles0[usage - 0x1f], 0x80)
//E_Notify((char*)pgm_read_pointer(&medInstrTitles3[usage - 0x80]), 0x80); else output_if_between(usage, 0x3f, 0x45, w, E_Notify, medInstrTitles1[usage - 0x40], 0x80)
output_pgm_message(w, E_Notify, medInstrTitles3[usage - 0x80], 0x80); else output_if_between(usage, 0x5f, 0x62, w, E_Notify, medInstrTitles2[usage - 0x60], 0x80)
else if (usage > 0x9f && usage < 0xa2) else output_if_between(usage, 0x7f, 0x8a, w, E_Notify, medInstrTitles3[usage - 0x80], 0x80)
// E_Notify((char*)pgm_read_pointer(&medInstrTitles4[usage - 0xa0]), 0x80); else output_if_between(usage, 0x9f, 0xa2, w, E_Notify, medInstrTitles4[usage - 0xa0], 0x80)
output_pgm_message(w, E_Notify, medInstrTitles4[usage - 0xa0], 0x80); else E_Notify(pstrUsagePageUndefined, 0x80);
else
E_Notify(pstrUsagePageUndefined, 0x80);
} }
uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) { uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {

View file

@ -14,6 +14,11 @@
// HANDY MACROS // HANDY MACROS
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define VALUE_BETWEEN(v,l,h) (((v)>(l)) && ((v)<(h)))
#define VALUE_WITHIN(v,l,h) (((v)>=(l)) && ((v)<=(h)))
#define output_pgm_message(wa,fp,mp,el) wa = &mp, fp((char *)pgm_read_pointer(wa), el)
#define output_if_between(v,l,h,wa,fp,mp,el) if(VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp,el);
#define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
#ifndef __BYTE_GRABBING_DEFINED__ #ifndef __BYTE_GRABBING_DEFINED__
#define __BYTE_GRABBING_DEFINED__ 1 #define __BYTE_GRABBING_DEFINED__ 1