📄 zbluesoc_drv.h
字号:
/*----------------------------------------------------------------------*/
/* zbluesoc_drv.h */
/* */
/* Description: */
/* - API declarations for zbluesoc_drv.dll */
/* (driver for Z-Blue(TM) Bluetooth Printer Dongle) */
/* */
/* Assumptions: */
/* */
/* To do: */
/* */
/* Author : Zeen Information Technologies, Inc. */
/* Version: 1.0 */
/*----------------------------------------------------------------------*/
#ifndef __ZBLUESOC_DRV_H
#define __ZBLUESOC_DRV_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ZBLUESOC_DLL_IMPORT
#define ZBLUESOC_API __declspec(dllimport)
#else
#define ZBLUESOC_API
#endif
/*----------------------------------------------------------------------*/
/* Exported Constants */
/*----------------------------------------------------------------------*/
#define MAX_PRINTER 7
enum MSG_TYPE
{
/* control messages */
RESET = 0x01,
CONNECT_REQUEST,
CONNECT_RESULT,
DISCONNECT_REQUEST,
DISCONNECT_RESULT,
DISCOVERY_REQUEST,
DISCOVERY_RESULT,
READ_BD_ADDR,
REPORT_BD_ADDR,
READ_FW_VERSION,
REPORT_FW_VERSION,
CHECK_STATUS,
REPORT_STATUS,
READ_CONFIG,
READ_CONFIG_RESULT,
WRITE_CONFIG,
WRITE_CONFIG_RESULT,
READ_PRNINFO,
READ_PRNINFO_RESULT,
WRITE_PRNINFO,
WRITE_PRNINFO_RESULT,
/* data indication */
APP_DATA
};
enum DEVICE_ROLE {
CLIENT_DEVICE = 0x00, /* master device */
SERVER_DEVICE = 0x01 /* slave device */
};
enum BAUDRATE {
BR_DIP_SW = 0x00,
BR_4800,
BR_9600,
BR_14400,
BR_19200,
BR_38400,
BR_57600,
BR_115200
};
enum FLOW_CONTROL {
FC_NONE = 0x00,
FC_HARDWARE, /* RTS/CTS */
FC_SOFTWARE /* Xon/Xoff */
};
enum RESET_LEVEL {
RESET_BT_MODULE = 0x01,
RESET_SYSTEM = 0x02,
RESET_CURRENT_OP = 0x03
};
/*----------------------------------------------------------------------*/
/* Exported Types */
/*----------------------------------------------------------------------*/
typedef unsigned char BD_ADDR[6];
typedef char FW_VERSION[14];
typedef char DEV_NAME[16];
typedef char DEV_LOCATION[13];
typedef struct _BT_PRN_TABLE {
unsigned char ID;
BD_ADDR BD_Addr;
DEV_NAME DeviceName;
DEV_LOCATION DeviceLocation;
} BT_PRN_TABLE;
typedef struct _CONNECT_RESULT_PARA {
unsigned char PrinterID;
BD_ADDR BD_Addr;
BOOLEAN Result;
} CONNECT_RESULT_PARA;
typedef struct _DISCONNECT_RESULT_PARA {
unsigned char PrinterID;
BD_ADDR BD_Addr;
BOOLEAN Result;
} DISCONNECT_RESULT_PARA;
typedef struct _DISCOVERY_RESULT_PARA {
unsigned char NumDiscovery;
BD_ADDR BD_Addr[MAX_PRINTER];
DEV_NAME DeviceName[MAX_PRINTER];
DEV_LOCATION DeviceLocation[MAX_PRINTER];
} DISCOVERY_RESULT_PARA;
typedef struct _REPORT_BD_ADDR_PARA {
BD_ADDR BD_Addr;
} REPORT_BD_ADDR_PARA;
typedef struct _REPORT_FW_VERSION_PARA {
FW_VERSION FW_Version;
} REPORT_FW_VERSION_PARA;
typedef struct _REPORT_STATUS_PARA {
unsigned char Status;
} REPORT_STATUS_PARA;
typedef struct _READ_CONFIG_RESULT_PARA {
unsigned char Role;
unsigned char Baudrate;
unsigned char FlowControl;
BOOLEAN AutoConnect;
BOOLEAN WaitForAllConnected;
BOOLEAN PrintFW_Info;
BOOLEAN DeviceNameAutoDetect;
DEV_NAME DeviceName;
DEV_LOCATION DeviceLocation;
} READ_CONFIG_RESULT_PARA;
typedef struct _WRITE_CONFIG_RESULT_PARA {
BOOLEAN Result;
} WRITE_CONFIG_RESULT_PARA;
typedef struct _READ_PRNINFO_RESULT_PARA {
unsigned char NumPrinters;
BT_PRN_TABLE PrinterTable[MAX_PRINTER];
} READ_PRNINFO_RESULT_PARA;
typedef struct _WRITE_PRNINFO_RESULT_PARA {
BOOLEAN Result;
} WRITE_PRNINFO_RESULT_PARA;
typedef struct _APP_DATA_PARA {
unsigned char *Buffer;
unsigned int DataSize;
} APP_DATA_PARA;
typedef union _PORT_EVENT_PARA {
CONNECT_RESULT_PARA ConnectResult;
DISCONNECT_RESULT_PARA DisconnectResult;
DISCOVERY_RESULT_PARA DiscoveryResult;
REPORT_BD_ADDR_PARA ReportBD_Addr;
REPORT_FW_VERSION_PARA ReportFW_Version;
REPORT_STATUS_PARA ReportStatus;
READ_CONFIG_RESULT_PARA ReadConfigResult;
WRITE_CONFIG_RESULT_PARA WriteConfigResult;
READ_PRNINFO_RESULT_PARA ReadPrnInfoResult;
WRITE_PRNINFO_RESULT_PARA WritePrnInfoResult;
APP_DATA_PARA AppData;
} PORT_EVENT_PARA;
/*----------------------------------------------------------------------*/
/* Exported Functions */
/*----------------------------------------------------------------------*/
ZBLUESOC_API int __stdcall PORT_Open(
char *btdev,
unsigned char baudrate);
ZBLUESOC_API void __stdcall PORT_Clear(void);
ZBLUESOC_API void __stdcall PORT_Close(void);
ZBLUESOC_API int __stdcall PORT_Write(
unsigned char *write_buf,
unsigned int data_size);
ZBLUESOC_API int __stdcall PORT_RegisterEventHandler(
long event_handler,
long event_msg);
ZBLUESOC_API int __stdcall PORT_Reset(unsigned char reset_level);
ZBLUESOC_API int __stdcall PORT_ConnectRequest(
unsigned char printer_id,
BD_ADDR bd_addr);
ZBLUESOC_API int __stdcall PORT_DisconnectRequest(
unsigned char printer_id,
BD_ADDR bd_addr);
ZBLUESOC_API int __stdcall PORT_DiscoveryRequest(unsigned char max_count);
ZBLUESOC_API int __stdcall PORT_ReadBD_Addr(void);
ZBLUESOC_API int __stdcall PORT_ReadFW_Version(void);
ZBLUESOC_API int __stdcall PORT_CheckStatus(void);
ZBLUESOC_API int __stdcall PORT_ReadConfig(void);
ZBLUESOC_API int __stdcall PORT_WriteConfig(
unsigned char role,
unsigned char baudrate,
unsigned char flow_control,
BOOLEAN auto_connect,
BOOLEAN wait_for_all_connected,
BOOLEAN print_fw_info,
BOOLEAN auto_detect,
char *device_name,
char *device_location);
ZBLUESOC_API int __stdcall PORT_ReadPrnInfo(void);
ZBLUESOC_API int __stdcall PORT_WritePrnInfo(
unsigned char n,
BT_PRN_TABLE *table,
unsigned char flash_update);
#ifdef __cplusplus
}
#endif
#endif /* __ZBLUESOC_DRV_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -