@hardwarebridge/client 1.0.4 โ†’ 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +45 -45
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ๐Ÿ”Œ Hardware Bridge Client
1
+ # Hardware Bridge Client
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/%40hardwarebridge%2Fclient.svg)](https://badge.fury.io/js/%40hardwarebridge%2Fclient)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -6,7 +6,7 @@
6
6
 
7
7
  A professional TypeScript client library for connecting to Hardware Bridge WebSocket services. Control hardware devices including printers, serial ports, and USB HID devices with ease.
8
8
 
9
- ## ๐Ÿš€ Quick Start
9
+ ## Quick Start
10
10
 
11
11
  ```bash
12
12
  npm install @hardwarebridge/client
@@ -24,7 +24,7 @@ await client.connect();
24
24
  const devices = await client.enumerateDevices();
25
25
  ```
26
26
 
27
- ## ๐Ÿ“‹ Table of Contents
27
+ ## Table of Contents
28
28
 
29
29
  - [Features](#features)
30
30
  - [Installation](#installation)
@@ -39,19 +39,19 @@ const devices = await client.enumerateDevices();
39
39
  - [License](#license)
40
40
  - [Support](#support)
41
41
 
42
- ## โœจ Features
42
+ ## Features
43
43
 
44
- - ๐Ÿ”Œ **WebSocket Communication** - Real-time connection to Hardware Bridge server
45
- - ๐Ÿ–จ๏ธ **Printer Support** - ESC/POS, ZPL, EPL protocols
46
- - ๐Ÿ”Œ **Serial Port Control** - Full serial communication capabilities
47
- - ๐Ÿ“ฑ **USB HID Devices** - Human Interface Device communication
48
- - ๐Ÿ“ฆ **Queue Management** - Built-in job queuing system
49
- - ๐Ÿ”’ **TypeScript Support** - Full type definitions and IntelliSense
50
- - ๐Ÿ”„ **Auto-reconnection** - Robust connection handling
51
- - ๐Ÿ“Š **Device Discovery** - Automatic device enumeration
52
- - โšก **Multi-format Support** - CommonJS, ES Modules, UMD builds
44
+ - **WebSocket Communication** - Real-time connection to Hardware Bridge server
45
+ - **Printer Support** - ESC/POS, ZPL, EPL protocols
46
+ - **Serial Port Control** - Full serial communication capabilities
47
+ - **USB HID Devices** - Human Interface Device communication
48
+ - **Queue Management** - Built-in job queuing system
49
+ - **TypeScript Support** - Full type definitions and IntelliSense
50
+ - **Auto-reconnection** - Robust connection handling
51
+ - **Device Discovery** - Automatic device enumeration
52
+ - **Multi-format Support** - CommonJS, ES Modules, UMD builds
53
53
 
54
- ## ๐Ÿ“ฆ Installation
54
+ ## Installation
55
55
 
56
56
  ```bash
57
57
  # npm
@@ -64,7 +64,7 @@ yarn add @hardwarebridge/client
64
64
  pnpm add @hardwarebridge/client
65
65
  ```
66
66
 
67
- ## ๐Ÿ”ง Basic Usage
67
+ ## Basic Usage
68
68
 
69
69
  ### Connecting to the Server
70
70
 
@@ -126,7 +126,7 @@ const jobs = await client.getQueueJobs();
126
126
  console.log(`Found ${jobs.length} jobs in queue`);
127
127
  ```
128
128
 
129
- ## ๐Ÿ“š API Reference
129
+ ## API Reference
130
130
 
131
131
  ### HardwareBridgeClient
132
132
 
@@ -201,7 +201,7 @@ const jobs = await client.getQueueJobs({
201
201
  await client.cancelQueueJob(jobId);
202
202
  ```
203
203
 
204
- ## ๐Ÿ–จ๏ธ Hardware Support
204
+ ## Hardware Support
205
205
 
206
206
  ### Supported Protocols
207
207
 
@@ -217,7 +217,7 @@ await client.cancelQueueJob(jobId);
217
217
  - **USB HID** - Human Interface Devices
218
218
  - **Custom Devices** - Extensible device support
219
219
 
220
- ## ๐Ÿ“– Examples
220
+ ## Examples
221
221
 
222
222
  ### Complete Printer Example
223
223
 
@@ -231,11 +231,11 @@ async function printReceipt() {
231
231
 
232
232
  try {
233
233
  await client.connect();
234
-
234
+
235
235
  // Find printer
236
236
  const devices = await client.enumerateDevices();
237
237
  const printer = devices.find(d => d.type === 'printer');
238
-
238
+
239
239
  if (!printer) {
240
240
  throw new Error('No printer found');
241
241
  }
@@ -258,7 +258,7 @@ Thank you!
258
258
 
259
259
  const result = await client.print(printer.id, receipt, 'escpos');
260
260
  console.log('Receipt printed:', result.jobId);
261
-
261
+
262
262
  } catch (error) {
263
263
  console.error('Print error:', error);
264
264
  } finally {
@@ -278,11 +278,11 @@ async function serialCommunication() {
278
278
  });
279
279
 
280
280
  await client.connect();
281
-
281
+
282
282
  // Find serial device
283
283
  const devices = await client.enumerateDevices();
284
284
  const serialDevice = devices.find(d => d.type === 'serial');
285
-
285
+
286
286
  if (serialDevice) {
287
287
  // Open serial port
288
288
  await client.openSerialPort(serialDevice.id, {
@@ -291,15 +291,15 @@ async function serialCommunication() {
291
291
  parity: 'none',
292
292
  stopBits: 1
293
293
  });
294
-
294
+
295
295
  // Send data
296
296
  await client.sendSerialData(serialDevice.id, 'Hello Serial!');
297
-
297
+
298
298
  // Receive data
299
299
  const data = await client.receiveSerialData(serialDevice.id);
300
300
  console.log('Received:', data);
301
301
  }
302
-
302
+
303
303
  await client.disconnect();
304
304
  }
305
305
  ```
@@ -313,7 +313,7 @@ async function queueManagement() {
313
313
  });
314
314
 
315
315
  await client.connect();
316
-
316
+
317
317
  // Get queue status
318
318
  const status = await client.getQueueStatus();
319
319
  console.log('Queue status:', {
@@ -322,18 +322,18 @@ async function queueManagement() {
322
322
  processing: status.processingJobs,
323
323
  completed: status.completedJobs
324
324
  });
325
-
325
+
326
326
  // Get recent jobs
327
327
  const jobs = await client.getQueueJobs({ limit: 10 });
328
328
  jobs.forEach(job => {
329
329
  console.log(`${job.id}: ${job.operation} - ${job.status}`);
330
330
  });
331
-
331
+
332
332
  await client.disconnect();
333
333
  }
334
334
  ```
335
335
 
336
- ## ๐ŸŽจ Print Format Examples
336
+ ## Print Format Examples
337
337
 
338
338
  ### ESC/POS (Receipt Format)
339
339
  ```typescript
@@ -384,7 +384,7 @@ P1
384
384
  await client.print(printerId, eplLabel, 'epl');
385
385
  ```
386
386
 
387
- ## ๐Ÿ”’ Error Handling
387
+ ## Error Handling
388
388
 
389
389
  ```typescript
390
390
  import { HardwareBridgeClient, HardwareBridgeError } from '@hardwarebridge/client';
@@ -409,10 +409,10 @@ client.onDeviceEvent((event) => {
409
409
  // Handle errors gracefully
410
410
  try {
411
411
  await client.connect();
412
-
412
+
413
413
  // Your code here
414
414
  const devices = await client.enumerateDevices();
415
-
415
+
416
416
  } catch (error) {
417
417
  if (error instanceof HardwareBridgeError) {
418
418
  console.error('Hardware Bridge Error:', error.message);
@@ -425,7 +425,7 @@ try {
425
425
  }
426
426
  ```
427
427
 
428
- ## ๐ŸŒ Browser Usage
428
+ ## Browser Usage
429
429
 
430
430
  ```html
431
431
  <!DOCTYPE html>
@@ -442,29 +442,29 @@ try {
442
442
 
443
443
  <script type="module">
444
444
  import { HardwareBridgeClient } from 'https://unpkg.com/@hardwarebridge/client@latest/dist/index.esm.js';
445
-
445
+
446
446
  const client = new HardwareBridgeClient({
447
447
  url: 'ws://localhost:8443'
448
448
  });
449
-
449
+
450
450
  document.getElementById('connect').addEventListener('click', async () => {
451
451
  try {
452
452
  await client.connect();
453
453
  document.getElementById('status').textContent = 'Connected!';
454
-
454
+
455
455
  const devices = await client.enumerateDevices();
456
- document.getElementById('devices').innerHTML =
456
+ document.getElementById('devices').innerHTML =
457
457
  devices.map(d => `<p>${d.name} (${d.type})</p>`).join('');
458
458
  } catch (error) {
459
459
  document.getElementById('status').textContent = 'Connection failed: ' + error.message;
460
460
  }
461
461
  });
462
-
462
+
463
463
  document.getElementById('print').addEventListener('click', async () => {
464
464
  try {
465
465
  const devices = await client.enumerateDevices();
466
466
  const printer = devices.find(d => d.type === 'printer');
467
-
467
+
468
468
  if (printer) {
469
469
  await client.print(printer.id, 'Hello from Browser!', 'raw');
470
470
  alert('Printed successfully!');
@@ -480,7 +480,7 @@ try {
480
480
  </html>
481
481
  ```
482
482
 
483
- ## ๐Ÿ› ๏ธ Configuration
483
+ ## Configuration
484
484
 
485
485
  ### Server Configuration
486
486
 
@@ -505,7 +505,7 @@ const client = new HardwareBridgeClient({
505
505
  });
506
506
  ```
507
507
 
508
- ## ๐Ÿงช Testing
508
+ ## Testing
509
509
 
510
510
  ```bash
511
511
  # Run the test applications
@@ -518,7 +518,7 @@ node simple-test-app.js
518
518
  node enhanced-test-app.js
519
519
  ```
520
520
 
521
- ## ๐Ÿค Contributing
521
+ ## Contributing
522
522
 
523
523
  Contributions are welcome! Please feel free to submit a Pull Request.
524
524
 
@@ -528,13 +528,13 @@ Contributions are welcome! Please feel free to submit a Pull Request.
528
528
  4. Push to the branch: `git push origin feature/amazing-feature`
529
529
  5. Open a Pull Request
530
530
 
531
- ## ๐Ÿ“„ License
531
+ ## License
532
532
 
533
533
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
534
534
 
535
535
  Copyright (c) 2026 Azlam
536
536
 
537
- ## ๐Ÿ†˜ Support
537
+ ## Support
538
538
 
539
539
  For support and questions:
540
540
  - **Issues**: [Create an issue](https://github.com/me-azlam-kp/hardwarebridge/issues) in the repository
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardwarebridge/client",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "TypeScript client library for Hardware Bridge WebSocket service",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",