5.2. AllReceipts

Provides the function of AllReceipts service

  • Method

    Name

    Contents

    uploadBitmap

    Uploads bitmap to the Star Micronics Service.

    uploadData

    Uploads data to the Star Micronics Service.

    updateStatus

    Updates the device status information on the Star Micronics Cloud.

    generateAllReceipts

    Generates the print data for the AllReceiptsTMuse.

Supported Method for each models.

Model/Emulation

mC-Print2 mC-Print3 mPOP FVP10 TSP100IIIW TSP100IIIBITSP100IIIU TSP100ECO TSP100U TSP100GTTSP100LAN TSP650II TSP650IISK TSP700II TSP800IITUP500SM-S210i SM-S220i SM-S230i SM-T300i/T300 SM-T400i BSC10 SM-L200 SM-L300 SP700SK1-211/221/V211 SK1-211/221/V211 Presenter SK1-311/321/V311 SK1-311/V311 Presenter
StarPRNT StarPRNT StarPRNT StarLine StarGraphic StarGraphic StarGraphic StarGraphic StarGraphic StarGraphic StarGraphic StarLine StarLine StarLine StarLine StarLine StarPRNT EscPosMobile StarPRNT EscPosMobile StarPRNT EscPosMobile StarPRNT EscPosMobile StarPRNT EscPosMobile EscPos StarPRNT StarPRNT StarDotImpact StarPRNT StarPRNT StarPRNT StarPRNT

uploadBitmap

- - - - - -

uploadData

- - - - - -

updateStatus

- - - - - -

generateAllReceipts

- - - - - -

5.2.1. uploadBitmap

Uploads bitmap to the Star Micronics Service.

  • Declaration

    public synchronized static String uploadBitmap(Context context, Bitmap bitmap, RequestCallback callback);
    
  • Parameter

    Name Contents Type
    context context android.context.Contex
    bitmap Bitmap to upload android.graphics.Bitmap
    callback
    callback

    When the upload is completed, check upload result as following status
    * statusCode … HTTP status code
    * error … Error information when fails to upload data
    RequestCallback
  • Return value

    Contents Type
    Uploaded URL String
  • Examples

    public static byte[] createData(Context context, Emulation emulation, Bitmap bitmap, RequestCallback callback) {
        String urlString = AllReceipts.uploadBitmap(context, bitmap, callback);
    
        ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation);
    
        builder.beginDocument();
    
        builder.appendBitmap(bitmap, false);
    
        byte[] data = AllReceipts.generateAllReceipts(context, urlString, emulation, true, true); builder.appendRaw(data);
    
        builder.appendCutPaper(CutPaperAction.PartialCutWithFeed);
    
        builder.endDocument();
    
        return builder.getCommands();
    }
    

    Refer to AllReceiptsFunctions.java.

5.2.2. uploadData

added in version 1.1.0

Uploads data to the Star Micronics Service.

  • Declaration

    public synchronized static String uploadData(Context context, byte[] data, Emulation emulation, CharacterCode characterCode, int width, RequestCallback callback);
    
  • Parameter

    Name Contents Type
    context context android.context.Contex
    data Data to upload byte[]
    emulation Emulation type Emulation
    characterCode Character code type constants CharacterCode
    width Printable width (Units : Dots) int
    callback
    callback

    When the upload is completed, check upload result as following status
    * statusCode … HTTP status code
    * error … Error information when fails to upload data
    RequestCallback

    Constant of Emulation for each model, refer to Emulation Constants.

  • Return value

    Contents Type
    Uploaded URL String
  • Examples

    public static byte[] createData(Context context, Emulation emulation, CharacterCode characterCode, byte[] data, RequestCallback callback) {
        ICommandBuilder uploadDataBuilder = StarIoExt.createCommandBuilder(emulation);
    
        uploadDataBuilder.beginDocument();
    
        uploadDataBuilder.append(data);
    
        uploadDataBuilder.appendCutPaper(CutPaperAction.PartialCutWithFeed);
    
        uploadDataBuilder.endDocument();
    
        byte[] receiptData = uploadDataBuilder.getCommands;
    
        String urlString = AllReceipts.uploadData(context, receiptData, emulation, characterCode, width, callback);
    
        ICommandBuilder printDataBuilder = StarIoExt.createCommandBuilder(emulation);
    
        printDataBuilder.beginDocument();
    
        printDataBuilder.append(data);
    
        byte[] allReceiptsData = AllReceipts.generateAllReceipts(context, urlString, emulation, true, true);
    
        printDataBuilder.appendRaw(allReceiptsData);
    
        printDataBuilder.appendCutPaper(CutPaperAction.PartialCutWithFeed);
    
        printDataBuilder.endDocument();
    
        return printDataBuilder.getCommands();
    }
    

    Refer to AllReceiptsFunctions.java.

