Last active
December 4, 2016 02:52
-
-
Save imorrish/725c3fed673efa96fc2ee2f4ca0ef083 to your computer and use it in GitHub Desktop.
Amira Camera Tally Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Send-CameraTally | |
{ Param ( | |
[Parameter(ValueFromPipeline=$true)] | |
[String[]]$Command, | |
[string]$CamerIP = "IPAddress", | |
[string]$Port = "23" | |
) | |
#Attach to the remote device, setup streaming requirements | |
$WaitTime = 200 | |
$Socket = New-Object System.Net.Sockets.TcpClient($CameraIP, $Port) | |
If ($Socket) | |
{ $Stream = $Socket.GetStream() | |
$Writer = New-Object System.IO.StreamWriter($Stream) | |
$Buffer = New-Object System.Byte[] 1024 | |
$Encoding = New-Object System.Text.AsciiEncoding | |
$Writer.WriteLine($Command) | |
$Writer.Flush() | |
Start-Sleep -Milliseconds $WaitTime | |
#camera will return Done. | |
While($Stream.DataAvailable) | |
{ $Read = $Stream.Read($Buffer, 0, 1024) | |
$Result += ($Encoding.GetString($Buffer, 0, $Read)) | |
} | |
} | |
Else | |
{ $Result = "Unable to connect to camera: $($CameraIP):$Port" | |
} | |
#Done, now save the results to a file | |
$Result | |
} | |
#Test | |
Get-Telnet -CameraIP "192.168.1.3" -Command "tallyengage 1" | |
Start-Sleep -Seconds 5 | |
Get-Telnet -CameraIP "192.168.1.3" -Command "tallyengage 0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Posted in relation to https://forum.blackmagicdesign.com/viewtopic.php?f=4&t=54115