using System;
using Microsoft.ReactNative.Managed;
using WinRT.BxlComponent.Plugin.BxlMpXamarinSDK;
using WinRT.BxlComponent.Plugin.BxlMpXamarinSDK.Abstractions;
using WinRT.BxlComponent.UwpWrapper;

namespace ReactNativeRnBixolonBgateLibs.UWPProxy
{
    [ReactModule]
    public sealed partial class MPosControllerLabelPrinterProxy
    {
        private MPosDeviceLabelPrinterImplementation _printerDev;
        private static int _uniqueDeviceId = 256;

        public MPosControllerLabelPrinterProxy()
        {
            _printerDev = new MPosDeviceLabelPrinterImplementation((int)MPosDeviceType.MPOS_DEVICE_LABEL_PRINTER, _uniqueDeviceId++);
        }
        [ReactMethod("openService")]
        public async void openService(uint[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.openService(array[0], array[1]));
            return;
        }
        [ReactMethod("closeService")]
        public async void closeService(uint closeTimeout/*second*/, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.closeService(closeTimeout));
            return;
        }
        [ReactMethod("selectCommandMode")]
        public void selectCommandMode(int commandMode, IReactPromise<int> promise)
        {
            promise.Resolve(_printerDev.selectCommandMode(commandMode));
            return;
        }
        [ReactMethod("selectInterface")]
        public void selectInterface(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(_printerDev.selectInterface(Convert.ToInt32(array[0]), array[1]));
            return;
        }
        [ReactMethod("isOpen")]
        public void isOpen(IReactPromise<int> promise)
        {
            promise.Resolve(Convert.ToInt32(_printerDev.isOpen()));
            return;
        }
        [ReactMethod("getDeviceId")]
        public void getDeviceId(IReactPromise<int> promise)
        {
            promise.Resolve(Convert.ToInt32(_printerDev.DeviceID));
            return;
        }

