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: command batching SOFIE-2549 #157

Merged
merged 12 commits into from
Dec 11, 2023
Merged

feat: command batching SOFIE-2549 #157

merged 12 commits into from
Dec 11, 2023

Conversation

Julusian
Copy link
Member

@Julusian Julusian commented Dec 1, 2023

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

feature

  • What is the current behavior? (You can also link to an open issue here)

When sending commands to the atem, it is only possible to send one per packet.

  • What is the new behavior (if this is a feature change)?

The sendCommands method is now exposed, allowing for sending multiple commands in one packet.
Each call to the method will result in packets being sent, no buffering/debouncing is performed between calls. Commands are packed into packets in order, up to a defined byte limit per packet.

The maximum packet size is defined based on the packetMtu property supplied to the constructor. Care should be taken when setting this, as any upload transfers do not fully respect this value and will result in packets failing to send.

  • Other information:

This partially covers #140, but only solves the case of constructing the commands manually (or with atem-state), not usage through the methods provided on the Atem class.
A friendlier batching api can be built on top of this work by someone later.

I have tested this against a Constellation 2ME HD by sending a pair of MixEffectKeyDVECommand commands multiple time at once, enough so that it spans multiple packets. The packets were acked, indicating that they were transmitted and received successfully.

@Julusian Julusian requested a review from a team December 1, 2023 14:34
@Julusian Julusian changed the title feat: command batching feat: command batching SOFIE-2549 Dec 1, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9f87cc1) 86.29% compared to head (fc1256e) 86.38%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/atem.ts 95.00% 1 Missing ⚠️
src/lib/atemSocket.ts 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #157      +/-   ##
==========================================
+ Coverage   86.29%   86.38%   +0.09%     
==========================================
  Files         180      181       +1     
  Lines        5814     5853      +39     
  Branches      958      965       +7     
==========================================
+ Hits         5017     5056      +39     
  Misses        775      775              
  Partials       22       22              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/lib/packetBuilder.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@nytamin nytamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me from an initial read through

@Julusian Julusian merged commit 4986fad into master Dec 11, 2023
14 checks passed
@Julusian Julusian deleted the feat/command-batching branch January 24, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants