@pamoja/lora 0.1.15

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 (3) hide show
  1. package/LICENSE-MIT +21 -0
  2. package/README.md +73 -0
  3. package/package.json +39 -0
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anthony Wiedman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @pamoja/lora
2
+
3
+ Time-on-air, duty-cycle off-time, and the regional channel plans a LoRa node must keep to. One capability of [pamoja](https://github.com/molexxxx/pamoja), one memory-safe Rust core with bindings for TypeScript, Python, and C#.
4
+
5
+ [![API reference](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-api.svg)](https://pamoja.molex.cloud/docs/reference/node/modules/_pamoja_lora.html)
6
+ [![read the guide](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-guide.svg)](https://pamoja.molex.cloud/docs/guides/lora.html)
7
+ [![documentation](https://raw.githubusercontent.com/molexxxx/pamoja/main/.github/badges/btn-docs.svg)](https://pamoja.molex.cloud/docs/)
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install @pamoja/lora
13
+ ```
14
+
15
+ This pulls in `@pamoja/native`, the compiled engine. `npm install pamoja` is the whole framework in one package.
16
+
17
+ ## Example
18
+
19
+ The test that runs in CI, spliced here as it ran.
20
+
21
+ From [`bindings/node/guides/lora.ts`](https://github.com/molexxxx/pamoja/blob/main/bindings/node/guides/lora.ts):
22
+
23
+ ```typescript
24
+ import { LoraRegion, airtimeUs, messagesPerHour, minOffTimeUs, planFor } from '@pamoja/lora'
25
+
26
+ // EU863-870 numbers its data rates from the slowest. DR0 is SF12 at 125 kHz, the setting
27
+ // that reaches furthest and holds the channel longest.
28
+ const plan = planFor(LoraRegion.Eu868)
29
+ const link = plan.linkSettings(0)!
30
+ console.log(`${plan.name} DR0 is SF${link.spreadingFactor} at 125 kHz`)
31
+
32
+ // The time on air for that setting, coding rate 4/5, an eight-symbol preamble, an explicit
33
+ // header and CRC on, carrying a ten-byte reading.
34
+ const airtime = airtimeUs(link, 10)
35
+ console.log(`airtime ${(airtime / 1e6).toFixed(2)} s for ten bytes`)
36
+
37
+ // 868.1 MHz falls in a sub-band capped at 1% of the time and 16 dBm, so every transmission
38
+ // buys ninety-nine times its own length in silence.
39
+ const channel = 868_100_000
40
+ const permille = plan.dutyCyclePermille(channel)!
41
+ console.log(`channel ${permille} per mille duty cycle, ${plan.maxEirpDbm(channel)} dBm`)
42
+
43
+ const offTime = minOffTimeUs(link, 10, permille)!
44
+ console.log(`silence ${(offTime / 1e6).toFixed(1)} s owed after each reading`)
45
+
46
+ // The airtime plus that silence is what one reading really costs, which is the budget a
47
+ // deployment plans against.
48
+ console.log(`budget ${messagesPerHour(link, 10, permille)} readings an hour`)
49
+
50
+ // A frequency in no sub-band the plan describes has no duty cycle to budget against. That
51
+ // is a limit published elsewhere, not permission to transmit.
52
+ const outside = plan.dutyCyclePermille(700_000_000)
53
+ console.log(`700 MHz is outside this plan, so it budgets nothing: ${outside === null}`)
54
+ ```
55
+
56
+ ## The same capability in every language
57
+
58
+ | Language | Package | Reference |
59
+ | --- | --- | --- |
60
+ | Rust | [`pamoja-lora`](https://crates.io/crates/pamoja-lora) | [reference](https://pamoja.molex.cloud/docs/reference/rust/pamoja_lora/index.html), [docs.rs](https://docs.rs/pamoja-lora) |
61
+ | TypeScript | [`@pamoja/lora`](https://www.npmjs.com/package/@pamoja/lora) | [reference](https://pamoja.molex.cloud/docs/reference/node/modules/_pamoja_lora.html) |
62
+ | Python | [`pamoja-lora`](https://pypi.org/project/pamoja-lora/) | [reference](https://pamoja.molex.cloud/docs/reference/python/pamoja/lora.html) |
63
+ | C# | [`Pamoja.Lora`](https://www.nuget.org/packages/Pamoja.Lora) | [reference](https://pamoja.molex.cloud/docs/reference/dotnet/api/Pamoja.Lora.html) |
64
+
65
+ ## Documentation
66
+
67
+ - [`@pamoja/lora` reference](https://pamoja.molex.cloud/docs/reference/node/modules/_pamoja_lora.html), every class, function, and type this package exports.
68
+ - [The LoRa airtime guide](https://pamoja.molex.cloud/docs/guides/lora.html), with the same example in Rust, Python, and C#.
69
+ - [Every capability](https://pamoja.molex.cloud/docs/), and the [install page](https://pamoja.molex.cloud/docs/install.html).
70
+
71
+ ## License
72
+
73
+ MIT
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@pamoja/lora",
3
+ "version": "0.1.15",
4
+ "description": "Time-on-air, duty-cycle off-time, and the regional channel plans a LoRa node must keep to.",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/molexxxx/pamoja.git",
12
+ "directory": "bindings/node/packages/lora"
13
+ },
14
+ "homepage": "https://pamoja.molex.cloud/docs/guides/lora.html",
15
+ "keywords": [
16
+ "pamoja",
17
+ "iot",
18
+ "robotics",
19
+ "lora"
20
+ ],
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist/",
31
+ "LICENSE-MIT"
32
+ ],
33
+ "engines": {
34
+ "node": ">= 16"
35
+ },
36
+ "dependencies": {
37
+ "@pamoja/native": "0.1.15"
38
+ }
39
+ }