initial commit
This commit is contained in:
88
types.ts
Normal file
88
types.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
export enum ConnectionStatus {
|
||||
DISCONNECTED = 'Disconnected',
|
||||
CONNECTING = 'Connecting',
|
||||
CONNECTED = 'Connected',
|
||||
ERROR = 'Error'
|
||||
}
|
||||
|
||||
export enum MemoryBank {
|
||||
RESERVED = 0x00,
|
||||
EPC = 0x01,
|
||||
TID = 0x02,
|
||||
USER = 0x03
|
||||
}
|
||||
|
||||
export interface SerialPortConfig {
|
||||
baudRate: number;
|
||||
}
|
||||
|
||||
export interface TagData {
|
||||
epc: string;
|
||||
tid?: string; // Added TID field
|
||||
count: number;
|
||||
rssi?: number;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export interface ReaderInfo {
|
||||
model: string;
|
||||
version: string;
|
||||
address: number;
|
||||
power: number;
|
||||
minFreq: number;
|
||||
maxFreq: number;
|
||||
protocol: 'ISO18000-6B' | 'EPCC1-G2' | 'Both' | 'None';
|
||||
maxResponseTime: number;
|
||||
band: FrequencyBand;
|
||||
}
|
||||
|
||||
export interface LogEntry {
|
||||
id: string;
|
||||
timestamp: Date;
|
||||
type: 'TX' | 'RX' | 'INFO' | 'ERROR' | 'WARN';
|
||||
message: string;
|
||||
data?: string;
|
||||
}
|
||||
|
||||
export interface QuickTestConfig {
|
||||
length: 3 | 4;
|
||||
format: 'hex' | 'ascii';
|
||||
}
|
||||
|
||||
// Command Codes from Manual
|
||||
export enum ReaderCommand {
|
||||
GET_INFO = 0x21,
|
||||
SET_REGION = 0x22,
|
||||
SET_ADDRESS = 0x24,
|
||||
SET_SCAN_TIME = 0x25,
|
||||
SET_BAUD_RATE = 0x28,
|
||||
SET_POWER = 0x2F,
|
||||
INVENTORY_G2 = 0x01,
|
||||
READ_DATA_G2 = 0x02,
|
||||
WRITE_DATA_G2 = 0x03,
|
||||
WRITE_EPC_G2 = 0x04,
|
||||
KILL_TAG_G2 = 0x05,
|
||||
LOCK_G2 = 0x06,
|
||||
ERASE_G2 = 0x07,
|
||||
SET_ACCESS_EPC_MATCH = 0x85, // Added for targeting specific tags
|
||||
EAS_ALARM_G2 = 0x0C,
|
||||
CHECK_EAS_ALARM = 0x0D,
|
||||
LOCK_USER_BLOCK = 0x0E
|
||||
}
|
||||
|
||||
export enum FrequencyBand {
|
||||
USER = 0,
|
||||
CHINESE = 1,
|
||||
US = 2,
|
||||
KOREAN = 3,
|
||||
EU = 4
|
||||
}
|
||||
|
||||
// Web Serial API Type Definition
|
||||
export interface SerialPort {
|
||||
readable: ReadableStream<Uint8Array> | null;
|
||||
writable: WritableStream<Uint8Array> | null;
|
||||
open(options: { baudRate: number }): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user