📄 testengine.h
字号:
#ifndef __INCTestEngineh
#define __INCTestEngineh
#ifndef COMMON__TYPES_H
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef signed short int16;
typedef unsigned long int uint32;
#endif /* COMMON__TYPES_H */
#define BER_BIT_COUNT 0
#define BER_BIT_ERRORS 1
#define BER_ACCESS_CODE 2 /* Not used */
#define BER_RCVD_PKTS 3
#define BER_EXP_PKTS 4
#define BER_HDR_ERRORS 5
#define BER_CRC_ERRORS 6
#define BER_UNCORR_ERRORS 7
#define BER_SYNC_ERRORS 8
#define BER_MAX 9
#ifdef _WIN32
#define TESTENGINE_API(T) T _stdcall
#else
#define TESTENGINE_API(T) T
#endif
const int TE_INVALID_HANDLE = -1;
const int TE_ERROR = 0;
const int TE_OK = 1;
const int TE_UNSUPPORTED_FUNCTION = 2;
/* ERROR CODES - in the format returned by teGetLastError */
#define TE_ERROR_NONE 0x000000
#define TE_ERROR_BCCMD_NO_SUCH_VARID 0x000001
#define TE_ERROR_BCCMD_DATA_EXCEEDED 0x000002
#define TE_ERROR_BCCMD_VAR_HAS_NO_VALUE 0x000003
#define TE_ERROR_BCCMD_BAD_VALUE 0x000004
#define TE_ERROR_BCCMD_NO_ACCESS 0x000005
#define TE_ERROR_BCCMD_READ_ONLY 0x000006
#define TE_ERROR_BCCMD_WRITE_ONLY 0x000007
#define TE_ERROR_BCCMD_OTHER_ERROR 0x000008
#define TE_ERROR_BCCMD_PERMISSION_DENIED 0x000009
#define TE_ERROR_TRANPSORT_ERROR 0x000100
#define TE_ERROR_HCI_UNKNOWN_COMMAND 0x010000
#define TE_ERROR_HCI_UNKNOWN_CONNECTION_ID 0x020000
#define TE_ERROR_HCI_HARDWARE_FAILURE 0x030000
#define TE_ERROR_HCI_PAGE_TIMEOUT 0x040000
#define TE_ERROR_HCI_AUTHENTICATION_FAILURE 0x050000
#define TE_ERROR_HCI_PIN_MISSING 0x060000
#define TE_ERROR_HCI_MEMORY_CAPACITY_EXCEEDED 0x070000
#define TE_ERROR_HCI_CONNECTION_TIMEOUT 0x080000
#define TE_ERROR_HCI_CONNECTION_LIMIT_EXCEEDED 0x090000
#define TE_ERROR_HCI_SYNCHRONOUS_CONNECTION_LIMIT_EXCEEDED 0x0a0000
#define TE_ERROR_HCI_ACL_CONNECTION_ALREADY_EXISTS 0x0b0000
#define TE_ERROR_HCI_COMMAND_DISALLOWED 0x0c0000
#define TE_ERROR_HCI_CONNECTION_REJECTED_LIMITED_RESOURCES 0x0d0000
#define TE_ERROR_HCI_CONNECTION_REJECTED_SECURITY_REASONS 0x0e0000
#define TE_ERROR_HCI_CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR 0x0f0000
#define TE_ERROR_HCI_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x100000
#define TE_ERROR_HCI_UNSUPPORTED_FEATURE 0x110000
#define TE_ERROR_HCI_INVALID_COMMAND_PARAMETERS 0x120000
#define TE_ERROR_HCI_REMOTE_USER_TERMINATED_CONNECTION 0x130000
#define TE_ERROR_HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES 0x140000
#define TE_ERROR_HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_POWER_OFF 0x150000
#define TE_ERROR_HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x160000
#define TE_ERROR_HCI_REPEATED_ATTEMPTS 0x170000
#define TE_ERROR_HCI_PAIRING_NOT_ALLOWED 0x180000
#define TE_ERROR_HCI_UNKNOWN_LMP_PDU 0x190000
#define TE_ERROR_HCI_UNSUPPORTED_REMOTE_FEATURE 0x1a0000
#define TE_ERROR_HCI_SCO_OFFSET_REJECTED 0x1b0000
#define TE_ERROR_HCI_SCO_INTERVAL_REJECTED 0x1c0000
#define TE_ERROR_HCI_SCO_AIR_MODE_REJECTED 0x1d0000
#define TE_ERROR_HCI_INVALID_LMP_PARAMETERS 0x1e0000
#define TE_ERROR_HCI_UNSPECIFIED_ERROR 0x1f0000
#define TE_ERROR_HCI_UNSUPPORTED_LMP_PARAMETER_VALUE 0x200000
#define TE_ERROR_HCI_ROLE_CHANGE_NOT_ALLOWED 0x210000
#define TE_ERROR_HCI_LMP_RESPONSE_TIMEOUT 0x220000
#define TE_ERROR_HCI_LMP_ERROR_TRANSACTION_COLLISION 0x230000
#define TE_ERROR_HCI_LMP_PDU_NOT_ALLOWED 0x240000
#define TE_ERROR_HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x250000
#define TE_ERROR_HCI_LINK_KEY_CANNOT_BE_CHANGED 0x260000
#define TE_ERROR_HCI_REQUESTED_QOS_NOT_SUPPORTED 0x270000
#define TE_ERROR_HCI_INSTANT_PASSED 0x280000
#define TE_ERROR_HCI_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x290000
#define TE_ERROR_HCI_DIFFERENT_TRANSACTION_COLLISION 0x2a0000
#define TE_ERROR_HCI_RESERVED_1 0x2b0000
#define TE_ERROR_HCI_QOS_UNACCEPTABLE_PARAMETER 0x2c0000
#define TE_ERROR_HCI_QOS_REJECTED 0x2d0000
#define TE_ERROR_HCI_CHANNEL_CLASSIFICATION_NOT_SUPPORTED 0x2e0000
#define TE_ERROR_HCI_INSUFFICIENT_SECURITY 0x2f0000
#define TE_ERROR_HCI_PARAMETER_OUT_OF_MANDATORY_RANGE 0x300000
#define TE_ERROR_HCI_RESERVED_2 0x310000
#define TE_ERROR_HCI_ROLE_SWITCH_PENDING 0x320000
#define TE_ERROR_HCI_RESERVED_3 0x330000
#define TE_ERROR_HCI_RESERVED_SLOT_VIOLATION 0x340000
#define TE_ERROR_HCI_ROLE_SWITCH_FAILED 0x350000
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*************************************************************************************
VERSION INFORMATION
*************************************************************************************/
/*************************************************************************************
Function Name : int getTestEngineVersion(char * versionStr)
Parameters :
versionStr - A pointer to a preallocated string that will have the
version string copied to it.
Returns : Always 1.
Description : Retrieve or displays the current version string.
*************************************************************************************/
TESTENGINE_API(int) getTestEngineVersion(char * versionStr);
/*************************************************************************************
LINK MANAGEMENT FUNCTIONS
*************************************************************************************/
#define BCSP 0x1
#define USB 0x2
#define H4 0x4
#define H5 0x8
/*************************************************************************************
Function Name : uint32 initTestEngine(int transport, char * transportDevice, unsigned long int dataRate, int usbTimeOut);
Parameters :
transport - defines the protocol to be used when setting up the
communication with BlueCore.
USB = 2
H4 = 4
BCSP = 1
transportDevice - Defines the physical port to use. A string which
for comm ports is "COMn" where 'n' is the number of the
port. USB device names take the form "\\.\CSRn" where n
is the number of the port.
dataRate - defines the baud rate to be used. For UART connections
only.
usbTimeout - where transport = 2, this parameter will define the
timeout to allow the USB device to ennumerate if it
has not already ennumerated. It has been found that some PC's
take a longer time than expected to ennumerate a USB device and,
in some cases, the PC's internal USB hub may have been reset
which can cause a further delay in ennumeration. This parameter
can be set to accomodate the extra time taken to reset USB devices.
Returns : This function will return a zero on failure or an unsigned integer which
defines the handle to the host / host controller connection. This
value is used as a parameter for all other function calls.
Description : An initTestEngine function has to called before any
communication with BlueCore can begin.
*************************************************************************************/
TESTENGINE_API(uint32) initTestEngine(int transport, char * transportDevice, unsigned long int dataRate, int usbTimeOut);
/*************************************************************************************
Function Name : uint32 initTestEngineSpi(int aPort, int aMulti, char aStopOnSpiAccess);
Parameters :
aPort - Defines the physical port to use. Usually an LPT port
starting from 1.
aMulti - A gate on a multi-spi interface
aStopOnSpiAccess - Flag defining whether the chip should be stopped
on SPI access.
Returns : This function will return a zero on failure or an unsigned integer which
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -