//
//  SIIMpaPrinterManager.h
//  SIIMpaPrinterManager
//

#ifndef MobilePrinter_PrinterManager_h
#define MobilePrinter_PrinterManager_h

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

/* 2Dcode default value */
#define PDF417_MODULE_HEIGHT_DEFAULT 10
#define PDF417_COLUMN_AUTO 0
#define PDF417_ROW_AUTO 0

/* discover result */
#define SII_MPM_EVENT_FINISHED_DISCOVERY 0
#define SII_MPM_EVENT_CANCELED_DISCOVERY 1

/* printer width */
#define SII_MPM_PAPER_WIDTH_80mm 576
#define SII_MPM_PAPER_WIDTH_100mm 736
#define SII_MPM_PAPER_WIDTH_105mm 776
#define SII_MPM_PAPER_WIDTH_112mm 832

typedef NS_ENUM(NSInteger, CharacterSet)
{
    SII_MPM_CODEPAGE_437 = 0,
    SII_MPM_CODEPAGE_KATAKANA,
    SII_MPM_CODEPAGE_850,
    SII_MPM_CODEPAGE_860,
    SII_MPM_CODEPAGE_863,
    SII_MPM_CODEPAGE_865,
    SII_MPM_CODEPAGE_857 = 13,
    SII_MPM_CODEPAGE_737,
    SII_MPM_CODEPAGE_1252 = 16,
    SII_MPM_CODEPAGE_866,
    SII_MPM_CODEPAGE_852,
    SII_MPM_CODEPAGE_858,
    SII_MPM_CODEPAGE_855 = 34,
    SII_MPM_CODEPAGE_864 = 37,
    SII_MPM_CODEPAGE_1250 = 45,
    SII_MPM_CODEPAGE_1251,
    SII_MPM_CODEPAGE_1253,
    SII_MPM_CODEPAGE_1254
};

typedef NS_ENUM(NSInteger, ErrorCode)
{
    SII_MPM_SUCCESS = 0,
    SII_MPM_ERR_PARAM,
    SII_MPM_ERR_OPENED,
    SII_MPM_ERR_NOT_OPENED,
    SII_MPM_ERR_TIMEOUT,
    SII_MPM_ERR_OFFLINE,
    SII_MPM_ERR_CLOSE_FAIL,
    SII_MPM_ERR_NOT_MONITORING,
    SII_MPM_ERR_INIT_FAILED,
    SII_MPM_ERR_DATA_SIZE_ZERO,
    SII_MPM_ERR_OVER_MAX_DATA_SIZE,
    SII_MPM_ERR_INVALID_DATA,
    SII_MPM_ERR_INVALID_STATE,
    SII_MPM_ERR_ACCESS,
    SII_MPM_ERR_CANCELED,
    SII_MPM_ERR_WRITE_FAULT,
    SII_MPM_ERR_FILE_INVALID = 20,
    SII_MPM_ERR_ENCODE_FAILED,
    SII_MPM_ERR_NOT_FOUND = 23,
    SII_MPM_ERR_TRANSACTION_STOPPED = 30,
    SII_MPM_ERR_PRINTER_STATUS_ERROR = 50,
};

typedef NS_ENUM(NSInteger, InternationalCharacterSet)
{
    SII_MPM_INT_CHAR_SET_USA = 0,
    SII_MPM_INT_CHAR_SET_FRANCE,
    SII_MPM_INT_CHAR_SET_GERMANY,
    SII_MPM_INT_CHAR_SET_UNITED_KINGDOM,
    SII_MPM_INT_CHAR_SET_DENMARK_1,
    SII_MPM_INT_CHAR_SET_SWEDEN,
    SII_MPM_INT_CHAR_SET_ITALY,
    SII_MPM_INT_CHAR_SET_SPAIN_1,
    SII_MPM_INT_CHAR_SET_JAPAN,
    SII_MPM_INT_CHAR_SET_NORWAY,
    SII_MPM_INT_CHAR_SET_DENMARK_2,
    SII_MPM_INT_CHAR_SET_SPAIN_2,
    SII_MPM_INT_CHAR_SET_LATIN_AMERICA,
    SII_MPM_INT_CHAR_SET_ARABIA = 17
};

typedef NS_ENUM(NSInteger, PrinterInformation)
{
    SII_MPM_GET_NV_MEM_CAP,
    SII_MPM_GET_NV_MEM_REM_CAP,
    SII_MPM_GET_NV_MEM_KEYCODE_LIST,
    SII_MPM_GET_REM_USER_MEM_CAP,
    SII_MPM_GET_REM_USER_MEM_CAP_DEFRAG,
    SII_MPM_GET_FUNC_SET_RESP,
    SII_MPM_GET_PRN_ID_MODEL,
    SII_MPM_GET_PRN_ID_TYPE,
    SII_MPM_GET_PRN_ID_ROM_VER,
    SII_MPM_GET_PRN_ID_FIRM_VER_MAIN,
    SII_MPM_GET_PRN_ID_MFR,
    SII_MPM_GET_PRN_ID_MODEL_NAME,
    SII_MPM_GET_PRN_ID_FIRM_VER_BOOT,
    SII_MPM_GET_PRN_ID_FIRM_CHECKSUM_BOOT,
    SII_MPM_GET_PRN_ID_FIRM_CHECKSUM_MAIN,
    SII_MPM_GET_PRN_ID_FIRM_CHECKSUM,
    SII_MPM_GET_MAINT_NUM_FEED_LINE,
    SII_MPM_GET_MAINT_NUM_HEAD_ACTIVE,
    SII_MPM_GET_MAINT_DRIVE_TIME,
    SII_MPM_GET_MAINT_NUM_FEED_LINE_INTEGRATION,
    SII_MPM_GET_MAINT_NUM_HEAD_ACTIVE_INTEGRATION,
    SII_MPM_GET_MAINT_DRIVE_TIME_INTEGRATION,
    SII_MPM_GET_HFONT_24_CHECKSUM,
    SII_MPM_GET_HFONT_24_ID,
    SII_MPM_GET_HFONT_24_INT_CHAR,
    SII_MPM_GET_HFONT_16_CHECKSUM,
    SII_MPM_GET_HFONT_16_ID,
    SII_MPM_GET_HFONT_16_INT_CHAR,
    SII_MPM_GET_FFONT_LANG,
    SII_MPM_GET_FFONT_STANDARD,
    SII_MPM_GET_FFONT_COMPANY,
    SII_MPM_GET_FFONT_CHECKSUM,
    SII_MPM_GET_FFONT_DATA_SIZE,
    SII_MPM_GET_FFONT_ROM_ID
};

typedef NS_ENUM(NSInteger, PrinterInterface)
{
    SII_MPM_PRN_IF_TCP = 1,
    SII_MPM_PRN_IF_BT,
    SII_MPM_PRN_IF_USB
};

typedef NS_ENUM(NSInteger, PrinterModel)
{
    SII_MPM_PRN_MODEL_MP_A40,
};

typedef NS_ENUM(NSInteger, TransactionFunction)
{
    SII_MPM_TRANSACTION_START = 0,
    SII_MPM_TRANSACTION_PRINT,
    SII_MPM_TRANSACTION_CLEAR
};

typedef NS_ENUM(NSInteger, TypeBarcode)
{
    SII_MPM_TYPE_BARCODE_UPC_A,
    SII_MPM_TYPE_BARCODE_UPC_E,
    SII_MPM_TYPE_BARCODE_JAN13,
    SII_MPM_TYPE_BARCODE_JAN8,
    SII_MPM_TYPE_BARCODE_CODE39,
    SII_MPM_TYPE_BARCODE_ITF,
    SII_MPM_TYPE_BARCODE_CODABAR,
    SII_MPM_TYPE_BARCODE_CODE128,
    SII_MPM_TYPE_BARCODE_CODE93,
    SII_MPM_TYPE_BARCODE_JAN13_ADDON2,
    SII_MPM_TYPE_BARCODE_JAN13_ADDON5,
    SII_MPM_TYPE_BARCODE_GS1_OMNI_DIRECTIONAL,
    SII_MPM_TYPE_BARCODE_GS1_TRUNCATED,
    SII_MPM_TYPE_BARCODE_GS1_LIMITED,
    SII_MPM_TYPE_BARCODE_GS1_EXPANDED
};

typedef NS_ENUM(NSInteger, ModuleWidthBarcode)
{
    SII_MPM_MODULE_WIDTH_BARCODE_2 = 2,
    SII_MPM_MODULE_WIDTH_BARCODE_3,
    SII_MPM_MODULE_WIDTH_BARCODE_4,
    SII_MPM_MODULE_WIDTH_BARCODE_5,
    SII_MPM_MODULE_WIDTH_BARCODE_6
};

