public static byte[] CreateTextPattern(DisplayFunctionManager.TextPattern pattern)
        {
            IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);

            builder.AppendClearScreen();
            builder.AppendCursorMode(DisplayCursorMode.Off);
            builder.AppendHomePosition();

            byte[] textPattern;

            switch (pattern)
            {
            default:
            case DisplayFunctionManager.TextPattern.Pattern1:
                textPattern = new byte[] {
                    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
                    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
                };
                break;

            case DisplayFunctionManager.TextPattern.Pattern2:
                textPattern = new byte[] {
                    0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
                    0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f
                };
                break;

            case DisplayFunctionManager.TextPattern.Pattern3:
                textPattern = new byte[] {
                    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
                    0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97
                };
                break;

            case DisplayFunctionManager.TextPattern.Pattern4:
                textPattern = new byte[] {
                    0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
                    0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf
                };
                break;

            case DisplayFunctionManager.TextPattern.Pattern5:
                textPattern = new byte[] {
                    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
                    0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7
                };
                break;

            case DisplayFunctionManager.TextPattern.Pattern6:
                textPattern = new byte[] {
                    0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
                    0xfc, 0xfd, 0xfe, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                };
                break;
            }

            builder.Append(textPattern);

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 2
0
        public static byte[] CreateScaleRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool bothScale, bool receipt, bool info, bool qrCode)
        {
            Bitmap image = localizeReceipt.CreateScaleRasterReceiptImage();

            byte[] urlData = SMCSAllReceipts.UploadBitmap(image);

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            if (receipt)
            {
                builder.AppendBitmap(image, false, width, bothScale);
            }

            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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public static byte[] CreateLineSpaceData(Emulation emulation)
        {
            byte[] data = Encoding.UTF8.GetBytes("Hello World.");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendLineSpace(32);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineSpace(24);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineSpace(32);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineSpace(24);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);
            builder.AppendLineFeed(data);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 5
0
        public static byte[] CreateAlignmentData(Emulation emulation)
        {
            byte[] data = Encoding.UTF8.GetBytes("Hello World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(data);

            builder.AppendAlignment(AlignmentPosition.Center);
            builder.Append(data);
            builder.AppendAlignment(AlignmentPosition.Right);
            builder.Append(data);
            builder.AppendAlignment(AlignmentPosition.Left);
            builder.Append(data);

            builder.AppendAlignment(data, AlignmentPosition.Center);
            builder.AppendAlignment(data, AlignmentPosition.Right);
            builder.Append(data);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 6
0
        public static byte[] CreateUnderLineData(Emulation emulation)
        {
            byte[] data      = Encoding.UTF8.GetBytes("Hello World.\n");
            byte[] dataHalf0 = Encoding.UTF8.GetBytes("Hello ");
            byte[] dataHalf1 = Encoding.UTF8.GetBytes("World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(data);

            builder.AppendUnderLine(true);
            builder.Append(data);
            builder.AppendUnderLine(false);
            builder.Append(data);

            builder.AppendUnderLine(data);
            builder.Append(data);

            builder.AppendUnderLine(dataHalf0);
            builder.Append(dataHalf1);

            builder.Append(dataHalf0);
            builder.AppendUnderLine(dataHalf1);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
        public static byte[] CreateGraphicPattern(DisplayFunctionManager.GraphicPattern pattern)
        {
            IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);

            builder.AppendClearScreen();
            builder.AppendCursorMode(DisplayCursorMode.Off);

            Bitmap bitmap, stream;

            switch (pattern)
            {
            default:
            case DisplayFunctionManager.GraphicPattern.Pattern1:
                stream = Properties.Resources.display_image_1;
                break;

            case DisplayFunctionManager.GraphicPattern.Pattern2:
                stream = Properties.Resources.display_image_2;
                break;
            }

            bitmap = new Bitmap(stream);

            builder.AppendBitmap(bitmap, false);

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 8
0
        public static byte[] CreatePasteTextBlackMarkData(Emulation emulation, LocalizeReceipt localizeReceipt, string pasteText, bool doubleHeight, BlackMarkType type, bool utf8)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendBlackMark(type);

            if (doubleHeight)
            {
                builder.AppendMultipleHeight(2);

                localizeReceipt.AppendPasteTextLabelData(builder, pasteText, utf8);

                builder.AppendMultipleHeight(1);
            }
            else
            {
                localizeReceipt.AppendPasteTextLabelData(builder, pasteText, utf8);
            }

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Sample : Getting scale status.
        /// </summary>
        public static Communication.PeripheralStatus GetScaleStatus(IPort port)
        {
            // Create IPeripheralConnectParser object.
            IPeripheralConnectParser parser = StarIoExt.CreateScaleConnectParser(ScaleModel.APS10);

            // Usage of parser sample is "Communication.ParseDoNotCheckCondition(IPeripheralCommandParser parser, IPort port)".
            Communication.CommunicationResult result = Communication.ParseDoNotCheckCondition(parser, port);

            // Check peripheral status.
            Communication.PeripheralStatus status = Communication.PeripheralStatus.Invalid;
            if (result == Communication.CommunicationResult.Success)
            {
                // Check parser property value.
                if (parser.IsConnected) // connect
                {
                    status = Communication.PeripheralStatus.Connect;
                }
                else // disconnect
                {
                    status = Communication.PeripheralStatus.Disconnect;
                }
            }
            else // communication error
            {
                status = Communication.PeripheralStatus.Impossible;
            }

            return(status);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sample : Getting displayed weight.
        /// </summary>
        public static Communication.PeripheralStatus GetScaleDisplayedWeight(IPort port, ref DisplayedWeightStatus weightStatus, ref string weight)
        {
            // Check scale status.
            Communication.PeripheralStatus status = GetScaleStatus(port);

            if (status != Communication.PeripheralStatus.Connect) // Scale is not connected.
            {
                return(status);
            }

            // Create IScaleWeightParser object.
            IScaleWeightParser parser = StarIoExt.CreateScaleWeightParser(ScaleModel.APS10);

            // Usage of parser sample is "ScaleCommunication.ParseDoNotCheckCondition(IPeripheralCommandParser parser, IPort port)".
            Communication.CommunicationResult result = ScaleCommunication.ParseDoNotCheckCondition(parser, port);

            if (result != Communication.CommunicationResult.Success) // communication error.
            {
                return(Communication.PeripheralStatus.Impossible);
            }

            // Check parser property value.
            weightStatus = parser.Status;                   // WeightStatus
            weight       = parser.Weight;                   // weight

            return(Communication.PeripheralStatus.Connect); // Success
        }
        public static byte[] CreateClearScreen()
        {
            IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);

            builder.AppendClearScreen();

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 12
0
        public static byte[] CreatePdf417Data(Emulation emulation)
        {
            byte[] data;

            data = Encoding.UTF8.GetBytes("Hello World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(Encoding.UTF8.GetBytes("\n*Module:2*\n"));
            builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Module:4*\n"));
            builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 4, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Column:2*\n"));
            builder.AppendPdf417(data, 0, 2, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Column:4*\n"));
            builder.AppendPdf417(data, 0, 4, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Line:10*\n"));
            builder.AppendPdf417(data, 10, 0, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Line:40*\n"));
            builder.AppendPdf417(data, 40, 0, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC0*\n"));
            builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC8*\n"));
            builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC8, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n"));
            builder.AppendPdf417WithAbsolutePosition(data, 0, 1, Pdf417Level.ECC0, 2, 2, 40);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n"));
            builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Center);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n"));
            builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Right);
            builder.AppendUnitFeed(32);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 13
0
        public static byte[] CreateZeroClear()
        {
            IScaleCommandBuilder builder = StarIoExt.CreateScaleCommandBuilder(ScaleModel.APS10);

            //IScaleCommandBuilder builder = StarIoExt.CreateScaleCommandBuilder(ScaleModel.APS12);
            //IScaleCommandBuilder builder = StarIoExt.CreateScaleCommandBuilder(ScaleModel.APS20);

            builder.AppendZeroClear();

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 14
0
        public static byte[] CreateData(Emulation emulation, PeripheralChannel channel)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendPeripheral(channel);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 15
0
        public static byte[] CreateMultipleData(Emulation emulation)
        {
            byte[] data      = Encoding.UTF8.GetBytes("Hello World.\n");
            byte[] dataHalf0 = Encoding.UTF8.GetBytes("Hello ");
            byte[] dataHalf1 = Encoding.UTF8.GetBytes("World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(data);

            builder.AppendMultiple(2, 2);
            builder.Append(data);
            builder.AppendMultiple(1, 1);
            builder.Append(data);

            builder.AppendMultiple(data, 2, 2);
            builder.Append(data);

            builder.AppendMultiple(dataHalf0, 2, 2);
            builder.Append(dataHalf1);
            builder.Append(dataHalf0);
            builder.AppendMultiple(dataHalf1, 2, 2);

            builder.AppendMultipleHeight(2);
            builder.Append(data);
            builder.AppendMultipleHeight(1);
            builder.Append(data);

            builder.AppendMultipleHeight(dataHalf0, 2);
            builder.Append(dataHalf1);
            builder.Append(dataHalf0);
            builder.AppendMultipleHeight(dataHalf1, 2);

            builder.AppendMultipleWidth(2);
            builder.Append(data);
            builder.AppendMultipleWidth(1);
            builder.Append(data);

            builder.AppendMultipleWidth(dataHalf0, 2);
            builder.Append(dataHalf1);
            builder.Append(dataHalf0);
            builder.AppendMultipleWidth(dataHalf1, 2);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 16
0
        public static byte[] CreateTextReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, bool utf8)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            localizeReceipt.AppendTextReceiptData(builder, utf8);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 17
0
        public static byte[] CreateSoundData(Emulation emulation)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendSound(SoundChannel.No1);
            builder.AppendSound(SoundChannel.No2);
            builder.AppendSound(SoundChannel.No1, 3);
            builder.AppendSound(SoundChannel.No2, 3);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 18
0
        public static byte[] CreatePeripheralData(Emulation emulation)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendPeripheral(PeripheralChannel.No1);
            builder.AppendPeripheral(PeripheralChannel.No2);
            builder.AppendPeripheral(PeripheralChannel.No1, 2000);
            builder.AppendPeripheral(PeripheralChannel.No2, 2000);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 19
0
        public static byte[] CreateScaleRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, bool bothScale)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            Bitmap rasterImage = localizeReceipt.CreateScaleRasterReceiptImage();

            builder.AppendBitmap(rasterImage, false, width, bothScale);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 20
0
        public static byte[] CreateFileOpenData(Emulation emulation, string filePath, int paperSize)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            Bitmap rasterImage = (Bitmap)Image.FromFile(filePath);

            builder.AppendBitmap(rasterImage, true, paperSize, true);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
        public static byte[] CreateContrastMode(DisplayContrastMode contrastMode)
        {
            IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);

            //builder.AppendClearScreen();
            //builder.AppendCursorMode(DisplayCursorMode.Off);
            //builder.AppendHomePosition();

            //byte[] textPattern = Encoding.UTF8.GetBytes("Star Micronics      Total :        12345");

            //builder.Append(textPattern);

            builder.AppendContrastMode(contrastMode);

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 22
0
        public static byte[] CreateCouponData(Emulation emulation, LocalizeReceipt localizeReceipt, int width, BitmapConverterRotation rotation)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            Bitmap rasterImage = localizeReceipt.CreateCouponImage();

            builder.AppendBitmap(rasterImage, false, width, true, rotation);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 23
0
        public static byte[] CreateQrCodeData(Emulation emulation)
        {
            byte[] data;

            data = Encoding.UTF8.GetBytes("Hello World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(Encoding.UTF8.GetBytes("*Cell:2*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Cell:8*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 8);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("*Level:L*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:M*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.M, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:Q*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.Q, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:H*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.H, 4);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n"));
            builder.AppendQrCodeWithAbsolutePosition(data, QrCodeModel.No2, QrCodeLevel.L, 4, 40);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n"));
            builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Center);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n"));
            builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Right);
            builder.AppendUnitFeed(32);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 24
0
        public void Print(List <TicketBase> tickets, int issueingNumber, Action <int> onPrint, Action <Exception, int> onError)
        {
            StarPrinterStatus status = port.BeginCheckedBlock();

            if (status.Offline)
            {
            }

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(Emulation.StarGraphic);

            builder.BeginDocument();

            tickets.ForEach((t, i) =>
            {
                try
                {
                    int height = 8 * 58 - 85 - 15;
                    // height = 8 * 58 - 25 - 15;

                    Bitmap bmp = t.Bitmap.Clone(new Rectangle((t.Bitmap.Width - 576) / 2, 70, 576, height), t.Bitmap.PixelFormat);

                    builder.AppendBitmapWithAbsolutePosition(bmp, false, 576, false, BitmapConverterRotation.Normal, 0);
                    builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

                    bmp.Dispose();

                    onPrint(i);
                }
                catch (Exception ex)
                {
                    onError(ex, i);
                }
            });

            builder.EndDocument();

            byte[] command = builder.Commands;

            uint writtenLength = port.WritePort(command, 0, (uint)command.Length);

            status = port.EndCheckedBlock();
            if (status.Offline)
            {
            }
        }
Ejemplo n.º 25
0
        public static byte[] CreateRasterReceiptData(Emulation emulation, LocalizeReceipt localizeReceipt)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            Bitmap rasterImage = localizeReceipt.CreateRasterReceiptImage();

            builder.AppendBitmap(rasterImage, false);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.AppendPeripheral(PeripheralChannel.No1);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 26
0
        public static byte[] CreateTextPageModeData(Emulation emulation, LocalizeReceipt localizeReceipt, Rectangle printRegion, BitmapConverterRotation rotation, bool utf8)
        {
            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.BeginPageMode(printRegion, rotation);

            localizeReceipt.AppendTextLabelData(builder, utf8);

            builder.EndPageMode();

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Sample : Checking barcode reader status.
        /// </summary>
        private void CheckBarcodeReaderStatus()
        {
            // Create IPeripheralConnectParser object.
            IPeripheralConnectParser parser = StarIoExt.CreateBcrConnectParser(BcrModel.POP1);

            // Usage of parser sample is "Communication.ParseDoNotCheckCondition(IPeripheralCommandParser parser, IPort port)".
            Communication.CommunicationResult result = Communication.ParseDoNotCheckCondition(parser, port);

            // Check peripheral status.
            currentBarcodeReaderStatus = Communication.PeripheralStatus.Invalid;
            if (result == Communication.CommunicationResult.Success)
            {
                // Check parser property value.
                if (parser.IsConnected) // connect
                {
                    currentBarcodeReaderStatus = Communication.PeripheralStatus.Connect;
                }
                else // disconnect
                {
                    currentBarcodeReaderStatus = Communication.PeripheralStatus.Disconnect;
                }
            }
            else // communication error
            {
                currentBarcodeReaderStatus = Communication.PeripheralStatus.Impossible;
            }

            switch (currentBarcodeReaderStatus)
            {
            default:
            case Communication.PeripheralStatus.Impossible:
                OnPrinterImpossible();
                break;

            case Communication.PeripheralStatus.Connect:
                OnBarcodeReaderConnect();
                break;

            case Communication.PeripheralStatus.Disconnect:
                OnBarcodeReaderDisconnect();
                break;
            }
        }
        public static void CheckBarcodeReaderStatus(IPort port)
        {
            // Create IPeripheralConnectParser object.
            IPeripheralConnectParser parser = StarIoExt.CreateBcrConnectParser(BcrModel.POP1);

            // Usage of parser sample is "Communication.ParseDoNotCheckCondition(IPeripheralCommandParser parser, IPort port)".
            CommunicationResult result = Communication.ParseDoNotCheckCondition(parser, port);

            // Check peripheral status.
            barcodeReaderStatus = PeripheralStatus.Invalid;
            if (result.Result == Result.Success)
            {
                // Check parser property value.
                if (parser.IsConnected) // connect
                {
                    barcodeReaderStatus = PeripheralStatus.Connect;
                }
                else // disconnect
                {
                    barcodeReaderStatus = PeripheralStatus.Disconnect;
                }
            }
            else // communication error
            {
                barcodeReaderStatus = PeripheralStatus.Impossible;
            }

            //switch (barcodeReaderStatus)
            //{
            //    default:
            //    case PeripheralStatus.Impossible:
            //        OnBarcodeReaderImpossible();
            //        break;

            //    case PeripheralStatus.Connect:
            //        OnBarcodeReaderConnect();
            //        break;

            //    case PeripheralStatus.Disconnect:
            //        OnBarcodeReaderDisconnect();
            //        break;
            //}
        }
        public static byte[] CreateUserDefinedCharacter(bool set)
        {
            IDisplayCommandBuilder builder = StarIoExt.CreateDisplayCommandBuilder(DisplayModel.SCD222);

            builder.AppendClearScreen();
            builder.AppendCursorMode(DisplayCursorMode.Off);
            builder.AppendHomePosition();

            builder.AppendInternational(DisplayInternationalType.USA);
            builder.AppendCodePage(DisplayCodePageType.Japanese);

            if (set)
            {
                byte[] font =
                {
                    0x00, 0x00, 0x32, 0x00, 0x49, 0x00, 0x49, 0x7f, 0x26, 0x48, 0x00, 0x48, 0x00, 0x30, 0x00, 0x00
                };

                byte[] dbcsFont =
                {
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0x04, 0x90, 0x04, 0x90, 0x02, 0x60,
                    0x00, 0x00, 0x07, 0xf0, 0x04, 0x80, 0x04, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                };

                builder.AppendUserDefinedCharacter(0, 0x20, font);
                builder.AppendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont);
            }
            else
            {
                builder.AppendUserDefinedCharacter(0, 0x20, null);
                builder.AppendUserDefinedDbcsCharacter(0, 0x8140, null);
            }

            byte[] textPattern =
            {
                0x5b, 0x20, 0x20, 0x53, 0x74, 0x61, 0x72, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x73, 0x20, 0x20, 0x5d,
                0x5b, 0x81, 0x40, 0x81, 0x40, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x90, 0xb8, 0x96, 0xa7, 0x81, 0x40, 0x81, 0x40, 0x5d,
            };

            builder.Append(textPattern);

            return(builder.PassThroughCommands);
        }
Ejemplo n.º 30
0
        public static byte[] CreateBlackMarkData(Emulation emulation, BlackMarkType type)
        {
            byte[] data = Encoding.UTF8.GetBytes("Hello World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.AppendBlackMark(type);

            builder.Append(data);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            //builder.AppendBlackMark(BlackMarkType.Invalid);

            builder.EndDocument();

            return(builder.Commands);
        }