5.2.3. updateStatus

Updates the device status information on the Star Micronics Cloud.

  • Declaration

    public synchronized static void updateStatus(Context context, String status, RequestCallback callback);
    
  • Parameter

    Name Contents Type
    context context android.context.Contex
    status
    Updated status

    Hexdecimal digit sequence of 3rd to 6th bytes in Automatic Status (ex. 28000000 ).
    Please refer to STAR Line Mode and StarPRNT command manual for details of Automatic Status.
    String
    callback
    callback

    When the upload is completed, check upload result as following status
    * statusCode … HTTP status code
    * error … Error information when fails to upload data
    RequestCallback
  • Return value

    None

  • Examples

    @Override
    public void onStatusUpdate(StarIoExtManager manager, String status) {
        AllReceipts.updateStatus(getContext(), status, new RequestCallback() {
            @Override
            public void onRequestResult(int statusCode, RequestError requestError) {
            String message;
    
            if (requestError != null) {
                message = requestError.getMessage();
            }
            else {
                essage = "Status Code : " + statusCode;
            }
    
            Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
            }
        });
    }
    

    Refer to AllReceiptsExtFragment.java.

5.2.4. generateAllReceipts

Generates the print data for the AllReceiptsTMuse.

  • Declaration

    public synchronized static byte[] generateAllReceipts(Context context, String urlString, Emulation emulation, boolean info, boolean qrCode);
    public synchronized static byte[] generateAllReceipts(Context context, String urlString, Emulation emulation, boolean info, boolean qrCode, int width);
    
  • Parameter

    Name Contents Type
    context context android.context.Contex
    urlString Uploaded URL String
    emulation Emulation type Emulation
    info
    Generates information logo
    true … Valid
    false … Invlid
    boolean
    qrCode
    Generates QR code.
    true … Valid
    false … Invlid
    boolean
    width Printable width (Units : Dots) int

    Constant of Emulation for each model, refer to Emulation Constants.

  • Return value

    Contents Type
    Generated print data byte[]
  • Examples

    public static byte[] createData(Context context, Emulation emulation, Bitmap bitmap, int width, RequestCallback callback) {
        String urlString = AllReceipts.uploadBitmap(context, bitmap, callback);
    
        ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation);
    
        builder.beginDocument();
    
        builder.appendBitmap(bitmap, false);
    
        byte[] data;
    
        if (emulation == Emulation.StarGraphic) {
            data = AllReceipts.generateAllReceipts(context, urlString, emulation, true, true); // Support to centering in Star Graphic.
        }
        else {
            data = AllReceipts.generateAllReceipts(context, urlString, emulation, true, true, width);  // Non support to centering in Star Graphic.
        }
    
        builder.appendRaw(data);
    
        builder.appendCutPaper(CutPaperAction.PartialCutWithFeed);
    
        builder.endDocument();
    
        return builder.getCommands();
    }
    

    Refer to AllReceiptsFunctions.java.