typedef NS_ENUM(NSInteger, HriPositionBarcode)
{
    SII_MPM_HRI_BARCODE_NONE,
    SII_MPM_HRI_BARCODE_TOP_FONT_A,
    SII_MPM_HRI_BARCODE_BOTTOM_FONT_A,
    SII_MPM_HRI_BARCODE_FONT_A,
    SII_MPM_HRI_BARCODE_TOP_FONT_B,
    SII_MPM_HRI_BARCODE_BOTTOM_FONT_B,
    SII_MPM_HRI_BARCODE_FONT_B
};

typedef NS_ENUM(NSInteger, NwRatioBarcode)
{
    SII_MPM_NWRATIO_BARCODE_1TO2 = 0,
    SII_MPM_NWRATIO_BARCODE_1TO2_5,
    SII_MPM_NWRATIO_BARCODE_1TO3
};

typedef NS_ENUM(NSInteger, Type2DCode)
{
    SII_MPM_TYPE_2DCODE_QR_CODE,
    SII_MPM_TYPE_2DCODE_PDF417,
    SII_MPM_TYPE_2DCODE_DATA_MATRIX,
    SII_MPM_TYPE_2DCODE_MAXI_CODE,
    SII_MPM_TYPE_2DCODE_GS1_STACKED,
    SII_MPM_TYPE_2DCODE_GS1_OMNI_DIRECTIONAL,
    SII_MPM_TYPE_2DCODE_GS1_EXPANDED_STACKED
};

typedef NS_ENUM(NSInteger, Mode2Dcode)
{
    SII_MPM_MODE_2DCODE_QR_CODE_MODEL1,
    SII_MPM_MODE_2DCODE_QR_CODE_MODEL2,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_10_10,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_12_12,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_14_14,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_16_16,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_18_18,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_20_20,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_22_22,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_24_24,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_26_26,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_32_32,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_36_36,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_40_40,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_44_44,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_48_48,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_52_52,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_64_64,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_72_72,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_80_80,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_88_88,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_96_96,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_104_104,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_120_120,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_132_132,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_144_144,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_8_18,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_8_32,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_12_26,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_12_36,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_16_36,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_16_48,
    SII_MPM_MODE_2DCODE_DATA_MATRIX_AUTO,
    SII_MPM_MODE_2DCODE_MAXI_CODE_2,
    SII_MPM_MODE_2DCODE_MAXI_CODE_3,
    SII_MPM_MODE_2DCODE_MAXI_CODE_4,
    SII_MPM_MODE_2DCODE_MAXI_CODE_5,
    SII_MPM_MODE_2DCODE_PDF417_STANDARD,
    SII_MPM_MODE_2DCODE_PDF417_COMPACT,
    SII_MPM_MODE_2DCODE_NONE
};

typedef NS_ENUM(NSInteger, ModuleSize2Dcode)
{
    SII_MPM_MODULE_SIZE_2DCODE_DEFAULT = -1,
    SII_MPM_MODULE_SIZE_2DCODE_2 = 2,
    SII_MPM_MODULE_SIZE_2DCODE_3,
    SII_MPM_MODULE_SIZE_2DCODE_4,
    SII_MPM_MODULE_SIZE_2DCODE_5,
    SII_MPM_MODULE_SIZE_2DCODE_6,
    SII_MPM_MODULE_SIZE_2DCODE_7,
    SII_MPM_MODULE_SIZE_2DCODE_8,
    SII_MPM_MODULE_SIZE_2DCODE_9,
    SII_MPM_MODULE_SIZE_2DCODE_10,
    SII_MPM_MODULE_SIZE_2DCODE_11,
    SII_MPM_MODULE_SIZE_2DCODE_12,
    SII_MPM_MODULE_SIZE_2DCODE_13,
    SII_MPM_MODULE_SIZE_2DCODE_14,
    SII_MPM_MODULE_SIZE_2DCODE_15,
    SII_MPM_MODULE_SIZE_2DCODE_16
};

typedef NS_ENUM(NSInteger, ErrorCorrect2Dcode)
{
    SII_MPM_ERR_CORRECTION_2DCODE_QR_CODE_L = 'L',
    SII_MPM_ERR_CORRECTION_2DCODE_QR_CODE_M = 'M',
    SII_MPM_ERR_CORRECTION_2DCODE_QR_CODE_Q = 'Q',
    SII_MPM_ERR_CORRECTION_2DCODE_QR_CODE_H = 'H',
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_0 = 0,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_1,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_2,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_3,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_4,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_5,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_6,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_7,
    SII_MPM_ERR_CORRECTION_2DCODE_PDF417_8,
    SII_MPM_ERR_CORRECTION_2DCODE_NONE = -1,
};

