5.3. SMCSAllReceipts¶
Provides the function of AllReceipts service
Method
Name
Contents
Uploads bitmap to the Star Micronics Service.
Uploads data to the Star Micronics Service.
Updates the device status information on the Star Micronics Cloud.
Generates the print data for the AllReceiptsTMuse.
Event
Name
Contents
Occurs when UploadBitmap method is completed.
Occurs when UploadData method is completed.
Occurs when UpdateStatus method is completed.
Supported Method for each models.
Model/Emulation |
mC-Print2 | mC-Print3 | mPOP | FVP10 | TSP100IIIW | TSP100IIIBI | TSP100IIIU | TSP100ECO | TSP100U | TSP100GT | TSP100LAN | TSP650II | TSP650IISK | TSP700II | TSP800II | SM-S210i | SM-S220i | SM-S230i | SM-T300i/T300 | SM-T400i | BSC10 | SM-L200 | SM-L300 | SP700 | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StarPRNT | StarPRNT | StarPRNT | StarLine | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarLine | StarLine | StarLine | StarLine | StarPRNT | EscPosMobile | StarPRNT | EscPosMobile | StarPRNT | EscPosMobile | StarPRNT | EscPosMobile | StarPRNT | EscPosMobile | EscPos | StarPRNT | StarPRNT | StarDotImpact | |
UploadBitmap |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | ✔ | ✔ | - |
UploadData |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | ✔ | ✔ | - |
UpdateStatus |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | ✔ | ✔ | - |
GenerateAllReceipts |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | - | ✔ | ✔ | ✔ | - |
5.3.1. UploadBitmap¶
Uploads bitmap to the Star Micronics Service.
Declaration
public static byte[] UploadBitmap(Bitmap bitmap)
Parameter
Name Contents Type bitmap Bitmap to upload System.Drawing.Bitmap Return value
Contents Type Uploaded URL byte[]
Examples
public static byte[] CreateRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool receipt, bool info, bool qrCode) { if (!receipt && !info && !qrCode) { return null; } Bitmap image = localizeReceipt.CreateRasterReceiptImage(); byte[] urlData = SMCSAllReceipts.UploadBitmap(image); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); if (receipt) { builder.AppendBitmap(image, false); } byte[] allReceiptsData; if (emulation == Emulation.StarGraphic) { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode, width); // Support to centering in Star Graphic. } else { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode);// Non support to centering in Star Graphic. } builder.AppendRaw(allReceiptsData); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return builder.Commands; }
Refer to AllReceiptsFunctions.m.
5.3.2. UploadData¶
Uploads data to the Star Micronics Service.
Declaration
public static byte[] UploadData(byte[] data, Emulation emulation, CharacterCode characterCode, int width)
Parameter
Name Contents Type data Data to upload byte[] emulation Emulation type Emulation characterCode Character code type constants CharacterCode width Printable width (Units : Dots) int Constant of Emulation for each model, refer to Emulation Constants.
Return value
Contents Type Uploaded URL byte[]
Examples
public static byte[] CreateTextReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool utf8, bool receipt, bool info, bool qrCode) { ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); localizeReceipt.AppendTextReceiptData(builder, utf8); builder.EndDocument(); byte[] receiptsData = builder.Commands; byte[] urlData = SMCSAllReceipts.UploadData(receiptsData, emulation, localizeReceipt.CharacterCode, width); ICommandBuilder printDataBuilder = StarIoExt.CreateCommandBuilder(emulation); printDataBuilder.BeginDocument(); if (receipt) { localizeReceipt.AppendTextReceiptData(printDataBuilder, utf8); } byte[] allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode); printDataBuilder.AppendRaw(allReceiptsData); printDataBuilder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); printDataBuilder.EndDocument(); return printDataBuilder.Commands; }
Refer to AllReceiptsFunctions.m.
5.3.3. UpdateStatus¶
Updates the device status information on the Star Micronics Cloud.
Declaration
public static void UpdateStatus(string status)
Parameter
Name Contents Type status Updated statusHexdecimal 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 Return value
None
Examples
private void OnStatusUpdated() { string statusCode = CreateCurrentPrinterStatusCode(); SMCSAllReceipts.UpdateStatus(statusCode); } private string CreateCurrentPrinterStatusCode() { int statusCode; if (currentPrinterStatus == PrinterStatus.Impossible) // Printer is impossible. { statusCode = 0x08000000; } else { statusCode = 0x00000000; if (currentPrinterStatus == PrinterStatus.Offline) // Printer is offline. { statusCode |= 0x08000000; } if (currentPaperStatus == PaperStatus.Empty) // Paper is empty. { statusCode |= 0x0000000c; } else if (currentPaperStatus == PaperStatus.NearEmpty) // Paper is near empty. { statusCode |= 0x00000004; } if (currentCoverStatus == CoverStatus.Open) // Cover is open. { statusCode |= 0x20000000; } if (currentCashDrawerStatus == CashDrawerStatus.Open) // Cash drawer is open. { statusCode |= 0x04000000; } } return String.Format("{0:x8}", statusCode); }
Refer to AllReceiptsExtSamplePage.xaml.cs.
5.3.4. GenerateAllReceipts¶
Generates the print data for the AllReceiptsTMuse.
Declaration
public static byte[] GenerateAllReceipts(byte[] url, Emulation emulation, bool info, bool qrCode) public static byte[] GenerateAllReceipts(byte[] url, Emulation emulation, bool info, bool qrCode, int width)
Parameter
Name Contents Type url Uploaded URL byte[] emulation Emulation type Emulation info Generates information logotrue … Validfalse … Invlidbool qrCode Generates QR code.true … Validfalse … Invlidbool 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[] CreateRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool receipt, bool info, bool qrCode) { if (!receipt && !info && !qrCode) { return null; } Bitmap image = localizeReceipt.CreateRasterReceiptImage(); byte[] urlData = SMCSAllReceipts.UploadBitmap(image); ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation); builder.BeginDocument(); if (receipt) { builder.AppendBitmap(image, false); } byte[] allReceiptsData; if (emulation == Emulation.StarGraphic) { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode, width); // Support to centering in Star Graphic. } else { allReceiptsData = SMCSAllReceipts.GenerateAllReceipts(urlData, emulation, info, qrCode);// Non support to centering in Star Graphic. } builder.AppendRaw(allReceiptsData); builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed); builder.EndDocument(); return builder.Commands; }
Refer to AllReceiptsFunctions.m.
5.3.5. UploadedBitmapResultEvent¶
Occurs when UploadBitmap method is completed.
Syntax
public static event EventHandler<RequestResult> UploadedBitmapResultEvent
Examples
public static void AddAllReceiptsFunctionEvent() { SMCloudServices.RegisterEvent += AllReceiptsFunctions.SMCloudServices_RegisterResultEvent; SMCSAllReceipts.UpdatedStatusResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UpdatedStatusResultEvent; SMCSAllReceipts.UploadedBitmapResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedBitmapResultEvent; SMCSAllReceipts.UploadedDataResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedDataResultEvent; } public static void SMCSAllReceipts_UploadedBitmapResultEvent(object sender, RequestResult e) { string resultMessage = e.ErrorMessage; string statusCode = e.StatusCode.ToString(); }
Refer to AllReceiptsFunctions.cs
5.3.6. UploadDataResultEvent¶
Occurs when UploadData method is completed.
Syntax
public static event EventHandler<RequestResult> UploadDataResultEvent
Examples
public static void AddAllReceiptsFunctionEvent() { SMCloudServices.RegisterEvent += AllReceiptsFunctions.SMCloudServices_RegisterResultEvent; SMCSAllReceipts.UpdatedStatusResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UpdatedStatusResultEvent; SMCSAllReceipts.UploadedBitmapResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedBitmapResultEvent; SMCSAllReceipts.UploadedDataResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedDataResultEvent; } public static void SMCSAllReceipts_UploadedDataResultEvent(object sender, RequestResult e) { string resultMessage = e.ErrorMessage; string statusCode = e.StatusCode.ToString(); }
Refer to AllReceiptsFunctions.m.
5.3.7. UpdatedStatusResultEvent¶
Occurs when UpdateStatus method is completed.
Syntax
public static event EventHandler<RequestResult> UpdatedStatusResultEvent
Examples
public static void AddAllReceiptsFunctionEvent() { SMCloudServices.RegisterEvent += AllReceiptsFunctions.SMCloudServices_RegisterResultEvent; SMCSAllReceipts.UpdatedStatusResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UpdatedStatusResultEvent; SMCSAllReceipts.UploadedBitmapResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedBitmapResultEvent; SMCSAllReceipts.UploadedDataResultEvent += AllReceiptsFunctions.SMCSAllReceipts_UploadedDataResultEvent; } public static void SMCSAllReceipts_UpdatedStatusResultEvent(object sender, RequestResult e) { string resultMessage = e.ErrorMessage; string statusCode= e.StatusCode.ToString(); }
Refer to AllReceiptsExtSamplePage.xaml.cs.
5.4. RequestResult¶
Request result notification class
Declaration
public class RequestResult : EventArgs
Property
Name Contents StatusCode HTTP status code ErrorMessage Error information when fails to upload data
5.4.2. ErrorMessage¶
Error information when fails to upload data
Syntax
public string ErrorMessage { get; }