@openrfid/core 0.1.0 → 1.0.0
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.
- package/README.md +111 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/rfidsoftwares/openrfid-simulator/main/assets/logo.svg" alt="OpenRFID Simulator Logo" width="180" />
|
|
4
|
+
|
|
5
|
+
# `@openrfid/core`
|
|
6
|
+
|
|
7
|
+
### Core Dependency Injection, EventBus, ConfigManager & SQLite Persistence Engine
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@openrfid/core)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://rfidsoftwares.com)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Overview
|
|
18
|
+
|
|
19
|
+
`@openrfid/core` provides the foundational architecture for the **OpenRFID Simulator** framework. It includes a decoupled typed `EventBus`, a persistent `ConfigManager`, a lightweight Dependency Injection (`ServiceContainer`) container, and a high-performance SQLite WAL storage engine for persisting RFID reader scan events and system logs.
|
|
20
|
+
|
|
21
|
+
Developed & Maintained by **[RFID Software India Private Limited](https://rfidsoftwares.com)**.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install @openrfid/core
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @openrfid/core
|
|
33
|
+
|
|
34
|
+
# yarn
|
|
35
|
+
yarn add @openrfid/core
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 💻 Code Example
|
|
41
|
+
|
|
42
|
+
### 1. Using the Typed EventBus
|
|
43
|
+
```typescript
|
|
44
|
+
import { EventBus } from '@openrfid/core';
|
|
45
|
+
|
|
46
|
+
// Subscribe to RFID tag detection events
|
|
47
|
+
EventBus.on('TagDetected', (event) => {
|
|
48
|
+
console.log(`Tag Detected: ${event.epc} on Reader: ${event.readerId} (RSSI: ${event.rssi} dBm)`);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Emit simulated tag scan event
|
|
52
|
+
EventBus.emit('TagDetected', {
|
|
53
|
+
epc: 'E28011700000020C3C9101AB',
|
|
54
|
+
readerId: 'READER-01',
|
|
55
|
+
antennaPort: 1,
|
|
56
|
+
rssi: -58.5,
|
|
57
|
+
timestamp: Date.now()
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. SQLite Event Storage
|
|
62
|
+
```typescript
|
|
63
|
+
import { SqliteStorageManager } from '@openrfid/core';
|
|
64
|
+
|
|
65
|
+
const storage = new SqliteStorageManager({ dbPath: './rfid_simulation.db' });
|
|
66
|
+
await storage.initialize();
|
|
67
|
+
|
|
68
|
+
// Save tag detection scan
|
|
69
|
+
await storage.saveScanEvent({
|
|
70
|
+
epc: '3034257BF4000B4000000001',
|
|
71
|
+
readerId: 'GATE-NORTH-01',
|
|
72
|
+
antennaPort: 2,
|
|
73
|
+
rssi: -62.0,
|
|
74
|
+
readCount: 1,
|
|
75
|
+
timestamp: Date.now()
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Query recent scan history
|
|
79
|
+
const recentScans = await storage.getRecentScans({ limit: 50 });
|
|
80
|
+
console.log('Recent Scans:', recentScans);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 📚 API Reference
|
|
86
|
+
|
|
87
|
+
| Export | Type | Description |
|
|
88
|
+
| :--- | :--- | :--- |
|
|
89
|
+
| `EventBus` | Singleton Class | Typed publish-subscribe event emitter for simulation events |
|
|
90
|
+
| `ConfigManager` | Class | Load, validate, and update system configuration parameters |
|
|
91
|
+
| `ServiceContainer` | Class | Lightweight IoC container for dependency resolution |
|
|
92
|
+
| `SqliteStorageManager` | Class | SQLite database manager with WAL logging for high-throughput persistence |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 🌐 Monorepo Ecosystem
|
|
97
|
+
|
|
98
|
+
| Package | Description |
|
|
99
|
+
| :--- | :--- |
|
|
100
|
+
| [`@openrfid/simulator`](https://www.npmjs.com/package/@openrfid/simulator) | High-throughput inventory simulation engine |
|
|
101
|
+
| [`@openrfid/readers`](https://www.npmjs.com/package/@openrfid/readers) | Virtual reader hardware and antenna models |
|
|
102
|
+
| [`@openrfid/epc`](https://www.npmjs.com/package/@openrfid/epc) | EPC Gen2 memory bank encoders & decoders |
|
|
103
|
+
| [`@openrfid/plugin-api`](https://www.npmjs.com/package/@openrfid/plugin-api) | Plugin sandbox and lifecycle interfaces |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 📄 License & Corporate Support
|
|
108
|
+
|
|
109
|
+
Licensed under the **MIT License**.
|
|
110
|
+
Brought to you by **RFID Software India Private Limited**.
|
|
111
|
+
For enterprise RFID middleware, hardware drivers, or custom protocol plugins, visit **[rfidsoftwares.com](https://rfidsoftwares.com)**.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrfid/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Core architecture, EventBus, DI Container, Config, Logger, and Storage contracts for OpenRFID Simulator.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"better-sqlite3": "^11.0.0"
|