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: virtualize rendering #798

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: use tahu for sparkplug decoding
  • Loading branch information
bj00rn committed May 17, 2024
commit f4bda3e2428bec337487ca196bb7364c0634ff4b
204 changes: 0 additions & 204 deletions backend/src/Model/sparkplugb.proto.ts

This file was deleted.

14 changes: 5 additions & 9 deletions backend/src/Model/sparkplugb.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// cSpell:words protobuf
import * as protobuf from 'protobufjs'
import protocol from './sparkplugb.proto'
import { Base64Message } from './Base64Message'
import { Decoder } from './Decoder'

const root = protobuf.parse(protocol).root
/* cspell:disable-next-line */
export let SparkplugPayload = root.lookupType('com.cirruslink.sparkplug.protobuf.Payload')
import { get } from 'sparkplug-payload'
var sparkplug = get("spBv1.0")

export const SparkplugDecoder = {
decode(input: Buffer): Base64Message {
try {
const message = Base64Message.fromString(
JSON.stringify(SparkplugPayload.toObject(SparkplugPayload.decode(new Uint8Array(input))))
const message = Base64Message.fromString(JSON.stringify(
// @ts-ignore
sparkplug.decodePayload(new Uint8Array(input)))
)
message.decoder = Decoder.SPARKPLUG
return message
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"semantic-release": "^23.0.8",
"semantic-release-export-data": "^1.0.1",
"source-map-support": "^0.5.9",
"sparkplug-client": "^3.2.4",
"ts-node": "^10.9.2",
"tslint": "^6.1.3",
"tslint-config-airbnb": "^5.11.2",
Expand All @@ -126,8 +127,8 @@
"lowdb": "^1.0.0",
"mime": "^2.4.4",
"mqtt": "^4.3.6",
"protobufjs": "^6.11.4",
"sha1": "^1.1.1",
"sparkplug-payload": "^1.0.3",
"uuid": "^8.3.2",
"yarn-run-all": "^3.1.1"
}
Expand Down
Loading
Loading