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: Kramer switches PPT-367 #106

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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(p3000): port switch_audio
  • Loading branch information
pkheav committed Feb 10, 2021
commit 4e8930c835eb044eece1d0b4d1721cf0d3fb2eda
23 changes: 23 additions & 0 deletions drivers/kramer/switches/protocol3000.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,29 @@ class Kramer::Switcher::Protocol3000 < PlaceOS::Driver
do_send(CMDS["switch_video"], build_switch_data({input => output}))
end

def switch_audio(input : String | Int32, output : Array(String))
do_send(CMDS["switch_video"], build_switch_data({input => output}))
end

enum RouteType
Video = 1
Audio = 2
USB = 3
AudioVideo = 12
VideoUSB = 13
AudioVideoUSB = 123
end
# def route(map, type = :audio_video)
# map.each do |input, outputs|
# input = input.to_s if input.is_a?(Symbol)
# input = input.to_i if input.is_a?(String)

# outputs.each do |output|
# do_send(CMDS[:route], ROUTE_TYPES[type], output, input)
# end
# end
# end

private def do_send(command, *args, **options)
cmd = args.empty? ? "##{@destination}#{command}\r" : "##{@destination}#{command} #{args.join(',')}\r"

Expand Down