123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- $PBExportHeader$uo_fingerprint.sru
- forward
- global type uo_fingerprint from nonvisualobject
- end type
- end forward
- global type uo_fingerprint from nonvisualobject autoinstantiate
- end type
- type prototypes
- FUNCTION long InitializeFg() LIBRARY "AdvFgSdk1.dll"
- FUNCTION long UnInitializeFg() LIBRARY "AdvFgSdk1.dll"
- FUNCTION long OpenDevice( BLOB pbuf,int size ) LIBRARY "AdvFgSdk1.dll"
- function long BeginReadDevice(boolean bvfy) library "advfgsdk1.dll"
- function long ReadDevice(boolean bvfy) library "advfgsdk1.dll"
- function long EndReadDevice(boolean bVfy, REF BLOB pDib,int dibSize ) library "advfgsdk1.dll"
- // 不需要回传DIB 图像数据 可用 EndRead 代替 EndReadDevice
- function long EndRead(boolean bvfy ) library "advfgsdk1.dll"
- function long EnrollFingerPrintEx( ref BLOB pbuf ,int size) library "advfgsdk1.dll"
- function long VerifyFingerPrintEx( BLOB pbuf ,int size) library "advfgsdk1.dll"
- //测试
- function long EndTest(ref BLOB buf ) library "advfgsdk1.dll"
- // 检测设备
- Function long CheckDevice () library "AdvFgSdk1.dll"
- Function long AbortReadDevice() library "AdvFgSdk1.dll"
- Function long RemoteVerify(ref Blob pbuf, ref Blob pvfy, int size) library "AdvFgSdk1.dll"
- Function long CopyvfyBuf(ref Blob pbuf, int size) library "AdvFgSdk1.dll"
- end prototypes
- type variables
- private boolean ib_abort = false
- protectedwrite boolean ib_reading = false
- end variables
- forward prototypes
- public function integer uf_regfingerprint (ref blob arg_buf, ref string arg_msg)
- public function integer uf_verifyfingerprint (blob arg_ident, ref string arg_msg)
- public function integer uf_remoteverify (blob arg_idents, blob arg_finger, ref string arg_msg)
- public subroutine uf_abort ()
- end prototypes
- public function integer uf_regfingerprint (ref blob arg_buf, ref string arg_msg);//////////////////////////////////////////////////
- // 读指纹三次,获取指纹特征blob{521} arg_buf
- // 读取指纹时,不阻塞其它消息
- ib_reading = true
- int rslt = 1
- Blob{64} pt ;
- // KEY 验证 数据
- BlobEdit(pt,1, (8))
- BlobEdit(pt,2, (4))
- BlobEdit(pt,3, (55))
- BlobEdit(pt,4, (27))
- BlobEdit(pt,5, (2))
- BlobEdit(pt,6, (9))
- BlobEdit(pt,7, (33))
- BlobEdit(pt,8, (61))
- BlobEdit(pt,9, (29))
- BlobEdit(pt,10, (50))
- BlobEdit(pt,11, (49))
- BlobEdit(pt,12, (34))
- BlobEdit(pt,13, (29))
- BlobEdit(pt,14, (32))
- BlobEdit(pt,15, (33))
- BlobEdit(pt,16, (30))
- BlobEdit(pt,17, (24))
- BlobEdit(pt,18, (14))
- BlobEdit(pt,19, (168))
- BlobEdit(pt,20, (83))
- BlobEdit(pt,21, (7))
- BlobEdit(pt,22, (27))
- BlobEdit(pt,23, (101))
- BlobEdit(pt,24, (184))
- BlobEdit(pt,25, (90))
- BlobEdit(pt,26, (152))
- BlobEdit(pt,27, (150))
- BlobEdit(pt,28, (103))
- BlobEdit(pt,29, (87))
- BlobEdit(pt,30, (98))
- BlobEdit(pt,31, (100))
- BlobEdit(pt,32, (93))
- if InitializeFg() <> 1 then
- rslt = 0
- arg_msg = '指纹API初始化失败'
- goto ext
- end if
- if CheckDevice() <> 1 then
- rslt = 0
- arg_msg = "指纹设备没有连接正确"
- goto ext
- end if
- if OpenDevice( pt ,32) <> 1 then
- rslt = 0
- arg_msg = '打开指纹设备失败'
- goto ext
- end if
- if BeginReadDevice(FALSE) <> 1 then
- rslt = 0
- arg_msg = '开始读指纹失败'
- goto ext
- end if
- long count = 3
- do
- Int bw = 1
- do
- bw = ReadDevice(FALSE)
- if ib_abort then
- rslt = 0
- arg_msg = '用户中断'
- goto ext
- end if
- loop while (bw <= 0)
- if EndRead(FALSE) = 1 then
- count = count - 1
- end if
- loop while (count > 0)
- blob{512} lb_buf
- long ret
- ret = EnrollFingerPrintEx(REF lb_buf,512 )
- if ret <> 1 then
- rslt = 0
- arg_msg = '获取指纹信息失败' + ',请重试!错误码:' + string(ret)
- goto ext
- end if
-
- arg_buf = lb_buf
- ext:
- UnInitializeFg()
- ib_abort = false
- ib_reading = false
- return rslt
- end function
- public function integer uf_verifyfingerprint (blob arg_ident, ref string arg_msg);////////////////////////////////////////////
- // 读取指纹,与指纹特征(arg_ident)比较
- //
- ib_reading = true
- int rslt = 1
- Blob{64} pt ;
- // KEY 验证 数据
- BlobEdit(pt,1, (8))
- BlobEdit(pt,2, (4))
- BlobEdit(pt,3, (55))
- BlobEdit(pt,4, (27))
- BlobEdit(pt,5, (2))
- BlobEdit(pt,6, (9))
- BlobEdit(pt,7, (33))
- BlobEdit(pt,8, (61))
- BlobEdit(pt,9, (29))
- BlobEdit(pt,10, (50))
- BlobEdit(pt,11, (49))
- BlobEdit(pt,12, (34))
- BlobEdit(pt,13, (29))
- BlobEdit(pt,14, (32))
- BlobEdit(pt,15, (33))
- BlobEdit(pt,16, (30))
- BlobEdit(pt,17, (24))
- BlobEdit(pt,18, (14))
- BlobEdit(pt,19, (168))
- BlobEdit(pt,20, (83))
- BlobEdit(pt,21, (7))
- BlobEdit(pt,22, (27))
- BlobEdit(pt,23, (101))
- BlobEdit(pt,24, (184))
- BlobEdit(pt,25, (90))
- BlobEdit(pt,26, (152))
- BlobEdit(pt,27, (150))
- BlobEdit(pt,28, (103))
- BlobEdit(pt,29, (87))
- BlobEdit(pt,30, (98))
- BlobEdit(pt,31, (100))
- BlobEdit(pt,32, (93))
- if InitializeFg() <> 1 then
- rslt = 0
- arg_msg = '指纹API初始化失败'
- goto ext
- end if
- if CheckDevice() <> 1 then
- rslt = 0
- arg_msg = "指纹设备没有连接正确"
- goto ext
- end if
- if OpenDevice( pt ,32) <> 1 then
- rslt = 0
- arg_msg = '打开指纹设备失败'
- goto ext
- end if
- if BeginReadDevice(TRUE) <> 1 then
- rslt = 0
- arg_msg = '开始读指纹失败'
- goto ext
- end if
- Int bw = 1
- do
- bw = ReadDevice(TRUE)
- if ib_abort then
- rslt = 0
- arg_msg = '用户中断'
- goto ext
- end if
- loop while (bw <= 0)
- if EndRead(TRUE) <> 1 then
- rslt = 0
- arg_msg = '读取指纹失败'
- goto ext
- end if
- long ret
- ret = VerifyFingerPrintEx(REF arg_ident,len(arg_ident))
- if ret <= 0 then
- rslt = 0
- arg_msg = '验证失败' + ',请重试!错误码:' + string(ret)
- goto ext
- end if
-
- ext:
- UnInitializeFg()
- ib_abort = false
- ib_reading = false
- return rslt
- end function
- public function integer uf_remoteverify (blob arg_idents, blob arg_finger, ref string arg_msg);int rslt = 1
- Blob{64} pt ;
- // KEY 验证 数据
- BlobEdit(pt,1, (8))
- BlobEdit(pt,2, (4))
- BlobEdit(pt,3, (55))
- BlobEdit(pt,4, (27))
- BlobEdit(pt,5, (2))
- BlobEdit(pt,6, (9))
- BlobEdit(pt,7, (33))
- BlobEdit(pt,8, (61))
- BlobEdit(pt,9, (29))
- BlobEdit(pt,10, (50))
- BlobEdit(pt,11, (49))
- BlobEdit(pt,12, (34))
- BlobEdit(pt,13, (29))
- BlobEdit(pt,14, (32))
- BlobEdit(pt,15, (33))
- BlobEdit(pt,16, (30))
- BlobEdit(pt,17, (24))
- BlobEdit(pt,18, (14))
- BlobEdit(pt,19, (168))
- BlobEdit(pt,20, (83))
- BlobEdit(pt,21, (7))
- BlobEdit(pt,22, (27))
- BlobEdit(pt,23, (101))
- BlobEdit(pt,24, (184))
- BlobEdit(pt,25, (90))
- BlobEdit(pt,26, (152))
- BlobEdit(pt,27, (150))
- BlobEdit(pt,28, (103))
- BlobEdit(pt,29, (87))
- BlobEdit(pt,30, (98))
- BlobEdit(pt,31, (100))
- BlobEdit(pt,32, (93))
- if InitializeFg() <> 1 then
- rslt = 0
- arg_msg = '指纹API初始化失败'
- goto ext
- end if
- long ret
- ret = RemoteVerify(REF arg_idents, ref arg_finger, len(arg_idents))
- if ret <= 0 then
- rslt = 0
- arg_msg = '验证失败' + ',请重试!错误码:' + string(ret)
- goto ext
- end if
-
- ext:
- UnInitializeFg()
- return rslt
- end function
- public subroutine uf_abort ();if ib_reading then
- AbortReadDevice()
- ib_abort = true
- end if
- end subroutine
- on uo_fingerprint.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_fingerprint.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|