Datalogic .NET SDK

ReadString (Method) (+2 overloads)

 

Syntax

 

    public string ReadString(int reqID, ref CodeId codeID);

 

 

Class                           : DecodeHandle

Namespace                : Datalogic.API

Assembly                   : Datalogic.API.DLL

 

 

Description

Reads data that was used to fulfill a request previously posted to a decoding device.

 

Parameters Table

 

Type

Parameter

Description

[in]

int

reqID

Request identifier of the request that has been satisfied with data. Datalogic.API.DecodeHandle.PostRequestWait, Datalogic.API.DecodeHandle.PostRequestMsg and  the class Datalogic.API.DecodeEvent return this identifier.

[out]

ref CodeId

codeID

Refers to a variable which will receive the code identifier for the string.

 

 

 

 

[return]

string

 

On success returns the string copied into the buffer, not including the null terminator.  Specifying a request ID that has not yet been fulfilled will return NULL.
If a NULL  string  is read by the decoding device, System.String.Empty will be returned.

[on error]

System.String.Empty

 

-

 

 

 

Example 1

 

 

reqID = hDcd.PostRequestWait((DecodeRequest)1);

 

if (reqID != -1)

{

      // Obtain the string, code id and code id modifier.

      try

      {

            /* Example #10: DecodeHandle.ReadString (overload 2) */

            strAimIdentifier = hDcd.GetAimIdentifier(reqID);

            modChar += strAimIdentifier[strAimIdentifier.Length - 1];

            codeIDMod = Convert.ToInt32(modChar, 16);

            dcdData = hDcd.ReadString(reqID, ref cID);

      }

      catch (Exception)

      {

            MessageBox.Show("Error reading string!");

            return;

            }

}

 

 

Example 2

 

 

/*Example #10b: Using the code id modifier to gain additional

 * information about a decoded symbol.

 * This example returns a description, but in actual practice, using

 * the codeIDMod as an integer

 * to inform the parsing routines of the

 * decoded data would be useful.*/

 if (codeIDMod == 0)

     return "Normal";

 

 String details = "Unknown Mod";

 switch (cID)

 {

     case CodeId.AztecCode:

         details = ((CodeIdModAztec)codeIDMod).ToString();

         break;

     case CodeId.Codabar:

         details = ((CodeIdModCodabar)codeIDMod).ToString();

         break;

     case CodeId.Code128:

         details = ((CodeIdModCode128)codeIDMod).ToString();

         break;

     case CodeId.Code39:

         details = ((CodeIdModCode39)codeIDMod).ToString();

         break;

 

     //No modifiers

     case CodeId.Code93:

         break;

 

     case CodeId.Datamatrix:

         details = ((CodeIdModDataMatrix)codeIDMod).ToString();

         break;

     case CodeId.EAN13:

     case CodeId.EAN8:

     case CodeId.UPCA:

     case CodeId.UPCE:

          details = ((CodeIdModUPC_EAN)codeIDMod).ToString();

         break;

 

     //No modifiers

     case CodeId.GS1_14:

     case CodeId.GS1Expanded:

     case CodeId.GS1Limited:

         break;

 

     case CodeId.Interleaved25:

         details = ((CodeIdModInterleaved25)codeIDMod).ToString();

         break;

 

     //No modifiers

     case CodeId.Matrix25:

         break;

 

     case CodeId.Maxicode:

         details = ((CodeIdModMaxiCode)codeIDMod).ToString();

         break;

     case CodeId.MicroPDF417:

         details = ((CodeIdModMicroPDF417)codeIDMod).ToString();

         break;

     case CodeId.MSI:

         details = ((CodeIdModMSI)codeIDMod).ToString();

         break;

 

     //No modifiers

     case CodeId.PDF417:

     case CodeId.Pharmacode39:

     case CodeId.Postal:

         break;

               

     case CodeId.QRCode:

         details = ((CodeIdModQRCode)codeIDMod).ToString();

         break;

     case CodeId.Standard25:

         details = ((CodeIdModStandard25)codeIDMod).ToString();

         break;

 

     //No modifiers

     case CodeId.Trioptic:

         break;

 

     case CodeId.UCCComposite:

         details = ((CodeIdModComposite)codeIDMod).ToString();

         break;

 

     default:

         details = "Unknown Code ID";

         break;

}

return details;

 

 

 

See Also

DecodeHandle.PostRequestWait (Method), DecodeHandle.PostRequestMsg(Method), DecodeEvent (Class),  Scanned (event), CodeId (Enum), Enumerations List (CodeIdModXXX enumerations), GetAimIdentifier, DecodeEventArgs (Class), Examples #010 and #10b.

 

 

Copyright © Datalogic ADC. All Right Reserved