RFID API Documentation  1.0
Reference guide for RFID API
Initialization

Functions

RFID_STATUS WINAPI RFID_ConnectW (RFID_HANDLE32 *pReaderHandle, WCHAR *pHostName, UINT32 port, UINT32 timeoutMilliseconds, LPCONNECTION_INFO lpConnectionInfo)
 This function establishes an LLRP connection to an RFID reader and returns a handle on successful connection. More...
 
RFID_STATUS WINAPI RFID_ConnectA (RFID_HANDLE32 *pReaderHandle, CHAR *pHostName, UINT32 port, UINT32 timeoutMilliseconds, LPCONNECTION_INFO lpConnectionInfo)
 
RFID_STATUS WINAPI RFID_Reconnect (RFID_HANDLE32 readerHandle)
 This function reconnects to the reader if a previous connection had been lost. More...
 
RFID_STATUS WINAPI RFID_AcceptConnection (RFID_HANDLE32 *pReaderHandle, SOCKET_HANDLE readerSocket, LPSERVER_INFO lpServerInfo, LPVOID rsvd)
 This function accepts an LLRP connection from an RFID reader running in server mode and returns a handle. More...
 

Detailed Description

Function Documentation

◆ RFID_ConnectW()

RFID_STATUS WINAPI RFID_ConnectW ( RFID_HANDLE32 pReaderHandle,
WCHAR pHostName,
UINT32  port,
UINT32  timeoutMilliseconds,
LPCONNECTION_INFO  lpConnectionInfo 
)

This function establishes an LLRP connection to an RFID reader and returns a handle on successful connection.

Parameters
[in]pReaderHandle
Pointer to Handle to the RFID device.
[in]pHostName
String containing the reader's host name. Can be NULL for device-based readers like MC, where the Dll connects to local-host.
[in]port
Port number, if specified as zero (0), the default port 5084 will be used.
[in]timeoutMilliseconds
Time out for the response from the Reader, if specified zero(0), the default time out 5000 (5sec) will be used. The lowest possible value could be 2sec. This value also translates to keep-alive timeout. If the connection to the reader was inactive (no keep-alive message from the Reader) for a time greater than 10 times the timeout, DISCONNECTION_EVENT will be triggered to the application, if the application has registered for the same.
[in]lpConnectionInfo
Information regarding the connection with the reader.
Returns
If the function succeeds, the return value is RFID_API_SUCCESS. If the function fails, the return value is one of the following:
  • RFID_COMM_OPEN_ERROR Unable to open connection with reader
  • RFID_COMM_CONNECTION_ALREADY_EXISTS Another Connection exists
  • RFID_COMM_RESOLVE_ERROR Unable to resolve IP or Host Name
Remarks
None
See also
RFID_Disconnect
Remarks
Example:
RFID_HANDLE32 readerHandle;
READER_ID readerId;
VERSION_INFO versionInfo;
if(RFID_API_SUCCESS == RFID_Connect(&readerHandle, TEXT("157.235.207.190"), 0, 0, 0))
{
// Set trace level
rfidStatus = RFID_SetTraceLevel(readerHandle, TRACE_LEVEL_ALL);
// Get DLL Version
RFID_GetDllVersionInfo(&versionInfo);
printf("\n Dll Verison: %S", versionInfo.dllVersion);
// Do something - Configurations, Capabilities, Inventory, Access
rfidStatus = RFID_Disconnect(readerHandle);
}

◆ RFID_ConnectA()

RFID_STATUS WINAPI RFID_ConnectA ( RFID_HANDLE32 pReaderHandle,
CHAR pHostName,
UINT32  port,
UINT32  timeoutMilliseconds,
LPCONNECTION_INFO  lpConnectionInfo 
)

◆ RFID_Reconnect()

RFID_STATUS WINAPI RFID_Reconnect ( RFID_HANDLE32  readerHandle)

This function reconnects to the reader if a previous connection had been lost.

Parameters
[in]readerHandleHandle to the RFID device.
Returns
If the function succeeds, the return value is RFID_API_SUCCESS. If the function fails, the return value is one of the following:
  • RFID_COMM_OPEN_ERROR Unable to open connection with reader
  • RFID_COMM_CONNECTION_ALREADY_EXISTS Another Connection exists
  • RFID_COMM_RESOLVE_ERROR Unable to resolve IP or Host Name
  • RFID_RECONNECT_FAILED Unable to Reconnect to reader. The Reader state might have changed. Attempt Connect API instead of Reconnect API.
Remarks
None
See also
RFID_Disconnect
Remarks
None.

◆ RFID_AcceptConnection()

RFID_STATUS WINAPI RFID_AcceptConnection ( RFID_HANDLE32 pReaderHandle,
SOCKET_HANDLE  readerSocket,
LPSERVER_INFO  lpServerInfo,
LPVOID  rsvd 
)

This function accepts an LLRP connection from an RFID reader running in server mode and returns a handle.

