feat: read schedule,calendar and trend#64
Conversation
Keep this branch focused on read-side BACnet compatibility only. Write examples are intentionally moved to the write-focused branch/PR to reduce review scope and avoid mixing unported write behavior into the read track.
robertsLando
left a comment
There was a problem hiding this comment.
Thanks for your PR @EveGun ! Didn't know we forgot to backport some changes from that repo, everything looks good! LGTM
Pull Request Test Coverage Report for Build 21896151072Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Ports legacy schedule/calendar/trend read-compatibility into @bacnet-js/client by adding specialized ASN.1 decode paths (weekly/exception schedules, effective period, calendar date list) and trend-log range decoding, plus tests and manual-run examples.
Changes:
- Added new ASN.1 decoders for schedule/calendar payloads and WEEKNDAY handling.
- Integrated
decodeRangeintoReadRange.decodeAcknowledgeand added trend-range parsing tests. - Added example scripts for reading schedule/calendar/trend data for manual validation.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/asn1.ts |
Adds WEEKNDAY decoding and new schedule/calendar/trend-range decode helpers. |
src/lib/services/ReadProperty.ts |
Routes certain Schedule/Calendar properties through specialized decoders. |
src/lib/services/ReadRange.ts |
Integrates decodeRange and adjusts rangeBuffer slicing behavior. |
src/lib/types.ts |
Updates ReadRangeAcknowledge.property type and adds optional values. |
test/unit/service-read-property.spec.ts |
Adds unit tests for schedule/calendar parsing compatibility. |
test/unit/service-read-range.spec.ts |
Adds unit tests for trend range decoding and offset slicing behavior. |
examples/read-trend.ts |
Adds a manual validation example for reading trend log ranges. |
examples/read-schedule-weekly.ts |
Adds a manual validation example for weekly schedules. |
examples/read-schedule-exceptions.ts |
Adds a manual validation example for exception schedules. |
examples/read-schedule-period.ts |
Adds a manual validation example for effective periods. |
examples/read-calendar-datelist.ts |
Adds a manual validation example for calendar date lists. |
|
@EveGun I think copilot review is legit, could you fix it please? |
Will look into it! |
86cbb1e
|
Looks like a flaky CI fail?I can reproduce this occasionally, but local reruns pass. |
|
@EveGun Yeah seems the CI is flaky, a re-run made it green |
jacoscaz
left a comment
There was a problem hiding this comment.
I haven't personally breached into the scheduling-related aspects of BACnet, yet, so take my words with a grain of salt but this generally LGTM! I will include some form of scheduling during my next round of work on @bacnet-js/device and might be able to provide better feedback then.
Summary
This PR ports schedule/calendar/trend read compatibility from the legacy
node-bacstackimplementation into@bacnet-js/client, and adds read examples for manual validation.Source reference:
What changed
ReadProperty.decodeAcknowledgefor:WEEKLY_SCHEDULEEXCEPTION_SCHEDULEEFFECTIVE_PERIODDATE_LISTWEEKNDAYsupport in ASN.1 decode flow.decodeRangeintegration inReadRange.decodeAcknowledge.ReadRangefallback range buffer handling.examples/read-schedule-weekly.tsexamples/read-schedule-exceptions.tsexamples/read-schedule-period.tsexamples/read-calendar-datelist.tsexamples/read-trend.tsType consistency
timestampnow returnsDate(instead of epoch number) for consistency with other decoded date/time fields.Validation
npm run lint✅npm run test:unit✅Notes