/*
* xxx.c
*
* Created on: 1 Jul 2016
* Author: ROBERT
*/
/*
============================================================================
Name : labviewWrapper.c
Author : Robert Kinchin
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdint.h>
typedef signed INT8S;
typedef unsigned INT8U;
typedef signed INT16S;
typedef unsigned INT16U;
typedef signed INT32S;
typedef unsigned INT32U;
typedef signed INT64S;
typedef unsigned INT64U;
typedef signed BOOL32;
typedef unsigned HANDLE32;
typedef unsigned HANDLE64;
typedef struct {
/* The major version (i.e, in 1.x.x.x, the 1) */
INT32U major;
/* The minor version (i.e., in x.1.x.x, the 1) */
INT32U minor;
/* The maintenance number (i.e., in x.x.1.x, the 1) */
INT32U maintenance;
/* The release number (i.e., in x.x.x.1, the 1) */
INT32U release;
} RFID_VERSION;
typedef struct {
/* The length of the structure in bytes. This will be */
/* sizeof(RFID_RADIO_INFO). */
INT32U length;
/* The version information for the radio's bus driver. */
RFID_VERSION driverVersion;
/* The unique cookie for the radio. This cookie is passed to */
/* RFID_RadioOpen() when the application wishes to take control of the */
/* radio. */
INT32U cookie;
/* The length, in bytes, of the uniqueId field(aka, serial number) */
/* including the null terminator */
INT32U idLength;
/* A pointer to an array of bytes that contain the radio module's unique */
/* ID (aka, serial number). */
INT8U* pUniqueId;
} RFID_RADIO_INFO;
/******************************************************************************
* Name: RFID_RADIO_ENUM - The data that will be returned from a request to
* list the radios that are attached to the system.
******************************************************************************/
typedef struct {
/* The length of the structure in bytes. The application must set this to*/
/* sizeof(RFID_RADIO_ENUM) before calling */
/* RFID_RetrieveAttachedRadiosList(). */
INT32U length;
/* The total length, in bytes, of radio enumeration structure. The */
/* application must fill in this field with the length of the radio */
/* enumeration buffer before calling RFID_RetrieveAttachedRadiosList(). */
/* If the buffer is not large enough, on return this field contains the */
/* required size of the radio-enumeration buffer. If the buffer is large */
/* enough, on return this field contains the number of bytes returned */
INT32U totalLength;
/* The number of radios that are attached to the system. This is also the*/
/* number of radio info structure pointers in the array pointed to by */
/* ppRadioInfo. */
INT32U countRadios;
/* A pointer to an array of RFID_RADIO_INFO structure pointers. The array*/
/* contains countRadios entries. */
RFID_RADIO_INFO** ppRadioInfo;
} RFID_RADIO_ENUM;
enum
{
/* Success */
RFID_STATUS_OK,
/* Attempted to open a radio that is already open */
RFID_ERROR_ALREADY_OPEN = -9999, /* -9999 */
/* Buffer supplied is too small */
RFID_ERROR_BUFFER_TOO_SMALL, /* -9998 */
/* General failure */
RFID_ERROR_FAILURE, /* -9997 */
/* Failed to load radio bus driver */
RFID_ERROR_DRIVER_LOAD, /* -9996 */
/* Library cannot use version of radio bus driver present on system */
RFID_ERROR_DRIVER_MISMATCH, /* -9995 */
/* This error code is no longer used, maintain slot in enum in case */
/* anyone is using hard-coded error codes for some reason */
RFID_ERROR_RESERVED_01, /* -9994 */
/* Antenna number is invalid */
RFID_ERROR_INVALID_ANTENNA, /* -9993 */
/* Radio handle provided is invalid */
RFID_ERROR_INVALID_HANDLE, /* -9992 */
/* One of the parameters to the function is invalid */
RFID_ERROR_INVALID_PARAMETER, /* -9991 */
/* Attempted to open a non-existent radio */
RFID_ERROR_NO_SUCH_RADIO, /* -9990 */
/* Library has not been successfully initialized */
RFID_ERROR_NOT_INITIALIZED, /* -9989 */
/* Function not supported */
RFID_ERROR_NOT_SUPPORTED, /* -9988 */
/* Operation was cancelled by call to cancel operation, close radio, or */
/* shut down the library */
RFID_ERROR_OPERATION_CANCELLED, /* -9987 */
/* Library encountered an error allocating memory */
RFID_ERROR_OUT_OF_MEMORY, /* -9986 */
/* The operation cannot be performed because the radio is currently busy */
RFID_ERROR_RADIO_BUSY, /* -9985 */
/* The underlying radio module encountered an error */
RFID_ERROR_RADIO_FAILURE, /* -9984 */
/* The radio has been detached from the system */
RFID_ERROR_RADIO_NOT_PRESENT, /* -9983 */
/* The RFID library function is not allowed at this time. */
RFID_ERROR_CURRENTLY_NOT_ALLOWED, /* -9982 */
/* The radio module's MAC firmware is not responding to requests. */
RFID_ERROR_RADIO_NOT_RESPONDING, /* -9981 */
/* The MAC firmware encountered an error while initiating the nonvolatile */
/* memory update. The MAC firmware will return to its normal idle state */
/* without resetting the radio module. */
RFID_ERROR_NONVOLATILE_INIT_FAILED, /* -9980 */
/* An attempt was made to write data to an address that is not in the */
/* valid range of radio module nonvolatile memory addresses. */
RFID_ERROR_NONVOLATILE_OUT_OF_BOUNDS, /* -9979 */
/* The MAC firmware encountered an error while trying to write to the */
/* radio module's nonvolatile memory region. */
RFID_ERROR_NONVOLATILE_WRITE_FAILED, /* -9978 */
/* The underlying transport layer detected that there was an overflow */
/* error resulting in one or more bytes of the incoming data being */
/* dropped. The operation was aborted and all data in the pipeline was */
/* flushed. */
RFID_ERROR_RECEIVE_OVERFLOW, /* -9977 */
/* An unexpected value was returned to this function by the MAC firmware */
RFID_ERROR_UNEXPECTED_VALUE, /* -9976 */
/* The MAC firmware encountered CRC errors while trying to */
/* write to the radio module's nonvolatile memory region. */
RFID_ERROR_NONVOLATILE_CRC_FAILED, /* -9975 */
/* The MAC firmware encountered unexpected values in the packet header */
RFID_ERROR_NONVOLATILE_PACKET_HEADER, /* -9974 */
/* The MAC firmware received more than the specified maximum packet size */
RFID_ERROR_NONVOLATILE_MAX_PACKET_LENGTH /* -9973 */
};
typedef INT32S RFID_STATUS;
#define RFID_LIBRARY_API __declspec(dllimport)
#define RFID_WRAPPER_API __declspec(dllexport)
RFID_LIBRARY_API RFID_STATUS RFID_RetrieveAttachedRadiosList(RFID_RADIO_ENUM *pBuffer,INT32U flags);
typedef struct {
INT32U length;
/* The total length, in bytes, of radio enumeration structure. The */
/* application must fill in this field with the length of the radio */
/* enumeration buffer before calling RFID_RetrieveAttachedRadiosList(). */
/* If the buffer is not large enough, on return this field contains the */
/* required size of the radio-enumeration buffer. If the buffer is large */
/* enough, on return this field contains the number of bytes returned */
INT32U totalLength;
/* The number of radios that are attached to the system. This is also the*/
/* number of radio info structure pointers in the array pointed to by */
/* ppRadioInfo. */
INT32U countRadios;
/* A pointer to an array of RFID_RADIO_INFO structure pointers. The array*/
/* contains countRadios entries. */
INT32U ilength;
/* The version information for the radio's bus driver. */
RFID_VERSION driverVersion;
/* The unique cookie for the radio. This cookie is passed to */
/* RFID_RadioOpen() when the application wishes to take control of the */
/* radio. */
INT32U cookie;
/* The length, in bytes, of the uniqueId field(aka, serial number) */
/* including the null terminator */
INT32U idLength;
/* A pointer to an array of bytes that contain the radio module's unique */
/* ID (aka, serial number). */
INT8U UniqueId;
}RFID_RADIO_ENUM_WP;
RFID_WRAPPER_API RFID_STATUS RFID_RetrieveAttachedRadiosListWapper(
RFID_RADIO_ENUM_WP* pWBuffer,
INT32U flags
)
{
RFID_RADIO_ENUM Buffer;
RFID_RADIO_ENUM *pBuffer;
RFID_RADIO_INFO Info;
RFID_RADIO_INFO *pInfo;
RFID_STATUS status;
Info.length = pWBuffer->ilength;
Info.driverVersion = pWBuffer->driverVersion;
Info.cookie = pWBuffer->cookie;
Info.idLength = pWBuffer->idLength;
Info.pUniqueId = &(pWBuffer->UniqueId);
pInfo = &Info;
pBuffer = &Buffer;
pBuffer->length = pWBuffer->length;
pBuffer->totalLength = pWBuffer->totalLength;
pBuffer->countRadios = pWBuffer->countRadios;
pBuffer->ppRadioInfo = &pInfo;
status = RFID_RetrieveAttachedRadiosList(pBuffer,flags);
pInfo = *(pBuffer->ppRadioInfo);
pWBuffer->length = pBuffer->length;
pWBuffer->totalLength = pBuffer->totalLength;
pWBuffer->countRadios = pBuffer->countRadios;
pWBuffer->driverVersion = pInfo->driverVersion;
pWBuffer->cookie = pInfo->cookie;
pWBuffer->idLength = pInfo->idLength;
pWBuffer->UniqueId = *(pInfo->pUniqueId);
return(status);
}
/*RFID_LIBRARY_API RFID_STATUS RFID_RetrieveAttachedRadiosList(RFID_RADIO_ENUM *pBuffer,INT32U flags)
{
return(RFID_STATUS_OK);
}*/