ADEL Lock System Interface Function (SDK) Manual
ADEL Lock System Interface Function (SDK) Manual
2. EndSession
Function prototype:
int EndSession(void);
Parameter: None
Return value: Refer to NOTE .
3. NewKey
Erase the current guest card information. The previous guest card cannot be used again after
the new issued guest card unlocks the door. Function prototype:
int NewKey(char *room,char *gate,char *stime,char *guestname,char *guestid, int
overflag, long *cardno,char * track1,char * track2);
Parameter:
room [in]: room number, 6-byte character string, must be set by lock system.
gate [in]: common gate, string parameter, 00 stands for default authorization, 99
stands for authorization for all, and others are specified gate codes, e.g., 010203 stands for
authorization for gate 01, 02, and 03.
Stime [in]: starting and ending time, 24-byte character string. The format is
yyyymmddhhnnyyyymmddhhnn, e.g., 200012311230200101011230 stands for the time period
from 12:30, Dec. 31, 2000 to 12:30, Jan. 1, 2001. Lock9200: starting time and ending time cannot
be in the same day or more than 1 month.
Guestname [in]: guest name, maximum: 30 bytes, can be NULL.
Guestid [in]: guest ID, maximum: 30 bytes, can be NULL.
Overflag [in]: integer, whether to overwrite current card information: 1-to overwrite,
erased automatically if the current card is not a new card (for guest card); 0-not to overwrite, back
if the card is not a new card. For magnetic card (manual encoder), ignore this parameter and
overwrite directly without erasing automatically.
Cardno [out]: long integer pointer, receive card number (the only card code distributed
1
4. DupKey
Both new guest card and old guest card can be used simultaneously, and the starting time is the
same. Function prototype:
int DupKey(char *room,char *gate,char *stime,char *guestname,char *guestid, int
overflag, long *cardno,char * track1,char * track2);
Parameter:
room [in]: room number, 6-byte character string, must be set by lock system.
gate [in]: common gate, string parameter, 00 stands for default authorization, 99
stands for authorization for all, and others are specified gate codes, e.g., 010203 stands for
authorization for gate 01, 02, and 03.
Stime [in]: starting and ending time, 24-byte character string. The format is
yyyymmddhhnnyyyymmddhhnn, e.g., 200012311230200101011230 stands for the time period
from 12:30, Dec. 31, 2000 to 12:30, Jan. 1, 2001. The starting time is the same with the one of
current guest card in use.
Guestname [in]: guest name, maximum: 30 bytes, can be NULL.
Guestid [in]: guest ID, maximum: 30 bytes, can be NULL.
Overfla [in]: integer, whether to overwrite current card information: 1-to overwrite,
erased automatically if the current card is not a new card (for guest card); 0-not to overwrite, back
if the card is not a new card. For magnetic card (manual encoder), ignore this parameter and
overwrite directly without erasing automatically.
Cardno [out]: long integer pointer, receive card number (the only card code distributed
after issuing the card), can be NULL.
track1 [in]: character string pointer, track 1 data of magnetic card, can be NULL if its
not written.
track2 [in]: character string pointer, track 2 data of magnetic card, can be NULL if its
not written.
Return value: Refer to NOTE .
5. ReadCard
Function prototype:
int ReadCard(char *room, char *gate,char *stime, char *guestname, char *guestid, char
*track1, char *track2, long *cardno, int *st);
Parameter:
room [out]: character string pointer, receive returned room number, 10 bytes
recommended.
gate [out]: character string pointer, receive returned authorized common gates, can be
NULL.
Guestname [out]: character string pointer, receive returned guest name, can be NULL.
Guestid [out]: character string pointer, receive returned guest ID, can be NULL.
2
6. EraseCard
Erase card and update database simultaneously. Function prototype:
int EraseCard (long cardno,char * track1,char * track2);
Parameter:
cardno [in]: card number, can be 0. When the parameter is 0: IC card, RF card, TM card,
and magnetic card (automatic encoder) read and erase card number automatically and update
database simultaneously; magnetic card (manual encoder) erases current card information but not
update database. Its recommended to call CheckOut function to update database or call EraseCard
after reading card number.
track1 [in]: character string pointer, track 1 data of magnetic card, must be NULL if its
not written.
track2 [in]: character string pointer, track 2 data of magnetic card, must be NULL if its
not written.
Return value: Refer to NOTE .
7. CheckOut
Update database only without erasing card. Function prototype:
int CheckOut (char *room, long cardno);
Parameter:
room [in]: room number.
Cardno [in]: card number, can be 0. When the parameter is 0, mark all guest cards as
normally erased.
Return value: Refer to NOTE .
8. LostCard
Update database only without erasing card. Function prototype:
int Lostcard (char *room, long cardno);
Parameter:
room [in]: room number.
Cardno [in]: card number, marked as the card number of lost guest card.
Return value: Refer to NOTE .
10. SetPort
Its unnecessary to call this function after calling Init function. Function prototype:
3
14. WriteMagCard
Its highly recommended to store data in track 1 and track 2 and use track 3 for lock system.
4
15. ReadMagCard
Function prototype:
int ReadMagCard(char * track1, char * track2, char * track3);
Parameter:
track1 [out]: character string pointer, receive track 1 data of magnetic card, can be NULL
if its not read.
track2 [out]: character string pointer, receive track 2 data of magnetic card, can be NULL
if its not read.
track3 [out]: character string pointer, receive track 3 data of magnetic card, can be NULL
if its not read.
Return value: Refer to NOTE .
NOTE:
. Function Return Value:
0-Operation succeeds
1-Read and write error/Data error
2-Damaged card
3-No card
4-Serial port error
5-Replaced card
6-Not a new card
7-New card
8-Invalid card
9-Not a guest card
10-Not a member card
11-Wrong password
12-No unlocking records
13-Incorrect card type
14-Parameter error
15-Canceled by pressing ESC
16-Time out
17-Card error
18-Blank card or card error
19-Reserved
20-Please call Init function first
21-The version of the lock system is unavailable
22-Failed to connect to database 23-Lock parameter not exist
24-Failed to initialize
25-No guest/Specified guest not exist
26-Guest room full
27-No records of the card
28-Please call SetPort function first 29-Invalid room number
30-Incorrect time range
31-Failed to register the existing card number (Lock9200)
32-Unavailable to call
33-Invalid authorization code
. Lock System Constants:
Lock3200-1
Lock3200K-2
Lock6200-6
Lock7200-7
A30-11
A50-14 A90-18
Lock4200-3
Lock7200D-8
Lock611-19
Lock4200D-4
Lock9200-9
Lock612D-20
Lock5200-5
Lock9200T-10
A92-22
. Operating Environment: 32-bit Windows operating system, and MDAC is required for
lock function.
. Call Mode: follow the Windows API call standard, i.e., stdcall.
. Parameter Description: [in] input parameter, [out] output parameter.