typedef NS_ENUM(NSInteger, Rotate)
{
    SII_MPM_ROTATE_CURRENT = -1,
    SII_MPM_ROTATE_NONE = 0,
    SII_MPM_ROTATE_90_TO_RIGHT,
    SII_MPM_ROTATE_180,
    SII_MPM_ROTATE_90_TO_LEFT,
};

typedef NS_ENUM(NSInteger, CharacterType)
{
    SII_MPM_CHAR_TYPE_FONT_CURRENT = -1,
    SII_MPM_CHAR_TYPE_FONT_A = 0,
    SII_MPM_CHAR_TYPE_FONT_B
};

typedef NS_ENUM(NSInteger, CharacterScale)
{
    SII_MPM_CHAR_SCALE_CURRENT = -1,
    SII_MPM_CHAR_SCALE_X1 = 1,
    SII_MPM_CHAR_SCALE_X2,
    SII_MPM_CHAR_SCALE_X3,
    SII_MPM_CHAR_SCALE_X4,
    SII_MPM_CHAR_SCALE_X5,
    SII_MPM_CHAR_SCALE_X6,
    SII_MPM_CHAR_SCALE_X7,
    SII_MPM_CHAR_SCALE_X8
};

typedef NS_ENUM(NSInteger, Underline)
{
    SII_MPM_CHAR_UNDERLINE_CURRENT = -1,
    SII_MPM_CHAR_UNDERLINE_NONE = 0,
    SII_MPM_CHAR_UNDERLINE_1DOT,
    SII_MPM_CHAR_UNDERLINE_2DOT
};

typedef NS_ENUM(NSInteger, Bold)
{
    SII_MPM_CHAR_BOLD_CURRENT,
    SII_MPM_CHAR_BOLD_OFF,
    SII_MPM_CHAR_BOLD_ON
};

typedef NS_ENUM(NSInteger, Reverse)
{
    SII_MPM_CHAR_REVERSE_CURRENT,
    SII_MPM_CHAR_REVERSE_OFF,
    SII_MPM_CHAR_REVERSE_ON
};

typedef NS_ENUM(NSInteger, Alignment)
{
    SII_MPM_ALIGN_LEFT,
    SII_MPM_ALIGN_CENTER,
    SII_MPM_ALIGN_RIGHT
};

typedef NS_ENUM(NSInteger, Direction)
{
    SII_MPM_DIRECTION_LEFT_TO_RIGHT,
    SII_MPM_DIRECTION_BOTTOM_TO_TOP,
    SII_MPM_DIRECTION_RIGHT_TO_LEFT,
    SII_MPM_DIRECTION_TOP_TO_BOTTOM
};

typedef NS_ENUM(NSInteger, LogFileSize)
{
    SII_MPM_LOG_FILE_SIZE_1MB,
    SII_MPM_LOG_FILE_SIZE_5MB,
    SII_MPM_LOG_FILE_SIZE_10MB,
    SII_MPM_LOG_FILE_SIZE_50MB
};

typedef NS_ENUM(NSInteger, Dithering)
{
    SII_MPM_DITHERING_DISABLE = 0,
    SII_MPM_DITHERING_ERRORDIFFUSION
};

typedef NS_ENUM(BOOL, ImageTransactionMode)
{
    SII_MPM_IMAGE_TRANSACTION_MODE_OFF = false,
    SII_MPM_IMAGE_TRANSACTION_MODE_ON = true
};

@interface SIIMpaPrinterStatus : NSObject

@property (readonly) BOOL      errVoltage;
@property (readonly) BOOL      errHardware;
@property (readonly) BOOL      errHeadTemperature;
@property (readonly) BOOL      errOutOfPaper;
@property (readonly) BOOL      errMarkPaperJam;
@property (readonly) BOOL      errCoverOpen;
@property (readonly) BOOL      errBattery;
@property (readonly) BOOL      stateFeedSwitch;
@property (readonly) BOOL      statePaperFeed;
@property (readonly) BOOL      stateReturnWaiting;
@property (readonly) BOOL      stateFlashMemoryRewriting;
@property (readonly) NSInteger stateBattery;
@property (readonly) BOOL      errOffline;

- (id)init;

@end

/**
 * SIIMpaPrinterDiscovery Class
 */
@interface SIIMpaPrinterDiscovery : NSObject

/**
 * Start printer search
 * @param method Specification of selector
 * @param target Specification of object
 * @param prnIf Constants of communication interface
 * @param retry Number of retry times
 * @param timeout Timeout period for 1 time search
 * @param error Error object reference
 */

