当前位置: 首页 > java >正文

酒店智能门锁SDK新V门锁系统接口函数[2025版]Delphi 7.0——东方仙盟硬件接口库

东方仙盟硬件接口库

:硬件接口开放,商家可自由接入多样资源,如丰富打印模板库。无需自研复杂硬件对接,降低开发成本与难度,上手业务更轻松,提升运营效率与便利性

接口图片

关键函数

unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, ComCtrls,StrUtils, Buttons, ExtCtrls, DateUtils;typeTForm1 = class(TForm)GroupBox1: TGroupBox;Button1: TButton;GroupBox2: TGroupBox;Label13: TLabel;Label16: TLabel;edt_LockNo: TEdit;edt_Dai: TEdit;Label5: TLabel;Label9: TLabel;DateTimePicker1: TDateTimePicker;DateTimePicker2: TDateTimePicker;GroupBox3: TGroupBox;Label2: TLabel;Label3: TLabel;Label20: TLabel;Label10: TLabel;edt_coID: TEdit;Button3: TButton;Label8: TLabel;Label7: TLabel;GroupBox4: TGroupBox;BitBtn1: TBitBtn;BitBtn3: TBitBtn;BitBtn2: TBitBtn;BitBtn5: TBitBtn;BitBtn6: TBitBtn;edt_CardData: TEdit;Label17: TLabel;Label1: TLabel;cmdExit: TBitBtn;BitBtn7: TBitBtn;BitBtn8: TBitBtn;BitBtn9: TBitBtn;Label6: TLabel;Label14: TLabel;Label4: TLabel;Button2: TButton;procedure cmdExitClick(Sender: TObject);procedure BitBtn6Click(Sender: TObject);procedure Button1Click(Sender: TObject);procedure BitBtn1Click(Sender: TObject);procedure BitBtn5Click(Sender: TObject);procedure FormShow(Sender: TObject);procedure Button3Click(Sender: TObject);procedure BitBtn3Click(Sender: TObject);procedure BitBtn7Click(Sender: TObject);procedure BitBtn8Click(Sender: TObject);procedure BitBtn9Click(Sender: TObject);procedure BitBtn2Click(Sender: TObject);procedure Button2Click(Sender: TObject);private{ Private declarations }function rdCard: Boolean;public{ Public declarations }end;varForm1:        TForm1;st:           Integer;bufCard:      Array[0..128] of char;implementation//读DLL版本号function GetDLLVersion(sDllVer:PChar):Integer; stdcall;external 'proRFL.DLL';//打开USBfunction initializeUSB(fUSB: Byte): Integer; stdcall;external 'proRFL.DLL';//关闭proUSBprocedure CloseUSB(fUSB: Byte); stdcall;external 'proRFL.DLL';//蜂鸣器function Buzzer(fUSB:Byte;t: Integer):Integer; stdcall;external 'proRFL.DLL';//读卡数据function ReadCard(fUSB:Byte;Buffer:PChar):Integer; stdcall;external 'proRFL.DLL';//读取57卡固有的ID号function ReadCardID_T5557(fUSB:Byte;Buffer:PChar):Integer; stdcall;external 'proRFL.DLL';//客人卡//int __stdcall GuestCard(uchar fUSB,int dlsCoID,uchar CardNo,uchar dai,uchar LLock,uchar pdoors,uchar BDate[10],uchar EDate[10],uchar RoomNo[8],uchar *cardHexStr)function GuestCard(fUSB:Byte;dlsCoID:Integer;CardNo,dai,llock,pdoors:Byte;BDate,EDate,RoomNo:Pchar;CardHexStr:PChar):Integer; stdcall;external 'proRFL.DLL';//挂失卡//int __stdcall LimitCard(uchar d12,int dlsCoID,uchar CardNo,uchar dai,uchar BDate[10],uchar LCardNo[4],uchar *cardHexStr)function LimitCard(fUSB:Byte;dlsCoID:Integer;CardNo,dai:Byte;BDate,LCardNo:Pchar;CardHexStr:PChar):Integer; stdcall;external 'proRFL.DLL';//注销卡片//int __stdcall CardErase(uchar fUSB,int dlsCoID,unsigned char *cardHexStr)function CardErase(fUSB:Byte;dlsCoID:Integer;cardHexStr:PChar):Integer; stdcall;external 'proRFL.DLL';//HEX-ASC//__int16 __stdcall hex_a(unsigned char *hex,unsigned char *a,__int16 len)function hex_a(hex,asc:PChar;hLen:Integer):Integer; stdcall;external 'proRFL.DLL';//ASC-HEX//__int16 __stdcall a_hex(unsigned char *a,unsigned char *hex,__int16 len)function a_hex(asc,hex:PChar;aLen:Integer):Integer; stdcall;external 'proRFL.DLL';//读取卡片类型//int __stdcall GetCardTypeByCardDataStr(unsigned char *CardDataStr,unsigned char *CardType)function GetCardTypeByCardDataStr(cardHexStr,CardType:PChar):Integer; stdcall;external 'proRFL.DLL';//读取客人卡锁号//int __stdcall GetGuestLockNoByCardDataStr(int dlsCoID,unsigned char *CardDataStr,unsigned char *LockNo)function GetGuestLockNoByCardDataStr(dlsCoID: Integer;cardHexStr,LockNo:PChar):Integer; stdcall;external 'proRFL.DLL';//读取客人离店时间//int __stdcall GetGuestETimeByCardDataStr(int dlsCoID,unsigned char *CardDataStr,unsigned char *eTime)function GetGuestETimeByCardDataStr(dlsCoID: Integer;cardHexStr,eTime:PChar):Integer; stdcall;external 'proRFL.DLL';//读取开门记录//int __stdcall ReadRecord(uchar d12,unsigned char *buffData)function ReadRecord(fUSB:Byte;bufData:PChar):Integer; stdcall;external 'proRFL.DLL';//根据记录仪数据解析开门记录//int __stdcall GetOpenRecordByDataStr(unsigned char *DataStr,unsigned char *sOpen)function GetOpenRecordByDataStr(DataStr,sOpen:PChar):Integer; stdcall;external 'proRFL.DLL';{$R *.dfm}//读卡,有错误提示
//同时返回当前卡的ID(卡类型、卡号、发卡时间)--copy(bufCard,25,8)
function TForm1.rdCard: Boolean;
varst:  Integer;
LabelExit_rdCard;
beginResult:=False;Screen.Cursor:=crHourGlass;st:=ReadCard(1,bufCard);if st<>0 then beginif st=1 thenApplication.MessageBox(PCHAR('请放一张卡在发卡器上面,'+#10+'确保 门锁软件 可以正常发卡,然后调试接口'+#10+bufCard),'读卡失败(返回值=1)',MB_OK+MB_ICONERROR)elseApplication.MessageBox(PCHAR('读卡失败'+#10+IntToStr(st)),'提示',MB_OK+MB_ICONERROR);goto Exit_rdCard;end;if copy(bufCard,5,2)<>'01' then beginApplication.MessageBox(PCHAR('发卡器的感应区无卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);goto Exit_rdCard;end;Result:=True;
Exit_rdCard:Screen.Cursor:=crDefault;
end;procedure TForm1.FormShow(Sender: TObject);
beginDateTimePicker1.DateTime:=Now+1;
end;procedure TForm1.cmdExitClick(Sender: TObject);
beginClose;
end;//读DLL版本号
procedure TForm1.BitBtn6Click(Sender: TObject);
varst:     Integer;sa1:    Array[0..256] of char;
beginst:=GetDLLVersion(sa1);if st=0 thenApplication.MessageBox(Pchar('DLL版本号:'+StrPas(sa1)),'提示',MB_OK+MB_ICONINFORMATION);
end;//打开USB
procedure TForm1.Button1Click(Sender: TObject);
varst:   Integer;
beginst:=initializeUSB(1);if st<>0 thenApplication.MessageBox(Pchar('打开USB失败'+#10+IntToStr(st)),'提示',MB_OK+MB_ICONWARNING)else beginApplication.MessageBox('打开USB成功','提示',MB_OK+MB_ICONINFORMATION);Button3.Enabled:=True;GroupBox4.Enabled:=True;end;
end;//蜂鸣器
procedure TForm1.BitBtn1Click(Sender: TObject);
beginBuzzer(1,50);   //发卡器鸣叫50x10毫秒
end;//注销卡片
procedure TForm1.BitBtn5Click(Sender: TObject);
varst:     Integer;sa1:    Array[0..256] of char;
beginif not rdCard then Exit;   //先读卡Screen.Cursor:=crHourGlass;st:=CardErase(1,StrToIntDef(edt_coID.Text,0),sa1);edt_CardData.Text:=StrPas(sa1);Screen.Cursor:=crDefault;if st<>0 thenApplication.MessageBox(Pchar('注销失败'+#10+IntToStr(st)),'提示',MB_OK+MB_ICONWARNING)else beginApplication.MessageBox('注销成功','提示',MB_OK+MB_ICONINFORMATION);end;
end;//从现有卡片读取酒店标识
procedure TForm1.Button3Click(Sender: TObject);
vari:   Integer;s:   String;
beginif not rdCard then Exit;   //先读卡edt_CardData.Text:=StrPas(bufCard);if copy(bufCard,25,8)='FFFFFFFF' then beginedt_coID.Text:='';Application.MessageBox('此卡是空白卡,请换一张能开门的卡','提示',MB_OK+MB_ICONWARNING);Exit;end;s:=copy(bufCard,11,4);i:=StrToInt('$'+s) mod 16384;s:=copy(bufCard,9,2);i:=i+(StrToInt('$'+s) * 65536);edt_coID.Text:=IntToStr(i);
end;//读卡
procedure TForm1.BitBtn3Click(Sender: TObject);
beginif not rdCard then Exit;   //读卡edt_CardData.Text:=StrPas(bufCard);if (copy(bufCard,77,4)='0400')OR (copy(bufCard,77,4)='0200') thenApplication.MessageBox(Pchar('发卡流水号:'+copy(bufCard,25,8)+#10+'M1卡的固有ID号:'+copy(bufCard,77,12)+#10+'白色框是完整卡数据'),'提示',MB_OK+MB_ICONINFORMATION)elseApplication.MessageBox(Pchar('发卡流水号:'+copy(bufCard,25,8)+#10+'白色框是完整卡数据'),'提示',MB_OK+MB_ICONINFORMATION);
end;procedure TForm1.BitBtn7Click(Sender: TObject);
varCardType:      Array[0..32] of char;
beginif not rdCard then Exit;   //先读卡edt_CardData.Text:=StrPas(bufCard);st:=GetCardTypeByCardDataStr(pChar(edt_CardData.Text),CardType);if st<>0 thenApplication.MessageBox(Pchar(('卡数据串无效:'+IntToStr(st))),'提示',MB_OK+MB_ICONWARNING)elseif CardType[0]='0' thenApplication.MessageBox('授权卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='1' thenApplication.MessageBox('记录卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='2' thenApplication.MessageBox('房号设置卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='3' thenApplication.MessageBox('时间设置卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='4' thenApplication.MessageBox('限制卡[挂失卡]','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='5' thenApplication.MessageBox('组号设置卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='6' thenApplication.MessageBox('客人卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='7' thenApplication.MessageBox('退房卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='8' thenApplication.MessageBox('组控卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='9' thenApplication.MessageBox('未知卡[无此类型]','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='A' thenApplication.MessageBox('应急卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='B' thenApplication.MessageBox('总控卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='C' thenApplication.MessageBox('楼栋卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='D' thenApplication.MessageBox('楼层卡','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='E' thenApplication.MessageBox('未知卡[无此类型]','提示',MB_OK+MB_ICONINFORMATION)else if CardType[0]='F' thenApplication.MessageBox('空白卡','提示',MB_OK+MB_ICONINFORMATION);
end;procedure TForm1.BitBtn8Click(Sender: TObject);
varLockNo:      Array[0..32] of char;
beginif not rdCard then Exit;   //先读卡edt_CardData.Text:=StrPas(bufCard);st:=GetGuestLockNoByCardDataStr(StrToIntDef(edt_coID.Text,0),pChar(edt_CardData.Text),LockNo);if st=0 thenApplication.MessageBox(PChar('锁号:'+#10+LockNo),'提示',MB_OK+MB_ICONINFORMATION)else if st=1 thenApplication.MessageBox(PChar('卡数据串无效'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=2 thenApplication.MessageBox(Pchar('非本酒店卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=3 thenApplication.MessageBox(Pchar('不是客人卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)elseApplication.MessageBox(Pchar('未知返回值'+#10+IntToStr(st)+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);
end;procedure TForm1.BitBtn9Click(Sender: TObject);
varETime:      Array[0..32] of char;
beginif not rdCard then Exit;   //先读卡edt_CardData.Text:=StrPas(bufCard);if copy(bufCard,25,1)<>'6' then beginApplication.MessageBox(Pchar('不是客人卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);Exit;end;st:=GetGuestETimeByCardDataStr(StrToIntDef(edt_coID.Text,0),pChar(edt_CardData.Text),ETime);if st=0 thenApplication.MessageBox(PChar('离店时间:'+#10+ETime+#10+copy(ETime,1,2)+'年'+copy(ETime,3,2)+'月'+copy(ETime,5,2)+'日  '+copy(ETime,7,2)+':'+copy(ETime,9,2)),'提示',MB_OK+MB_ICONINFORMATION)else if st=1 thenApplication.MessageBox(PChar('卡数据串无效'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=2 thenApplication.MessageBox(Pchar('非本酒店卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=3 thenApplication.MessageBox(Pchar('不是客人卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)elseApplication.MessageBox(Pchar('未知返回值'+#10+IntToStr(st)+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);
end;procedure TForm1.BitBtn2Click(Sender: TObject);
varst:            Integer;llock:         Byte;sa1:           Array[0..256] of char;
beginif not rdCard then Exit;   //先读卡//退房时间DateTimePicker1.Time:=DateTimePicker2.Time;Screen.Cursor:=crHourGlass;st:=GuestCard(1,StrToIntDef(edt_coID.Text,0),    //酒店标识0,StrToIntDef(edt_Dai.Text,0) mod 256,     //DAI0,0,PCHAR(FormatDateTime('YYMMDDHHMM',Now())),   //发卡时间PCHAR(FormatDateTime('YYMMDDHHMM',DateTimePicker1.DateTime)),  //退房时间PCHAR(edt_LockNo.Text),      //锁号sa1);                        //返回 卡数据edt_CardData.Text:=StrPas(sa1);Screen.Cursor:=crDefault;if st<>0 thenApplication.MessageBox(Pchar('调用发卡函数失败'+#10+IntToStr(st)),'提示',MB_OK+MB_ICONWARNING)else beginApplication.MessageBox('制卡后,请调用读卡函数,数据一致才是真正的制卡成功!','调用发卡函数成功',MB_OK+MB_ICONINFORMATION);end;
end;procedure TForm1.Button2Click(Sender: TObject);
varETime:      Array[0..32] of char;sss:        String;
beginif not rdCard then Exit;   //先读卡edt_CardData.Text:=StrPas(bufCard);if copy(bufCard,25,1)<>'6' then beginApplication.MessageBox(Pchar('不是客人卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);Exit;end;sss:=copy(edt_CardData.Text,1,32)+copy(edt_CardData.Text,27,6);  //把发卡时间 放到 退房时间st:=GetGuestETimeByCardDataStr(StrToIntDef(edt_coID.Text,0),pChar(sss),ETime);if st=0 thenApplication.MessageBox(PChar('发卡时间:'+#10+ETime+#10+copy(ETime,1,2)+'年'+copy(ETime,3,2)+'月'+copy(ETime,5,2)+'日  '+copy(ETime,7,2)+':'+copy(ETime,9,2)),'提示',MB_OK+MB_ICONINFORMATION)else if st=1 thenApplication.MessageBox(PChar('卡数据串无效'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=2 thenApplication.MessageBox(Pchar('非本酒店卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)else if st=3 thenApplication.MessageBox(Pchar('不是客人卡'+#10+bufCard),'提示',MB_OK+MB_ICONWARNING)elseApplication.MessageBox(Pchar('未知返回值'+#10+IntToStr(st)+#10+bufCard),'提示',MB_OK+MB_ICONWARNING);
end;end.

阿雪技术观

在科技发展浪潮中,我们不妨积极投身技术共享。不满足于做受益者,更要主动担当贡献者。无论是分享代码、撰写技术博客,还是参与开源项目维护改进,每一个微小举动都可能蕴含推动技术进步的巨大能量。东方仙盟是汇聚力量的天地,我们携手在此探索硅基生命,为科技进步添砖加瓦。

Hey folks, in this wild tech - driven world, why not dive headfirst into the whole tech - sharing scene? Don't just be the one reaping all the benefits; step up and be a contributor too. Whether you're tossing out your code snippets, hammering out some tech blogs, or getting your hands dirty with maintaining and sprucing up open - source projects, every little thing you do might just end up being a massive force that pushes tech forward. And guess what? The Eastern FairyAlliance is this awesome place where we all come together. We're gonna team up and explore the whole silicon - based life thing, and in the process, we'll be fueling the growth of technology.

http://www.xdnf.cn/news/16395.html

相关文章:

  • 学习游戏制作记录(剑投掷技能)7.26
  • 中文语音识别与偏误检测系统开发
  • Java基础-文件操作
  • Spring boot Grafana优秀的监控模板
  • 生猪产业新生态:结构调整与种养结合,筑牢农业强国根基
  • HashMap(JDK1.7、JDK1.8)原理与结构分析与synchronizedMap()
  • 【LeetCode刷题指南】--队列实现栈,栈实现队列
  • C 语言详解:特性、应用与发展
  • GRE和MGRE综合实验
  • DMDSC安装部署教程
  • 基于cooragent的旅游多智能体的MCP组件安装与其开发
  • Android Jetpack 组件库 ->Jetpack Navigation (下)
  • 从治理到共情——平台伦理的乡村共建之路
  • 在 C# 中,问号 ? 的一些作用
  • HTML初学者第五天
  • 启动式service
  • 强化学习(第三课第三周)
  • 在 Scintilla 中为 Squirrel 语言设置语法解析器的方法
  • Kubernetes 配置管理
  • odoo代码分析(一)
  • 认识泛型、泛型类和泛型接口
  • 大语言模型 LLM 通过 Excel 知识库 增强日志分析,根因分析能力的技术方案(2):LangChain + LlamaIndex 实现
  • Java学习第七十七部分——JVM运行时数据区
  • Java同步锁性能优化:15个高效实践与深度解析
  • 7月26号打卡
  • C++/CLI与标准C++的语法差异(一)
  • ASP.NET Core MVC中taghelper的ModelExpression详解
  • Spring Boot 3 如何整合 MinIO 实现分布式文件存储?
  • MyBatis-Plus 通用 Service 详解:IService 与 CRUD 操作全解析
  • PYTHON从入门到实践-15数据可视化