        [ReactMethod("directIO")]
        //public async void directIO([ReadOnlyArray()] byte[] data, IReactPromise<int> promise)
        public async void directIO(byte[] data, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.directIO(data));
            return;
        }

        [ReactMethod("printBuffer")]
        public async void printBuffer(int numberOfCopies, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.printBuffer(numberOfCopies));
            return;
        }
        [ReactMethod("setTransaction")]
        public async void setTransaction(int transactionMode, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setTransaction(transactionMode));
            return;
        }

        [ReactMethod("drawTextDeviceFont")] //Use array due to more than 8 parameters.
        public async void drawTextDeviceFont(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawTextDeviceFont(
                array[0],                                  //string   data
                Convert.ToInt32(array[1]),  //int      xPos
                Convert.ToInt32(array[2]),  //int      yPos
                Convert.ToChar(array[3]),  //string   fontSelection
                Convert.ToInt32(array[4]),  //int      fontWidth
                Convert.ToInt32(array[5]),  //int      fontHeight
                Convert.ToInt32(array[6]),  //int      rightSpace
                Convert.ToInt32(array[7]),  //int      rotation
                Convert.ToBoolean(int.Parse(array[8])),  //bool     reverse
                Convert.ToBoolean(int.Parse(array[9])),  //bool     bold
                Convert.ToBoolean(int.Parse(array[10])),  //bool     rightToLeft
                Convert.ToInt32(array[11])));  //int      alignment
            return;
        }
        //[ReactMethod("drawTextDeviceFont")]
        //public async void drawTextDeviceFont(string data, int xPos, int yPos, string fontSelection, int fontWidth, int fontHeight,
        //                                                int rightSpace, int rotation, int reverse, int bold, int rightToLeft, int alignment, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawTextDeviceFont(data, xPos, yPos, char.Parse(fontSelection), fontWidth, fontHeight,
        //                                                rightSpace, rotation, Convert.ToBoolean(reverse), Convert.ToBoolean(bold), Convert.ToBoolean(rightToLeft), alignment));
        //    return;
        //}

        [ReactMethod("drawTextVectorFont")] //Use array due to more than 8 parameters.
        public async void drawTextVectorFont(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawTextVectorFont(
                array[0],                                  //string data
                Convert.ToInt32(array[1]),  //int    xPos
                Convert.ToInt32(array[2]),  //int    yPos
                Convert.ToChar(array[3]),  //char   fontSelection
                Convert.ToInt32(array[4]),  //int    fontWidth
                Convert.ToInt32(array[5]),  //int    fontHeight
                Convert.ToInt32(array[6]),  //int    rightSpace
                Convert.ToInt32(array[7]),  //int    rotation
                Convert.ToBoolean(int.Parse(array[8])),  //bool   reverse
                Convert.ToBoolean(int.Parse(array[9])),  //bool   bold
                Convert.ToBoolean(int.Parse(array[10])),  //bool   italic
                Convert.ToBoolean(int.Parse(array[11])),  //bool   rightToLeft
                Convert.ToInt32(array[12])));  //int    alignment
            return;
        }
        //[ReactMethod("drawTextVectorFont")] 
        //public async void drawTextVectorFont(string data, int xPos, int yPos, char fontSelection, int fontWidth, int fontHeight, int rightSpace, int rotation,
        //                            bool reverse, bool bold, bool italic, bool rightToLeft, int alignment, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawTextVectorFont(data, xPos, yPos, fontSelection, fontWidth, fontHeight, rightSpace, rotation, reverse, bold, italic, rightToLeft, alignment));
        //    return;
        //}

        [ReactMethod("drawBarcode1D")]//Use array due to more than 8 parameters.
        public async void drawBarcode1D(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcode1D(
                array[0],                     //string data
                Convert.ToInt32(array[1]),  //int    xPos
                Convert.ToInt32(array[2]),  //int    yPos
                Convert.ToInt32(array[3]),  //int    barcodeType
                Convert.ToInt32(array[4]),  //int    widthNarrow
                Convert.ToInt32(array[5]),  //int    widthWide
                Convert.ToInt32(array[6]),  //int    height
                Convert.ToInt32(array[7]),  //int    hri
                Convert.ToInt32(array[8]),  //int    quietZoneWidth
                Convert.ToInt32(array[9])));  //int    rotation
            return;
        }
        //[ReactMethod("drawBarcode1D")]
        //public async void drawBarcode1D(string data, int xPos, int yPos, int barcodeType, int widthNarrow, int widthWide, int height, int hri, int quietZoneWidth, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcode1D(data, xPos, yPos, barcodeType, widthNarrow, widthWide, height, hri, quietZoneWidth, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeMaxiCode")]
        public async void drawBarcodeMaxiCode(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeMaxiCode(
                array[0],                   //string data
                Convert.ToInt32(array[1]),  //int    xPos
                Convert.ToInt32(array[2]),  //int    yPos
                Convert.ToInt32(array[3])  //int    mode
                ));
            return;
        }

        [ReactMethod("drawBarcodePDF417")]//Use array due to more than 8 parameters.
        public async void drawBarcodePDF417(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodePDF417(
                array[0],                                   //string data
                Convert.ToInt32(array[1]),   //int    xPos
                Convert.ToInt32(array[2]),   //int    yPos
                Convert.ToInt32(array[3]),   //int    maximumRowCount
                Convert.ToInt32(array[4]),   //int    maximumColumnCount
                Convert.ToInt32(array[5]),   //int    errorCorrectionLevel 
                Convert.ToInt32(array[6]),   //int    dataCompressionMethod
                Convert.ToBoolean(int.Parse(array[7])),   //bool   hri
                Convert.ToInt32(array[8]),   //int    barcodeOriginPoint
                Convert.ToInt32(array[9]),   //int    moduleWidth 
                Convert.ToInt32(array[10]),   //int    barHeight 
                Convert.ToInt32(array[11])));   //int    rotation
            return;
        }
        //[ReactMethod("drawBarcodePDF417")]//8개이상의 파라미터
        //public async void drawBarcodePDF417(string data, int xPos, int yPos, int maximumRowCount, int maximumColumnCount, 
        //    int errorCorrectionLevel, int dataCompressionMethod, bool hri, int barcodeOriginPoint, int moduleWidth, int barHeight, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodePDF417(data, xPos, yPos, maximumRowCount, maximumColumnCount, errorCorrectionLevel,
        //            dataCompressionMethod, hri, barcodeOriginPoint, moduleWidth, barHeight, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeQRCode")]
        public async void drawBarcodeQRCode(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeQRCode(
                array[0],                                   //string data
                Convert.ToInt32(array[1]),   //int    xPos
                Convert.ToInt32(array[2]),   //int    yPos
                Convert.ToInt32(array[3]),   //int    maximumRowCount
                Convert.ToInt32(array[4]),   //int    maximumColumnCount
                Convert.ToInt32(array[5]),   //int    errorCorrectionLevel 
                Convert.ToInt32(array[6])
                ));
            return;
        }
        [ReactMethod("drawBarcodeDataMatrix")]
        public async void drawBarcodeDataMatrix(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeDataMatrix(
                array[0],                               //string data
                Convert.ToInt32(array[1]),              //int    xPos
                Convert.ToInt32(array[2]),              //int    yPos
                Convert.ToInt32(array[3]),              //int    size
                Convert.ToBoolean(int.Parse(array[4])), //bool   reverse
                Convert.ToInt32(array[5])               //int lotation
                ));
            return;
        }
        [ReactMethod("drawBarcodeAztec")] //Use array due to more than 8 parameters.
        public async void drawBarcodeAztec(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeAztec(
                array[0],  //string  data
                Convert.ToInt32(array[1]),  //int     xPos
                Convert.ToInt32(array[2]),  //int     yPos
                Convert.ToInt32(array[3]),  //int     size
                Convert.ToBoolean(int.Parse(array[4])),  //bool    extendedChannel
                Convert.ToInt32(array[5]),  //int     errorCorrectionLevel
                Convert.ToBoolean(int.Parse(array[6])),  //bool    menuSymbol
                Convert.ToInt32(array[7]),  //int     numberOfSymbols
                array[8],  //string  optionalID
                Convert.ToInt32(array[9])));  //int     rotation
            return;
        }
        //[ReactMethod("drawBarcodeAztec")] 
        //public async void drawBarcodeAztec(string data, int xPos, int yPos, int size, bool extendedChannel,
        //                            int errorCorrectionLevel, bool menuSymbol, int numberOfSymbols, string optionalID, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeAztec(data, xPos, yPos, size, extendedChannel,
        //                            errorCorrectionLevel, menuSymbol, numberOfSymbols, optionalID, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeCode49")] //Use array due to more than 8 parameters.
        public async void drawBarcodeCode49(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeCode49(
                array[0],  //string  data
                Convert.ToInt32(array[1]),  //int     xPos
                Convert.ToInt32(array[2]),  //int     yPos
                Convert.ToInt32(array[3]),  //int     widthNarrow
                Convert.ToInt32(array[4]),  //int     widthWide
                Convert.ToInt32(array[5]),  //int     height
                Convert.ToInt32(array[6]),  //int     hri
                Convert.ToInt32(array[7]),  //int     startingMode
                Convert.ToInt32(array[8])));  //int     rotation
            return;
        }
        //[ReactMethod("drawBarcodeCode49")]
        //public async void drawBarcodeCode49(string data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int hri, int startingMode, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeCode49(data, xPos, yPos, widthNarrow, widthWide, height, hri, startingMode, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeCodaBlock")] //Use array due to more than 8 parameters.
        public async void drawBarcodeCodaBlock(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeCodaBlock(
                array[0],  //string  data
                Convert.ToInt32(array[1]),  //int     xPos
                Convert.ToInt32(array[2]),  //int     yPos
                Convert.ToInt32(array[3]),  //int     widthNarrow
                Convert.ToInt32(array[4]),  //int     widthWide
                Convert.ToInt32(array[5]),  //int     height
                Convert.ToBoolean(int.Parse(array[6])),  //bool    securityLevel
                Convert.ToInt32(array[7]),  //int     numberOfCharactersPerRow
                Convert.ToChar(array[8]),  //char    mode
                Convert.ToInt32(array[9])));  //int     numberOfRowToEncode
            return;
        }
        //[ReactMethod("drawBarcodeCodaBlock")] 
        //public async void drawBarcodeCodaBlock(string data, int xPos, int yPos, int widthNarrow, int widthWide, int height, bool securityLevel,
        //                                int numberOfCharactersPerRow, char mode, int numberOfRowToEncode, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeCodaBlock(data, xPos, yPos, widthNarrow, widthWide, height, securityLevel,
        //                                numberOfCharactersPerRow, mode, numberOfRowToEncode));
        //    return;
        //}

        [ReactMethod("drawBarcodeMicroPDF")]
        public async void drawBarcodeMicroPDF(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeMicroPDF(
                array[0],                    //string  data
                Convert.ToInt32(array[1]),   //int     xPos
                Convert.ToInt32(array[2]),   //int     yPos
                Convert.ToInt32(array[3]),   //int     moduleWidth
                Convert.ToInt32(array[4]),   //int     moduleHeight
                Convert.ToInt32(array[5]),   //int     mode
                Convert.ToInt32(array[6])    //int     rotation
                ));
            return;
        }
        [ReactMethod("drawBarcodeIMB")]
        public async void drawBarcodeIMB(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeIMB(
                 array[0],                               //string  data
                Convert.ToInt32(array[1]),               //int     xPos
                Convert.ToInt32(array[2]),               //int     yPos
                Convert.ToBoolean(int.Parse(array[3])),  //int     moduleWidth
                Convert.ToInt32(array[4])                //int     moduleHeight
                ));
            return;
        }

        [ReactMethod("drawBarcodeMSI")] //Use array due to more than 8 parameters.
        public async void drawBarcodeMSI(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeMSI(
                array[0],   //string  data
                Convert.ToInt32(array[1]),   //int     xPos
                Convert.ToInt32(array[2]),   //int     yPos
                Convert.ToInt32(array[3]),   //int     narrowWidth
                Convert.ToInt32(array[4]),   //int     wideWidth
                Convert.ToInt32(array[5]),   //int     height
                Convert.ToInt32(array[6]),   //int     checkDigitSelection
                Convert.ToBoolean(int.Parse(array[7])),   //bool    printCheckDigit
                Convert.ToInt32(array[8]),   //int     hri
                Convert.ToInt32(array[9])));   //int     rotation

            return;
        }
        //[ReactMethod("drawBarcodeMSI")] 
        //public async void drawBarcodeMSI(string data, int xPos, int yPos, int narrowWidth, int wideWidth, int height,
        //    int checkDigitSelection, bool printCheckDigit, int hri, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeMSI(data, xPos, yPos, narrowWidth, wideWidth, height, checkDigitSelection, printCheckDigit, hri, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodePlessey")] //Use array due to more than 8 parameters.
        public async void drawBarcodePlessey(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodePlessey(
                array[0],   //string  data
                Convert.ToInt32(array[1]),   //int     xPos
                Convert.ToInt32(array[2]),   //int     yPos
                Convert.ToInt32(array[3]),   //int     narrowWidth
                Convert.ToInt32(array[4]),   //int     wideWidth
                Convert.ToInt32(array[5]),   //int     height
                Convert.ToBoolean(int.Parse(array[6])),   //bool    printCheckDigit
                Convert.ToInt32(array[7]),   //int     hri
                Convert.ToInt32(array[8])));   //int     rotation
            return;
        }
        //[ReactMethod("drawBarcodePlessey")] 
        //public async void drawBarcodePlessey(string data, int xPos, int yPos, int narrowWidth, int wideWidth, int height, bool printCheckDigit, int hri, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodePlessey(data, xPos, yPos, narrowWidth, wideWidth, height, printCheckDigit, hri, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeTLC39")] //Use array due to more than 8 parameters.
        public async void drawBarcodeTLC39(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeTLC39(
                array[0],   //string  data
                Convert.ToInt32(array[1]),   //int     xPos
                Convert.ToInt32(array[2]),   //int     yPos
                Convert.ToInt32(array[3]),   //int     narrowWidth
                Convert.ToInt32(array[4]),   //int     wideWidth
                Convert.ToInt32(array[5]),   //int     height
                Convert.ToInt32(array[6]),   //int     rowHeightOfMicroPDF417
                Convert.ToInt32(array[7]),   //int     narrowWidthOfMicroPDF417
                Convert.ToInt32(array[8]))   //int     rotation
                );
            return;
        }
        //[ReactMethod("drawBarcodeTLC39")] 
        //public async void drawBarcodeTLC39(string data, int xPos, int yPos, int narrowWidth, int wideWidth, int height,
        //    int rowHeightOfMicroPDF417, int narrowWidthOfMicroPDF417, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeTLC39(data, xPos, yPos, narrowWidth, wideWidth, height, rowHeightOfMicroPDF417, narrowWidthOfMicroPDF417, rotation));
        //    return;
        //}

        [ReactMethod("drawBarcodeRSS")] //Use array due to more than 8 parameters.
        public async void drawBarcodeRSS(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBarcodeRSS(
                array[0],   //string  data
                Convert.ToInt32(array[1]),   //int     xPos 
                Convert.ToInt32(array[2]),   //int     yPos
                Convert.ToInt32(array[3]),   //int     barcodeType
                Convert.ToInt32(array[4]),   //int     magnification, 
                Convert.ToInt32(array[5]),   //int     separatorHeight
                Convert.ToInt32(array[6]),   //int     barcodeHeight
                Convert.ToInt32(array[7]),   //int     segmentWidth
                Convert.ToInt32(array[8]))   //int     rotation
                );
            return;
        }
        //[ReactMethod("drawBarcodeRSS")] 
        //public async void drawBarcodeRSS(string data, int xPos, int yPos, int barcodeType, int magnification, int separatorHeight, int barcodeHeight, int segmentWidth, int rotation, IReactPromise<int> promise)
        //{
        //    promise.Resolve(await _printerDev.drawBarcodeRSS(data, xPos, yPos, barcodeType, magnification, separatorHeight, barcodeHeight, segmentWidth, rotation));
        //    return;
        //}

        [ReactMethod("drawBlock")]
        public async void drawBlock(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawBlock(
                Convert.ToInt32(array[0]),   //int     startPosX
                Convert.ToInt32(array[1]),   //int     startPosY 
                Convert.ToInt32(array[2]),   //int     endPosX
                Convert.ToInt32(array[3]),   //int     endPosY
                Convert.ToChar(array[4]),   //string  option, 
                Convert.ToInt32(array[5])    //int     thickness
                ));
            return;
        }
        [ReactMethod("drawCircle")]
        public async void drawCircle(int[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawCircle(
                array[0],   //int  xPos
                array[1],   //int  yPos
                array[2],   //int  sizeSelection
                array[3]    //int  xPmultiplieros
                ));
            return;
        }
        [ReactMethod("drawImageFile")]
        public async void drawImageFile(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawImageFile(
                array[0],                                //string  filePath
                Convert.ToInt32(array[1]),               //int     xPos 
                Convert.ToInt32(array[2]),               //int     yPos
                Convert.ToInt32(array[3]),               //int     width
                Convert.ToInt32(array[4]),               //int     brightness, 
                Convert.ToBoolean(int.Parse(array[5])),  //bool    isDithering
                Convert.ToBoolean(int.Parse(array[6]))   //bool    isCompress
                ));
            return;
        }
        [ReactMethod("drawBase64Image")]
        public async void drawImageWithBase64(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.drawImageWithBase64(
                array[0],                                //string  base64String
                Convert.ToInt32(array[1]),               //int     xPos 
                Convert.ToInt32(array[2]),               //int     yPos
                Convert.ToInt32(array[3]),               //int     width
                Convert.ToInt32(array[4]),               //int     brightness, 
                Convert.ToBoolean(int.Parse(array[5])),  //bool    isDithering
                Convert.ToBoolean(int.Parse(array[6]))   //bool    isCompress
                ));
            return;
        }
        [ReactMethod("setCharacterset")]
        public async void setCharacterset(int[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setCharacterset(
                array[0],
                array[1]
                ));
            return;
        }
        [ReactMethod("setPrintingType")]
        public async void setPrintingType(char printingType, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setPrintingType(printingType));
            return;
        }
        [ReactMethod("setMargin")]
        public async void setMargin(int[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setMargin(
                array[0],
                array[1]
                ));
            return;
        }
        [ReactMethod("setLength")]
        public async void setLength(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setLength(
                Convert.ToInt32(array[0]),               //int  labelLength
                Convert.ToInt32(array[1]),               //int  gapLength 
                Convert.ToChar(array[2]),               //char mediaType
                Convert.ToInt32(array[3])                //int  offsetLength
                ));
            return;
        }
        [ReactMethod("setWidth")]
        public async void setWidth(int labelWidth, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setWidth(labelWidth));
            return;
        }
        [ReactMethod("setSpeed")]
        public async void setSpeed(int speed, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setSpeed(speed));
            return;
        }
        [ReactMethod("setDensity")]
        public async void setDensity(int density, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setDensity(density));
            return;
        }
        [ReactMethod("setOrientation")]
        public async void setOrientation(char orientation, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setOrientation(orientation));
            return;
        }
        [ReactMethod("setAutoCutter")]
        public async void setAutoCutter(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setAutoCutter(
                Convert.ToBoolean(int.Parse(array[0])),  //bool enable
                Convert.ToInt32(array[1])                //int period
                ));
            return;
        }
        [ReactMethod("setupRFID")]
        public async void setupRFID(int[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setupRFID(
                array[0],
                array[1],
                array[2],
                array[3]
                ));
            return;
        }
        [ReactMethod("setEPCDataStructure")]
        public async void setEPCDataStructure(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setEPCDataStructure(
                Convert.ToInt32(array[0]),
                array[1]
                ));
            return;
        }
        [ReactMethod("setRFIDPosition")]
        public async void setRFIDPosition(int transPosition, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setRFIDPosition(transPosition));
            return;
        }
        [ReactMethod("calibrateRFID")]
        public async void calibrateRFID(IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.calibrateRFID());
            return;
        }
        [ReactMethod("writeRFID")]
        public async void writeRFID(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.writeRFID(
                Convert.ToInt32(array[0]),  //int dataType
                Convert.ToInt32(array[1]),  //int startingBlockNumber
                Convert.ToInt32(array[2]),  //int dataLength
                array[3]                    //string data
                )); ;
            return;
        }
        [ReactMethod("setRFIDPassword")]
        public async void setRFIDPassword(string[] array, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setRFIDPassword(
                array[0],
                array[1],
                array[2],
                array[3]
                ));
            return;
        }
        [ReactMethod("lockRFID")]
        public async void lockRFID(IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.lockRFID());
            return;
        }
        [ReactMethod("checkPrinterStatus")]
        public async void checkPrinterStatus(IReactPromise<int> promise)
        {
            promise.Resolve((int)await _printerDev.checkPrinterStatus());
            return;
        }
        [ReactMethod("setOffset")]
        public async void setOffset(int offset, IReactPromise<int> promise)
        {
            promise.Resolve((int)await _printerDev.setOffset(offset));
            return;
        }
        public async void setCuttingPosition(int cuttingPosition, IReactPromise<int> promise)
        {
            promise.Resolve(await _printerDev.setCuttingPosition(cuttingPosition));
            return;
        }
        [ReactMethod("getModelName")]
        public async void getModelName(IReactPromise<string> promise)
        {
            //promise.Resolve(await _printerDev.getModelName());
            return;
        }

        [ReactMethod("getFirmwareVersion")]
        public async void getFirmwareVersion(IReactPromise<string> promise)
        {
            //promise.Resolve(await _printerDev.getFirmwareVersion());
            return;
        }
        [ReactMethod("setRewinder")]
        public async void setRewinder(bool Enable, IReactPromise<int> promise)
        {
            //promise.Resolve(await _printerDev.setRewinder(Enable));
            return;
        }

    }
}