- (BOOL)startDiscoveryPrinter:(SEL)method
                       target:(NSObject *)target
                        prnIf:(PrinterInterface)prnIf
                        retry:(NSInteger)retry
                      timeout:(NSInteger)timeout
                        error:(NSError **)error;

/**
 * Cancel printer search
 * @param error Error object reference
 */
- (BOOL)cancelDiscoveryPrinter:(NSError **)error;

/**
 * Retrieve information list of searched printer
 * @param foundPrinter information list of searched printer
 * @param error Error object reference
 */
- (BOOL)getFoundPrinter:(NSMutableArray **)foundPrinter
                  error:(NSError **)error;

@end

/**
 * SIIMpaDiscoveredPrinter Class
 */
@interface SIIMpaDiscoveredPrinter : NSObject

/**
 * Retrieve printer model name
 */
@property (readonly) NSString *printerModel;

/**
 * Retrieve Bluetooth address
 */
@property (readonly) NSString *bluetoothAddress;

/**
 * Retrieve IP address
 */
@property (readonly) NSString *ipAddress;

/**
 * Retrieve MAC address
 */
@property (readonly) NSString *macAddress;

/**
 * Retrieve Serial Number
 */
@property (readonly) NSString *serialNumber;

@end

/**
 * SIIMpaPrinterManager
 */
@interface  SIIMpaPrinterManager : NSObject {
    BOOL                       isOpened;
}

/**
 * Start using printer
 * @param printerInterface Communication interface constant
 * @param printerModel Printer model constant
 * @param address Printer's IP address(TCP) or Bluetooth address(Bluetooth).
 * @param socketKeepingTime socket keeping time(TCP)
 * @param error Error object reference
 */
- (BOOL)open:(PrinterInterface)printerInterface
printerModel:(PrinterModel)printerModel
     address:(NSString *)address
socketKeepingTime:(NSInteger)socketKeepingTime
       error:(NSError **)error;

/**
 * Finish using printer
 * @param error Error object reference
 */
- (BOOL)close:(NSError **)error;

/**
 * Retrieve printer status
 * @param getStatus Printer status
 * @param error Error object reference
 */
- (BOOL)getStatus:(SIIMpaPrinterStatus **)getStatus
            error:(NSError **)error;

/**
 * Start callback of printer status change
 * @param method Selector specification
 * @param target Object specification
 * @param error Error object reference
 */
- (BOOL)startCallbackFunction:(SEL)method
                       target:(NSObject *)target
                        error:(NSError **)error;

/**
 * Finish callback of printer status change
 * @param error Error object reference
 */
- (BOOL)stopCallbackFunction:(NSError **)error;

/**
 * Retrieve receive data
 * @param readBinary Receive data
 * @param bufferSize Receive data size (byte)
 * @param error Error object reference
 */
- (BOOL)read:(NSMutableData **)readBinary
  bufferSize:(NSInteger)bufferSize
       error:(NSError **)error;

/**
 * Retrieve available receive data size
 * @param readSize Receive data size (byte)
 * @param error Error object reference
 */
- (BOOL)getReadSize:(NSInteger *)readSize
              error:(NSError **)error;

/**
 * Send Binary data
 * @param binary Binary data to send to a printer
 * @param offset Specification of the starting position of the data send
 * @param error Error object reference
*/
- (BOOL)write:(NSData *)binary
       offset:(NSInteger)offset
        error:(NSError **)error;

/**
 * Send text data
 * @param text Text data to send to the printer
 * @param error Error object reference
 */
- (BOOL)printText:(NSString *)text
            error:(NSError **)error;

/**
 * Send Image data
 * @param image UIImage type image to send to the printer.
 * @param dithering Dithering selection for image.
 * @param error Error object reference.
 */
- (BOOL)sendImage:(UIImage *)image
           dithering:(Dithering)dithering
            error:(NSError **)error;

/**
 * Send file data
 * @param filePath File path to send to the printer
 * @param dithering Dithering selection for image file.
 * @param error Error object reference
 */
- (BOOL)sendDataFile:(NSString *)filePath
           dithering:(Dithering)dithering
               error:(NSError **)error;

/**
 * Send file data
 * @param filePath File path to send to the printer
 * @param error Error object reference
 */
- (BOOL)sendDataFile:(NSString *)filePath
               error:(NSError **)error;

/**
 * Prints the specified page of the selected PDF file.
 * @param filePath File path of PDF
 * @param startIndex Start number of the printed page
 * @param endIndex End number of the printed page
 * @param rotate Rotation direction of the image
 * @param width WIdth of the image (dot)
 * @param bottomMargin Bottom margin (dot)
 * @param dithering Dithering
 * @param error Error object reference
 */
- (BOOL)printPDF:(NSString *)filePath
      startIndex:(NSInteger)startIndex
        endIndex:(NSInteger)endIndex
          rotate:(Rotate)rotate
           width:(NSInteger)width
    bottomMargin:(NSInteger)bottomMargin
       dithering:(Dithering)dithering
           error:(NSError **)error;

/**
 * Send and receive binary data
 * @param sendBinary Data to send
 * @param receiveBinary Data to receive
 * @param bufferSize Maximum size of the data to receive
 * @param respControl Operation selection for receive process
 * @param incAsbData Include the automatic status response to the receive data or not
 * @param error Error object reference
 */
- (BOOL)writeAndWaitResponse:(NSData *)sendBinary
               receiveBinary:(NSMutableData **)receiveBinary
                  bufferSize:(NSInteger)bufferSize
                 respControl:(BOOL)respControl
                  incAsbData:(BOOL)incAsbData
                       error:(NSError **)error;

/**
 * Retrieve printer information(NSData)
 * @param prnInfo Printer information type to retrieve
 * @param prnInfoValue Printer information
 * @param error Error object reference
 */
- (BOOL)getPrinterInformation:(PrinterInformation)prnInfo
      printerInformationValue:(NSData **)prnInfoValue
                        error:(NSError **)error;

/**
 * Retrieve printer information(NSString)
 * @param prnInfo Printer information type to retrieve
 * @param prnInfoValue Printer information
 * @param error Error object reference
 */
- (BOOL)getPrinterInformationString:(PrinterInformation)prnInfo
            printerInformationValue:(NSString **)prnInfoValue
                              error:(NSError **)error;

/**
 * Retrieve printer information(NSInteger)
 * @param prnInfo Printer information type to retrieve
 * @param prnInfoValue Printer information
 * @param error Error object reference
 */
- (BOOL)getPrinterInformationNumber:(PrinterInformation)prnInfo
                   printerInfoValue:(NSInteger **)prnInfoValue
                              error:(NSError **)error;

/**
 * Feed paper by line
 * @param lines Number of lines to feed (line)
 * @param error Error object reference
 */
- (BOOL)feedLine:(NSInteger)lines
           error:(NSError **)error;

/**
 * Feed paper by dot
 * @param dotLines Number of dots to feed (dot)
 * @param error Error object reference
 */
- (BOOL)feedDotLine:(NSInteger)dotLines
              error:(NSError **)error;

/**
 * Feed paper to cut position
 * @param error Error object reference
 */
- (BOOL)feedCutPosition:(NSError **)error;

/**
 * Marked paper form feed
 * @param dotLines Correction amount (dot)
 * @param error Error object reference
 */
- (BOOL)feedMarkPosition:(NSInteger)dotLines
                   error:(NSError **)error;

/**
 * Print logo registered in printer
 * @param regNum Logo number
 * @param error Error object reference
 */
- (BOOL)printLogo:(NSInteger)regNum
            error:(NSError **)error;

/**
 * Print barcode
 * @param type Barcode type
 * @param text Barcode text data
 * @param moduleWidth Barcode module width or fine element
 * @param moduleHeight Barcode module height(dot)
 * @param hri Barcode HRI character
 * @param nwRatio Barcode N:W ratio
 * @param error Error object reference
 */
- (BOOL)printBarcode:(TypeBarcode)type
                text:(NSString *)text
         moduleWidth:(ModuleWidthBarcode)moduleWidth
        moduleHeight:(NSInteger)moduleHeight
                 hri:(HriPositionBarcode)hri
             nwRatio:(NwRatioBarcode)nwRatio
               error:(NSError **)error;

/**
 * Print barcode
 * @param type Barcode type
 * @param binary Barcode binary data
 * @param moduleWidth Barcode module width or fine element
 * @param moduleHeight Barcode module height(dot)
 * @param hri Barcode HRI character
 * @param nwRatio Barcode N:W ratio
 * @param error Error object reference
 */
- (BOOL)printBarcode:(TypeBarcode)type
                binary:(NSData *)binary
         moduleWidth:(ModuleWidthBarcode)moduleWidth
        moduleHeight:(NSInteger)moduleHeight
                 hri:(HriPositionBarcode)hri
             nwRatio:(NwRatioBarcode)nwRatio
               error:(NSError **)error;

/**
 * Print 2-dimensional barcode
 * @param type 2-dimensional barcode type
 * @param text Barcode text data
 * @param mode 2-dimensional barcode mode
 * @param moduleSize 2-dimensional barcode module size
 * @param moduleHeight  2-dimensional barcode module height (dot)
 * @param column Number of columns in 2-dimensional barcode
 * @param row Number of rows in 2-dimensional barcode
 * @param errorCorrect Error correction level of 2-dimensional barcode
 * @param error Error object reference
 */
- (BOOL)print2DCode:(Type2DCode)type
               text:(NSString *)text
               mode:(Mode2Dcode)mode
         moduleSize:(ModuleSize2Dcode)moduleSize
       moduleHeight:(NSInteger)moduleHeight
             column:(NSInteger)column
                row:(NSInteger)row
       errorCorrect:(ErrorCorrect2Dcode)errorCorrect
              error:(NSError **)error;

/**
 * Print 2-dimensional barcode
 * @param type 2-dimensional barcode type
 * @param binary Barcode binary data
 * @param mode 2-dimensional barcode mode
 * @param moduleSize 2-dimensional barcode module size
 * @param moduleHeight  2-dimensional barcode module height (dot)
 * @param column Number of columns in 2-dimensional barcode
 * @param row Number of rows in 2-dimensional barcode
 * @param errorCorrect Error correction level of 2-dimensional barcode
 * @param error Error object reference
 */
- (BOOL)print2DCode:(Type2DCode)type
             binary:(NSData *)binary
               mode:(Mode2Dcode)mode
         moduleSize:(ModuleSize2Dcode)moduleSize
       moduleHeight:(NSInteger)moduleHeight
             column:(NSInteger)column
                row:(NSInteger)row
       errorCorrect:(ErrorCorrect2Dcode)errorCorrect
              error:(NSError **)error;

/**
 * Select print direction for barcode or 2-dimensional barcode
 * @param rotate Print direction
 * @param error Error object reference
 */
- (BOOL)setStandardModeBarcodeDirection:(Rotate)rotate
                                  error:(NSError**)error;

/**
 * Draw rectangular
 * @param startX Horizontal start point (dot)
 * @param startY Vertical start point (dot)
 * @param width Width (dot)
 * @param height Height (dot)
 * @param thickness Line width (dot)
 * @param error Error object reference
 */
- (BOOL)printPageModeRectangle:(NSInteger)startX
                        startY:(NSInteger)startY
                         width:(NSInteger)width
                        height:(NSInteger)height
                     thickness:(NSInteger)thickness
                         error:(NSError**)error;

/**
 * Format character
 * @param type Character font
 * @param verticalScale Character size (in vertical direction)
 * @param horizontalScale Character size (in horizontal direction)
 * @param underline Underline
 * @param bold Bold print
 * @param reverse Reverse print
 * @param rotate Character Rotation Print
 * @param error Error object reference
 */
- (BOOL)setCharacterFormatting:(CharacterType)type
                 verticalScale:(CharacterScale)verticalScale
               horizontalScale:(CharacterScale)horizontalScale
                     underline:(Underline)underline
                          bold:(Bold)bold
                       reverse:(Reverse)reverse
                        rotate:(Rotate)rotate
                         error:(NSError **)error;

/**
 * Specify print area in standard mode
 * @param leftMargin Left margin (dot)
 * @param prnAreaWidth Print area width (dot)
 * @param error Error object reference
 */
- (BOOL)setStandardModeArea:(NSInteger)leftMargin
             printAreaWidth:(NSInteger)prnAreaWidth
                      error:(NSError **)error;
 
/**
 * Alignment
 * @param align Alignment
 * @param error Error object reference
 */
- (BOOL)setStandardModeAlignment:(Alignment)align
                           error:(NSError **)error;

/**
 * Specify character right space amount
 * @param space Right space amount (dot)
 * @param error Error object reference
 */
- (BOOL)setCharacterRightSpace:(NSInteger)space
                         error:(NSError **)error;
 
/**
 * Specify line space amount
 * @param lineSpacing Line spacing (dot)
 * @param error Error object reference
 */
- (BOOL)setLineSpacing:(NSInteger)lineSpacing
                 error:(NSError **)error;

/**
 * Specify absolute position
 * @param horizontalPosition Horizontal print starting position (dot)
 * @param error Error object reference
 */
