Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/connector/network-digi-x-on/CON-277 #113

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions decoders/connector/digi-x-on/custom-kpn-things/connector.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "../../../../schema/connector.json",
"name": "Custom Digi X-ON",
"images": {
"logo": "./assets/logo.png"
},
"versions": {
"v1.0.0": {
"src": "./v1.0.0/payload.ts",
"manifest": "./v1.0.0/payload-config.jsonc"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use this Custom setup if your device connected through Digi X-ON doesn’t show up in the list. It works with ANY Digi X-ON device.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "../../../../../schema/connector_details.json",
"description": "../description.md",
"install_text": "",
"install_end_text": "",
"device_annotation": "",
"device_parameters": [],
"networks": [
"../../../../network/digi-x-on/v1.0.0/payload.ts"
]
}
Empty file.
Binary file added decoders/network/digi-x-on/assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added decoders/network/digi-x-on/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added decoders/network/digi-x-on/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions decoders/network/digi-x-on/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Secure edge-to-cloud IoT solution with remote monitoring and long battery life.
15 changes: 15 additions & 0 deletions decoders/network/digi-x-on/network.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../../schema/network.json",
"name": "Digi X-ON",
"images": {
"logo": "./assets/logo.png",
"icon": "./assets/icon.png",
"banner": "./assets/banner.png"
},
"versions": {
"v1.0.0": {
"src": "./v1.0.0/payload.ts",
"manifest": "./v1.0.0/payload-config.jsonc"
}
}
}
14 changes: 14 additions & 0 deletions decoders/network/digi-x-on/v1.0.0/payload-config.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "../../../../schema/network_details.json",
"description": "../description.md",
"serial_number_config": {
"required": true,
"case": "upper",
"label": "Device EUI/IMEI"
},
"device_parameters": [],
"middleware_endpoint": {
"us-e1": "digixon.middleware.us-e1.tago.io",
"eu-w1": "digixon.middleware.eu-w1.tago.io"
}
}
21 changes: 21 additions & 0 deletions decoders/network/digi-x-on/v1.0.0/payload.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { describe, expect, test, beforeEach } from "vitest";
import { DataToSend } from "@tago-io/sdk/lib/types";

import { decoderRun } from "../../../../src/functions/decoder-run";

const file_path = "decoders/network/digi-x-on/v1.0.0/payload.ts";

let payload: DataToSend[] = [];

describe("Shall not be parsed", () => {
beforeEach(() => {
payload = [{ variable: "shallnotpass", value: "04096113950292" }];
});
payload = decoderRun(file_path, { payload });
test("Output Result", () => {
expect(Array.isArray(payload)).toBe(true);
});
test("Not parsed Result", () => {
expect(payload).toEqual([{ variable: "shallnotpass", value: "04096113950292" }]);
});
});
5 changes: 5 additions & 0 deletions decoders/network/digi-x-on/v1.0.0/payload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const data = payload.find((x) => x.variable === "payload");

if (data) {
payload = JSON.parse(data.value);
}