feat: schedule/calendar write#69
Conversation
…stead of hex substring
…tructure assertions
|
@EveGun changes look good to me, let's see if copilot detects something :) Thanks for your PRs 🙏🏼 |
There was a problem hiding this comment.
Pull request overview
This PR adds support for writing BACnet schedule and calendar properties (WEEKLY_SCHEDULE, EXCEPTION_SCHEDULE, EFFECTIVE_PERIOD, and DATE_LIST) to the @bacnet-js/client library. The implementation ports functionality from the legacy node-bacstack library, adding specialized encoding paths for these complex property types that require custom payload structures beyond simple application data arrays.
Changes:
- Added specialized encoding methods in
WritePropertyservice for schedule/calendar properties with validation - Introduced new TypeScript types for schedule/calendar payload structures in
src/lib/types.ts - Added comprehensive unit tests covering both successful encoding and validation failure scenarios
- Provided four example files demonstrating write operations for each supported property type
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/services/WriteProperty.ts |
Core implementation with specialized encoding methods and validation logic for schedule/calendar properties |
src/lib/types.ts |
New type definitions for schedule/calendar payload structures |
src/lib/client.ts |
Updated signature to accept new payload types |
test/unit/service-write-property.spec.ts |
Added 19 new test cases covering encoding and validation |
examples/write-schedule-weekly.ts |
Example demonstrating weekly schedule write |
examples/write-schedule-exception.ts |
Example demonstrating exception schedule write |
examples/write-schedule-period.ts |
Example demonstrating effective period write |
examples/write-calendar-datelist.ts |
Example demonstrating calendar date list write |
Accept BACnet DATE day marker values (32/33/34) in generic DATE encoding and schedule/calendar WriteProperty encoding. Add focused unit tests for both code paths.
Extend existing day-marker tests to assert support for BACnet raw DATE day values 32, 33 and 34 in both generic ASN.1 app-data encoding and WriteProperty exception schedule encoding.
|
@EveGun I see you marked this as draft now, was it intended? |
|
@robertsLando Yes, but ready again now. |
|
@robertsLando maybe run CI again? Looks like coveralls failed at some external http calls. |
|
@EveGun Coveralls it's failing in many others projects I own, seems it's an issue with their server so no issues here 🙏🏼 |
Summary
This PR ports schedule/calendar write compatibility from the legacy
node-bacstackimplementation into@bacnet-js/client, and adds write examples for manual validation.Source reference:
What changed
WriteProperty.encodefor:WEEKLY_SCHEDULEEXCEPTION_SCHEDULEEFFECTIVE_PERIODDATE_LISTsrc/lib/services/WriteProperty.tsfor weekly schedule, exception schedule, effective period, and calendar date list.1..16DATERANGEentries must contain exactly 2 datesWEEKNDAYvalues are validated (including wildcard0xff)year/month/day/wday) is validatedexamples/write-schedule-weekly.tsexamples/write-schedule-exception.tsexamples/write-schedule-period.tsexamples/write-calendar-datelist.tshost[:port], with optional local bind port as separate argument.test/unit/service-write-property.spec.tsfor schedule/calendar write compatibility and failure cases.Type consistency
writePropertycontract unchanged.Validation
Notes