- (BOOL)setHorizontalPosition:(NSInteger)horizontalPosition
                        error:(NSError **)error;

/**
 * Start page mode
 * @param startX Horizontal start point (dot)
 * @param startY Vertical start point (dot)
 * @param width Print area width (dot)
 * @param height Print area height (dot)
 * @param direction Print direction (dot)
 * @param error Error object reference
 */
- (BOOL)selectPageMode:(NSInteger)startX
                startY:(NSInteger)startY
                 width:(NSInteger)width
                height:(NSInteger)height
             direction:(Direction)direction
                 error:(NSError **)error;

/**
 * Print page mode data
 * @param error Error object reference
 */
- (BOOL)printPageModeData:(NSError **)error;

/**
 * Select standard mode
 * @param error Error object reference
 */
- (BOOL)selectStandardMode:(NSError **)error;

/**
 * Specify vertical absolute position in page mode
 * @param verticalPosition Data mapping starting position in vertical direction (dot)
 * @param error Error object reference
 */
- (BOOL)setPageModeVerticalPosition:(NSInteger)verticalPosition
                              error:(NSError **)error;

/**
 * Start/finish print data batch sending
 * @param control Operation selection of batch process
 * @param error Error object reference
 */
- (BOOL)controlTransaction:(TransactionFunction)control
                     error:(NSError **)error;

/**
 * Register logo to printer
 * @param filePath File path of image data
 * @param regNum Logo number
 * @param dithering Dithering selection for image file.
 * @param error Error object reference
 */
- (BOOL)registerLogo:(NSString *)filePath
      registerNumber:(NSInteger)regNum
           dithering:(Dithering)dithering
               error:(NSError **)error;

/**
 * Register logo to printer
 * @param filePath File path of image data
 * @param regNum Logo number
 * @param error Error object reference
 */
- (BOOL)registerLogo:(NSString *)filePath
      registerNumber:(NSInteger)regNum
               error:(NSError **)error;

/**
 * Delete logo in printer
 * @param regNum Logo number
 * @param error Error object reference
 */
- (BOOL)deleteLogo:(NSInteger)regNum
             error:(NSError **)error;
 
/**
 * Register style sheet to printer
 * @param filePath File path for style sheet
 * @param regNum Style sheet number
 * @param error Error object reference
 */
- (BOOL)registerStyleSheet:(NSString *)filePath
            registerNumber:(NSInteger)regNum
                     error:(NSError **)error;

/**
 * Delete style sheet in printer
 * @param regNum Style sheet number
 * @param error Error object reference
 */
- (BOOL)deleteStyleSheet:(NSInteger)regNum
                   error:(NSError **)error;

/**
 * Reset printer
 * @param error Error object reference
 */
- (BOOL)reset:(NSError **)error;

/**
 * Specify log output
 * @param logLevel Log output level
 * @param logFileSize Maximum size of log file
 * @param error Error object reference
 */
- (BOOL)setLog:(NSInteger)logLevel
    logFileSize:(LogFileSize)logFileSize
          error:(NSError **)error;

/**
 * Get version of SDK.
 * @return version.
 */
- (NSString *)getVersion;

/**
 * Retrieve printer using status
 */
@property (readonly) BOOL isOpened;

/**
 * Select character set
 * @param charSet Character set
 */
- (BOOL)selectCharacterSet:(CharacterSet)charSet
                     error:(NSError **)error;

/**
 * Retrieve specified character set
 */
- (NSInteger)getCharacterSet;

/**
 * Select international character set
 * @param intCharSet International character set
 */
- (BOOL)selectInternationalCharacterSet:(InternationalCharacterSet)intCharSet
                                  error:(NSError **)error;

/**
 * Retrieve specified international character set
 */
- (NSInteger)getInternationalCharacterSet;

/**
 * Set send timeout period
 * @param writeTimeout Send timeout period (millisecond)
 */
- (void)setWriteTimeout:(NSInteger)writeTimeout;

/**
 * Retrieve send timeout period
 */
- (NSInteger)getWriteTimeout;

/**
 * Set receive timeout period
 * @param respTimeout Receive timeout period (millisecond)
 */
- (void)setResponseTimeout:(NSInteger)respTimeout;

/**
 * Retrieve receive timeout period
 */
- (NSInteger)getResponseTimeout;

/**
 * Set image transaction mode
 * @param mode image transaction mode
 */
- (void)setImageTransactionMode:(ImageTransactionMode)mode;

/**
 * Retrieve image transaction mode
 */
- (BOOL)getImageTransactionMode;

@end

#endif