Parameters
[out]pReaderHandle
Pointer to Handle to the RFID device.
[in]readerSocket
Socket Handle to the reader initiated connection
[in]lpServerInfo
Pointer to ServerInfo parameters(timeout and version info)
[in]rsvd
Reserved for future use
Returns
If the function succeeds, the return value is RFID_API_SUCCESS If the function fails, the return value is RFID_INVALID_SOCKET an unconnected socket handle is passed RFID_API_PARAM_OUT_OF_RANGE timeout passed is less than 2 seconds(However, zero corresponds to a valid timeout- default LLRP timeout) RFID_API_PARAM_ERROR the version info passed is RFID_VERSION_5_0;
Remarks
This API accepts the socket handle of the reader connection and returns a readerhandle for this connection whose disconnection and command timeouts are configured from the timeout parameter of the serverInfo structure
See also
RFID_Connect, RFID_Disconnect, RFID_Reconnect
Remarks
Example:
RFID_HANDLE32 readerHandle;
SERVER_INFO serverInfo;
serverInfo.timeoutMilliseconds = 2000;
serverInfo.version = RFID_API3_5_1;
READER_CAPS readerCaps;
SOCKET listeningSocket, acceptedSocket;
// Initialize Winsock.
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
// Create a SOCKET for listening for incoming connection requests.
listeningSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listeningSocket == INVALID_SOCKET)
{
WSACleanup();
return;
}
sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(5084);
if (bind(listeningSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR)
{
closesocket(listeningSocket);
return ;
}
// Connect from a reader to the local IP address at the same LLRP port.The Socket Connection is accepted here and
// passed to RFID_AcceptConnection to get the ReaderHandle
//
if (listen(listeningSocket, 2) == SOCKET_ERROR)
return;
acceptedSocket = accept(listeningSocket, NULL, NULL);
if(RFID_API_SUCCESS == RFID_AcceptConnection(&readerHandle, acceptedSocket, &serverInfo, NULL))
{
// Set trace level
rfidStatus = RFID_SetTraceLevel(readerHandle, TRACE_LEVEL_ALL);
// Do something - Configurations, Capabilities, Inventory, Access
rfidStatus = RFID_GetReaderCaps(readerHandle, &readerCaps);
printf(" The model name of connected reader is %S", readerCaps.modelName);
rfidStatus = RFID_Disconnect(readerHandle);
}
RFID_GetReaderCaps
#define RFID_GetReaderCaps
Definition: rfidapi.h:88
VERSION_INFOW::dllVersion
WCHAR dllVersion[MAX_PATH]
Specifies the version of RFIDAPI3 C Dll.
Definition: rfidapiStructs.h:1758
RFID_API3_5_1
@ RFID_API3_5_1
RFID API3 - Dll version 5.1.xx.
Definition: rfidapiConstants.h:33
READER_CAPSW
Provides information on Reader Capabilities as reported by the Reader.
Definition: rfidapiStructs.h:531
SERVER_INFO
This struct holds the timeout and version information related to the connection accepted.
Definition: rfidapiStructs.h:65
RFID_GetDllVersionInfo
#define RFID_GetDllVersionInfo
Definition: rfidapi.h:74
RFID_Disconnect
RFID_STATUS WINAPI RFID_Disconnect(RFID_HANDLE32 readerHandle)
This function closes connection to the Reader.
Definition: rfidapi.cpp:1061
TRACE_LEVEL_ALL
@ TRACE_LEVEL_ALL
Enable all traces.
Definition: rfidapiConstants.h:637
SERVER_INFO::version
RFID_VERSION version
< Timeout in milliseconds.
Definition: rfidapiStructs.h:67
RFID_HANDLE32
void * RFID_HANDLE32
Definition: rfidapiTypes.h:76
SERVER_INFO::timeoutMilliseconds
UINT32 timeoutMilliseconds
Definition: rfidapiStructs.h:66
RFID_API_SUCCESS
@ RFID_API_SUCCESS
Definition: rfidapiErrors.h:27
RFID_AcceptConnection
RFID_STATUS WINAPI RFID_AcceptConnection(RFID_HANDLE32 *pReaderHandle, SOCKET_HANDLE readerSocket, LPSERVER_INFO lpServerInfo, LPVOID rsvd)
This function accepts an LLRP connection from an RFID reader running in server mode and returns a han...
Definition: rfidapi.cpp:913
VERSION_INFOW
This struct contains RFID Version Info.
Definition: rfidapiStructs.h:1757
RFID_Connect
#define RFID_Connect
Definition: rfidapi.h:51
RFID_STATUS
RFID_STATUS
Definition: rfidapiErrors.h:26
RFID_SetTraceLevel
RFID_STATUS WINAPI RFID_SetTraceLevel(RFID_HANDLE32 readerHandle, UINT32 traceLevel)
This function sets the trace level for debugging purpose.
Definition: rfidapi.cpp:13338
READER_CAPSW::modelName
WCHAR modelName[MAX_PATH]
Reader Model.
Definition: rfidapiStructs.h:539
READER_IDW
Reader ID as supported by the reader either MAC for EPC Format.Unicode Version It is a member of READ...
Definition: rfidapiStructs.h:444