Я создал обертку для SDK пакета, который шел с Терминалом на Android. Мне нужны функции печати из этого пакета.
В проекте все компилируется нормально, но при попытке вызова классов из обертки выдается ошибка, что класс не инициализирован.
часть кода обертки:type
Jsdk_DriverManager = interface;//com.zcs.sdk.DriverManager
JLed = interface;//com.zcs.sdk.Led
JLedLightModeEnum = interface;//com.zcs.sdk.LedLightModeEnum
Jsdk_Printer = interface;//com.zcs.sdk.Printer
JSdkData = interface;//com.zcs.sdk.SdkData
JSdkResult = interface;//com.zcs.sdk.SdkResult
Jsdk_DriverManagerClass = interface(JObjectClass)
['{4A7F5734-E16B-4134-9AA9-FC299B1196B0}']
{class} function getInstance: Jsdk_DriverManager; cdecl;
{class} function init: Jsdk_DriverManager; cdecl;
end;
[JavaSignature('com/zcs/sdk/DriverManager')]
Jsdk_DriverManager = interface(JObject)
['{0279E67B-31DA-4375-B96C-A675297818B7}']
function getBaseSysDevice: JSys; cdecl;
function getBeeper: JBeeper; cdecl;
function getBluetoothHandler: JBluetoothHandler; cdecl;
function getCardReadManager: JCardReaderManager; cdecl;
function getExternalCardManager: JExternalCardManager; cdecl;
function getFingerprintManager: Jfingerprint_FingerprintManager; cdecl;
function getLedDriver: JLed; cdecl;
function getPadManager: JPinPadManager; cdecl;
function getPrinter: Jsdk_Printer; cdecl;
function getSingleThreadExecutor: JExecutorService; cdecl;
function getUart: JUart; cdecl;
procedure setJni(smartPosJni: JSmartPosJni); cdecl;
end;
TJsdk_DriverManager = class(TJavaGenericImport<Jsdk_DriverManagerClass, Jsdk_DriverManager>) end;
JLedClass = interface(JObjectClass)
['{355BFEF1-7B0C-4F57-8B6E-1CD621CC39B4}']
end;
[JavaSignature('com/zcs/sdk/Led')]
JLed = interface(JObject)
['{FD89DF57-465D-433D-8575-9EC5E53F16DD}']
function setLed(ledLightModeEnum: JLedLightModeEnum; b: Boolean): Integer; cdecl;
end;
TJLed = class(TJavaGenericImport<JLedClass, JLed>) end;
JLedLightModeEnumClass = interface(JEnumClass)
['{0E610D53-7E7B-42DE-8933-4F5960A9A4AE}']
{class} function _GetALL: JLedLightModeEnum; cdecl;
{class} function _GetBLUE: JLedLightModeEnum; cdecl;
{class} function _GetGREEN: JLedLightModeEnum; cdecl;
{class} function _GetRED: JLedLightModeEnum; cdecl;
{class} function _GetYELLOW: JLedLightModeEnum; cdecl;
{class} function valueOf(string_: JString): JLedLightModeEnum; cdecl;
{class} function values: TJavaObjectArray<JLedLightModeEnum>; cdecl;
{class} property ALL: JLedLightModeEnum read _GetALL;
{class} property BLUE: JLedLightModeEnum read _GetBLUE;
{class} property GREEN: JLedLightModeEnum read _GetGREEN;
{class} property RED: JLedLightModeEnum read _GetRED;
{class} property YELLOW: JLedLightModeEnum read _GetYELLOW;
end;
Jsdk_PrinterClass = interface(JObjectClass)
['{16A78F6B-6B42-4290-8577-62D0FB1511A3}']
{class} function createQRCode(string_: JString; i: Integer; i1: Integer): JBitmap; cdecl; overload;
{class} function sysCopy(list: JList): TJavaArray<Byte>; cdecl;
end;
[JavaSignature('com/zcs/sdk/Printer')]
Jsdk_Printer = interface(JObject)
['{C8CAA496-4806-4B2C-BE6A-BE8A735ADBCD}']
function coverAllBitmap(i: Integer; i1: Integer): JBitmap; cdecl;
//function createBarcode(context: JContext; string_: JString; i: Integer; i1: Integer; b: Boolean; alignment: JLayout_Alignment; barcodeFormat: JBarcodeFormat; i2: Integer): JBitmap; cdecl;
function createQRCode(string_: JString; i: Integer; i1: Integer; alignment: JLayout_Alignment; i2: Integer): JBitmap; cdecl; overload;
function getPrinterStatus: Integer; cdecl;
function labelPrintBackFeed: Integer; cdecl; overload;
function labelPrintBackFeed(i: Integer): Integer; cdecl; overload;
function labelPrintForwardFeed: Integer; cdecl; overload;
function labelPrintForwardFeed(i: Integer): Integer; cdecl; overload;
function labelPrintLocationFeed: Integer; cdecl;
function setLabelPrintStart: Integer; cdecl; overload;
function setLabelPrintStart(i: Integer; i1: Integer): Integer; cdecl; overload;
//procedure setPrintAppendBarCode(context: JContext; string_: JString; i: Integer; i1: Integer; b: Boolean; alignment: JLayout_Alignment; barcodeFormat: JBarcodeFormat); cdecl; overload;
//procedure setPrintAppendBarCode(context: JContext; string_: JString; i: Integer; i1: Integer; b: Boolean; alignment: JLayout_Alignment; barcodeFormat: JBarcodeFormat; i2: Integer); cdecl; overload;
procedure setPrintAppendBitmap(bitmap: JBitmap; alignment: JLayout_Alignment); cdecl; overload;
procedure setPrintAppendBitmap(bitmap: JBitmap; alignment: JLayout_Alignment; i: Integer); cdecl; overload;
procedure setPrintAppendQRCode(string_: JString; i: Integer; i1: Integer; alignment: JLayout_Alignment); cdecl; overload;
procedure setPrintAppendQRCode(string_: JString; i: Integer; i1: Integer; alignment: JLayout_Alignment; i2: Integer); cdecl; overload;
procedure setPrintAppendString(string_: JString; prnStrFormat: JPrnStrFormat); cdecl; overload;
procedure setPrintAppendString(string_: JString; prnStrFormat: JPrnStrFormat; i: Integer); cdecl; overload;
function setPrintLine(i: Integer): Integer; cdecl;
function setPrintStart: Integer; cdecl; overload;
function setPrintStart(i: Integer): Integer; cdecl; overload;
end;
TJsdk_Printer = class(TJavaGenericImport<Jsdk_PrinterClass, Jsdk_Printer>) end;
доступ к устройствам:var
Man : Jsdk_DriverManager;
Printer : Jsdk_Printer;
prnStrFormat: JPrnStrFormat;
Res : JSdkResult;
LedUNum : JLedLightModeEnum;
Led : JLed;
paperWidth, paperHeight,
i : Integer;
begin
paperWidth := 360;
paperHeight := 240;
Res := TJSdkResult.Create;
Man := TJsdk_DriverManager.Create; //Мереджер устройств
Led := TJLed.Create;
Led := Man.getLedDriver; //Управление светодиодами
LedUNum := TJLedLightModeEnum.Create;
i := LedUNum.getClor;
Memo1.Lines.Add('getClor ='+IntToStr(i));
i := Led.setLed(LLL.ALL,true); // Сдесь ошибка при передачи параметра
Memo1.Lines.Add('setLed ='+IntToStr(i));
Printer := TJsdk_Printer.Create;
Printer := Man.getPrinter();
prnStrFormat := TJPrnStrFormat.Create;
i := prnStrFormat.getTextSize;
Memo1.Lines.Add('getTextSize ='+IntToStr(i));
i := Printer.getPrinterStatus;
Memo1.Lines.Add('getPrinterStatus ='+IntToStr(i));
Printer.setPrintAppendString(StringToJString('qwertyyuiasdfhjfgdAFDSVDSZ'),prnStrFormat);
// i := Printer.setLabelPrintStart(360,240{paperWidth, paperHeight});
// Memo1.Lines.Add('setLabelPrintStart ='+IntToStr(i));
i := Printer.setPrintStart;
Memo1.Lines.Add('setPrintStart ='+IntToStr(i));
Ошибка при выполнении из-за неправильной инициализации этих классов.