Commit bb3f723a by 원종진

최초등록

parents
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#
# Delphi compiler-generated binaries (safe to delete)
*.exe
*.dll
*.bpl
*.bpi
*.dcp
*.so
*.apk
*.drc
*.map
*.dres
*.rsm
*.tds
*.dcu
*.lib
*.a
*.o
*.ocx
# Delphi autogenerated files (duplicated info)
*.cfg
*.hpp
*Resource.rc
# Delphi local files (user-specific info)
*.local
*.identcache
*.projdata
*.tvsconfig
*.dsk
# Delphi history and backups
__history/
__recovery/
*.~*
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat
*.bak
*.dof
*.dex
*.cbk
GPATH
GRTAGS
GTAGS
*.log
*.skincfg
unit CommonDataUnit;
interface
uses
Classes;
type
TRecQueryResult = record
code : String;
data : String;
name : String;
end;
PRecResultDetail = ^TRecResultDetail;
TRecResultDetail = record
Key : String;
Value : String;
end;
TQueryResultList = class(TList)
protected
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
end;
procedure LoadIni;
procedure SaveIni;
function HexStrToStr(const HexStr : String) : String;
var
g_FacilityID : String;
g_SvrAddr : String;
implementation
uses
IniFiles, SysUtils;
procedure LoadIni;
begin
with TIniFile.Create('.\' + ChangeFileExt(ExtractFileName(ParamStr(0)), '') + '.ini') do
try
g_FacilityID := ReadString(UpperCase('CONFIG'), UpperCase('FACILITY_ID'), '');
g_SvrAddr := ReadString(UpperCase('CONFIG'), UpperCase('SERVER_ADDRESS'), '');
finally
Free;
end;
end;
procedure SaveIni;
begin
with TIniFile.Create('.\' + ChangeFileExt(ExtractFileName(ParamStr(0)), '') + '.ini') do
try
WriteString(UpperCase('CONFIG'), UpperCase('FACILITY_ID'), g_FacilityID);
finally
Free;
end;
end;
function HexStrToStr(const HexStr : String) : String;
var
tmp : String;
begin
Assert(not Odd(Length(HexStr)), 'HexStr length must be an even number');
SetLength(tmp, Length(HexStr) div 2);
HexToBin(PChar(HexStr), @tmp[1], Length(tmp));
Result := tmp;
end;
{ TQueryResultList }
procedure TQueryResultList.Notify(Ptr: Pointer;
Action: TListNotification);
begin
inherited;
if Action = lnDeleted then
Dispose(PRecResultDetail(Ptr));
end;
end.
keep empty dir
{
Required
1. Zebra CORESCANNER SDK(SDK에 드라이버가 포함되어 있음)
2. 제브라 드라이버 설치후, CCoreScanner 타입라이브러리 임포트하여 소스 패스에 넣어줄 것.
- 현 프로젝트에서는 ZebraCtrlUnit.pas 에 CoreScanner_TLB 유닛으로 참조되어 있음.
3. CoolTray 컴포넌트 필요
- 혁산에서 이미 사용중인 FMCS 컴포넌트 중의 하나이므로 FMCS컴파일 하는 사람이면 누구나 가지고 있을 것임.
4. SuperObject 컴포넌트 필요
- XML, JSON 문자열 파싱을 도와주는 컴포넌트
- 역시 FMCS에서 사용중인 컴포넌트이므로 FMCS 컴파일 가능한 환경이면 이미 가지고 있을 것임.
}
program ESB_Agent;
uses
FastMM4,
Forms,
frmMainUnit in 'frmMainUnit.pas' {frmMain},
frmAboutUnit in 'frmAboutUnit.pas' {frmAbout},
frmConfigUnit in 'frmConfigUnit.pas' {frmConfig},
frmResultUnit in 'frmResultUnit.pas' {frmResult},
CommonDataUnit in 'CommonDataUnit.pas',
ZebraCtrlUnit in 'ZebraCtrlUnit.pas';
{$R *.res}
begin
Application.Initialize;
Application.ShowMainForm := false;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
//////// Binary
////////
////////
////////
unit
FMCUtilsWrapper;
interface
function Base64DecodeString(const AData: AnsiString): AnsiString;
function Base64EncodeString(const AData: AnsiString): AnsiString;
function SHA256HashString(const AData: AnsiString): AnsiString;
function SHA512HashString(const AData: AnsiString): AnsiString;
function AES256DecodeString(const AData, AKey: AnsiString): AnsiString;
function AES256EncodeString(const AData, AKey: AnsiString): AnsiString;
function AES128DecodeString(const AData, AKey: AnsiString): AnsiString;
function AES128EncodeString(const AData, AKey: AnsiString): AnsiString;
implementation
const
CFMCUtilsLibraryFileName = 'FMCUtils.dll';
function InternalBase64DecodeString(ADataBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'Base64DecodeString';
function InternalBase64EncodeString(ADataBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'Base64EncodeString';
function InternalSHA256HashString(ADataBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'SHA256HashString';
function InternalSHA512HashString(ADataBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'SHA512HashString';
function InternalAES256DecodeString(ADataBuffer, AKeyBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'AES256DecodeString';
function InternalAES256EncodeString(ADataBuffer, AKeyBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'AES256EncodeString';
function InternalAES128DecodeString(ADataBuffer, AKeyBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'AES128DecodeString';
function InternalAES128EncodeString(ADataBuffer, AKeyBuffer, AResultBuffer: PAnsiChar; AResultBufferSize: Integer): Boolean; stdcall; external CFMCUtilsLibraryFileName Name 'AES128EncodeString';
////////////////
const
CDefaultBufferSize = 4096;
function Base64DecodeString(const AData: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if AData <> '' then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalBase64DecodeString(PAnsiChar(AData), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function Base64EncodeString(const AData: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if AData <> '' then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalBase64EncodeString(PAnsiChar(AData), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function SHA256HashString(const AData: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if AData <> '' then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalSHA256HashString(PAnsiChar(AData), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function SHA512HashString(const AData: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if AData <> '' then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalSHA512HashString(PAnsiChar(AData), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function AES256DecodeString(const AData, AKey: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if (AData <> '') and (AKey <> '') then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalAES256DecodeString(PAnsiChar(AData), PAnsiChar(AKey), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function AES256EncodeString(const AData, AKey: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if (AData <> '') and (AKey <> '') then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalAES256EncodeString(PAnsiChar(AData), PAnsiChar(AKey), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function AES128DecodeString(const AData, AKey: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if (AData <> '') and (AKey <> '') then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalAES128DecodeString(PAnsiChar(AData), PAnsiChar(AKey), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
function AES128EncodeString(const AData, AKey: AnsiString): AnsiString;
var
LResult: AnsiString;
begin
Result := '';
if (AData <> '') and (AKey <> '') then
begin
SetLength(LResult, CDefaultBufferSize);
if InternalAES128EncodeString(PAnsiChar(AData), PAnsiChar(AKey), PAnsiChar(LResult), CDefaultBufferSize) then
begin
Result := PAnsiChar(LResult);
end;
end;
end;
end.
keep empty dir
ActiveIcon ICON "Appicon_Active.ico"
InActiveIcon ICON "Appicon_InActive.ico"
\ No newline at end of file
unit ZebraCtrlUnit;
interface
uses
Classes, SysUtils, SuperObject, SuperXmlParser, CoreScanner_TLB, ActiveX;
type
TUSB_HOST_MODE = (uhmIBMHID, uhmIBMTT, uhmHIDKB, uhmOPOS, uhmSNAPI_WITH_IMAGING, uhmSNAPI_WITHOUT_IMAGING, uhmCDC);
const
C_ARR_HOST_MODE_USB : Array[0..7-1] of String = ('XUA-45001-1'
, 'XUA-45001-2'
, 'XUA-45001-3'
, 'XUA-45001-8'
, 'XUA-45001-9'
, 'XUA-45001-10'
, 'XUA-45001-11');
C_OPCODE_GET_VERSION = $3E8; //1000
C_OPCODE_REGISTER_FOR_EVENTS = $3E9; //1001
C_OPCODE_UNREGISTER_FOR_EVENTS = $3EA; //1002
C_OPCODE_CLAIM_DEVICE = $5DC; //1500
C_OPCODE_RELEASE_DEVICE = $5DD; //1501
C_OPCODE_DEVICE_ABORT_MACROPDF = $7D0; //2000
C_OPCODE_DEVICE_ABORT_UPDATE_FIRMWARE = $7D1; //2001
C_OPCODE_DEVICE_AIM_OFF = $7D2; //2002
C_OPCODE_DEVICE_AIM_ON = $7D3; //2003
C_OPCODE_DEVICE_ENTER_LOW_POWER_MODE = $7D4; //2004
C_OPCODE_DEVICE_FLUSH_MACROPDF = $7D5; //2005
C_OPCODE_DEVICE_GET_PARAMETERS = $7D7; //2007
C_OPCODE_DEVICE_GET_SCANNER_CAPABILITIES = $7D8; //2008
C_OPCODE_DEVICE_LED_OFF = $7D9; //2009
C_OPCODE_DEVICE_LED_ON = $7DA; //2010
C_OPCODE_DEVICE_PULL_TRIGGER = $7DB; //2011
C_OPCODE_DEVICE_RELEASE_TRIGGER = $7DC; //2012
C_OPCODE_DEVICE_SCAN_DISABLE = $7DD; //2013
C_OPCODE_DEVICE_SCAN_ENABLE = $7DE; //2014
C_OPCODE_DEVICE_SET_PARAMETER_DEFAULTS = $7DF; //2015
C_OPCODE_DEVICE_SET_PARAMETERS = $7E0; //2016
C_OPCODE_DEVICE_SET_PARAMETER_PERSISTANCE = $7E1; //2017
C_OPCODE_DEVICE_BEEP_CONTROL = $7E2; //2018
C_OPCODE_REBOOT_SCANNER = $7E3; //2019
C_OPCODE_DISCONNECT_BT_SCANNER = $7E7; //2023
C_OPCODE_DEVICE_CAPTURE_IMAGE = $BB8; //3000
C_OPCODE_DEVICE_ABORT_IMAGE_XFER = $BB9; //3001
C_OPCODE_DEVICE_CAPTURE_BARCODE = $DAC; //3500
C_OPCODE_DEVICE_CAPTURE_VIDEO = $FA0; //4000
C_OPCODE_GET_PAIRING_BARCODE = $3ED; //1005
C_OPCODE_RSM_ATTR_GETALL = $1388; //5000
C_OPCODE_RSM_ATTR_GET = $1389; //5001
C_OPCODE_RSM_ATTR_GETNEXT = $138A; //5002
C_OPCODE_RSM_ATTR_GETOFFSET = $138B; //5003
C_OPCODE_RSM_ATTR_SET = $138C; //5004
C_OPCODE_RSM_ATTR_STORE = $138D; //5005
C_OPCODE_GET_DEVICE_TOPOLOGY = $138E; //5006
C_OPCODE_REFRESH_TOPOLOGY = $138F; //5007
C_OPCODE_UPDATE_DECODE_TONE = $13BA; //5050
C_OPCODE_ERASE_DECODE_TONE = $13BB; //5051
C_OPCODE_START_NEW_FIRMWARE = $1396; //5014
C_OPCODE_UPDATE_ATTRIB_META_FILE = $1397; //5015
C_OPCODE_DEVICE_UPDATE_FIRMWARE = $1398; //5016
C_OPCODE_DEVICE_UPDATE_FIRMWARE_FROM_PLUGIN = $1399; //5017
C_OPCODE_DEVICE_SET_SERIAL_PORT_SETTINGS = $17D5; //6101
C_OPCODE_SET_ACTION = $1770; //6000
C_OPCODE_DEVICE_SWITCH_HOST_MODE = $1838; //6200
//HID keyboard emulator opcodes
C_OPCODE_KEYBOARD_EMULATOR_ENABLE = $189C; //6300
C_OPCODE_KEYBOARD_EMULATOR_SET_LOCALE = $189D; //6301
C_OPCODE_KEYBOARD_EMULATOR_GET_CONFIG = $189E; //6302
//DRIVER ADF COMMANDS
C_OPCODE_CONFIGURE_DADF = $1900; //6400
C_OPCODE_RESET_DADF = $1901; //6401
//Scale opcodes
C_OPCODE_SCALE_READ_WEIGHT = $1b58; //7000
C_OPCODE_SCALE_ZERO_SCALE = $1B5A; //7002
C_OPCODE_SCALE_SYSTEM_RESET = $1B67; //7015
C_OPCODE_ERROR_OPCODE = -1;
type
PRecScannerInfo_Zebra = ^TRecScannerInfo_Zebra;
TRecScannerInfo_Zebra = record
ScannerID : String;
InterfaceType : String;
end;
TScannerInfoList_Zebra = class(TList)
protected
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
end;
procedure Open_Zebra;
procedure Close_Zebra;
procedure Discover_Zebra;
function SetEvent_Zebra(const aScannerID : String) : Boolean;
function SwitchHostMode_Zebra(const aScannerID : String; const aHostMode : TUSB_HOST_MODE) : Boolean;
var
g_CoreScanner : TCCorescanner;
g_ScannerInfoList_Zebra : TScannerInfoList_Zebra;
implementation
procedure Open_Zebra;
var
SafeArrBound : SAFEARRAYBOUND;
pSafeArr : PSafeArray;
ArrScannerTypes : Array[0..0] of SmallInt;
aStatus : Integer;
i : Integer;
begin
aStatus := 1;
SafeArrBound.cElements := 1;
SafeArrBound.lLbound := 0;
pSafeArr := SafeArrayCreate(VT_I2, 1, SafeArrBound);
ArrScannerTypes[0] := 1;
for i:=0 to Length(ArrScannerTypes)-1 do
SafeArrayPutElement(pSafeArr, i, ArrScannerTypes[i]);
g_CoreScanner.Open(0, pSafeArr, 1, aStatus);
end;
procedure Close_Zebra;
var
aStatus : Integer;
begin
g_CoreScanner.Close(0, aStatus);
end;
procedure Discover_Zebra;
var
aNUmberOfScanners : SmallInt;
aStatus : Integer;
pSafeArr : PSafeArray;
SafeArrBound : SAFEARRAYBOUND;
aOutXML : WideString;
SuperObj : ISuperObject;
i : Integer;
pItem : PRecScannerInfo_Zebra;
begin
SafeArrBound.cElements := 255;
SafeArrBound.lLbound := 0;
pSafeArr := SafeArrayCreate(VT_I2, 1, SafeArrBound);
g_ScannerInfoList_Zebra.Clear;
g_CoreScanner.GetScanners(aNumberOfScanners, pSafeArr, aOutXML, aStatus);
SuperObj := XMLParseString(aOutXML, true);
for i:=0 to aNUmberOfScanners-1 do
begin
New(pItem);
with pItem^ do
begin
ScannerID := SuperObj['scanner.scannerID'].AsString;
InterfaceType := SuperObj['scanner.type'].AsString;
end;
g_ScannerInfoList_Zebra.Add(pItem);
end;
end;
{ TScannerInfoList_Zebra }
procedure TScannerInfoList_Zebra.Notify(Ptr: Pointer;
Action: TListNotification);
begin
inherited;
if Action = lnDeleted then
Dispose(PRecScannerInfo_Zebra(Ptr));
end;
function SetEvent_Zebra(const aScannerID : String) : Boolean;
var
aInputXML : WideString;
aOutputXML : WideString;
aStatus : Integer;
begin
Result := false;
if g_ScannerInfoList_Zebra.Count < 1 then
exit;
aInputXML := '<inArgs><cmdArgs>';
// target event count
aInputXML := aInputXML + '<arg-int>6</arg-int>';
// target event id 1(SUBSCRIBE_BARCODE)
aInputXML := aInputXML + '<arg-int>1,2,4,8,16,32</arg-int></cmdArgs></inArgs>';
g_CoreScanner.ExecCommand(C_OPCODE_REGISTER_FOR_EVENTS, aInputXML, aOutputXML, aStatus);
Result := true;
end;
function SwitchHostMode_Zebra(const aScannerID : String; const aHostMode : TUSB_HOST_MODE) : Boolean;
var
aInXML, aOutXML : WideString;
aStatus : Integer;
begin
Result := false;
aInXML := '<inArgs><scannerID>%s</scannerID><cmdArgs><arg-string>%s</arg-string><arg-bool>%s</arg-bool><arg-bool>%s</arg-bool></cmdArgs></inArgs>';
aInXML := format(aInXML, [aScannerID, C_ARR_HOST_MODE_USB[Ord(aHostMode)], 'FALSE', 'FALSE']);
g_CoreScanner.ExecCommand(C_OPCODE_DEVICE_SWITCH_HOST_MODE, aInXML, aOutXML, aStatus);
end;
initialization
g_CoreScanner := TCCoreScanner.Create(nil);
g_ScannerInfoList_Zebra := TScannerInfoList_Zebra.Create;
finalization
FreeAndNil(g_ScannerInfoList_Zebra);
FreeAndNil(g_CoreScanner);
end.
keep empty dir
[CONFIG]
FACILITY_ID=SI104008
SERVER_ADDRESS=https://ctcard.suncheon.go.kr/api/001?scn_cardno=
object frmAbout: TfrmAbout
Left = 712
Top = 451
BorderStyle = bsDialog
Caption = #51228#54408#51221#48372
ClientHeight = 133
ClientWidth = 400
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = #44404#47548#52404
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 12
object Image1: TImage
Left = 32
Top = 24
Width = 40
Height = 40
AutoSize = True
Center = True
Picture.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000002800
00002808060000008CFEB86D000003F84944415478DABD995B48145118C7BF81
30495728D4CA8A52488550112D28132F54E656BB3DB81518787B11332968D710
4A2B10D407C3D40ABC051AC9FA90525A146A94055E88B47025D0A434F152E17A
7F99E69B18DB756766CF991DFDBFECE5CCCCF9EFEF9CF39DEF7CCB80425946A6
D8DE2FE330343A0343DF66C03ABF0CD68565BE4DB36533F8F96AC0CF47033BBD
3D21FE903F04FBFB304AFAA1BA69766E89AD7FDE0F9DBDA39CA969AA8ED06C1C
6734591B02BB7CBD88FB25BA108D3D68EA83964E0B476A4509083B259F0A0553
6A1451DF4E2FEAF93CC6DEACEC80F129ABCBC66CA5F17003634A14E8E382653D
48360AD41AB8215D4F39A329DA80E64A1EBDE78674685DCD098A3CE007D5057A
512F92CEC30CF7D90D71E7C4A4C317C5755DEC7A0FAB94E20EFAC35DD3493B4F
761FDABB87D9AB252FA91E9AA60B81747DA864BB21F7294C4CCF133FAFD498C0
C5CD80555FAB6F70DE9D373551AD56CF2D6E602ED2F3AF526AEB1A86C29A0FC4
CFC4D5DD5A9E0C5E9EEE8C9DC1CAC66EF621B76AD5A4A794A22E3608EE5C8AFF
6F10E969B31BA882F00E6F0FA8CDD7CAD2534A11D55A91CCEF388C527A391722
C0703C98F87A5A8A427CE40D2666D5B334738F869EA0B71F7F405EF91BE2EB71
2EBEABCB6018CC4A7071D0282FFD3024460588B68D4D5AB9A1D1A842B1B13809
98FA679FF85D8354E141DBA1CC744CB46D6E61054C659D5079FD842A148D2947
80B952FC82EDE81921BE09CDA14931D534F7436DCB001466C74074F86E972962
E066320A9AF9C49344D829762E45CF90DBCCBFE21C35179D759922CE43866681
90D013A40645DEE0D1D46A9624FEC9D1C3CED26EB5F2F404A94591D8604D8116
F6EFD92A4EF6491F985F591CBE97A3985ED00A5FBFFF56C72086140C2DA4423A
48490D8ACC39A399953B006130C6A08C9D91CA76C1C8C54C671483F67903E32C
FF234D08A408B942119358466E1F2649A7E4240CB5528AB81F3398C944A7D5AA
4A4F100E71E265B3628A98BC4A260BAED213149DD1F08F2625452171E50D8ACD
43397AB47BAAF083DBEE1944DBD01C9AB4955DBAB57698E5D2291CB69CE2D744
316CAD482922BDAA7C1D5FCF594DF96F54B4B3C23958EE41189031302B112945
DBD39DC3A1C9C37D13BFE74AD1C32D8D26A7A3A538F16B5EFCD084C263E7E2E2
92E4F6B43621580F8A83237FE0E2E930C763A720DBA1DE6889D569444B1F3439
A25AC26DAD2AFFCCEAD0CA1ADC6893B8A5955E4B7030276B10B511751A1CD6CC
A40851734E0DA29A3B2C7C01536D61ACCB4C8AB45B108A0CA2D4AC17A2319C6F
B7B3E2886AD55445F4B1C95996230A8FDB06A86BD5684C171B0CBA9840AA8ABF
A2BF065018332D23D3D037F813C6B9C3BA6DB28166FC7CBCF8CA7EE0DE6DFCDF
10F85E6A9EC9E92F07D942B7AC3161BA0000000049454E44AE426082}
Transparent = True
end
object Label1: TLabel
Left = 98
Top = 30
Width = 222
Height = 12
Caption = 'HISCO Qualification Agent Ver 1.0.0.0'
end
object Label2: TLabel
Left = 98
Top = 53
Width = 270
Height = 12
Caption = 'Coptyright C. HISCO 2019 All rights reserved.'
end
object PDJXPButton1: TPDJXPButton
Left = 280
Top = 96
Width = 97
Height = 25
XPScheme = xpOrange
Caption = #54869#51064
TabOrder = 0
ModalResult = 1
end
end
unit frmAboutUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, PDJ_XPCS, PDJ_XPB, StdCtrls, pngimage;
type
TfrmAbout = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
PDJXPButton1: TPDJXPButton;
private
{ Private declarations }
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
end;
var
frmAbout: TfrmAbout;
implementation
{$R *.dfm}
{ TfrmAbout }
constructor TfrmAbout.Create(AOwner: TComponent);
var
Icon : TIcon;
begin
inherited;
icon := TIcon.Create;
try
Icon.Handle := LoadIcon(hInstance, 'ActiveIcon');
PostMessage(Self.Handle, WM_SETICON, ICON_SMALL, icon.Handle);
finally
Icon.free;
end;
end;
end.
object frmConfig: TfrmConfig
Left = 599
Top = 340
BorderStyle = bsDialog
Caption = #54665#51221#44048#47732#49436#48708#49828' '#54869#51064' '#49444#51221
ClientHeight = 120
ClientWidth = 290
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = #44404#47548#52404
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 12
object Label1: TLabel
Left = 24
Top = 32
Width = 48
Height = 12
Caption = #49884#49444#53076#46300
end
object edtFCLTY_ID: TPDJXPEdit
Left = 80
Top = 28
Width = 185
Height = 20
TabOrder = 0
end
object btnOK: TPDJXPButton
Left = 90
Top = 79
Width = 92
Height = 25
XPScheme = xpOrange
Caption = #54869#51064
TabOrder = 1
ModalResult = 1
OnClick = btnOKClick
end
object btnCancel: TPDJXPButton
Left = 190
Top = 79
Width = 92
Height = 25
XPScheme = xpOrange
Caption = #52712#49548
TabOrder = 2
ModalResult = 2
end
end
unit frmConfigUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, PDJ_XPCS, PDJ_XPB, StdCtrls, PDJ_XPC, IniFiles;
type
TfrmConfig = class(TForm)
edtFCLTY_ID: TPDJXPEdit;
btnOK: TPDJXPButton;
btnCancel: TPDJXPButton;
Label1: TLabel;
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
procedure Init;
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
end;
var
frmConfig: TfrmConfig;
implementation
{$R *.dfm}
uses
CommonDataUnit;
{ TfrmConfig }
constructor TfrmConfig.Create(AOwner: TComponent);
var
Icon : TIcon;
begin
inherited;
icon := TIcon.Create;
try
Icon.Handle := LoadIcon(hInstance, 'ActiveIcon');
PostMessage(Self.Handle, WM_SETICON, ICON_SMALL, icon.Handle);
finally
Icon.free;
end;
Init;
end;
procedure TfrmConfig.Init;
begin
edtFCLTY_ID.Text := g_FacilityID;
end;
procedure TfrmConfig.btnOKClick(Sender: TObject);
begin
g_FacilityID := edtFCLTY_ID.Text;
end;
end.
This diff is collapsed. Click to expand it.
unit frmMainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XPStyleActnCtrls, ActnList, ActnMan, Menus,
IniFiles,
StdCtrls, CoolTrayIcon;
type
TfrmMain = class(TForm)
ActionManager1: TActionManager;
actShowAboutForm: TAction;
actShowConfigForm: TAction;
actTerminateApp: TAction;
CoolTrayIcon1: TCoolTrayIcon;
PopupMenu1: TPopupMenu;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
procedure RxTrayIcon1DblClick(Sender: TObject);
procedure actTerminateAppExecute(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure actShowAboutFormExecute(Sender: TObject);
procedure actShowConfigFormExecute(Sender: TObject);
protected
procedure ScannerBarcodeEvent(ASender: TObject; eventType: Smallint; var pscanData: WideString);
private
{ Private declarations }
private
procedure CheckConfig;
procedure SetTrayIcon(const aIsActive : Boolean);
function ReqDCInfo(const aCardNo : String) : String; // 행정감면정보 조회
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
{$R resicon.res}
uses
FMCUtilsWrapper
, ZebraCtrlUnit
, CommonDataUnit
, SuperObject
, SuperXmlParser
, ActiveX, ComObj, DateUtils
, frmAboutUnit, frmConfigUnit
, frmResultUnit;
constructor TfrmMain.Create(AOwner: TComponent);
var
Icon : TIcon;
begin
inherited;
// Scanner initialization
Open_Zebra;
Discover_Zebra;
SetEvent_Zebra('1'); // 스캐너가 무조건 1개 이상 연결됐을 거라고 가정한다.
SwitchHostMode_Zebra('1', uhmIBMHID);
icon := TIcon.Create;
try
Icon.Handle := LoadIcon(hInstance, 'ActiveIcon');
PostMessage(Self.Handle, WM_SETICON, ICON_SMALL, icon.Handle);
finally
Icon.free;
end;
LoadIni;
CheckConfig;
CoInitialize(nil);
g_CoreScanner.OnBarcodeEvent := ScannerBarcodeEvent;
end;
destructor TfrmMain.Destroy;
begin
Close_Zebra;
CoUninitialize;
inherited;
end;
procedure TfrmMain.RxTrayIcon1DblClick(Sender: TObject);
begin
actTerminateApp.Execute;
end;
procedure TfrmMain.actTerminateAppExecute(Sender: TObject);
begin
Application.Terminate;
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
CoolTrayIcon1.Enabled := false;
end;
procedure TfrmMain.FormHide(Sender: TObject);
begin
CoolTrayIcon1.Enabled := true;
end;
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caNone;
Hide;
end;
procedure TfrmMain.actShowAboutFormExecute(Sender: TObject);
begin
with TfrmAbout.Create(nil) do
try
ShowModal();
finally
Free;
end;
end;
function TfrmMain.ReqDCInfo(const aCardNo: String): String;
var
aRequest : Variant;
begin
try
aRequest := CreateOleObject('WinHttp.WinHttpRequest.5.1');
aRequest.Open('GET', g_SvrAddr + aCardNo, false);
aRequest.SetRequestHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0');
aRequest.SetRequestHeader('FCLTY_ID', g_FacilityID);
aRequest.Send;
Result := aRequest.ResponseText;
finally
aRequest := Unassigned;
end;
end;
procedure TfrmMain.CheckConfig;
begin
SetTrayIcon(Length(g_FacilityID) > 0);
if Length(g_FacilityID) < 1 then
CoolTrayIcon1.ShowBalloonHint('ESB Agent', '시설코드가 올바르게 입력되지 않았습니다', bitError, 10);
if Length(g_SvrAddr) < 1 then
CoolTrayIcon1.ShowBalloonHint('ESB Agent', '서비스 서버 주소가 올바르지 않습니다', bitError, 10);
end;
procedure TfrmMain.actShowConfigFormExecute(Sender: TObject);
begin
with TfrmConfig.Create(nil) do
try
if ShowModal() = mrOK then
begin
SaveIni;
CheckConfig;
end;
finally
Free;
end;
end;
procedure TfrmMain.SetTrayIcon(const aIsActive: Boolean);
begin
if aIsActive then
CoolTrayIcon1.Icon.Handle := LoadIcon(HInstance, 'ActiveIcon')
else
CoolTrayIcon1.Icon.Handle := LoadIcon(HInstance, 'InActiveIcon');
end;
procedure TfrmMain.ScannerBarcodeEvent(ASender: TObject;
eventType: Smallint; var pscanData: WideString);
var
SuperObj : ISuperObject;
aHexStr : String;
aEncodeStr : String;
aAESKey : String;
RstStr : String;
begin
SuperObj := XMLParseString(pscanData, true);
aHexStr := SuperObj['arg-xml.scandata.datalabel'].AsString;
aHexStr := StringReplace(aHexStr, ' 0x', '', [rfReplaceAll]);
aHexStr := StringReplace(aHexStr, '0x', '', [rfReplaceAll]);
// AESEncryption 암호키로 기관번호+scn2019x 문자열을 사용한다.
aAESKey := g_FacilityID + 'scn2019x';
aEncodeStr := AES128EncodeString(HexStrToStr(aHexStr), aAESKey);
RstStr := ReqDCInfo(aEncodeStr);
with TfrmResult.Create(nil) do
try
SetResult(RstStr);
ShowModal();
finally
Free;
end;
end;
end.
object frmResult: TfrmResult
Left = 889
Top = 189
BorderStyle = bsDialog
Caption = 'frmResult'
ClientHeight = 338
ClientWidth = 420
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = #44404#47548#52404
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnKeyPress = FormKeyPress
PixelsPerInch = 96
TextHeight = 12
object ListBox1: TListBox
Left = 0
Top = 0
Width = 420
Height = 338
Style = lbOwnerDrawFixed
Align = alClient
BorderStyle = bsNone
Ctl3D = False
ExtendedSelect = False
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = #44404#47548#52404
Font.Style = []
ItemHeight = 30
ParentCtl3D = False
ParentFont = False
TabOrder = 0
TabWidth = 150
OnDrawItem = ListBox1DrawItem
end
end
unit frmResultUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CommonDataUnit;
type
TfrmResult = class(TForm)
ListBox1: TListBox;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
private
{ Private declarations }
fResultList : TQueryResultList;
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
procedure SetResult(const aData : String);
end;
var
frmResult: TfrmResult;
implementation
{$R *.dfm}
uses
FMCUtilsWrapper
, SuperObject
;
{ TfrmResult }
constructor TfrmResult.Create(AOwner: TComponent);
var
Icon : TIcon;
begin
inherited;
fResultList := TQueryResultList.Create;
icon := TIcon.Create;
try
Icon.Handle := LoadIcon(hInstance, 'ActiveIcon');
PostMessage(Self.Handle, WM_SETICON, ICON_SMALL, icon.Handle);
finally
Icon.free;
end;
end;
procedure TfrmResult.SetResult(const aData: String);
var
SuperObj : ISuperObject;
DetailObj : ISuperObject;
aRecResult : TRecQueryResult;
aAESKey : String;
i : Integer;
pDetailItem : PRecResultDetail;
JSONArrIter : TSuperObjectIter;
begin
fResultList.Clear;
ListBox1.Items.Clear;
SuperObj := SO(aData);
aAESKey := g_FacilityID + 'scn2019x';
with aRecResult do
begin
code := SuperObj['code'].AsString;
data := AES128DecodeString(SuperObj['data'].AsString, aAESKey);
name := AES128DecodeString(SuperObj['name'].AsString, aAESKey);
DetailObj := SO(data);
for i:=0 to DetailObj.AsArray.Length-1 do
begin
if ObjectFindFirst(DetailObj.AsArray.O[i], JSONArrIter) then
repeat
New(pDetailItem);
with pDetailItem^ do
begin
Key := JSONArrIter.key;
Value := JSONArrIter.val.AsString;
end;
fResultList.Add(pDetailItem);
ListBox1.Items.Add('');
until not ObjectFindNext(JSONArrIter);
ObjectFindClose(JSONArrIter);
end;
Self.Caption := name;
end;
end;
procedure TfrmResult.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key = #27 then
ModalResult := mrOK;
end;
destructor TfrmResult.Destroy;
begin
FreeAndNil(fResultList);
inherited;
end;
procedure TfrmResult.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
KeyStr, ValueStr : String;
begin
if Index < 0 then exit;
if Index > fResultList.Count-1 then exit;
KeyStr := PRecResultDetail(fResultList.Items[Index])^.Key;
ValueStr := PRecResultDetail(fResultList.Items[Index])^.Value;
with TListbox(Control).Canvas do
begin
if odSelected in State then
begin
Brush.Color := $00238AFF;
Pen.Color := $00238AFF;
end
else begin
Brush.Color := clWhite;
Pen.Color := clWhite;
end;
FillRect(Rect);
Rectangle(Rect);
Font.Style := [fsBold];
Pen.Color := clBlack;
Pen.Width := 1;
DrawTextEx(Handle, PChar(KeyStr), Length(KeyStr), Rect, DT_VCENTER or DT_SINGLELINE or DT_LEFT, nil);
DrawTextEx(Handle, PChar(ValueStr), Length(ValueStr), Rect, DT_VCENTER or DT_SINGLELINE or DT_RIGHT, nil);
end;
end;
end.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment