@@ -551,9 +551,9 @@ ndicapiExport char* ndiErrorString(int errnum)
551551 " Too much environmental infrared" ,
552552 " Unrecognized error code" ,
553553 " Unrecognized error code" ,
554- " Unable to read Flash EPROM" ,
555- " Unable to write Flash EPROM" ,
556554 " Unable to erase Flash EPROM"
555+ " Unable to write Flash EPROM" ,
556+ " Unable to read Flash EPROM" ,
557557 };
558558
559559 static char * textarray_api[] = // values specific to the API
@@ -568,17 +568,29 @@ ndicapiExport char* ndiErrorString(int errnum)
568568 " Measurement System not found on specified port"
569569 };
570570
571+ static char * textarray_serial[] = // values specific to serial errors
572+ {
573+ " Serial DSR query failure" ,
574+ " Bad reply from measurement system" ,
575+ " System does not support Features.Firmware" ,
576+ " Command VER failed"
577+ };
578+
571579 if (errnum >= 0x00 && errnum <= 0x31 )
572580 {
573581 return textarray_low[errnum];
574582 }
575- else if (errnum <= 0xf6 && errnum >= 0xf1 )
583+ else if (errnum >= 0xf1 && errnum <= 0xf6 )
576584 {
577585 return textarray_high[errnum - 0xf1 ];
578586 }
579- else if (errnum >= 0x100 && errnum <= 0x700 )
587+ else if (errnum >= 0x0100 && errnum <= 0x0107 )
588+ {
589+ return textarray_api[errnum - 0x0100 ];
590+ }
591+ else if (errnum >= 0x0200 && errnum <= 0x0203 )
580592 {
581- return textarray_api[( errnum >> 8 ) - 1 ];
593+ return textarray_serial[ errnum - 0x200 ];
582594 }
583595
584596 return " Unrecognized error code" ;
@@ -723,7 +735,7 @@ ndicapiExport int ndiSerialProbe(const char* device)
723735 if (!ndiSerialCheckDSR (serial_port))
724736 {
725737 ndiSerialClose (serial_port);
726- return NDI_PROBE_FAIL ;
738+ return NDI_DSR_FAILURE ;
727739 }
728740
729741 // set comm parameters to default, but decrease timeout to 0.1s
@@ -757,7 +769,7 @@ ndicapiExport int ndiSerialProbe(const char* device)
757769 if (n < 0 )
758770 {
759771 ndiSerialClose (serial_port);
760- return NDI_READ_ERROR ;
772+ return errorCode ;
761773 }
762774 else if (n == 0 )
763775 {
@@ -769,7 +781,7 @@ ndicapiExport int ndiSerialProbe(const char* device)
769781 if (strncmp (init_reply, " RESETBE6F\r " , 10 ) != 0 )
770782 {
771783 ndiSerialClose (serial_port);
772- return NDI_PROBE_FAIL ;
784+ return NDI_BAD_REPLY ;
773785 }
774786 // try to initialize a second time
775787 ndiSerialSleep (serial_port, 100 );
@@ -809,7 +821,7 @@ ndicapiExport int ndiSerialProbe(const char* device)
809821 if (ndiSerialWrite (serial_port, " GETINFO:Features.Firmware.Version0492\r " , strlen (" GETINFO:Features.Firmware.Version0492\r " )) != strlen (" GETINFO:Features.Firmware.Version0492\r " ))
810822 {
811823 ndiSerialClose (serial_port);
812- return NDI_PROBE_FAIL ;
824+ return NDI_NO_FEATURES_FIRMWARE ;
813825 }
814826
815827 n = ndiSerialRead (serial_port, reply, 1023 , false , &errorCode);
@@ -831,13 +843,13 @@ ndicapiExport int ndiSerialProbe(const char* device)
831843 (n = ndiSerialRead (serial_port, reply, 1023 , false , &errorCode)) < 7 )
832844 {
833845 ndiSerialClose (serial_port);
834- return NDI_PROBE_FAIL ;
846+ return NDI_COMMAND_VER_FAILED ;
835847 }
836848 }
837849 else if (strncmp (reply, " Features" , strlen (" Features" )) != 0 )
838850 {
839851 ndiSerialClose (serial_port);
840- return NDI_PROBE_FAIL ;
852+ return NDI_BAD_REPLY ;
841853 }
842854 }
843855
0 commit comments